|
1 | | -import { For, Show, createEffect, createMemo, createSignal } from "solid-js"; |
| 1 | +import { For, Show, createEffect, createMemo } from "solid-js"; |
2 | 2 | import type { Part } from "@opencode-ai/sdk/v2/client"; |
3 | 3 | import type { |
4 | 4 | ArtifactItem, |
@@ -28,7 +28,6 @@ import { |
28 | 28 | import Button from "../components/button"; |
29 | 29 | import PartView from "../components/part-view"; |
30 | 30 | import WorkspaceChip from "../components/workspace-chip"; |
31 | | -import { isTauriRuntime, isWindowsPlatform } from "../utils"; |
32 | 31 |
|
33 | 32 | export type SessionViewProps = { |
34 | 33 | selectedSessionId: string | null; |
@@ -103,13 +102,6 @@ export default function SessionView(props: SessionViewProps) { |
103 | 102 | return Array.from({ length: total }, (_, idx) => idx < completed); |
104 | 103 | }); |
105 | 104 |
|
106 | | - const [artifactToast, setArtifactToast] = createSignal<string | null>(null); |
107 | | - |
108 | | - createEffect(() => { |
109 | | - if (!artifactToast()) return; |
110 | | - const id = window.setTimeout(() => setArtifactToast(null), 3000); |
111 | | - return () => window.clearTimeout(id); |
112 | | - }); |
113 | 105 |
|
114 | 106 | const humanizePlugin = (name: string) => { |
115 | 107 | const cleaned = name |
@@ -141,50 +133,6 @@ export default function SessionView(props: SessionViewProps) { |
141 | 133 | props.setExpandedSidebarSections((current) => ({ ...current, [key]: !current[key] })); |
142 | 134 | }; |
143 | 135 |
|
144 | | - const artifactActionLabel = () => (isWindowsPlatform() ? "Open" : "Reveal"); |
145 | | - |
146 | | - const artifactActionToast = () => (isWindowsPlatform() ? "Opened in default app." : "Revealed in file manager."); |
147 | | - |
148 | | - const resolveArtifactPath = (artifact: ArtifactItem) => { |
149 | | - const rawPath = artifact.path?.trim(); |
150 | | - if (!rawPath) return null; |
151 | | - if (/^(?:[a-zA-Z]:[\\/]|~[\\/]|\/)/.test(rawPath)) { |
152 | | - return rawPath; |
153 | | - } |
154 | | - |
155 | | - const root = props.activeWorkspaceDisplay.path?.trim(); |
156 | | - if (!root) return rawPath; |
157 | | - |
158 | | - const separator = root.includes("\\") ? "\\" : "/"; |
159 | | - const trimmedRoot = root.replace(/[\\/]+$/, ""); |
160 | | - const trimmedPath = rawPath.replace(/^[\\/]+/, ""); |
161 | | - return `${trimmedRoot}${separator}${trimmedPath}`; |
162 | | - }; |
163 | | - |
164 | | - const handleOpenArtifact = async (artifact: ArtifactItem) => { |
165 | | - const resolvedPath = resolveArtifactPath(artifact); |
166 | | - if (!resolvedPath) { |
167 | | - setArtifactToast("Artifact path missing."); |
168 | | - return; |
169 | | - } |
170 | | - |
171 | | - if (!isTauriRuntime()) { |
172 | | - setArtifactToast("Open is only available in the desktop app."); |
173 | | - return; |
174 | | - } |
175 | | - |
176 | | - try { |
177 | | - const { openPath, revealItemInDir } = await import("@tauri-apps/plugin-opener"); |
178 | | - if (isWindowsPlatform()) { |
179 | | - await openPath(resolvedPath); |
180 | | - } else { |
181 | | - await revealItemInDir(resolvedPath); |
182 | | - } |
183 | | - setArtifactToast(artifactActionToast()); |
184 | | - } catch (error) { |
185 | | - setArtifactToast(error instanceof Error ? error.message : "Could not open artifact."); |
186 | | - } |
187 | | - }; |
188 | 136 |
|
189 | 137 | const modelLabelParts = createMemo(() => { |
190 | 138 | const label = props.selectedSessionModelLabel || "Model"; |
@@ -468,35 +416,10 @@ export default function SessionView(props: SessionViewProps) { |
468 | 416 | </div> |
469 | 417 | </Show> |
470 | 418 |
|
471 | | - <For each={props.artifacts}> |
472 | | - {(artifact) => ( |
473 | | - <div class="rounded-2xl border border-gray-6 bg-gray-1/60 p-4 flex items-center justify-between"> |
474 | | - <div class="flex items-center gap-3"> |
475 | | - <div class="h-10 w-10 rounded-xl bg-gray-2 flex items-center justify-center"> |
476 | | - <FileText size={18} class="text-gray-11" /> |
477 | | - </div> |
478 | | - <div> |
479 | | - <div class="text-sm text-gray-12">{artifact.name}</div> |
480 | | - <div class="text-xs text-gray-10">Document</div> |
481 | | - </div> |
482 | | - </div> |
483 | | - <Button variant="outline" class="text-xs" onClick={() => handleOpenArtifact(artifact)}> |
484 | | - {artifactActionLabel()} |
485 | | - </Button> |
486 | | - </div> |
487 | | - )} |
488 | | - </For> |
489 | | - |
490 | 419 | <div ref={(el) => (messagesEndEl = el)} /> |
491 | 420 | </div> |
492 | 421 | </div> |
493 | 422 |
|
494 | | - <Show when={artifactToast()}> |
495 | | - <div class="fixed bottom-24 right-8 z-30 rounded-xl bg-gray-2 border border-gray-6 px-4 py-2 text-xs text-gray-11 shadow-lg"> |
496 | | - {artifactToast()} |
497 | | - </div> |
498 | | - </Show> |
499 | | - |
500 | 423 | <aside class="hidden lg:flex w-80 border-l border-gray-6 bg-gray-1 flex-col"> |
501 | 424 | <div class="p-4 space-y-4 overflow-y-auto flex-1"> |
502 | 425 | <Show when={realTodos().length > 0}> |
|
0 commit comments