From 252d7430842e6cabcab5798adae27a4c754657ee Mon Sep 17 00:00:00 2001 From: stef barsch <16940454+stefba@users.noreply.github.com> Date: Sat, 18 May 2024 18:24:51 +0200 Subject: [PATCH] Let active target toggle --- src/parts/nav/nav.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/parts/nav/nav.tsx b/src/parts/nav/nav.tsx index a23133f..8f7bc13 100644 --- a/src/parts/nav/nav.tsx +++ b/src/parts/nav/nav.tsx @@ -10,7 +10,7 @@ import { extendedBase, section, isFile } from 'funcs/paths'; import { TargetsContext, TargetsProps } from 'context/targets'; //import { ErrContext } from 'context/err'; import File from 'funcs/files'; -import { setActiveTarget, removeTarget } from 'funcs/targets'; +import { setActiveTarget, removeTarget, unsetActiveTarget } from 'funcs/targets'; import { ErrComponent } from 'parts/nav/error'; import Config from 'config'; import { ErrContext } from 'context/err'; @@ -67,6 +67,10 @@ export default function Nav({path}: NavProps) { alert("Cannot make file active dir.") return; } + if (isActiveTarget(targets, path)) { + saveTargets(unsetActiveTarget(targets)); + return; + } saveTargets(setActiveTarget(targets, path)); }