Skip to content

Commit ddf51b5

Browse files
committed
ui(web): update node workflow-output-renderer
1 parent add169b commit ddf51b5

2 files changed

Lines changed: 82 additions & 12 deletions

File tree

apps/web/src/components/workflow/workflow-node.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -460,12 +460,6 @@ export const WorkflowNode = memo(
460460
key={`output-value-${output.id}-${index}`}
461461
className="space-y-1"
462462
>
463-
<div className="text-xs font-medium flex items-center gap-2">
464-
<span>{output.name}</span>
465-
<span className="text-xs text-neutral-500">
466-
{output.type}
467-
</span>
468-
</div>
469463
<WorkflowOutputRenderer
470464
output={output}
471465
createObjectUrl={data.createObjectUrl}
Lines changed: 82 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,30 @@
11
import { ObjectReference } from "@dafthunk/types";
2+
import {
3+
AsteriskIcon,
4+
BoxIcon,
5+
BracesIcon,
6+
Building2Icon,
7+
BuildingIcon,
8+
CalendarIcon,
9+
ChartNoAxesGanttIcon,
10+
CheckIcon,
11+
DotIcon,
12+
EllipsisIcon,
13+
GlobeIcon,
14+
HashIcon,
15+
ImageIcon,
16+
LayoutGridIcon,
17+
LockIcon,
18+
MinusIcon,
19+
MusicIcon,
20+
ShapesIcon,
21+
SquareIcon,
22+
StickyNoteIcon,
23+
TriangleIcon,
24+
TypeIcon,
25+
} from "lucide-react";
26+
27+
import { cn } from "@/utils/utils";
228

329
import { WorkflowParameter } from "./workflow-types";
430
import { WorkflowValueRenderer } from "./workflow-value-renderer";
@@ -9,17 +35,67 @@ interface WorkflowOutputRendererProps {
935
compact?: boolean;
1036
}
1137

38+
const TypeIconRenderer = ({ type }: { type: string }) => {
39+
const iconMap: Record<string, React.ReactNode> = {
40+
string: <TypeIcon className="!size-2" />,
41+
number: <HashIcon className="!size-2" />,
42+
boolean: <CheckIcon className="!size-2" />,
43+
image: <ImageIcon className="!size-2" />,
44+
document: <StickyNoteIcon className="!size-2" />,
45+
audio: <MusicIcon className="!size-2" />,
46+
buffergeometry: <BoxIcon className="!size-2" />,
47+
gltf: <BoxIcon className="!size-2" />,
48+
json: <BracesIcon className="!size-2" />,
49+
date: <CalendarIcon className="!size-2" />,
50+
point: <DotIcon className="!size-2" />,
51+
multipoint: <EllipsisIcon className="!size-2" />,
52+
linestring: <MinusIcon className="!size-2" />,
53+
multilinestring: <ChartNoAxesGanttIcon className="!size-2" />,
54+
polygon: <TriangleIcon className="!size-2" />,
55+
multipolygon: <ShapesIcon className="!size-2" />,
56+
geometry: <SquareIcon className="!size-2" />,
57+
geometrycollection: <LayoutGridIcon className="!size-2" />,
58+
feature: <BuildingIcon className="!size-2" />,
59+
featurecollection: <Building2Icon className="!size-2" />,
60+
geojson: <GlobeIcon className="!size-2" />,
61+
secret: <LockIcon className="!size-2" />,
62+
any: <AsteriskIcon className="!size-2" />,
63+
};
64+
65+
return iconMap[type] || iconMap.any;
66+
};
67+
1268
export function WorkflowOutputRenderer({
1369
output,
1470
createObjectUrl,
1571
compact = false,
1672
}: WorkflowOutputRendererProps) {
1773
return (
18-
<WorkflowValueRenderer
19-
parameter={output}
20-
createObjectUrl={createObjectUrl}
21-
compact={compact}
22-
readonly={true}
23-
/>
74+
<div className="space-y-1.5">
75+
{/* Output Header */}
76+
<div className="flex items-center gap-1 text-[0.6rem]">
77+
<div
78+
className={cn(
79+
"inline-flex items-center justify-center size-3.5 flex-shrink-0",
80+
"rounded-[0.3rem] text-neutral-500 dark:text-neutral-400",
81+
"bg-neutral-100 dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700"
82+
)}
83+
title={output.type}
84+
>
85+
<TypeIconRenderer type={output.type} />
86+
</div>
87+
<p className="text-neutral-700 dark:text-neutral-300 truncate font-medium">
88+
{output.name}
89+
</p>
90+
</div>
91+
92+
{/* Output Value */}
93+
<WorkflowValueRenderer
94+
parameter={output}
95+
createObjectUrl={createObjectUrl}
96+
compact={compact}
97+
readonly={true}
98+
/>
99+
</div>
24100
);
25101
}

0 commit comments

Comments
 (0)