11import { type Edge , useNodesData , useReactFlow } from '@xyflow/react' ;
22import { Spline } from 'lucide-react' ;
33import { DashedSplineIcon } from '@/components/icons/dashed-spline' ;
4+ import { Badge } from '@/components/ui/badge' ;
45import { Checkbox } from '@/components/ui/checkbox' ;
56import { Label } from '@/components/ui/label' ;
67import { useGraphActions } from '@/features/graph/state/use-graph-store' ;
78import type { A2AEdgeData } from '../../configuration/edge-types' ;
89
910type RelationshipOptionProps = {
1011 id : string ;
11- label : string ;
12+ label : string | React . ReactNode ;
1213 onCheckedChange : ( id : string , checked : boolean ) => void ;
1314 checked : boolean ;
1415} ;
@@ -20,9 +21,12 @@ function RelationshipOption({ id, label, onCheckedChange, checked }: Relationshi
2021 id = { id }
2122 onCheckedChange = { ( checked ) => onCheckedChange ( id , checked as boolean ) }
2223 checked = { checked }
24+ className = "mt-[5px]"
2325 />
2426 < div className = "grid gap-2" >
25- < Label htmlFor = { id } > { label } </ Label >
27+ < Label htmlFor = { id } className = "font-normal" >
28+ { label }
29+ </ Label >
2630 </ div >
2731 </ div >
2832 ) ;
@@ -32,7 +36,7 @@ type RelationshipSectionProps = {
3236 icon : React . ReactNode ;
3337 title : string ;
3438 description : string ;
35- options : Array < { id : string ; label : string } > ;
39+ options : Array < { id : string ; label : string | React . ReactNode } > ;
3640 onCheckedChange : ( id : string , checked : boolean ) => void ;
3741 checkedValues : A2AEdgeData [ 'relationships' ] ;
3842} ;
@@ -131,35 +135,89 @@ function EdgeEditor({ selectedEdge }: EdgeEditorProps) {
131135 ? [
132136 {
133137 id : 'transferSourceToTarget' ,
134- label : `${ sourceNode ?. data . name } can transfer to itself` ,
138+ label : (
139+ < div >
140+ < Badge variant = "code" className = "my-0.5" >
141+ { sourceNode ?. data . name as string }
142+ </ Badge > { ' ' }
143+ can transfer to itself
144+ </ div >
145+ ) ,
135146 } ,
136147 ]
137148 : [
138149 {
139150 id : 'transferSourceToTarget' ,
140- label : `${ sourceNode ?. data . name } can transfer to ${ targetNode ?. data . name } ` ,
151+ label : (
152+ < div >
153+ < Badge variant = "code" className = "my-0.5" >
154+ { sourceNode ?. data . name as string }
155+ </ Badge > { ' ' }
156+ can transfer to{ ' ' }
157+ < Badge variant = "code" className = "my-0.5" >
158+ { targetNode ?. data . name as string }
159+ </ Badge >
160+ </ div >
161+ ) ,
141162 } ,
142163 {
143164 id : 'transferTargetToSource' ,
144- label : `${ targetNode ?. data . name } can transfer to ${ sourceNode ?. data . name } ` ,
165+ label : (
166+ < div >
167+ < Badge variant = "code" className = "my-0.5" >
168+ { targetNode ?. data . name as string }
169+ </ Badge > { ' ' }
170+ can transfer to{ ' ' }
171+ < Badge variant = "code" className = "my-0.5" >
172+ { sourceNode ?. data . name as string }
173+ </ Badge >
174+ </ div >
175+ ) ,
145176 } ,
146177 ] ;
147178
148179 const delegateOptions = isSelfLoop
149180 ? [
150181 {
151182 id : 'delegateSourceToTarget' ,
152- label : `${ sourceNode ?. data . name } can delegate to itself` ,
183+ label : (
184+ < div >
185+ < Badge variant = "code" className = "my-0.5" >
186+ { sourceNode ?. data . name as string }
187+ </ Badge > { ' ' }
188+ can delegate to itself
189+ </ div >
190+ ) ,
153191 } ,
154192 ]
155193 : [
156194 {
157195 id : 'delegateSourceToTarget' ,
158- label : `${ sourceNode ?. data . name } can delegate to ${ targetNode ?. data . name } ` ,
196+ label : (
197+ < div >
198+ < Badge variant = "code" className = "my-0.5" >
199+ { sourceNode ?. data . name as string }
200+ </ Badge > { ' ' }
201+ can delegate to{ ' ' }
202+ < Badge variant = "code" className = "my-0.5" >
203+ { targetNode ?. data . name as string }
204+ </ Badge >
205+ </ div >
206+ ) ,
159207 } ,
160208 {
161209 id : 'delegateTargetToSource' ,
162- label : `${ targetNode ?. data . name } can delegate to ${ sourceNode ?. data . name } ` ,
210+ label : (
211+ < div >
212+ < Badge variant = "code" className = "my-0.5" >
213+ { targetNode ?. data . name as string }
214+ </ Badge > { ' ' }
215+ can delegate to{ ' ' }
216+ < Badge variant = "code" className = "my-0.5" >
217+ { sourceNode ?. data . name as string }
218+ </ Badge >
219+ </ div >
220+ ) ,
163221 } ,
164222 ] ;
165223
0 commit comments