diff options
| author | Adam <[email protected]> | 2025-12-09 11:52:39 -0600 |
|---|---|---|
| committer | Adam <[email protected]> | 2025-12-09 11:52:43 -0600 |
| commit | 1bc1e56da379fdd9040dc40caac1a57ffe8d1197 (patch) | |
| tree | a29b8ae17b7db70cb7cf22f2378b8f6b0295090d /packages/desktop/src/context/layout.tsx | |
| parent | 0d0c20e673d90bf5f5bb005fb6b91fd4850726a3 (diff) | |
| download | opencode-1bc1e56da379fdd9040dc40caac1a57ffe8d1197.tar.gz opencode-1bc1e56da379fdd9040dc40caac1a57ffe8d1197.zip | |
wip(desktop): progress
Diffstat (limited to 'packages/desktop/src/context/layout.tsx')
| -rw-r--r-- | packages/desktop/src/context/layout.tsx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/desktop/src/context/layout.tsx b/packages/desktop/src/context/layout.tsx index 5ef41c1f4..58d947af4 100644 --- a/packages/desktop/src/context/layout.tsx +++ b/packages/desktop/src/context/layout.tsx @@ -66,6 +66,16 @@ export const { use: useLayout, provider: LayoutProvider } = createSimpleContext( collapse(directory: string) { setStore("projects", (x) => x.map((x) => (x.directory === directory ? { ...x, expanded: false } : x))) }, + move(directory: string, toIndex: number) { + setStore("projects", (projects) => { + const fromIndex = projects.findIndex((x) => x.directory === directory) + if (fromIndex === -1 || fromIndex === toIndex) return projects + const result = [...projects] + const [item] = result.splice(fromIndex, 1) + result.splice(toIndex, 0, item) + return result + }) + }, }, sidebar: { opened: createMemo(() => store.sidebar.opened), |
