summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/context/layout.tsx
diff options
context:
space:
mode:
authorAdam <[email protected]>2026-01-05 00:25:44 -0600
committeradamelmore <[email protected]>2026-01-26 11:07:51 -0600
commitd9eed4c6cacf59089e6b6d6101deff58c7bd5040 (patch)
tree9baa833645787d9b9d66cfcbe8363962a85aa6b5 /packages/app/src/context/layout.tsx
parent7e34d27b77b3ce51cda27110b4ad1d3d5bc4317c (diff)
downloadopencode-d9eed4c6cacf59089e6b6d6101deff58c7bd5040.tar.gz
opencode-d9eed4c6cacf59089e6b6d6101deff58c7bd5040.zip
feat(app): file tree
Diffstat (limited to 'packages/app/src/context/layout.tsx')
-rw-r--r--packages/app/src/context/layout.tsx36
1 files changed, 36 insertions, 0 deletions
diff --git a/packages/app/src/context/layout.tsx b/packages/app/src/context/layout.tsx
index 5bb6f92ec..414c3d6f1 100644
--- a/packages/app/src/context/layout.tsx
+++ b/packages/app/src/context/layout.tsx
@@ -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) {