Skip to content

Commit 3bc1379

Browse files
fix: remove aggregated artifact cards (anomalyco#153)
1 parent 66fa717 commit 3bc1379

1 file changed

Lines changed: 1 addition & 78 deletions

File tree

‎src/app/pages/session.tsx‎

Lines changed: 1 addition & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { For, Show, createEffect, createMemo, createSignal } from "solid-js";
1+
import { For, Show, createEffect, createMemo } from "solid-js";
22
import type { Part } from "@opencode-ai/sdk/v2/client";
33
import type {
44
ArtifactItem,
@@ -28,7 +28,6 @@ import {
2828
import Button from "../components/button";
2929
import PartView from "../components/part-view";
3030
import WorkspaceChip from "../components/workspace-chip";
31-
import { isTauriRuntime, isWindowsPlatform } from "../utils";
3231

3332
export type SessionViewProps = {
3433
selectedSessionId: string | null;
@@ -103,13 +102,6 @@ export default function SessionView(props: SessionViewProps) {
103102
return Array.from({ length: total }, (_, idx) => idx < completed);
104103
});
105104

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-
});
113105

114106
const humanizePlugin = (name: string) => {
115107
const cleaned = name
@@ -141,50 +133,6 @@ export default function SessionView(props: SessionViewProps) {
141133
props.setExpandedSidebarSections((current) => ({ ...current, [key]: !current[key] }));
142134
};
143135

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-
};
188136

189137
const modelLabelParts = createMemo(() => {
190138
const label = props.selectedSessionModelLabel || "Model";
@@ -468,35 +416,10 @@ export default function SessionView(props: SessionViewProps) {
468416
</div>
469417
</Show>
470418

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-
490419
<div ref={(el) => (messagesEndEl = el)} />
491420
</div>
492421
</div>
493422

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-
500423
<aside class="hidden lg:flex w-80 border-l border-gray-6 bg-gray-1 flex-col">
501424
<div class="p-4 space-y-4 overflow-y-auto flex-1">
502425
<Show when={realTodos().length > 0}>

0 commit comments

Comments
 (0)