Skip to content

Database diagrams editor that allows you to visualize and design your DB with a single query.

fix show or hide sidebar in view menu

Guy Ben-Aharond0d07c798d3a
diff --git a/src/context/layout-context/layout-provider.tsx b/src/context/layout-context/layout-provider.tsx
index d7e2efff..e1019d2b 100644
--- a/src/context/layout-context/layout-provider.tsx
+++ b/src/context/layout-context/layout-provider.tsx
@@ -1,9 +1,11 @@
import React from 'react';
import { LayoutContext, layoutContext, SidebarSection } from './layout-context';
+import { useBreakpoint } from '@/hooks/use-breakpoint';
export const LayoutProvider: React.FC<React.PropsWithChildren> = ({
children,
}) => {
+ const { isMd: isDesktop } = useBreakpoint('md');
const [openedTableInSidebar, setOpenedTableInSidebar] = React.useState<
string | undefined
>();
@@ -12,7 +14,7 @@ export const LayoutProvider: React.FC<React.PropsWithChildren> = ({
const [selectedSidebarSection, setSelectedSidebarSection] =
React.useState<SidebarSection>('tables');
const [isSidePanelShowed, setIsSidePanelShowed] =
- React.useState<boolean>(false);
+ React.useState<boolean>(isDesktop);
const closeAllTablesInSidebar: LayoutContext['closeAllTablesInSidebar'] =
() => setOpenedTableInSidebar('');
diff --git a/src/pages/editor-page/editor-page.tsx b/src/pages/editor-page/editor-page.tsx
index 22e51eb1..d83bce41 100644
--- a/src/pages/editor-page/editor-page.tsx
+++ b/src/pages/editor-page/editor-page.tsx
@@ -88,7 +88,7 @@ export const EditorPage: React.FC = () => {
<ResizablePanel
defaultSize={isXl ? 25 : isLg ? 35 : 50}
minSize={isXl ? 25 : isLg ? 35 : 50}
- maxSize={!isSidePanelShowed ? 99 : 0}
+ maxSize={isSidePanelShowed ? 99 : 0}
>
<SidePanel />
</ResizablePanel>