|
@@ -16,6 +16,7 @@ import {
|
|
|
import { A, useNavigate, useParams } from "@solidjs/router"
|
|
import { A, useNavigate, useParams } from "@solidjs/router"
|
|
|
import { useLayout, getAvatarColors, LocalProject } from "@/context/layout"
|
|
import { useLayout, getAvatarColors, LocalProject } from "@/context/layout"
|
|
|
import { useGlobalSync } from "@/context/global-sync"
|
|
import { useGlobalSync } from "@/context/global-sync"
|
|
|
|
|
+import { Persist, persisted } from "@/utils/persist"
|
|
|
import { base64Decode, base64Encode } from "@opencode-ai/util/encode"
|
|
import { base64Decode, base64Encode } from "@opencode-ai/util/encode"
|
|
|
import { Avatar } from "@opencode-ai/ui/avatar"
|
|
import { Avatar } from "@opencode-ai/ui/avatar"
|
|
|
import { ResizeHandle } from "@opencode-ai/ui/resize-handle"
|
|
import { ResizeHandle } from "@opencode-ai/ui/resize-handle"
|
|
@@ -62,13 +63,16 @@ import { Titlebar } from "@/components/titlebar"
|
|
|
import { useServer } from "@/context/server"
|
|
import { useServer } from "@/context/server"
|
|
|
|
|
|
|
|
export default function Layout(props: ParentProps) {
|
|
export default function Layout(props: ParentProps) {
|
|
|
- const [store, setStore] = createStore({
|
|
|
|
|
- lastSession: {} as { [directory: string]: string },
|
|
|
|
|
- activeProject: undefined as string | undefined,
|
|
|
|
|
- activeWorkspace: undefined as string | undefined,
|
|
|
|
|
- workspaceOrder: {} as Record<string, string[]>,
|
|
|
|
|
- workspaceExpanded: {} as Record<string, boolean>,
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ const [store, setStore, , ready] = persisted(
|
|
|
|
|
+ Persist.global("layout.page", ["layout.page.v1"]),
|
|
|
|
|
+ createStore({
|
|
|
|
|
+ lastSession: {} as { [directory: string]: string },
|
|
|
|
|
+ activeProject: undefined as string | undefined,
|
|
|
|
|
+ activeWorkspace: undefined as string | undefined,
|
|
|
|
|
+ workspaceOrder: {} as Record<string, string[]>,
|
|
|
|
|
+ workspaceExpanded: {} as Record<string, boolean>,
|
|
|
|
|
+ }),
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
let scrollContainerRef: HTMLDivElement | undefined
|
|
let scrollContainerRef: HTMLDivElement | undefined
|
|
|
const xlQuery = window.matchMedia("(min-width: 1280px)")
|
|
const xlQuery = window.matchMedia("(min-width: 1280px)")
|
|
@@ -289,6 +293,7 @@ export default function Layout(props: ParentProps) {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
createEffect(() => {
|
|
createEffect(() => {
|
|
|
|
|
+ if (!ready()) return
|
|
|
const project = currentProject()
|
|
const project = currentProject()
|
|
|
if (!project) return
|
|
if (!project) return
|
|
|
|
|
|
|
@@ -708,7 +713,7 @@ export default function Layout(props: ParentProps) {
|
|
|
const id = params.id
|
|
const id = params.id
|
|
|
setStore("lastSession", directory, id)
|
|
setStore("lastSession", directory, id)
|
|
|
notification.session.markViewed(id)
|
|
notification.session.markViewed(id)
|
|
|
- untrack(() => setStore("workspaceExpanded", directory, true))
|
|
|
|
|
|
|
+ untrack(() => setStore("workspaceExpanded", directory, (value) => value ?? true))
|
|
|
requestAnimationFrame(() => scrollToSession(id))
|
|
requestAnimationFrame(() => scrollToSession(id))
|
|
|
})
|
|
})
|
|
|
|
|
|