Skip to content

Commit

Permalink
feat: persist left pane
Browse files Browse the repository at this point in the history
  • Loading branch information
nichenqin committed Sep 18, 2024
1 parent 2ffcb93 commit 9870a8e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions apps/frontend/src/lib/store/persisted.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export const preferences = persisted("undb_preferences", {
showHiddenFields: false,
duplicateFieldIncludeData: true,
gridViewPerPage: 50,
panelLeftWidth: 20,
})
6 changes: 4 additions & 2 deletions apps/frontend/src/routes/(authed)/(space)/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import ImportTableDialog from "$lib/components/blocks/import-table/import-table-dialog.svelte"
import MemberMenu from "$lib/components/blocks/member/member-menu.svelte"
import { derived } from "svelte/store"
import { preferences } from "$lib/store/persisted.store"
export let data: LayoutData
Expand Down Expand Up @@ -82,10 +83,11 @@
<Resizable.PaneGroup direction="horizontal">
<Resizable.Pane
bind:pane={panelLeft}
onResize={(size) => ($preferences.panelLeftWidth = size)}
onCollapse={() => (collapsed = true)}
onExpand={() => (collapsed = false)}
class="bg-muted/40 hidden border-r md:block"
defaultSize={20}
defaultSize={$preferences.panelLeftWidth ?? 20}
minSize={15}
maxSize={30}
>
Expand All @@ -103,7 +105,7 @@
</div>
</Resizable.Pane>
<Resizable.Handle />
<Resizable.Pane class="grid h-screen" defaultSize={85}>
<Resizable.Pane class="grid h-screen" defaultSize={100 - $preferences.panelLeftWidth}>
<slot />
</Resizable.Pane>
</Resizable.PaneGroup>
Expand Down

0 comments on commit 9870a8e

Please sign in to comment.