fix(app): regressions

This commit is contained in:
Adam
2026-02-10 10:12:17 -06:00
parent 3929f0b5bd
commit 70c794e913
13 changed files with 101 additions and 73 deletions

View File

@@ -25,7 +25,8 @@ export default function Home() {
const homedir = createMemo(() => sync.data.path.home)
const recent = createMemo(() => {
return sync.data.project
.toSorted((a, b) => (b.time.updated ?? b.time.created) - (a.time.updated ?? a.time.created))
.slice()
.sort((a, b) => (b.time.updated ?? b.time.created) - (a.time.updated ?? a.time.created))
.slice(0, 5)
})

View File

@@ -1938,7 +1938,7 @@ export default function Layout(props: ParentProps) {
direction="horizontal"
size={layout.sidebar.width()}
min={244}
max={window.innerWidth * 0.3 + 64}
max={typeof window === "undefined" ? 1000 : window.innerWidth * 0.3 + 64}
collapseThreshold={244}
onResize={layout.sidebar.resize}
onCollapse={layout.sidebar.close}

View File

@@ -26,7 +26,7 @@ export const isRootVisibleSession = (session: Session, directory: string) =>
workspaceKey(session.directory) === workspaceKey(directory) && !session.parentID && !session.time?.archived
export const sortedRootSessions = (store: { session: Session[]; path: { directory: string } }, now: number) =>
store.session.filter((session) => isRootVisibleSession(session, store.path.directory)).toSorted(sortSessions(now))
store.session.filter((session) => isRootVisibleSession(session, store.path.directory)).sort(sortSessions(now))
export const childMapByParent = (sessions: Session[]) => {
const map = new Map<string, string[]>()

View File

@@ -118,7 +118,7 @@ export const SortableWorkspace = (props: {
const touch = createMediaQuery("(hover: none)")
const showNew = createMemo(() => !loading() && (touch() || sessions().length === 0 || (active() && !params.id)))
const loadMore = async () => {
setWorkspaceStore("limit", (limit) => limit + 5)
setWorkspaceStore("limit", (limit) => (limit ?? 0) + 5)
await globalSync.project.loadSessions(props.directory)
}
@@ -368,7 +368,7 @@ export const LocalWorkspace = (props: {
const loading = createMemo(() => !booted() && sessions().length === 0)
const hasMore = createMemo(() => workspace().store.sessionTotal > sessions().length)
const loadMore = async () => {
workspace().setStore("limit", (limit) => limit + 5)
workspace().setStore("limit", (limit) => (limit ?? 0) + 5)
await globalSync.project.loadSessions(props.project.worktree)
}

View File

@@ -1683,7 +1683,7 @@ export default function Page() {
direction="horizontal"
size={layout.session.width()}
min={450}
max={window.innerWidth * 0.45}
max={typeof window === "undefined" ? 1000 : window.innerWidth * 0.45}
onResize={layout.session.resize}
/>
</Show>

View File

@@ -228,6 +228,7 @@ export const createScrollSpy = (input: Input) => {
node.delete(key)
visible.delete(key)
dirty = true
schedule()
}
const markDirty = () => {

View File

@@ -41,7 +41,7 @@ export function TerminalPanel(props: {
direction="vertical"
size={props.height}
min={100}
max={window.innerHeight * 0.6}
max={typeof window === "undefined" ? 1000 : window.innerHeight * 0.6}
collapseThreshold={50}
onResize={props.resize}
onCollapse={props.close}

View File

@@ -365,48 +365,81 @@ export const useSessionCommands = (input: {
return [
{
id: "session.share",
title: input.info()?.share?.url ? "Copy share link" : input.language.t("command.session.share"),
title: input.info()?.share?.url
? input.language.t("session.share.copy.copyLink")
: input.language.t("command.session.share"),
description: input.info()?.share?.url
? "Copy share URL to clipboard"
? input.language.t("toast.session.share.success.description")
: input.language.t("command.session.share.description"),
category: input.language.t("command.category.session"),
slash: "share",
disabled: !input.params.id,
onSelect: async () => {
if (!input.params.id) return
const copy = (url: string, existing: boolean) =>
navigator.clipboard
.writeText(url)
.then(() =>
showToast({
title: existing
? input.language.t("session.share.copy.copied")
: input.language.t("toast.session.share.success.title"),
description: input.language.t("toast.session.share.success.description"),
variant: "success",
}),
)
.catch(() =>
showToast({
title: input.language.t("toast.session.share.copyFailed.title"),
variant: "error",
}),
)
const url = input.info()?.share?.url
if (url) {
await copy(url, true)
const write = (value: string) => {
const body = typeof document === "undefined" ? undefined : document.body
if (body) {
const textarea = document.createElement("textarea")
textarea.value = value
textarea.setAttribute("readonly", "")
textarea.style.position = "fixed"
textarea.style.opacity = "0"
textarea.style.pointerEvents = "none"
body.appendChild(textarea)
textarea.select()
const copied = document.execCommand("copy")
body.removeChild(textarea)
if (copied) return Promise.resolve(true)
}
const clipboard = typeof navigator === "undefined" ? undefined : navigator.clipboard
if (!clipboard?.writeText) return Promise.resolve(false)
return clipboard.writeText(value).then(
() => true,
() => false,
)
}
const copy = async (url: string, existing: boolean) => {
const ok = await write(url)
if (!ok) {
showToast({
title: input.language.t("toast.session.share.copyFailed.title"),
variant: "error",
})
return
}
showToast({
title: existing
? input.language.t("session.share.copy.copied")
: input.language.t("toast.session.share.success.title"),
description: input.language.t("toast.session.share.success.description"),
variant: "success",
})
}
const existing = input.info()?.share?.url
if (existing) {
await copy(existing, true)
return
}
await input.sdk.client.session
const url = await input.sdk.client.session
.share({ sessionID: input.params.id })
.then((res) => copy(res.data!.share!.url, false))
.catch(() =>
showToast({
title: input.language.t("toast.session.share.failed.title"),
description: input.language.t("toast.session.share.failed.description"),
variant: "error",
}),
)
.then((res) => res.data?.share?.url)
.catch(() => undefined)
if (!url) {
showToast({
title: input.language.t("toast.session.share.failed.title"),
description: input.language.t("toast.session.share.failed.description"),
variant: "error",
})
return
}
await copy(url, false)
},
},
{