From 180608a8b89fd70068feb12b9556b8e7dd5284a5 Mon Sep 17 00:00:00 2001 From: Nikolaj Frey Date: Mon, 14 Aug 2023 13:13:23 +1000 Subject: [PATCH] feat: feature/mvp-sprint-1 Made settings menu hide type selection when on readonly mode --- .../app/components/Thingtime/SettingsMenu.tsx | 89 ++++++++++--------- remix/app/components/Thingtime/Thingtime.tsx | 23 +++-- 2 files changed, 60 insertions(+), 52 deletions(-) diff --git a/remix/app/components/Thingtime/SettingsMenu.tsx b/remix/app/components/Thingtime/SettingsMenu.tsx index 3cdc21b..1cd6caa 100644 --- a/remix/app/components/Thingtime/SettingsMenu.tsx +++ b/remix/app/components/Thingtime/SettingsMenu.tsx @@ -67,59 +67,62 @@ export const SettingsMenu = (props) => { cursor="pointer" paddingY={basePadding} > - - - - Types - - + {!props?.readonly && ( + + + + Types + + + )} - {types.map((type, idx) => { - const ret = ( - div": { - background: "greys.light", - }, - }} - onClick={() => onChangeType(type?.key || type)} - paddingY={1} - > + {!props?.readonly && + types.map((type, idx) => { + const ret = ( div": { + background: "greys.light", + }, + }} + onClick={() => onChangeType(type?.key || type)} + paddingY={1} > - - - {type?.label || type?.key || type} - + + + + {type?.label || type?.key || type} + + - - ) - return ret - })} + ) + return ret + })} diff --git a/remix/app/components/Thingtime/Thingtime.tsx b/remix/app/components/Thingtime/Thingtime.tsx index 9a7eb81..6b10528 100644 --- a/remix/app/components/Thingtime/Thingtime.tsx +++ b/remix/app/components/Thingtime/Thingtime.tsx @@ -564,17 +564,21 @@ export const Thingtime = (props) => { const pathDom = React.useMemo(() => { if (renderedPath) { return ( - - {renderedPath} - + <> + + ) } - }, [renderedPath, pl, props?.pathPl]) + }, [renderedPath, pl, props?.edit, props?.pathPl]) const handleMouseEvent = React.useCallback( (e) => { @@ -674,6 +678,7 @@ export const Thingtime = (props) => { opacity={showContextIcon ? 1 : 0} uuid={uuid} fullPath={fullPath} + readonly={!props?.edit} onChangeType={onChangeType} >