diff --git a/src/options-ui/components/storage/command/snapshot-dump.command.ts b/src/options-ui/components/storage/command/snapshot-dump.command.ts index ac2a37f..ed82d75 100644 --- a/src/options-ui/components/storage/command/snapshot-dump.command.ts +++ b/src/options-ui/components/storage/command/snapshot-dump.command.ts @@ -1,3 +1,19 @@ +/* + * This file is part of the pinmenote-extension distribution (https://github.com/pinmenote/pinmenote-extension). + * Copyright (c) 2024 Michal Szczepanski. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ import {BrowserStorage} from "@pinmenote/browser-api"; import {SegmentData, SegmentPage, SegmentType} from "@pinmenote/page-compute"; import {fnConsoleLog} from "../../../../common/fn/fn-console"; diff --git a/src/options-ui/options-ui.tsx b/src/options-ui/options-ui.tsx index 6b325fc..53935cf 100644 --- a/src/options-ui/options-ui.tsx +++ b/src/options-ui/options-ui.tsx @@ -74,20 +74,28 @@ const OptionsUI: FunctionComponent = () => { const handleHashChange = async () => { const view = getView(); setCurrentView(view); - if (view === CurrentView.OBJ_DETAILS) { - await renderDetails(); - } else if (view === CurrentView.PDF_DETAILS) { - setShowPreview(false); - setShowPdfPreview(true); - } else if (view === CurrentView.SETTINGS) { - setShowDrawer(false); - } else if (view === CurrentView.STORAGE) { - setShowDrawer(false); - } else { - setShowPreview(false); - setShowPdfPreview(false); - if (!SettingsStore.settings?.interface) return; - setShowDrawer(!!SettingsStore.settings.interface.optionsDrawerOpen); + switch (view) { + case CurrentView.OBJ_DETAILS: { + await renderDetails(); + break + } + case CurrentView.PDF_DETAILS: { + setShowPreview(false); + setShowPdfPreview(true); + break + } + case CurrentView.SETTINGS: + case CurrentView.STORAGE: { + setShowDrawer(false); + break; + } + default: { + setShowPreview(false); + setShowPdfPreview(false); + if (!SettingsStore.settings?.interface) return; + setShowDrawer(!!SettingsStore.settings.interface.optionsDrawerOpen); + break + } } };