From 733cf88bbfb172fe9c2211d2432e2b1ff2ffcc2d Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Mon, 16 Aug 2021 16:43:31 +0200 Subject: feat: link children to parent heading #62 #53 #49 --- components/config.ts | 2 +- components/tweaks.tsx | 65 +++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 56 insertions(+), 11 deletions(-) (limited to 'components') diff --git a/components/config.ts b/components/config.ts index b48cbe4..0c23528 100644 --- a/components/config.ts +++ b/components/config.ts @@ -34,7 +34,7 @@ export const initialPhysics = { export const initialFilter = { orphans: false, - parents: true, + parent: 'heading', filelessCites: false, tagsBlacklist: [], tagsWhitelist: [], diff --git a/components/tweaks.tsx b/components/tweaks.tsx index 26f1b60..d0605cd 100644 --- a/components/tweaks.tsx +++ b/components/tweaks.tsx @@ -202,6 +202,60 @@ export const Tweaks = (props: TweakProps) => { paddingLeft={7} color="gray.800" > + + Link children to... + + } + colorScheme="" + color="black" + > + {(() => { + 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 { isChecked={filter.orphans} > - - Link nodes with parent file - { - setFilter({ ...filter, parents: !filter.parents }) - }} - isChecked={filter.parents} - > - Citations without note files { setPhysicsCallback(v, 'gravity', -1 / 100)} + onChange={(v) => setPhysicsCallback(v, 'charge', -1 / 100)} label="Repulsive Force" />