From c72e4e767faffed895f7a9010e2fc0dd0eea3f2b Mon Sep 17 00:00:00 2001 From: lcomplete Date: Tue, 28 Mar 2023 18:06:21 +0800 Subject: [PATCH] chore: change setting button position in electron app --- app/client/src/components/Header.tsx | 25 +++++++++++++++---------- app/client/src/styles/globals.css | 3 +++ 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/client/src/components/Header.tsx b/app/client/src/components/Header.tsx index ef2bdd4..13e9d32 100644 --- a/app/client/src/components/Header.tsx +++ b/app/client/src/components/Header.tsx @@ -11,11 +11,11 @@ export default function Header() { const [fullScreen, setFullScreen] = useState(false); const [focused, setFocused] = useState(false); const [settingModalOpen, setSettingModalOpen] = useState(false); - const inBrowser = !window.electron; - const isMac = !inBrowser && window.electron.utilsBridge.isMac; + const inElectron = !!window.electron; + const isMac = inElectron && window.electron.utilsBridge.isMac; useEffect(() => { - if (inBrowser) { + if (!inElectron) { return; } const {utilsBridge} = window.electron; @@ -51,10 +51,10 @@ export default function Header() { const openSettingModal = useCallback(() => { setSettingModalOpen(true); }, []); - - const closeSettingModal = useCallback(()=>{ + + const closeSettingModal = useCallback(() => { setSettingModalOpen(false); - },[]); + }, []); return
{!isMac && ( @@ -66,14 +66,19 @@ export default function Header() { - - - + { + (!inElectron || isMac) && + + + } - {!isMac && !inBrowser && ( + {!isMac && inElectron && (
+ + +