@@ -24,7 +24,7 @@ export const SolutionVennDiagram = ({ solutionOverview, onOverlapClick }: ISolut
24
24
'#EC4899' , // pink
25
25
] ;
26
26
27
- // Helper function to get component type summary
27
+ // Helper function to get component type summary as array for vertical display
28
28
const getComponentTypeSummary = ( components : SolutionComponentType [ ] ) => {
29
29
const typeCounts = components . reduce ( ( acc , component ) => {
30
30
const type = component . ComponentTypeName || 'Unknown' ;
@@ -33,8 +33,7 @@ export const SolutionVennDiagram = ({ solutionOverview, onOverlapClick }: ISolut
33
33
} , { } as Record < string , number > ) ;
34
34
35
35
return Object . entries ( typeCounts )
36
- . map ( ( [ type , count ] ) => `${ count } ${ type } ${ count > 1 ? 's' : '' } ` )
37
- . join ( ', ' ) ;
36
+ . map ( ( [ type , count ] ) => `${ count } ${ type } ${ count > 1 ? 's' : '' } ` ) ;
38
37
} ;
39
38
40
39
// For simplicity, we'll render based on the number of solutions
@@ -51,7 +50,7 @@ export const SolutionVennDiagram = ({ solutionOverview, onOverlapClick }: ISolut
51
50
function renderSingleSolution ( ) {
52
51
const solution = solutions [ 0 ] ;
53
52
const overlap = overlaps . find ( o => o . SolutionNames . length === 1 && o . SolutionNames [ 0 ] === solution . UniqueName ) ;
54
- const typeSummary = overlap ? getComponentTypeSummary ( overlap . SharedComponents ) : '' ;
53
+ const typeSummary = overlap ? getComponentTypeSummary ( overlap . SharedComponents ) : [ ] ;
55
54
56
55
return (
57
56
< div className = "flex items-center justify-center h-80" >
@@ -67,17 +66,24 @@ export const SolutionVennDiagram = ({ solutionOverview, onOverlapClick }: ISolut
67
66
className = "cursor-pointer hover:fillOpacity-0.8"
68
67
onClick = { ( ) => overlap && onOverlapClick ( overlap . SolutionNames , overlap . SharedComponents ) }
69
68
/>
70
- < text x = "200" y = "140 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white font-bold text-lg" >
69
+ < text x = "200" y = "130 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white font-bold text-lg" >
71
70
{ solution . DisplayName }
72
71
</ text >
73
- < text x = "200" y = "160 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white text-sm font-semibold" >
72
+ < text x = "200" y = "150 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white text-sm font-semibold" >
74
73
{ overlap ?. ComponentCount || 0 } components
75
74
</ text >
76
- { typeSummary && (
77
- < text x = "200" y = "175" textAnchor = "middle" dominantBaseline = "middle" className = "fill-white text-xs" >
78
- { typeSummary }
75
+ { typeSummary . map ( ( typeText , index ) => (
76
+ < text
77
+ key = { index }
78
+ x = "200"
79
+ y = { 165 + index * 12 }
80
+ textAnchor = "middle"
81
+ dominantBaseline = "middle"
82
+ className = "fill-white text-xs"
83
+ >
84
+ { typeText }
79
85
</ text >
80
- ) }
86
+ ) ) }
81
87
</ svg >
82
88
</ div >
83
89
) ;
@@ -89,9 +95,9 @@ export const SolutionVennDiagram = ({ solutionOverview, onOverlapClick }: ISolut
89
95
const overlap2 = overlaps . find ( o => o . SolutionNames . length === 1 && o . SolutionNames [ 0 ] === solution2 . UniqueName ) ;
90
96
const overlapBoth = overlaps . find ( o => o . SolutionNames . length === 2 ) ;
91
97
92
- const typeSummary1 = overlap1 ? getComponentTypeSummary ( overlap1 . SharedComponents ) : '' ;
93
- const typeSummary2 = overlap2 ? getComponentTypeSummary ( overlap2 . SharedComponents ) : '' ;
94
- const typeSummaryBoth = overlapBoth ? getComponentTypeSummary ( overlapBoth . SharedComponents ) : '' ;
98
+ const typeSummary1 = overlap1 ? getComponentTypeSummary ( overlap1 . SharedComponents ) : [ ] ;
99
+ const typeSummary2 = overlap2 ? getComponentTypeSummary ( overlap2 . SharedComponents ) : [ ] ;
100
+ const typeSummaryBoth = overlapBoth ? getComponentTypeSummary ( overlapBoth . SharedComponents ) : [ ] ;
95
101
96
102
return (
97
103
< div className = "flex items-center justify-center h-80" >
@@ -134,43 +140,61 @@ export const SolutionVennDiagram = ({ solutionOverview, onOverlapClick }: ISolut
134
140
/>
135
141
136
142
{ /* Solution 1 Labels */ }
137
- < text x = "140" y = "160 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white font-bold text-base" >
143
+ < text x = "140" y = "145 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white font-bold text-base" >
138
144
{ solution1 . DisplayName }
139
145
</ text >
140
- < text x = "140" y = "180 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white text-sm font-semibold" >
146
+ < text x = "140" y = "165 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white text-sm font-semibold" >
141
147
{ overlap1 ?. ComponentCount || 0 } components
142
148
</ text >
143
- { typeSummary1 && (
144
- < text x = "140" y = "195" textAnchor = "middle" dominantBaseline = "middle" className = "fill-white text-xs" >
145
- { typeSummary1 }
149
+ { typeSummary1 . map ( ( typeText , index ) => (
150
+ < text
151
+ key = { index }
152
+ x = "140"
153
+ y = { 180 + index * 12 }
154
+ textAnchor = "middle"
155
+ dominantBaseline = "middle"
156
+ className = "fill-white text-xs"
157
+ >
158
+ { typeText }
146
159
</ text >
147
- ) }
160
+ ) ) }
148
161
149
162
{ /* Solution 2 Labels */ }
150
- < text x = "460" y = "160 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white font-bold text-base" >
163
+ < text x = "460" y = "145 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white font-bold text-base" >
151
164
{ solution2 . DisplayName }
152
165
</ text >
153
- < text x = "460" y = "180 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white text-sm font-semibold" >
166
+ < text x = "460" y = "165 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white text-sm font-semibold" >
154
167
{ overlap2 ?. ComponentCount || 0 } components
155
168
</ text >
156
- { typeSummary2 && (
157
- < text x = "460" y = "195" textAnchor = "middle" dominantBaseline = "middle" className = "fill-white text-xs" >
158
- { typeSummary2 }
169
+ { typeSummary2 . map ( ( typeText , index ) => (
170
+ < text
171
+ key = { index }
172
+ x = "460"
173
+ y = { 180 + index * 12 }
174
+ textAnchor = "middle"
175
+ dominantBaseline = "middle"
176
+ className = "fill-white text-xs"
177
+ >
178
+ { typeText }
159
179
</ text >
160
- ) }
180
+ ) ) }
161
181
162
182
{ /* Overlap Labels */ }
163
- < text x = "300" y = "160 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white font-bold text-base" >
183
+ < text x = "300" y = "155 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white font-bold text-base" >
164
184
{ overlapBoth ?. ComponentCount || 0 }
165
185
</ text >
166
- < text x = "300" y = "180" textAnchor = "middle" dominantBaseline = "middle" className = "fill-white text-sm font-semibold" >
167
- shared
168
- </ text >
169
- { typeSummaryBoth && (
170
- < text x = "300" y = "195" textAnchor = "middle" dominantBaseline = "middle" className = "fill-white text-xs" >
171
- { typeSummaryBoth }
186
+ { typeSummaryBoth . map ( ( typeText , index ) => (
187
+ < text
188
+ key = { index }
189
+ x = "300"
190
+ y = { 175 + index * 12 }
191
+ textAnchor = "middle"
192
+ dominantBaseline = "middle"
193
+ className = "fill-white text-xs"
194
+ >
195
+ { typeText }
172
196
</ text >
173
- ) }
197
+ ) ) }
174
198
</ svg >
175
199
</ div >
176
200
) ;
@@ -257,26 +281,74 @@ export const SolutionVennDiagram = ({ solutionOverview, onOverlapClick }: ISolut
257
281
} ) }
258
282
259
283
{ /* Labels */ }
260
- < text x = "250" y = "85 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white font-bold text-base" >
284
+ < text x = "250" y = "80 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white font-bold text-base" >
261
285
{ solution1 . DisplayName }
262
286
</ text >
263
- < text x = "250" y = "105 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white text-sm font-semibold" >
287
+ < text x = "250" y = "100 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white text-sm font-semibold" >
264
288
{ overlaps . find ( o => o . SolutionNames . length === 1 && o . SolutionNames [ 0 ] === solution1 . UniqueName ) ?. ComponentCount || 0 } components
265
289
</ text >
290
+ { ( ( ) => {
291
+ const overlap = overlaps . find ( o => o . SolutionNames . length === 1 && o . SolutionNames [ 0 ] === solution1 . UniqueName ) ;
292
+ const typeSummary = overlap ? getComponentTypeSummary ( overlap . SharedComponents ) : [ ] ;
293
+ return typeSummary . map ( ( typeText , index ) => (
294
+ < text
295
+ key = { index }
296
+ x = "250"
297
+ y = { 115 + index * 12 }
298
+ textAnchor = "middle"
299
+ dominantBaseline = "middle"
300
+ className = "fill-white text-xs"
301
+ >
302
+ { typeText }
303
+ </ text >
304
+ ) ) ;
305
+ } ) ( ) }
266
306
267
- < text x = "130" y = "305 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white font-bold text-base" >
307
+ < text x = "130" y = "300 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white font-bold text-base" >
268
308
{ solution2 . DisplayName }
269
309
</ text >
270
- < text x = "130" y = "325 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white text-sm font-semibold" >
310
+ < text x = "130" y = "320 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white text-sm font-semibold" >
271
311
{ overlaps . find ( o => o . SolutionNames . length === 1 && o . SolutionNames [ 0 ] === solution2 . UniqueName ) ?. ComponentCount || 0 } components
272
312
</ text >
313
+ { ( ( ) => {
314
+ const overlap = overlaps . find ( o => o . SolutionNames . length === 1 && o . SolutionNames [ 0 ] === solution2 . UniqueName ) ;
315
+ const typeSummary = overlap ? getComponentTypeSummary ( overlap . SharedComponents ) : [ ] ;
316
+ return typeSummary . map ( ( typeText , index ) => (
317
+ < text
318
+ key = { index }
319
+ x = "130"
320
+ y = { 335 + index * 12 }
321
+ textAnchor = "middle"
322
+ dominantBaseline = "middle"
323
+ className = "fill-white text-xs"
324
+ >
325
+ { typeText }
326
+ </ text >
327
+ ) ) ;
328
+ } ) ( ) }
273
329
274
- < text x = "370" y = "305 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white font-bold text-base" >
330
+ < text x = "370" y = "300 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white font-bold text-base" >
275
331
{ solution3 . DisplayName }
276
332
</ text >
277
- < text x = "370" y = "325 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white text-sm font-semibold" >
333
+ < text x = "370" y = "320 " textAnchor = "middle" dominantBaseline = "middle" className = "fill-white text-sm font-semibold" >
278
334
{ overlaps . find ( o => o . SolutionNames . length === 1 && o . SolutionNames [ 0 ] === solution3 . UniqueName ) ?. ComponentCount || 0 } components
279
335
</ text >
336
+ { ( ( ) => {
337
+ const overlap = overlaps . find ( o => o . SolutionNames . length === 1 && o . SolutionNames [ 0 ] === solution3 . UniqueName ) ;
338
+ const typeSummary = overlap ? getComponentTypeSummary ( overlap . SharedComponents ) : [ ] ;
339
+ return typeSummary . map ( ( typeText , index ) => (
340
+ < text
341
+ key = { index }
342
+ x = "370"
343
+ y = { 335 + index * 12 }
344
+ textAnchor = "middle"
345
+ dominantBaseline = "middle"
346
+ className = "fill-white text-xs"
347
+ >
348
+ { typeText }
349
+ </ text >
350
+ ) ) ;
351
+ } ) ( ) }
280
352
281
353
{ /* Overlap count labels */ }
282
354
{ overlaps . map ( ( overlap , index ) => {
@@ -293,17 +365,21 @@ export const SolutionVennDiagram = ({ solutionOverview, onOverlapClick }: ISolut
293
365
294
366
return (
295
367
< g key = { index } >
296
- < text x = { centerX } y = { centerY - 5 } textAnchor = "middle" dominantBaseline = "middle" className = "fill-white font-bold text-sm" >
368
+ < text x = { centerX } y = { centerY - 10 } textAnchor = "middle" dominantBaseline = "middle" className = "fill-white font-bold text-sm" >
297
369
{ overlap . ComponentCount }
298
370
</ text >
299
- < text x = { centerX } y = { centerY + 10 } textAnchor = "middle" dominantBaseline = "middle" className = "fill-white text-xs" >
300
- shared
301
- </ text >
302
- { typeSummary && (
303
- < text x = { centerX } y = { centerY + 25 } textAnchor = "middle" dominantBaseline = "middle" className = "fill-white text-xs" >
304
- { typeSummary }
371
+ { typeSummary . map ( ( typeText , typeIndex ) => (
372
+ < text
373
+ key = { typeIndex }
374
+ x = { centerX }
375
+ y = { centerY + 5 + typeIndex * 12 }
376
+ textAnchor = "middle"
377
+ dominantBaseline = "middle"
378
+ className = "fill-white text-xs"
379
+ >
380
+ { typeText }
305
381
</ text >
306
- ) }
382
+ ) ) }
307
383
</ g >
308
384
) ;
309
385
}
@@ -322,7 +398,7 @@ export const SolutionVennDiagram = ({ solutionOverview, onOverlapClick }: ISolut
322
398
< div className = "grid grid-cols-2 gap-4" >
323
399
{ solutions . map ( ( solution , index ) => {
324
400
const overlap = overlaps . find ( o => o . SolutionNames . length === 1 && o . SolutionNames [ 0 ] === solution . UniqueName ) ;
325
- const typeSummary = overlap ? getComponentTypeSummary ( overlap . SharedComponents ) : '' ;
401
+ const typeSummary = overlap ? getComponentTypeSummary ( overlap . SharedComponents ) : [ ] ;
326
402
return (
327
403
< div
328
404
key = { solution . SolutionId }
@@ -332,9 +408,9 @@ export const SolutionVennDiagram = ({ solutionOverview, onOverlapClick }: ISolut
332
408
>
333
409
< div className = "font-bold text-lg" > { solution . DisplayName } </ div >
334
410
< div className = "text-sm text-gray-700 font-semibold" > { overlap ?. ComponentCount || 0 } components</ div >
335
- { typeSummary && (
336
- < div className = "text-xs text-gray-600 mt-1" > { typeSummary } </ div >
337
- ) }
411
+ { typeSummary . map ( ( typeText , typeIndex ) => (
412
+ < div key = { typeIndex } className = "text-xs text-gray-600 mt-1" > { typeText } </ div >
413
+ ) ) }
338
414
</ div >
339
415
) ;
340
416
} ) }
@@ -353,10 +429,10 @@ export const SolutionVennDiagram = ({ solutionOverview, onOverlapClick }: ISolut
353
429
onClick = { ( ) => onOverlapClick ( overlap . SolutionNames , overlap . SharedComponents ) }
354
430
>
355
431
< div className = "font-semibold text-base" > { overlap . SolutionNames . join ( ' + ' ) } </ div >
356
- < div className = "text-sm text-gray-700 font-medium" > { overlap . ComponentCount } shared components</ div >
357
- { typeSummary && (
358
- < div className = "text-xs text-gray-600 mt-1" > { typeSummary } </ div >
359
- ) }
432
+ < div className = "text-sm text-gray-700 font-medium" > { overlap . ComponentCount } components</ div >
433
+ { typeSummary . map ( ( typeText , typeIndex ) => (
434
+ < div key = { typeIndex } className = "text-xs text-gray-600 mt-1" > { typeText } </ div >
435
+ ) ) }
360
436
</ div >
361
437
) ;
362
438
} ) }
0 commit comments