GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Feat/clickable subtask (#6846) · f2dmarques/opencode@8996185

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages
    • app/src
      • components/session
        • session-header.tsx
      • pages
        • directory-layout.tsx
    • ui/src
      • components
        • basic-tool.css
        • basic-tool.tsx
        • message-part.tsx
      • context
        • data.tsx
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/app/src/components/session/session-header.tsx‎

Copy file name to clipboardExpand all lines: packages/app/src/components/session/session-header.tsx
+57-12Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ export function SessionHeader() {
3535
const projectDirectory = createMemo(() => base64Decode(params.dir ?? ""))
3636

3737
const sessions = createMemo(() => (sync.data.session ?? []).filter((s) => !s.parentID))
38-
const currentSession = createMemo(() => sessions().find((s) => s.id === params.id))
38+
const currentSession = createMemo(() => sync.data.session.find((s) => s.id === params.id))
39+
const parentSession = createMemo(() => {
40+
const current = currentSession()
41+
if (!current?.parentID) return undefined
42+
return sync.data.session.find((s) => s.id === current.parentID)
43+
})
3944
const shareEnabled = createMemo(() => sync.data.config.share !== "disabled")
4045
const worktrees = createMemo(() => layout.projects.list().map((p) => p.worktree), [], { equals: same })
4146

@@ -45,6 +50,8 @@ export function SessionHeader() {
4550

4651
function navigateToSession(session: Session | undefined) {
4752
if (!session) return
53+
// Only navigate if we're actually changing to a different session
54+
if (session.id === params.id) return
4855
navigate(`/${params.dir}/session/${session.id}`)
4956
}
5057

@@ -79,18 +86,56 @@ export function SessionHeader() {
7986
</Select>
8087
<div class="text-text-weaker">/</div>
8188
</div>
82-
<Select
83-
options={sessions()}
84-
current={currentSession()}
85-
placeholder="New session"
86-
label={(x) => x.title}
87-
value={(x) => x.id}
88-
onSelect={navigateToSession}
89-
class="text-14-regular text-text-base max-w-[calc(100vw-180px)] md:max-w-md"
90-
variant="ghost"
91-
/>
89+
<Show
90+
when={parentSession()}
91+
fallback={
92+
<>
93+
<Select
94+
options={sessions()}
95+
current={currentSession()}
96+
placeholder="New session"
97+
label={(x) => x.title}
98+
value={(x) => x.id}
99+
onSelect={navigateToSession}
100+
class="text-14-regular text-text-base max-w-[calc(100vw-180px)] md:max-w-md"
101+
variant="ghost"
102+
/>
103+
</>
104+
}
105+
>
106+
<div class="flex items-center gap-2 min-w-0">
107+
<Select
108+
options={sessions()}
109+
current={parentSession()}
110+
placeholder="Back to parent session"
111+
label={(x) => x.title}
112+
value={(x) => x.id}
113+
onSelect={(session) => {
114+
// Only navigate if selecting a different session than current parent
115+
const currentParent = parentSession()
116+
if (session && currentParent && session.id !== currentParent.id) {
117+
navigateToSession(session)
118+
}
119+
}}
120+
class="text-14-regular text-text-base max-w-[calc(100vw-180px)] md:max-w-md"
121+
variant="ghost"
122+
/>
123+
<div class="text-text-weaker">/</div>
124+
<div class="flex items-center gap-1.5 min-w-0">
125+
<Tooltip value="Back to parent session">
126+
<button
127+
type="button"
128+
class="flex items-center justify-center gap-1 p-1 rounded hover:bg-surface-raised-base-hover active:bg-surface-raised-base-active transition-colors flex-shrink-0"
129+
onClick={() => navigateToSession(parentSession())}
130+
>
131+
<Icon name="arrow-left" size="small" class="text-icon-base" />
132+
</button>
133+
</Tooltip>
134+
</div>
135+
</div>
136+
</Show>
92137
</div>
93-
<Show when={currentSession()}>
138+
<Show when={currentSession() && !parentSession()}>
94139
<TooltipKeybind class="hidden xl:block" title="New session" keybind={command.keybind("session.new")}>
95140
<IconButton as={A} href={`/${params.dir}/session`} icon="edit-small-2" variant="ghost" />
96141
</TooltipKeybind>
Collapse file

‎packages/app/src/pages/directory-layout.tsx‎

Copy file name to clipboardExpand all lines: packages/app/src/pages/directory-layout.tsx
+12-2Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createMemo, Show, type ParentProps } from "solid-js"
2-
import { useParams } from "@solidjs/router"
2+
import { useNavigate, useParams } from "@solidjs/router"
33
import { SDKProvider, useSDK } from "@/context/sdk"
44
import { SyncProvider, useSync } from "@/context/sync"
55
import { LocalProvider } from "@/context/local"
@@ -10,6 +10,7 @@ import { iife } from "@opencode-ai/util/iife"
1010

1111
export default function Layout(props: ParentProps) {
1212
const params = useParams()
13+
const navigate = useNavigate()
1314
const directory = createMemo(() => {
1415
return base64Decode(params.dir!)
1516
})
@@ -26,8 +27,17 @@ export default function Layout(props: ParentProps) {
2627
response: "once" | "always" | "reject"
2728
}) => sdk.client.permission.respond(input)
2829

30+
const navigateToSession = (sessionID: string) => {
31+
navigate(`/${params.dir}/session/${sessionID}`)
32+
}
33+
2934
return (
30-
<DataProvider data={sync.data} directory={directory()} onPermissionRespond={respond}>
35+
<DataProvider
36+
data={sync.data}
37+
directory={directory()}
38+
onPermissionRespond={respond}
39+
onNavigateToSession={navigateToSession}
40+
>
3141
<LocalProvider>{props.children}</LocalProvider>
3242
</DataProvider>
3343
)
Collapse file

‎packages/ui/src/components/basic-tool.css‎

Copy file name to clipboardExpand all lines: packages/ui/src/components/basic-tool.css
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,16 @@
6868
line-height: var(--line-height-large);
6969
letter-spacing: var(--letter-spacing-normal);
7070
color: var(--text-weak);
71+
72+
&.clickable {
73+
cursor: pointer;
74+
text-decoration: underline;
75+
transition: color 0.15s ease;
76+
77+
&:hover {
78+
color: var(--text-base);
79+
}
80+
}
7181
}
7282

7383
[data-slot="basic-tool-tool-arg"] {
Collapse file

‎packages/ui/src/components/basic-tool.tsx‎

Copy file name to clipboardExpand all lines: packages/ui/src/components/basic-tool.tsx
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export interface BasicToolProps {
2525
hideDetails?: boolean
2626
defaultOpen?: boolean
2727
forceOpen?: boolean
28+
onSubtitleClick?: () => void
2829
}
2930

3031
export function BasicTool(props: BasicToolProps) {
@@ -59,6 +60,13 @@ export function BasicTool(props: BasicToolProps) {
5960
data-slot="basic-tool-tool-subtitle"
6061
classList={{
6162
[trigger().subtitleClass ?? ""]: !!trigger().subtitleClass,
63+
clickable: !!props.onSubtitleClick,
64+
}}
65+
onClick={(e) => {
66+
if (props.onSubtitleClick) {
67+
e.stopPropagation()
68+
props.onSubtitleClick()
69+
}
6270
}}
6371
>
6472
{trigger().subtitle}
Collapse file

‎packages/ui/src/components/message-part.tsx‎

Copy file name to clipboardExpand all lines: packages/ui/src/components/message-part.tsx
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,13 @@ ToolRegistry.register({
759759
})
760760
}
761761

762+
const handleSubtitleClick = () => {
763+
const sessionId = childSessionId()
764+
if (sessionId && data.navigateToSession) {
765+
data.navigateToSession(sessionId)
766+
}
767+
}
768+
762769
const renderChildToolPart = () => {
763770
const toolData = childToolPart()
764771
if (!toolData) return null
@@ -797,6 +804,7 @@ ToolRegistry.register({
797804
titleClass: "capitalize",
798805
subtitle: props.input.description,
799806
}}
807+
onSubtitleClick={handleSubtitleClick}
800808
/>
801809
}
802810
>
@@ -826,6 +834,7 @@ ToolRegistry.register({
826834
titleClass: "capitalize",
827835
subtitle: props.input.description,
828836
}}
837+
onSubtitleClick={handleSubtitleClick}
829838
>
830839
<div
831840
ref={autoScroll.scrollRef}
Collapse file

‎packages/ui/src/context/data.tsx‎

Copy file name to clipboardExpand all lines: packages/ui/src/context/data.tsx
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,16 @@ export type PermissionRespondFn = (input: {
3030
response: "once" | "always" | "reject"
3131
}) => void
3232

33+
export type NavigateToSessionFn = (sessionID: string) => void
34+
3335
export const { use: useData, provider: DataProvider } = createSimpleContext({
3436
name: "Data",
35-
init: (props: { data: Data; directory: string; onPermissionRespond?: PermissionRespondFn }) => {
37+
init: (props: {
38+
data: Data
39+
directory: string
40+
onPermissionRespond?: PermissionRespondFn
41+
onNavigateToSession?: NavigateToSessionFn
42+
}) => {
3643
return {
3744
get store() {
3845
return props.data
@@ -41,6 +48,7 @@ export const { use: useData, provider: DataProvider } = createSimpleContext({
4148
return props.directory
4249
},
4350
respondToPermission: props.onPermissionRespond,
51+
navigateToSession: props.onNavigateToSession,
4452
}
4553
},
4654
})

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.