@principal-ai/subsystems-react 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/index.d.ts +7 -44
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +6 -32
  4. package/dist/index.js.map +1 -1
  5. package/package.json +2 -2
  6. package/src/index.ts +9 -199
  7. package/src/components/ConfigurationSelector.tsx +0 -133
  8. package/src/components/GraphRenderer.tsx +0 -3195
  9. package/src/components/MultiCanvasRenderer.tsx +0 -295
  10. package/src/components/NodeTooltip.tsx +0 -279
  11. package/src/components/PendingChanges.test.tsx +0 -375
  12. package/src/components/SelectionSidebar.tsx +0 -352
  13. package/src/components/SequenceDiagramRenderer.tsx +0 -1156
  14. package/src/components/WorkflowSequenceDiagram.tsx +0 -270
  15. package/src/components/dashboard/DashboardRenderer.tsx +0 -317
  16. package/src/components/dashboard/MetricPanel.tsx +0 -254
  17. package/src/components/dashboard/MockDataProvider.ts +0 -330
  18. package/src/components/dashboard/components/BarChart.tsx +0 -299
  19. package/src/components/dashboard/components/LineChart.tsx +0 -279
  20. package/src/components/dashboard/components/MetricCard.tsx +0 -270
  21. package/src/components/dashboard/components/SourceLink.tsx +0 -63
  22. package/src/components/dashboard/components/TimeRangeSelector.tsx +0 -280
  23. package/src/components/dashboard/components/index.ts +0 -5
  24. package/src/components/dashboard/index.ts +0 -47
  25. package/src/components/dashboard/types.ts +0 -126
  26. package/src/components/state-view/PipelineView.tsx +0 -347
  27. package/src/components/state-view/index.ts +0 -14
  28. package/src/components/state-view/types.ts +0 -261
  29. package/src/components/state-view/useStateView.ts +0 -205
  30. package/src/contexts/GraphEditContext.tsx +0 -27
  31. package/src/contexts/TooltipPortalContext.ts +0 -8
  32. package/src/edges/CustomEdge.tsx +0 -402
  33. package/src/edges/GenericEdge.tsx +0 -36
  34. package/src/hooks/usePathBasedEvents.ts +0 -192
  35. package/src/hooks/useSequenceLayout.ts +0 -543
  36. package/src/hooks/useUndoRedo.ts +0 -144
  37. package/src/nodes/CustomNode.tsx +0 -1231
  38. package/src/nodes/GenericNode.tsx +0 -55
  39. package/src/nodes/otel/OtelBoundaryNode.tsx +0 -224
  40. package/src/nodes/otel/OtelEventNode.tsx +0 -225
  41. package/src/nodes/otel/OtelResourceNode.tsx +0 -251
  42. package/src/nodes/otel/OtelScopeNode.tsx +0 -221
  43. package/src/nodes/otel/OtelSpanConventionNode.tsx +0 -295
  44. package/src/nodes/otel/index.ts +0 -23
  45. package/src/nodes/otel/shared/NodeBadges.tsx +0 -295
  46. package/src/nodes/otel/shared/NodeContent.tsx +0 -204
  47. package/src/nodes/otel/shared/index.ts +0 -8
  48. package/src/nodes/otel/shared/types.ts +0 -138
  49. package/src/nodes/otel/shared/useNodeBehavior.ts +0 -114
  50. package/src/stories/Audit/BoundaryNodes.stories.tsx +0 -385
  51. package/src/stories/Audit/CanvasEdgeTypes.stories.tsx +0 -1448
  52. package/src/stories/Audit/CanvasNodeTypes.stories.tsx +0 -1049
  53. package/src/stories/Audit/ColorPriority.stories.tsx +0 -895
  54. package/src/stories/Audit/DiamondBadges.stories.tsx +0 -629
  55. package/src/stories/Audit/NodeDimensionsTesting.stories.tsx +0 -724
  56. package/src/stories/Audit/NodeFieldsAudit.stories.tsx +0 -996
  57. package/src/stories/Audit/NodeFontSizeTesting.stories.tsx +0 -715
  58. package/src/stories/Audit/NodeShapes.stories.tsx +0 -1208
  59. package/src/stories/Audit/WideNodesTesting.stories.tsx +0 -1045
  60. package/src/stories/Components/DashboardRenderer.stories.tsx +0 -263
  61. package/src/stories/Components/GraphRenderer.stories.tsx +0 -3236
  62. package/src/stories/Components/MultiCanvasRenderer.stories.tsx +0 -370
  63. package/src/stories/Components/SequenceDiagram.stories.tsx +0 -255
  64. package/src/stories/Components/StateView.stories.tsx +0 -417
  65. package/src/stories/Components/TraceViewer.stories.tsx +0 -442
  66. package/src/stories/Components/WorkflowSequenceDiagram.stories.tsx +0 -802
  67. package/src/stories/Features/AnimationWorkshop.stories.tsx +0 -727
  68. package/src/stories/Features/ChangeTypeVisual.stories.tsx +0 -67
  69. package/src/stories/Features/EventDrivenAnimations.stories.tsx +0 -513
  70. package/src/stories/Features/MultiConfig.stories.tsx +0 -539
  71. package/src/stories/Layout/ElkEdgeRouting.stories.tsx +0 -539
  72. package/src/stories/Layout/GraphOrientation.stories.tsx +0 -500
  73. package/src/stories/Layout/MultiDirectionalConnections.stories.tsx +0 -352
  74. package/src/stories/Nodes/NodeDefinitionComparison.stories.tsx +0 -560
  75. package/src/stories/Nodes/NodeNameFallbacks.stories.tsx +0 -491
  76. package/src/stories/Nodes/NumericColors.stories.tsx +0 -440
  77. package/src/stories/OTEL/EventNameDisplay.stories.tsx +0 -694
  78. package/src/stories/OTEL/EventNameFallback.stories.tsx +0 -578
  79. package/src/stories/OTEL/OtelComponents.stories.tsx +0 -422
  80. package/src/stories/OTEL/OtelNodeTypesPrototype.stories.tsx +0 -806
  81. package/src/stories/OTEL/RawEventCards.stories.tsx +0 -57
  82. package/src/stories/OTEL/SpanBadges.stories.tsx +0 -840
  83. package/src/stories/OTEL/ValidationEventsCanvas.stories.tsx +0 -209
  84. package/src/stories/RealWorld/BacklogMdCanvases.stories.tsx +0 -721
  85. package/src/stories/RealWorld/FileCitySequence.stories.tsx +0 -516
  86. package/src/stories/RealWorld/RealCanvasFiles.stories.tsx +0 -336
  87. package/src/stories/__traces__/test-run.canvas.json +0 -241
  88. package/src/stories/data/activity-feed-analytics.dashboard.json +0 -300
  89. package/src/stories/data/file-city-images-transformed.otel.canvas.json +0 -295
  90. package/src/stories/data/file-city-workflows.json +0 -269
  91. package/src/stories/data/graph-converter-test-execution.json +0 -443
  92. package/src/stories/data/graph-converter-test.workflow.json +0 -105
  93. package/src/stories/data/graph-converter-validated-execution.json +0 -58
  94. package/src/utils/animationMapping.ts +0 -166
  95. package/src/utils/canvasBounds.ts +0 -146
  96. package/src/utils/graphConverter.ts +0 -148
  97. package/src/utils/iconResolver.tsx +0 -53
  98. package/src/utils/orientationUtils.ts +0 -73
@@ -1,299 +0,0 @@
1
- /**
2
- * BarChart
3
- *
4
- * Simple SVG-based bar chart for grouped/stacked data.
5
- * For prototyping - can be replaced with a more robust charting library later.
6
- */
7
-
8
- import { useMemo } from 'react';
9
- import { useTheme } from '@principal-ade/industry-theme';
10
- import type { BarChartProps } from '../types';
11
-
12
- const CHART_COLORS = [
13
- '#3b82f6', // blue
14
- '#22c55e', // green
15
- '#f59e0b', // amber
16
- '#ef4444', // red
17
- '#8b5cf6', // violet
18
- '#ec4899', // pink
19
- ];
20
-
21
- export function BarChart({
22
- title,
23
- data,
24
- xKey = 'date',
25
- series,
26
- stacked = false,
27
- unit,
28
- height = 200,
29
- onClick,
30
- }: BarChartProps) {
31
- const { theme } = useTheme();
32
-
33
- const padding = { top: 20, right: 20, bottom: 40, left: 60 };
34
- const chartWidth = 400;
35
- const chartHeight = height;
36
-
37
- const { bars, yAxisLabels, xAxisLabels } = useMemo(() => {
38
- if (!data || data.length === 0 || !series || series.length === 0) {
39
- return { bars: [], yAxisLabels: [], xAxisLabels: [], maxValue: 0 };
40
- }
41
-
42
- // Find max value
43
- let max = 0;
44
- for (const point of data) {
45
- if (stacked) {
46
- // Sum all series for stacked bars
47
- let sum = 0;
48
- for (const key of series) {
49
- const val = point[key];
50
- if (typeof val === 'number') sum += val;
51
- }
52
- if (sum > max) max = sum;
53
- } else {
54
- // Max of individual values for grouped bars
55
- for (const key of series) {
56
- const val = point[key];
57
- if (typeof val === 'number' && val > max) max = val;
58
- }
59
- }
60
- }
61
-
62
- max = max * 1.1; // Add padding
63
-
64
- const innerWidth = chartWidth - padding.left - padding.right;
65
- const innerHeight = chartHeight - padding.top - padding.bottom;
66
-
67
- const barGroupWidth = innerWidth / data.length;
68
- const barPadding = barGroupWidth * 0.2;
69
- const barAreaWidth = barGroupWidth - barPadding;
70
-
71
- const barsResult: Array<{
72
- x: number;
73
- y: number;
74
- width: number;
75
- height: number;
76
- color: string;
77
- label: string;
78
- value: number;
79
- }> = [];
80
-
81
- data.forEach((point, i) => {
82
- const groupX = padding.left + i * barGroupWidth + barPadding / 2;
83
-
84
- if (stacked) {
85
- // Stacked bars
86
- let currentY = padding.top + innerHeight;
87
-
88
- series.forEach((key, keyIndex) => {
89
- const val = point[key];
90
- if (typeof val === 'number') {
91
- const barHeight = (val / max) * innerHeight;
92
- currentY -= barHeight;
93
-
94
- barsResult.push({
95
- x: groupX,
96
- y: currentY,
97
- width: barAreaWidth,
98
- height: barHeight,
99
- color: CHART_COLORS[keyIndex % CHART_COLORS.length],
100
- label: key,
101
- value: val,
102
- });
103
- }
104
- });
105
- } else {
106
- // Grouped bars
107
- const singleBarWidth = barAreaWidth / series.length;
108
-
109
- series.forEach((key, keyIndex) => {
110
- const val = point[key];
111
- if (typeof val === 'number') {
112
- const barHeight = (val / max) * innerHeight;
113
- const barX = groupX + keyIndex * singleBarWidth;
114
- const barY = padding.top + innerHeight - barHeight;
115
-
116
- barsResult.push({
117
- x: barX,
118
- y: barY,
119
- width: singleBarWidth * 0.9,
120
- height: barHeight,
121
- color: CHART_COLORS[keyIndex % CHART_COLORS.length],
122
- label: key,
123
- value: val,
124
- });
125
- }
126
- });
127
- }
128
- });
129
-
130
- // Y-axis labels
131
- const yLabels: Array<{ value: string; y: number }> = [];
132
- for (let i = 0; i <= 4; i++) {
133
- const value = (max / 4) * (4 - i);
134
- const y = padding.top + (i / 4) * innerHeight;
135
- yLabels.push({
136
- value: formatNumber(value),
137
- y,
138
- });
139
- }
140
-
141
- // X-axis labels
142
- const xLabels: Array<{ value: string; x: number }> = [];
143
- data.forEach((point, i) => {
144
- const x = padding.left + i * barGroupWidth + barGroupWidth / 2;
145
- xLabels.push({
146
- value: String(point[xKey] || '').slice(-5), // Show last 5 chars (e.g., MM-DD)
147
- x,
148
- });
149
- });
150
-
151
- return {
152
- bars: barsResult,
153
- yAxisLabels: yLabels,
154
- xAxisLabels: xLabels,
155
- maxValue: max,
156
- };
157
- }, [data, series, xKey, stacked, chartWidth, chartHeight]);
158
-
159
- return (
160
- <div
161
- onClick={onClick}
162
- style={{
163
- backgroundColor: theme.colors.surface || theme.colors.background,
164
- border: `1px solid ${theme.colors.border}`,
165
- borderRadius: theme.radii?.[2] || 8,
166
- padding: theme.space?.[3] || 16,
167
- cursor: onClick ? 'pointer' : 'default',
168
- fontFamily: theme.fonts.body,
169
- }}
170
- >
171
- {/* Title */}
172
- <div
173
- style={{
174
- fontSize: theme.fontSizes[1],
175
- fontWeight: theme.fontWeights.medium,
176
- color: theme.colors.text,
177
- marginBottom: theme.space?.[3] || 16,
178
- }}
179
- >
180
- {title}
181
- {unit && (
182
- <span style={{ color: theme.colors.textSecondary, fontWeight: theme.fontWeights.body }}>
183
- {' '}
184
- ({unit})
185
- </span>
186
- )}
187
- </div>
188
-
189
- {/* Chart */}
190
- <svg
191
- width="100%"
192
- height={chartHeight}
193
- viewBox={`0 0 ${chartWidth} ${chartHeight}`}
194
- preserveAspectRatio="xMidYMid meet"
195
- >
196
- {/* Grid lines */}
197
- {yAxisLabels.map((label, i) => (
198
- <line
199
- key={i}
200
- x1={padding.left}
201
- y1={label.y}
202
- x2={chartWidth - padding.right}
203
- y2={label.y}
204
- stroke={theme.colors.border}
205
- strokeDasharray="4 4"
206
- opacity={0.5}
207
- />
208
- ))}
209
-
210
- {/* Y-axis labels */}
211
- {yAxisLabels.map((label, i) => (
212
- <text
213
- key={i}
214
- x={padding.left - 8}
215
- y={label.y}
216
- textAnchor="end"
217
- dominantBaseline="middle"
218
- fontSize={theme.fontSizes[0]}
219
- fontFamily={theme.fonts.monospace}
220
- fill={theme.colors.textSecondary}
221
- >
222
- {label.value}
223
- </text>
224
- ))}
225
-
226
- {/* X-axis labels */}
227
- {xAxisLabels.map((label, i) => (
228
- <text
229
- key={i}
230
- x={label.x}
231
- y={chartHeight - padding.bottom + 20}
232
- textAnchor="middle"
233
- fontSize={theme.fontSizes[0]}
234
- fontFamily={theme.fonts.monospace}
235
- fill={theme.colors.textSecondary}
236
- >
237
- {label.value}
238
- </text>
239
- ))}
240
-
241
- {/* Bars */}
242
- {bars.map((bar, i) => (
243
- <rect
244
- key={i}
245
- x={bar.x}
246
- y={bar.y}
247
- width={bar.width}
248
- height={bar.height}
249
- fill={bar.color}
250
- rx={2}
251
- />
252
- ))}
253
- </svg>
254
-
255
- {/* Legend */}
256
- {series && series.length > 1 && (
257
- <div
258
- style={{
259
- display: 'flex',
260
- gap: theme.space?.[3] || 16,
261
- marginTop: theme.space?.[3] || 12,
262
- justifyContent: 'center',
263
- }}
264
- >
265
- {series.map((s, i) => (
266
- <div
267
- key={s}
268
- style={{
269
- display: 'flex',
270
- alignItems: 'center',
271
- gap: 6,
272
- fontSize: theme.fontSizes[0],
273
- color: theme.colors.textSecondary,
274
- fontFamily: theme.fonts.body,
275
- }}
276
- >
277
- <div
278
- style={{
279
- width: 12,
280
- height: 12,
281
- backgroundColor: CHART_COLORS[i % CHART_COLORS.length],
282
- borderRadius: 2,
283
- }}
284
- />
285
- {s}
286
- </div>
287
- ))}
288
- </div>
289
- )}
290
- </div>
291
- );
292
- }
293
-
294
- function formatNumber(value: number): string {
295
- if (value >= 1000000) return `${(value / 1000000).toFixed(1)}M`;
296
- if (value >= 1000) return `${(value / 1000).toFixed(1)}K`;
297
- if (value % 1 !== 0) return value.toFixed(1);
298
- return Math.round(value).toString();
299
- }
@@ -1,279 +0,0 @@
1
- /**
2
- * LineChart
3
- *
4
- * Simple SVG-based line chart for time series data.
5
- * For prototyping - can be replaced with a more robust charting library later.
6
- */
7
-
8
- import { useMemo } from 'react';
9
- import { useTheme } from '@principal-ade/industry-theme';
10
- import type { LineChartProps } from '../types';
11
-
12
- const CHART_COLORS = [
13
- '#3b82f6', // blue
14
- '#22c55e', // green
15
- '#f59e0b', // amber
16
- '#ef4444', // red
17
- '#8b5cf6', // violet
18
- '#ec4899', // pink
19
- ];
20
-
21
- export function LineChart({
22
- title,
23
- data,
24
- xKey = 'date',
25
- yKey = 'value',
26
- series,
27
- unit,
28
- height = 200,
29
- onClick,
30
- }: LineChartProps) {
31
- const { theme } = useTheme();
32
-
33
- const padding = { top: 20, right: 20, bottom: 40, left: 60 };
34
- const chartWidth = 400;
35
- const chartHeight = height;
36
-
37
- const { paths, yAxisLabels, xAxisLabels } = useMemo(() => {
38
- if (!data || data.length === 0) {
39
- return { paths: [], yAxisLabels: [], xAxisLabels: [], maxValue: 0 };
40
- }
41
-
42
- // Determine which keys to plot
43
- const keys = series || [yKey];
44
-
45
- // Find max value across all series
46
- let max = 0;
47
- for (const point of data) {
48
- for (const key of keys) {
49
- const val = point[key];
50
- if (typeof val === 'number' && val > max) {
51
- max = val;
52
- }
53
- }
54
- }
55
-
56
- // Add 10% padding to max
57
- max = max * 1.1;
58
-
59
- const innerWidth = chartWidth - padding.left - padding.right;
60
- const innerHeight = chartHeight - padding.top - padding.bottom;
61
-
62
- // Generate paths for each series
63
- const pathsResult: Array<{ path: string; color: string; label: string }> = [];
64
-
65
- keys.forEach((key, keyIndex) => {
66
- const points: Array<{ x: number; y: number }> = [];
67
-
68
- data.forEach((point, i) => {
69
- const val = point[key];
70
- if (typeof val === 'number') {
71
- const x = padding.left + (i / (data.length - 1 || 1)) * innerWidth;
72
- const y = padding.top + innerHeight - (val / max) * innerHeight;
73
- points.push({ x, y });
74
- }
75
- });
76
-
77
- if (points.length > 0) {
78
- const pathD = points
79
- .map((p, i) => `${i === 0 ? 'M' : 'L'} ${p.x} ${p.y}`)
80
- .join(' ');
81
-
82
- pathsResult.push({
83
- path: pathD,
84
- color: CHART_COLORS[keyIndex % CHART_COLORS.length],
85
- label: key,
86
- });
87
- }
88
- });
89
-
90
- // Y-axis labels (5 ticks)
91
- const yLabels: Array<{ value: string; y: number }> = [];
92
- for (let i = 0; i <= 4; i++) {
93
- const value = (max / 4) * (4 - i);
94
- const y = padding.top + (i / 4) * innerHeight;
95
- yLabels.push({
96
- value: formatNumber(value),
97
- y,
98
- });
99
- }
100
-
101
- // X-axis labels (show first, middle, last)
102
- const xLabels: Array<{ value: string; x: number }> = [];
103
- const indices = [0, Math.floor(data.length / 2), data.length - 1];
104
- for (const idx of indices) {
105
- if (data[idx]) {
106
- const x = padding.left + (idx / (data.length - 1 || 1)) * innerWidth;
107
- xLabels.push({
108
- value: String(data[idx][xKey] || ''),
109
- x,
110
- });
111
- }
112
- }
113
-
114
- return {
115
- paths: pathsResult,
116
- yAxisLabels: yLabels,
117
- xAxisLabels: xLabels,
118
- maxValue: max,
119
- };
120
- }, [data, series, yKey, xKey, chartWidth, chartHeight]);
121
-
122
- return (
123
- <div
124
- onClick={onClick}
125
- style={{
126
- backgroundColor: theme.colors.surface || theme.colors.background,
127
- border: `1px solid ${theme.colors.border}`,
128
- borderRadius: theme.radii?.[2] || 8,
129
- padding: theme.space?.[3] || 16,
130
- cursor: onClick ? 'pointer' : 'default',
131
- fontFamily: theme.fonts.body,
132
- }}
133
- >
134
- {/* Title */}
135
- <div
136
- style={{
137
- fontSize: theme.fontSizes[1],
138
- fontWeight: theme.fontWeights.medium,
139
- color: theme.colors.text,
140
- marginBottom: theme.space?.[3] || 16,
141
- }}
142
- >
143
- {title}
144
- {unit && (
145
- <span style={{ color: theme.colors.textSecondary, fontWeight: theme.fontWeights.body }}>
146
- {' '}
147
- ({unit})
148
- </span>
149
- )}
150
- </div>
151
-
152
- {/* Chart */}
153
- <svg
154
- width="100%"
155
- height={chartHeight}
156
- viewBox={`0 0 ${chartWidth} ${chartHeight}`}
157
- preserveAspectRatio="xMidYMid meet"
158
- >
159
- {/* Grid lines */}
160
- {yAxisLabels.map((label, i) => (
161
- <line
162
- key={i}
163
- x1={padding.left}
164
- y1={label.y}
165
- x2={chartWidth - padding.right}
166
- y2={label.y}
167
- stroke={theme.colors.border}
168
- strokeDasharray="4 4"
169
- opacity={0.5}
170
- />
171
- ))}
172
-
173
- {/* Y-axis labels */}
174
- {yAxisLabels.map((label, i) => (
175
- <text
176
- key={i}
177
- x={padding.left - 8}
178
- y={label.y}
179
- textAnchor="end"
180
- dominantBaseline="middle"
181
- fontSize={theme.fontSizes[0]}
182
- fontFamily={theme.fonts.monospace}
183
- fill={theme.colors.textSecondary}
184
- >
185
- {label.value}
186
- </text>
187
- ))}
188
-
189
- {/* X-axis labels */}
190
- {xAxisLabels.map((label, i) => (
191
- <text
192
- key={i}
193
- x={label.x}
194
- y={chartHeight - padding.bottom + 20}
195
- textAnchor="middle"
196
- fontSize={theme.fontSizes[0]}
197
- fontFamily={theme.fonts.monospace}
198
- fill={theme.colors.textSecondary}
199
- >
200
- {label.value}
201
- </text>
202
- ))}
203
-
204
- {/* Lines */}
205
- {paths.map((p, i) => (
206
- <path
207
- key={i}
208
- d={p.path}
209
- fill="none"
210
- stroke={p.color}
211
- strokeWidth={2}
212
- strokeLinecap="round"
213
- strokeLinejoin="round"
214
- />
215
- ))}
216
-
217
- {/* Data points */}
218
- {paths.map((p, pathIndex) => {
219
- const points = p.path.split(/[ML]/).filter(Boolean);
220
- return points.map((point, i) => {
221
- const [x, y] = point.trim().split(' ').map(Number);
222
- return (
223
- <circle
224
- key={`${pathIndex}-${i}`}
225
- cx={x}
226
- cy={y}
227
- r={3}
228
- fill={p.color}
229
- />
230
- );
231
- });
232
- })}
233
- </svg>
234
-
235
- {/* Legend */}
236
- {series && series.length > 1 && (
237
- <div
238
- style={{
239
- display: 'flex',
240
- gap: theme.space?.[3] || 16,
241
- marginTop: theme.space?.[3] || 12,
242
- justifyContent: 'center',
243
- }}
244
- >
245
- {series.map((s, i) => (
246
- <div
247
- key={s}
248
- style={{
249
- display: 'flex',
250
- alignItems: 'center',
251
- gap: 6,
252
- fontSize: theme.fontSizes[0],
253
- color: theme.colors.textSecondary,
254
- fontFamily: theme.fonts.body,
255
- }}
256
- >
257
- <div
258
- style={{
259
- width: 12,
260
- height: 3,
261
- backgroundColor: CHART_COLORS[i % CHART_COLORS.length],
262
- borderRadius: 2,
263
- }}
264
- />
265
- {s}
266
- </div>
267
- ))}
268
- </div>
269
- )}
270
- </div>
271
- );
272
- }
273
-
274
- function formatNumber(value: number): string {
275
- if (value >= 1000000) return `${(value / 1000000).toFixed(1)}M`;
276
- if (value >= 1000) return `${(value / 1000).toFixed(1)}K`;
277
- if (value % 1 !== 0) return value.toFixed(1);
278
- return Math.round(value).toString();
279
- }