diff --git a/app/src/mainMenuDefinition.js b/app/src/mainMenuDefinition.js index 8d5e8c02..8ce7056e 100644 --- a/app/src/mainMenuDefinition.js +++ b/app/src/mainMenuDefinition.js @@ -69,6 +69,7 @@ module.exports = ({ editMenu }) => [ { command: 'app.toggleDevTools', hideDisabled: true }, { command: 'app.toggleFullScreen', hideDisabled: true }, { command: 'app.minimize', hideDisabled: true }, + { command: 'toggle.sidebar' }, { divider: true }, { command: 'theme.changeTheme', hideDisabled: true }, { command: 'settings.show' }, diff --git a/packages/web/src/Screen.svelte b/packages/web/src/Screen.svelte index 1ca9ed53..5ba23f30 100644 --- a/packages/web/src/Screen.svelte +++ b/packages/web/src/Screen.svelte @@ -8,6 +8,7 @@ leftPanelWidth, openedSnackbars, selectedWidget, + visibleWidgetSideBar, visibleCommandPalette, visibleTitleBar, visibleToolbar, @@ -63,7 +64,7 @@
- {#if $selectedWidget} + {#if $selectedWidget && $visibleWidgetSideBar}
@@ -74,7 +75,7 @@
- {#if $selectedWidget} + {#if $selectedWidget && $visibleWidgetSideBar}
showModal(AboutModal), }); +registerCommand({ + id: 'toggle.sidebar', + category: 'Sidebar', + name: 'Show', + toolbarName: 'Toggle sidebar', + keyText: 'CtrlOrCommand+B', + onClick: () => visibleWidgetSideBar.update(x => !x), +}); + registerCommand({ id: 'new.connection', toolbar: true, diff --git a/packages/web/src/modals/ImportExportModal.svelte b/packages/web/src/modals/ImportExportModal.svelte index 37777c82..1d1c6dc7 100644 --- a/packages/web/src/modals/ImportExportModal.svelte +++ b/packages/web/src/modals/ImportExportModal.svelte @@ -16,7 +16,7 @@ import { getDefaultFileFormat } from '../plugins/fileformats'; import RunnerOutputFiles from '../query/RunnerOutputFiles.svelte'; import SocketMessageView from '../query/SocketMessageView.svelte'; - import { currentArchive, currentDatabase, extensions, getCurrentConfig, selectedWidget } from '../stores'; + import { currentArchive, currentDatabase, extensions, visibleWidgetSideBar, selectedWidget } from '../stores'; import { apiCall, apiOff, apiOn } from '../utility/api'; import createRef from '../utility/createRef'; import openNewTab from '../utility/openNewTab'; @@ -85,6 +85,7 @@ apiCall('archive/refresh-files', { folder: refreshArchiveFolderRef.get() }); $currentArchive = refreshArchiveFolderRef.get(); $selectedWidget = 'archive'; + $visibleWidgetSideBar = true; } }; diff --git a/packages/web/src/settings/SettingsModal.svelte b/packages/web/src/settings/SettingsModal.svelte index ebf2d9a1..9879232e 100644 --- a/packages/web/src/settings/SettingsModal.svelte +++ b/packages/web/src/settings/SettingsModal.svelte @@ -18,7 +18,13 @@ import { closeCurrentModal } from '../modals/modalTools'; import { EDITOR_THEMES, FONT_SIZES } from '../query/AceEditor.svelte'; import SqlEditor from '../query/SqlEditor.svelte'; - import { currentEditorFontSize, currentEditorTheme, extensions, selectedWidget } from '../stores'; + import { + currentEditorFontSize, + currentEditorTheme, + extensions, + selectedWidget, + visibleWidgetSideBar, + } from '../stores'; import { isMac } from '../utility/common'; import getElectron from '../utility/getElectron'; import ThemeSkeleton from './ThemeSkeleton.svelte'; @@ -47,6 +53,7 @@ ORDER BY function openThemePlugins() { closeCurrentModal(); $selectedWidget = 'plugins'; + $visibleWidgetSideBar = true; } @@ -123,7 +130,6 @@ ORDER BY { value: 'lowerCase', label: 'lower case' }, ]} /> -
Application theme
diff --git a/packages/web/src/stores.ts b/packages/web/src/stores.ts index 79686d1a..38275329 100644 --- a/packages/web/src/stores.ts +++ b/packages/web/src/stores.ts @@ -50,6 +50,11 @@ function subscribeCssVariable(store, transform, cssVariable) { } export const selectedWidget = writableWithStorage('database', 'selectedWidget'); +export const visibleWidgetSideBar = writableWithStorage(true, 'visibleWidgetSideBar'); +export const visibleSelectedWidget = derived( + [selectedWidget, visibleWidgetSideBar], + ([$selectedWidget, $visibleWidgetSideBar]) => ($visibleWidgetSideBar ? $selectedWidget : null) +); export const emptyConnectionGroupNames = writableWithStorage([], 'emptyConnectionGroupNames'); export const openedConnections = writable([]); export const openedSingleDatabaseConnections = writable([]); @@ -128,7 +133,7 @@ export const visibleHamburgerMenuWidget = derived(useSettings(), $settings => { return !!$settings['app.fullscreen']; }); -subscribeCssVariable(selectedWidget, x => (x ? 1 : 0), '--dim-visible-left-panel'); +subscribeCssVariable(visibleSelectedWidget, x => (x ? 1 : 0), '--dim-visible-left-panel'); // subscribeCssVariable(visibleToolbar, x => (x ? 1 : 0), '--dim-visible-toolbar'); subscribeCssVariable(leftPanelWidth, x => `${x}px`, '--dim-left-panel-width'); subscribeCssVariable(visibleTitleBar, x => (x ? 1 : 0), '--dim-visible-titlebar'); diff --git a/packages/web/src/utility/openArchiveFolder.ts b/packages/web/src/utility/openArchiveFolder.ts index 3e0c01be..efbce000 100644 --- a/packages/web/src/utility/openArchiveFolder.ts +++ b/packages/web/src/utility/openArchiveFolder.ts @@ -1,6 +1,6 @@ import { get } from 'svelte/store'; import getElectron from './getElectron'; -import { currentArchive, extensions, selectedWidget } from '../stores'; +import { currentArchive, extensions, selectedWidget, visibleWidgetSideBar } from '../stores'; import { showSnackbarSuccess } from './snackbar'; import { apiCall } from './api'; @@ -16,5 +16,6 @@ export async function openArchiveFolder() { currentArchive.set(resp); selectedWidget.set('archive'); + visibleWidgetSideBar.set(true); showSnackbarSuccess(`Created link ${resp}`); } diff --git a/packages/web/src/widgets/WidgetContainer.svelte b/packages/web/src/widgets/WidgetContainer.svelte index c53900b5..2d41c11d 100644 --- a/packages/web/src/widgets/WidgetContainer.svelte +++ b/packages/web/src/widgets/WidgetContainer.svelte @@ -1,5 +1,5 @@ -