11import { 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
329import { WorkflowParameter } from "./workflow-types" ;
430import { 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+
1268export 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