summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/Tweaks/GraphColorSelect.tsx13
-rw-r--r--components/Tweaks/VisualsPanel.tsx4
-rw-r--r--components/Tweaks/index.tsx3
-rw-r--r--components/config.ts3
4 files changed, 16 insertions, 7 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"
diff --git a/components/Tweaks/VisualsPanel.tsx b/components/Tweaks/VisualsPanel.tsx
index 015acfc..ca7f20e 100644
--- a/components/Tweaks/VisualsPanel.tsx
+++ b/components/Tweaks/VisualsPanel.tsx
@@ -18,7 +18,7 @@ import {
import React, { useCallback } from 'react'
import { HighlightingPanel } from './HighlightingPanel'
import { ColorsPanel } from './ColorsPanel'
-import { initialVisuals } from '../config'
+import { initialColoring, initialVisuals } from '../config'
import { NodesNLinksPanel } from './NodesNLinksPanel'
import { LabelsPanel } from './LabelsPanel'
import { CitationsPanel } from './CitationsPanel'
@@ -32,7 +32,7 @@ export interface VisualsPanelProps {
highlightColor: string
setHighlightColor: any
threeDim: boolean
- coloring: string
+ coloring: typeof initialColoring
setColoring: any
}
diff --git a/components/Tweaks/index.tsx b/components/Tweaks/index.tsx
index 078ee99..0af25aa 100644
--- a/components/Tweaks/index.tsx
+++ b/components/Tweaks/index.tsx
@@ -22,6 +22,7 @@ import {
initialBehavior,
TagColors,
colorList,
+ initialColoring,
} from '../config'
import FilterPanel from './FilterPanel'
@@ -48,7 +49,7 @@ export interface TweakProps {
tags: string[]
tagColors: TagColors
setTagColors: any
- coloring: string
+ coloring: typeof initialColoring
setColoring: any
}
diff --git a/components/config.ts b/components/config.ts
index b3f5905..669942b 100644
--- a/components/config.ts
+++ b/components/config.ts
@@ -45,6 +45,9 @@ export const initialFilter = {
date: [],
noter: true,
}
+export const initialColoring = {
+ method: 'degree',
+}
export const initialVisuals = {
particles: false,