summaryrefslogtreecommitdiff
path: root/components/Tweaks/GraphColorSelect.tsx
diff options
context:
space:
mode:
authorThomas F. K. Jorna <[email protected]>2021-10-17 01:04:13 +0200
committerThomas F. K. Jorna <[email protected]>2021-10-17 01:04:13 +0200
commit85b665b343d63096a3e62c210931040a44b07a1b (patch)
treef4fbcc054f275dee2d6d3d712719cad145d0aac5 /components/Tweaks/GraphColorSelect.tsx
parent0895967f20ef33bc0f32c99bac0a93761915b87f (diff)
feat(algos): properly working communities
Diffstat (limited to 'components/Tweaks/GraphColorSelect.tsx')
-rw-r--r--components/Tweaks/GraphColorSelect.tsx13
1 files changed, 9 insertions, 4 deletions
diff --git a/components/Tweaks/GraphColorSelect.tsx b/components/Tweaks/GraphColorSelect.tsx
index b52dde2..60fd8cf 100644
--- a/components/Tweaks/GraphColorSelect.tsx
+++ b/components/Tweaks/GraphColorSelect.tsx
@@ -11,9 +11,10 @@ import {
Text,
} from '@chakra-ui/react'
import { ChevronDownIcon } from '@chakra-ui/icons'
+import { initialColoring } from '../config'
export interface GraphColorSelectProps {
- coloring: string
+ coloring: typeof initialColoring
setColoring: any
}
@@ -31,12 +32,14 @@ export const GraphColorSelect = (props: GraphColorSelectProps) => {
color="black"
rightIcon={<ChevronDownIcon />}
>
- {coloring === 'degree' ? 'Links' : 'Communities'}
+ {coloring.method === 'degree' ? 'Links' : 'Communities'}
</MenuButton>
<Portal>
<MenuList minW={10} zIndex="popover" bgColor="gray.200">
<MenuItem
- onClick={() => setColoring('degree')}
+ onClick={() =>
+ setColoring((curr: typeof initialColoring) => ({ ...curr, method: 'degree' }))
+ }
justifyContent="space-between"
alignItems="center"
display="flex"
@@ -44,7 +47,9 @@ export const GraphColorSelect = (props: GraphColorSelectProps) => {
Number of links
</MenuItem>
<MenuItem
- onClick={() => setColoring('community')}
+ onClick={() =>
+ setColoring((curr: typeof initialColoring) => ({ ...curr, method: 'community' }))
+ }
justifyContent="space-between"
alignItems="center"
display="flex"