From d35753c4aebaf1a04145e90bb0ef8979583a340a Mon Sep 17 00:00:00 2001 From: Tuur Lievens Date: Sat, 23 Oct 2021 21:32:34 +0200 Subject: [PATCH 1/2] Add show note in tree button --- components/note-nav.tsx | 37 ++++++++++++++++------ libs/web/state/tree.ts | 68 +++++++++++++++++++++++++++++++++-------- 2 files changed, 83 insertions(+), 22 deletions(-) diff --git a/components/note-nav.tsx b/components/note-nav.tsx index 7ea41753a..bfcd884ef 100644 --- a/components/note-nav.tsx +++ b/components/note-nav.tsx @@ -12,6 +12,7 @@ import PortalState from 'libs/web/state/portal' import { NOTE_SHARED } from 'libs/shared/meta' import useI18n from 'libs/web/hooks/use-i18n' import NavButtonGroup from './nav-button-group' +import { EyeIcon } from '@heroicons/react/outline' const MenuButton = () => { const { sidebar } = UIState.useContainer() @@ -37,7 +38,7 @@ const NoteNav = () => { const { t } = useI18n() const { note, loading } = NoteState.useContainer() const { ua } = UIState.useContainer() - const { getPaths } = NoteTreeState.useContainer() + const { getPaths, showItem, checkItemIsShown } = NoteTreeState.useContainer() const { share, menu } = PortalState.useContainer() const handleClickShare = useCallback( @@ -58,6 +59,11 @@ const NoteNav = () => { [note, menu] ) + const handleClickOpenInTree = useCallback(() => { + if (!note) return + showItem(note); + }, [note, showItem]) + return (