import { ChevronDownIcon } from '@chakra-ui/icons' import { Text, Box, Button, Flex, Menu, MenuButton, StackDivider, VStack, Portal, MenuList, MenuItem, Switch, Accordion, AccordionItem, AccordionButton, AccordionIcon, AccordionPanel, } from '@chakra-ui/react' import React, { useContext } from 'react' import { OptionPanel } from '../OptionPanel' import { initialFilter, initialLocal, TagColors } from '../../config' import { TagColorPanel } from './TagColorPanel' import { SliderWithInfo } from '../SliderWithInfo' import { VariablesContext } from '../../../util/variablesContext' export interface FilterPanelProps { filter: typeof initialFilter setFilter: any tagColors: TagColors setTagColors: any highlightColor: string colorList: string[] tags: string[] local: typeof initialLocal setLocal: any } const FilterPanel = (props: FilterPanelProps) => { const { filter, setFilter, local, setLocal, tagColors, setTagColors, highlightColor, colorList, tags, } = props const { roamDir, subDirs } = useContext(VariablesContext) return ( } align="stretch" paddingLeft={7} color="gray.800" > Link children to } colorScheme="" color="black" size="sm" > {(() => { switch (filter.parent) { case 'parent': return File case 'heading': return Heading default: return Nothing } })()} setFilter((curr: typeof initialFilter) => ({ ...curr, parent: '' })) } > Nothing setFilter((curr: typeof initialFilter) => ({ ...curr, parent: 'parent', })) } > Parent file node setFilter((curr: typeof initialFilter) => ({ ...curr, parent: 'heading', })) } > Next highest heading node Orphans { setFilter((curr: typeof initialFilter) => { return { ...curr, orphans: !curr.orphans } }) }} isChecked={filter.orphans} > Dailies { setFilter((curr: typeof initialFilter) => { return { ...curr, dailies: !curr.dailies } }) }} isChecked={filter.dailies} > Org-noter pages { setFilter((curr: typeof initialFilter) => { return { ...curr, noter: !curr.noter } }) }} isChecked={filter.noter} > Citations without note files { setFilter({ ...filter, filelessCites: !filter.filelessCites }) }} isChecked={filter.filelessCites} > Non-existent nodes { setTagColors({ ...tagColors, bad: 'white' }) setFilter({ ...filter, bad: !filter.bad }) }} isChecked={filter.bad} > setLocal({ ...local, neighbors: v })} min={1} max={5} step={1} /> Directory filters Tag filters Tag colors ) } export default FilterPanel