Skip to content

Commit

Permalink
1982 show root T (#1990)
Browse files Browse the repository at this point in the history
* show root T

* hide move to parent for root
  • Loading branch information
Ptrhnk authored Mar 20, 2024
1 parent 2679d00 commit 516c343
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {
StyledMoveToParent,
StyledSuggesterRow,
} from "./StatementListHeaderStyles";
import { rootTerritoryId } from "Theme/constants";

interface StatementListHeader {
data: IResponseTerritory;
Expand Down Expand Up @@ -305,20 +306,22 @@ export const StatementListHeader: React.FC<StatementListHeader> = ({
: "no territory selected"}
</StyledHeading>

<StyledMoveToParent>
{"Move to parent:\xa0"}
<EntitySuggester
disableTemplatesAccept
filterEditorRights
inputWidth={96}
disableCreate
categoryTypes={[EntityEnums.Class.Territory]}
onSelected={(newSelectedId: string) => {
moveTerritoryMutation.mutate(newSelectedId);
}}
excludedActantIds={excludedMoveTerritories}
/>
</StyledMoveToParent>
{territoryId !== rootTerritoryId && (
<StyledMoveToParent>
{"Move to parent:\xa0"}
<EntitySuggester
disableTemplatesAccept
filterEditorRights
inputWidth={96}
disableCreate
categoryTypes={[EntityEnums.Class.Territory]}
onSelected={(newSelectedId: string) => {
moveTerritoryMutation.mutate(newSelectedId);
}}
excludedActantIds={excludedMoveTerritories}
/>
</StyledMoveToParent>
)}
</StyledHeaderRow>

<StyledSuggesterRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,73 +263,69 @@ export const TerritoryTreeNode: React.FC<TerritoryTreeNode> = ({

return (
<>
{id !== rootTerritoryId && (
<>
{!tempDisabled ? (
<StyledTerritoryTagWrap
id={`territory${id}`}
style={{
backgroundColor: foundByRecursion
? themeContext?.color.foundByTreeFilter
: "",
}}
>
<StyledIconWrap>
{hasChildren ? (
<>{renderArrowIcon()}</>
{!tempDisabled ? (
<StyledTerritoryTagWrap
id={`territory${id}`}
style={{
backgroundColor: foundByRecursion
? themeContext?.color.foundByTreeFilter
: "",
}}
>
<StyledIconWrap>
{hasChildren ? (
<>{renderArrowIcon()}</>
) : (
<>
{statementsCount > 0 ? (
<StyledFaCircle
size={11}
color={symbolColor}
onClick={() => {
setTerritoryId(id);
}}
/>
) : (
<>
{statementsCount > 0 ? (
<StyledFaCircle
size={11}
color={symbolColor}
onClick={() => {
setTerritoryId(id);
}}
/>
) : (
<StyledFaDotCircle
size={11}
color={symbolColor}
onClick={() => {
setTerritoryId(id);
}}
/>
)}
</>
<StyledFaDotCircle
size={11}
color={symbolColor}
onClick={() => {
setTerritoryId(id);
}}
/>
)}
</StyledIconWrap>
<animated.div style={animatedStyle}>
<EntityTag
entity={territory}
parentId={parent.territoryId}
lvl={lvl}
isSelected={isSelected}
index={index}
fullWidth
moveFn={moveFn}
updateOrderFn={moveTerritoryMutation.mutate}
statementsCount={statementsCount}
isFavorited={isFavorited}
showOnly="label"
tooltipPosition="right"
/>
</animated.div>
<TerritoryTreeContextMenu
territoryActant={territory}
onMenuOpen={() => setContextMenuOpen(true)}
onMenuClose={() => setContextMenuOpen(false)}
right={right}
empty={(empty && !children.length) || false}
storedTerritories={storedTerritories}
updateUserMutation={updateUserMutation}
isFavorited={isFavorited}
/>
</StyledTerritoryTagWrap>
) : (
<StyledDisabledTag />
)}
</>
</>
)}
</StyledIconWrap>
<animated.div style={animatedStyle}>
<EntityTag
entity={territory}
parentId={parent.territoryId}
lvl={lvl}
isSelected={isSelected}
index={index}
fullWidth
moveFn={moveFn}
updateOrderFn={moveTerritoryMutation.mutate}
statementsCount={statementsCount}
isFavorited={isFavorited}
showOnly="label"
tooltipPosition="right"
/>
</animated.div>
<TerritoryTreeContextMenu
territoryActant={territory}
onMenuOpen={() => setContextMenuOpen(true)}
onMenuClose={() => setContextMenuOpen(false)}
right={right}
empty={(empty && !children.length) || false}
storedTerritories={storedTerritories}
updateUserMutation={updateUserMutation}
isFavorited={isFavorited}
/>
</StyledTerritoryTagWrap>
) : (
<StyledDisabledTag />
)}
</>
);
Expand All @@ -339,7 +335,7 @@ export const TerritoryTreeNode: React.FC<TerritoryTreeNode> = ({
<>
{renderTreeNode()}

<StyledChildrenWrap $noIndent={lvl === 0}>
<StyledChildrenWrap>
{!hideChildTerritories &&
isExpanded &&
childTerritories.map((child: IExtendedResponseTree, key: number) => (
Expand Down

0 comments on commit 516c343

Please sign in to comment.