fix: options-ui convert to switch-case
This commit is contained in:
parent
51c18444eb
commit
50df558756
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {BrowserStorage} from "@pinmenote/browser-api";
|
||||
import {SegmentData, SegmentPage, SegmentType} from "@pinmenote/page-compute";
|
||||
import {fnConsoleLog} from "../../../../common/fn/fn-console";
|
||||
|
@ -74,20 +74,28 @@ const OptionsUI: FunctionComponent = () => {
|
||||
const handleHashChange = async () => {
|
||||
const view = getView();
|
||||
setCurrentView(view);
|
||||
if (view === CurrentView.OBJ_DETAILS) {
|
||||
switch (view) {
|
||||
case CurrentView.OBJ_DETAILS: {
|
||||
await renderDetails();
|
||||
} else if (view === CurrentView.PDF_DETAILS) {
|
||||
break
|
||||
}
|
||||
case CurrentView.PDF_DETAILS: {
|
||||
setShowPreview(false);
|
||||
setShowPdfPreview(true);
|
||||
} else if (view === CurrentView.SETTINGS) {
|
||||
break
|
||||
}
|
||||
case CurrentView.SETTINGS:
|
||||
case CurrentView.STORAGE: {
|
||||
setShowDrawer(false);
|
||||
} else if (view === CurrentView.STORAGE) {
|
||||
setShowDrawer(false);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
setShowPreview(false);
|
||||
setShowPdfPreview(false);
|
||||
if (!SettingsStore.settings?.interface) return;
|
||||
setShowDrawer(!!SettingsStore.settings.interface.optionsDrawerOpen);
|
||||
break
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user