From d1b71861ecf5c8093cbf3d37813ad7ab514edc42 Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Wed, 21 Sep 2022 21:40:32 +0530 Subject: [PATCH] feat: add lock button to navigation panel on mobile (#1609) --- .../Components/Navigation/Navigation.tsx | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/packages/web/src/javascripts/Components/Navigation/Navigation.tsx b/packages/web/src/javascripts/Components/Navigation/Navigation.tsx index 179fc2cb1..da89a683f 100644 --- a/packages/web/src/javascripts/Components/Navigation/Navigation.tsx +++ b/packages/web/src/javascripts/Components/Navigation/Navigation.tsx @@ -22,6 +22,15 @@ const Navigation: FunctionComponent = ({ application }) => { const [panelWidth, setPanelWidth] = useState(0) const { toggleAppPane } = useResponsiveAppPane() + const [hasPasscode, setHasPasscode] = useState(() => application.hasPasscode()) + useEffect(() => { + const removeObserver = application.addEventObserver(async () => { + setHasPasscode(application.hasPasscode()) + }, ApplicationEvent.KeyStatusChanged) + + return removeObserver + }, [application]) + useEffect(() => { const removeObserver = application.addEventObserver(async () => { const width = application.getPreference(PrefKey.TagsPanelWidth) @@ -87,18 +96,29 @@ const Navigation: FunctionComponent = ({ application }) => { onClick={() => { viewControllerManager.accountMenuController.toggleShow() }} - title="Go to items list" - aria-label="Go to items list" + title="Go to account menu" + aria-label="Go to account menu" > + {hasPasscode && ( + + )}