import { ArrowRightIcon, ChevronDownIcon, RepeatIcon } from '@chakra-ui/icons' import { Text, Box, Flex, IconButton, StackDivider, Tooltip, VStack, MenuButton, Menu, Portal, MenuList, MenuOptionGroup, MenuItemOption, Button, MenuItem, } from '@chakra-ui/react' import React from 'react' import { ColorMenu } from './ColorMenu' import { colorList, initialVisuals } from './config' export interface ColorsPanelProps { visuals: typeof initialVisuals setVisualsCallback: any highlightColor: string setHighlightColor: any } export const ColorsPanel = (props: ColorsPanelProps) => { const { visuals, setVisualsCallback, highlightColor, setHighlightColor } = props return ( } align="stretch" color="gray.800" > Nodes } variant="ghost" onClick={() => { const arr = visuals.nodeColorScheme ?? [] setVisualsCallback({ ...visuals, //shuffle that guy //definitely thought of this myself nodeColorScheme: arr .map((x: any) => [Math.random(), x]) .sort(([a], [b]) => a - b) .map(([_, x]) => x), }) }} /> } size="sm" variant="ghost" onClick={() => { const arr = visuals.nodeColorScheme ?? [] setVisualsCallback({ ...visuals, nodeColorScheme: [...arr.slice(1, arr.length), arr[0]], }) }} /> } > {visuals.nodeColorScheme.map((color) => ( ))} {' '} { if (!colors.length) { return } setVisualsCallback({ ...visuals, nodeColorScheme: colors }) }} > {colorList.map((color) => ( c === color)} value={color} isDisabled={ visuals.nodeColorScheme.length === 1 && visuals.nodeColorScheme[0] === color } > ))} Links }> {visuals.linkColorScheme ? ( ) : ( {visuals.nodeColorScheme.map((color) => ( ))} )} {' '} setVisualsCallback({ ...visuals, linkColorScheme: '' })} justifyContent="space-between" alignItems="center" display="flex" > {visuals.nodeColorScheme.map((color) => ( ))} {colorList.map((color) => ( setVisualsCallback({ ...visuals, linkColorScheme: color, }) } justifyContent="space-between" alignItems="center" display="flex" > ))} Accent }> {} {' '} {colorList.map((color) => ( setHighlightColor(color)} justifyContent="space-between" alignItems="center" display="flex" > ))} ) }