Skip to content

Commit a35ab92

Browse files
committed
feat(desktop): add review pane resizing, padding fix, and share commands
- Add resizable session changes panel with width persisted in layout - Fix left padding when review pane is in side-by-side mode - Add /share and /unshare slash commands for session sharing Closes anomalyco#135, closes anomalyco#138
1 parent 7a64e98 commit a35ab92

2 files changed

Lines changed: 56 additions & 2 deletions

File tree

‎packages/desktop/src/context/layout.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const { use: useLayout, provider: LayoutProvider } = createSimpleContext(
5050
},
5151
review: {
5252
state: "pane" as "pane" | "tab",
53+
width: 450,
5354
},
5455
theme: DEFAULT_THEME_ID,
5556
font: FONTS[0].id,
@@ -188,6 +189,10 @@ export const { use: useLayout, provider: LayoutProvider } = createSimpleContext(
188189
tab() {
189190
setStore("review", "state", "tab")
190191
},
192+
width: createMemo(() => store.review?.width ?? 450),
193+
resize(width: number) {
194+
setStore("review", "width", width)
195+
},
191196
},
192197
dialog: {
193198
opened: createMemo(() => ephemeral.dialog?.open),

‎packages/desktop/src/pages/session.tsx‎

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { useCodeComponent } from "@opencode-ai/ui/context/code"
1616
import { SessionTurn } from "@opencode-ai/ui/session-turn"
1717
import { SessionMessageRail } from "@opencode-ai/ui/session-message-rail"
1818
import { SessionReview } from "@opencode-ai/ui/session-review"
19+
import { showToast } from "@opencode-ai/ui/toast"
1920
import {
2021
DragDropProvider,
2122
DragDropSensors,
@@ -318,6 +319,43 @@ export default function Page() {
318319
setActiveMessage(priorMsg)
319320
},
320321
},
322+
{
323+
id: "session.share",
324+
title: "Share session",
325+
description: "Create a shareable link for the session",
326+
category: "Session",
327+
slash: "share",
328+
disabled: !params.id || !!info()?.share?.url || sync.data.config.share === "disabled",
329+
onSelect: async () => {
330+
if (!params.id) return
331+
try {
332+
const res = await sdk.client.session.share({ sessionID: params.id })
333+
if (res.data?.share?.url) {
334+
await navigator.clipboard.writeText(res.data.share.url)
335+
showToast({ title: "Share URL copied to clipboard!", variant: "success" })
336+
}
337+
} catch {
338+
showToast({ title: "Failed to share session", variant: "error" })
339+
}
340+
},
341+
},
342+
{
343+
id: "session.unshare",
344+
title: "Unshare session",
345+
description: "Remove the shareable link",
346+
category: "Session",
347+
slash: "unshare",
348+
disabled: !params.id || !info()?.share?.url,
349+
onSelect: async () => {
350+
if (!params.id) return
351+
try {
352+
await sdk.client.session.unshare({ sessionID: params.id })
353+
showToast({ title: "Session unshared", variant: "success" })
354+
} catch {
355+
showToast({ title: "Failed to unshare session", variant: "error" })
356+
}
357+
},
358+
},
321359
])
322360

323361
const handleKeyDown = (event: KeyboardEvent) => {
@@ -654,7 +692,7 @@ export default function Page() {
654692
root: "pb-20 flex-1 min-w-0 overflow-x-hidden",
655693
content: "pb-20",
656694
container:
657-
"w-full max-w-full " + (wide() ? "max-w-146 mx-auto px-4 sm:px-6" : "pr-4 sm:pr-6"),
695+
"w-full max-w-full " + (wide() ? "max-w-146 mx-auto px-4 sm:px-6" : "px-4 sm:px-6"),
658696
}}
659697
/>
660698
</Show>
@@ -699,9 +737,20 @@ export default function Page() {
699737
<Show when={layout.review.state() === "pane" && diffs().length}>
700738
<div
701739
classList={{
702-
"relative grow pt-3 flex-1 min-h-0 border-l border-border-weak-base": true,
740+
"relative pt-3 shrink-0 min-h-0 border-l border-border-weak-base": true,
703741
}}
742+
style={{ width: `${layout.review.width()}px` }}
704743
>
744+
<ResizeHandle
745+
direction="horizontal"
746+
reverse
747+
size={layout.review.width()}
748+
min={300}
749+
max={window.innerWidth * 0.5}
750+
collapseThreshold={100}
751+
onResize={layout.review.resize}
752+
onCollapse={() => layout.review.tab()}
753+
/>
705754
<SessionReview
706755
classes={{
707756
root: "pb-20",

0 commit comments

Comments
 (0)