-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
touchup: add "view" context menu items
to prepare for allowing indicators to be hidden - this way, indicator functionality is still enabled via the context menu.
- Loading branch information
Showing
4 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/web/common/components/ContextMenu/ViewContextMenuItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { ContextMenuItem } from "@/web/common/components/ContextMenu/CloseOnClickMenuItem"; | ||
import { GraphPart, isNode } from "@/web/topic/utils/graph"; | ||
import { contextMethods } from "@/web/topic/utils/partContext"; | ||
|
||
export const ViewContextMenuItem = ({ graphPart }: { graphPart: GraphPart }) => { | ||
const partType = isNode(graphPart) ? graphPart.type : graphPart.label; | ||
const viewContext = contextMethods[partType]?.viewContext; | ||
|
||
if (!viewContext) return <></>; | ||
|
||
return <ContextMenuItem onClick={() => viewContext(graphPart.id)}>View context</ContextMenuItem>; | ||
}; |
17 changes: 17 additions & 0 deletions
17
src/web/common/components/ContextMenu/ViewDetailsMenuItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { ContextMenuItem } from "@/web/common/components/ContextMenu/CloseOnClickMenuItem"; | ||
import { emitter } from "@/web/common/event"; | ||
import { GraphPart } from "@/web/topic/utils/graph"; | ||
import { setSelected } from "@/web/view/currentViewStore/store"; | ||
|
||
export const ViewDetailsMenuItem = ({ graphPart }: { graphPart: GraphPart }) => { | ||
return ( | ||
<ContextMenuItem | ||
onClick={() => { | ||
setSelected(graphPart.id); | ||
emitter.emit("viewTopicDetails"); | ||
}} | ||
> | ||
View details | ||
</ContextMenuItem> | ||
); | ||
}; |
11 changes: 11 additions & 0 deletions
11
src/web/common/components/ContextMenu/ViewTableMenuItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { ContextMenuItem } from "@/web/common/components/ContextMenu/CloseOnClickMenuItem"; | ||
import { Node } from "@/web/topic/utils/graph"; | ||
import { viewCriteriaTable } from "@/web/view/currentViewStore/filter"; | ||
|
||
export const ViewTableMenuItem = ({ node }: { node: Node }) => { | ||
return ( | ||
<ContextMenuItem onClick={() => viewCriteriaTable(node.id)}> | ||
View criteria table | ||
</ContextMenuItem> | ||
); | ||
}; |