feat(app): file tree

This commit is contained in:
Adam
2026-01-05 00:25:44 -06:00
committed by adamelmore
parent 7e34d27b77
commit d9eed4c6ca
5 changed files with 364 additions and 93 deletions

View File

@@ -82,6 +82,10 @@ export const { use: useLayout, provider: LayoutProvider } = createSimpleContext(
diffStyle: "split" as ReviewDiffStyle,
panelOpened: true,
},
fileTree: {
opened: false,
width: 260,
},
session: {
width: 600,
},
@@ -449,6 +453,38 @@ export const { use: useLayout, provider: LayoutProvider } = createSimpleContext(
setStore("review", "diffStyle", diffStyle)
},
},
fileTree: {
opened: createMemo(() => store.fileTree?.opened ?? false),
width: createMemo(() => store.fileTree?.width ?? 260),
open() {
if (!store.fileTree) {
setStore("fileTree", { opened: true, width: 260 })
return
}
setStore("fileTree", "opened", true)
},
close() {
if (!store.fileTree) {
setStore("fileTree", { opened: false, width: 260 })
return
}
setStore("fileTree", "opened", false)
},
toggle() {
if (!store.fileTree) {
setStore("fileTree", { opened: true, width: 260 })
return
}
setStore("fileTree", "opened", (x) => !x)
},
resize(width: number) {
if (!store.fileTree) {
setStore("fileTree", { opened: true, width })
return
}
setStore("fileTree", "width", width)
},
},
session: {
width: createMemo(() => store.session?.width ?? 600),
resize(width: number) {