import { CloseIcon, RepeatClockIcon, SettingsIcon } from '@chakra-ui/icons' import { Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, Box, Button, IconButton, Tooltip, Heading, } from '@chakra-ui/react' import React, { useContext } from 'react' import Scrollbars from 'react-custom-scrollbars-2' import { initialPhysics, initialFilter, initialVisuals, initialMouse, initialBehavior, initialLocal, TagColors, colorList, } from '../config' import FilterPanel from './FilterPanel' import { ThemeContext } from '../../util/themecontext' import { usePersistantState } from '../../util/persistant-state' import { PhysicsPanel } from './PhysicsPanel' import { VisualsPanel } from './VisualsPanel' import { BehaviorPanel } from './BehaviorPanel' export interface TweakProps { physics: typeof initialPhysics setPhysics: any threeDim: boolean setThreeDim: (newValue: boolean) => void filter: typeof initialFilter setFilter: any visuals: typeof initialVisuals setVisuals: any mouse: typeof initialMouse setMouse: any behavior: typeof initialBehavior setBehavior: any tags: string[] tagColors: TagColors setTagColors: any local: typeof initialLocal setLocal: any } export const Tweaks = (props: TweakProps) => { const { physics, setPhysics, threeDim, setThreeDim, filter, setFilter, visuals, setVisuals, mouse, setMouse, behavior, setBehavior, tags, tagColors, setTagColors, local, setLocal, } = props const [showTweaks, setShowTweaks] = usePersistantState('showTweaks', false) const { highlightColor, setHighlightColor } = useContext(ThemeContext) return !showTweaks ? ( } onClick={() => setShowTweaks(true)} /> ) : ( } onClick={() => { setVisuals(initialVisuals) setFilter(initialFilter) setMouse(initialMouse) setPhysics(initialPhysics) setBehavior(initialBehavior) }} variant="subtle" size="sm" /> } aria-label="Close Tweak Panel" variant="subtle" onClick={() => setShowTweaks(false)} /> ( )} > Filter Physics Visual Behavior ) }