@decido/shell 1.0.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 (208) hide show
  1. package/.turbo/turbo-build.log +13 -0
  2. package/package.json +65 -0
  3. package/src/AgentPlayer.tsx +105 -0
  4. package/src/DecidoPlayer.tsx +117 -0
  5. package/src/bridge/BridgeAgent.ts +443 -0
  6. package/src/components/DecidoIcon.tsx +56 -0
  7. package/src/components/JsonTreeEditor.tsx +117 -0
  8. package/src/components/PanelSplitter.tsx +71 -0
  9. package/src/components/PluginErrorBoundary.tsx +69 -0
  10. package/src/components/SafeLiquidUI.tsx +114 -0
  11. package/src/components/TransientLayer.tsx +92 -0
  12. package/src/components/agent/AgentChat.tsx +134 -0
  13. package/src/components/chat-extensions/IntentCatalogPanel.tsx +81 -0
  14. package/src/components/chat-extensions/chatSlashCommands.ts +101 -0
  15. package/src/components/controls/CreatorInputBar.tsx +144 -0
  16. package/src/components/controls/OSToolbar.tsx +90 -0
  17. package/src/components/controls/TimelineTape.tsx +43 -0
  18. package/src/components/debug/ActionTimelineTab.tsx +111 -0
  19. package/src/components/debug/CSSInspectorTab.tsx +436 -0
  20. package/src/components/debug/ExportTab.tsx +192 -0
  21. package/src/components/debug/FlowHealthTab.tsx +86 -0
  22. package/src/components/debug/LogsTab.tsx +110 -0
  23. package/src/components/debug/MorphStackTab.tsx +241 -0
  24. package/src/components/debug/NetworkTab.tsx +173 -0
  25. package/src/components/debug/PerformanceTab.tsx +171 -0
  26. package/src/components/debug/ProfilesTab.tsx +238 -0
  27. package/src/components/debug/ReplayTab.tsx +70 -0
  28. package/src/components/debug/StoresTab.tsx +255 -0
  29. package/src/components/debug/TopologyTab.tsx +59 -0
  30. package/src/components/debug/debugConfig.tsx +66 -0
  31. package/src/components/playground/DebugPanel.tsx +112 -0
  32. package/src/components/playground/HeaderCenterControls.tsx +92 -0
  33. package/src/components/playground/KeyframeListItem.tsx +70 -0
  34. package/src/components/playground/PlaygroundAppSidebar.tsx +171 -0
  35. package/src/components/playground/PlaygroundBottomControls.tsx +132 -0
  36. package/src/components/playground/PlaygroundCanvas.tsx +87 -0
  37. package/src/components/playground/PlaygroundChat.tsx +236 -0
  38. package/src/components/playground/PlaygroundErrorBoundary.tsx +63 -0
  39. package/src/components/playground/PlaygroundFloatingInput.tsx +352 -0
  40. package/src/components/playground/PlaygroundHeader.tsx +222 -0
  41. package/src/components/playground/PlaygroundSidebar.tsx +136 -0
  42. package/src/components/playground/PlaygroundTerminal.tsx +44 -0
  43. package/src/components/playground/SuggestionCards.tsx +29 -0
  44. package/src/components/playground/demos/ClinicaAINode.tsx +221 -0
  45. package/src/components/playground/demos/FinanceAINode.tsx +226 -0
  46. package/src/components/playground/demos/KiaAcademyNode.tsx +250 -0
  47. package/src/components/playground/demos/KiaBotNode.tsx +207 -0
  48. package/src/components/playground/demos/KiaCampaignNode.tsx +191 -0
  49. package/src/components/playground/demos/KiaComplianceNode.tsx +140 -0
  50. package/src/components/playground/demos/KiaCustomerJourneyNode.tsx +220 -0
  51. package/src/components/playground/demos/KiaCyberNode.tsx +203 -0
  52. package/src/components/playground/demos/KiaDashboardNode.tsx +399 -0
  53. package/src/components/playground/demos/KiaEmbudoOverviewNode.tsx +168 -0
  54. package/src/components/playground/demos/KiaExecutiveNode.tsx +169 -0
  55. package/src/components/playground/demos/KiaGamificationNode.tsx +229 -0
  56. package/src/components/playground/demos/KiaIntelligenceHubNode.tsx +165 -0
  57. package/src/components/playground/demos/KiaInventoryNode.tsx +183 -0
  58. package/src/components/playground/demos/KiaLeadScoringNode.tsx +226 -0
  59. package/src/components/playground/demos/KiaLiveSimulationNode.tsx +177 -0
  60. package/src/components/playground/demos/KiaMultiDealerNode.tsx +223 -0
  61. package/src/components/playground/demos/KiaNPSVoiceNode.tsx +214 -0
  62. package/src/components/playground/demos/KiaOmnichannelNode.tsx +162 -0
  63. package/src/components/playground/demos/KiaPBIBudgetNode.tsx +152 -0
  64. package/src/components/playground/demos/KiaPBIConversionNode.tsx +206 -0
  65. package/src/components/playground/demos/KiaPBIFunnelNode.tsx +184 -0
  66. package/src/components/playground/demos/KiaPBIOwnershipNode.tsx +113 -0
  67. package/src/components/playground/demos/KiaPBIPartnerNode.tsx +143 -0
  68. package/src/components/playground/demos/KiaPBIPreciosNode.tsx +120 -0
  69. package/src/components/playground/demos/KiaPBIRuntNode.tsx +205 -0
  70. package/src/components/playground/demos/KiaPartnerScoreNode.tsx +206 -0
  71. package/src/components/playground/demos/KiaPredictiveNode.tsx +226 -0
  72. package/src/components/playground/demos/KiaShowroomNode.tsx +194 -0
  73. package/src/components/playground/demos/KiaStoreNode.tsx +215 -0
  74. package/src/components/playground/demos/KiaSustainabilityNode.tsx +173 -0
  75. package/src/components/playground/demos/KiaUsedVehiclesNode.tsx +163 -0
  76. package/src/components/playground/demos/KiaWorkshopNode.tsx +221 -0
  77. package/src/components/playground/demos/SmartCityNode.tsx +205 -0
  78. package/src/components/playground/demos/kia_campaign_manifest.json +112 -0
  79. package/src/components/playground/input-parts/AIModelSelector.tsx +156 -0
  80. package/src/components/playground/input-parts/InputActions.tsx +80 -0
  81. package/src/components/playground/input-parts/InputToolbar.tsx +245 -0
  82. package/src/components/playground/input-parts/ResourceLibraryPanel.tsx +287 -0
  83. package/src/components/playground/sidebarDsdIO.ts +82 -0
  84. package/src/components/settings/SettingsPanel.tsx +267 -0
  85. package/src/components/shell/AppHeader.tsx +9 -0
  86. package/src/components/shell/AppShell.tsx +139 -0
  87. package/src/components/shell/ArtifactBar.tsx +97 -0
  88. package/src/components/shell/BootScreen.tsx +19 -0
  89. package/src/components/shell/CenterComposite.tsx +87 -0
  90. package/src/components/shell/CodeEditorPanel.tsx +88 -0
  91. package/src/components/shell/GlobalOverlays.tsx +228 -0
  92. package/src/components/shell/LayoutConfigurator.tsx +209 -0
  93. package/src/components/shell/LayoutGrid.tsx +178 -0
  94. package/src/components/shell/MorphShell.tsx +368 -0
  95. package/src/components/shell/PluginViewer.tsx +147 -0
  96. package/src/components/shell/ShellNexusPreview.tsx +458 -0
  97. package/src/components/shell/SlotRenderer.tsx +115 -0
  98. package/src/components/shell/TabBar.tsx +94 -0
  99. package/src/components/shell/TemplateLibrary.tsx +195 -0
  100. package/src/components/shell/layoutConstants.ts +35 -0
  101. package/src/components/shell/morphStageMeta.ts +15 -0
  102. package/src/components/shell/shells/BuiltInShells.tsx +443 -0
  103. package/src/components/shell/shells/DatawayChatShell.tsx +42 -0
  104. package/src/components/shell/shells/TokenPreview.tsx +339 -0
  105. package/src/components/shell/shells/bootShells.ts +31 -0
  106. package/src/components/shells/CreatorShell.tsx +37 -0
  107. package/src/components/shells/DecidoShell.tsx +447 -0
  108. package/src/components/shells/ExperimentalChatShell.tsx +245 -0
  109. package/src/components/shells/UserCanvas.tsx +44 -0
  110. package/src/components/studio/BlueprintManagerPanel.tsx +137 -0
  111. package/src/components/studio/DependencyTreePanel.tsx +192 -0
  112. package/src/components/studio/NodePalette.tsx +92 -0
  113. package/src/components/studio/NodePropertiesPanel.tsx +81 -0
  114. package/src/components/studio/ReactFlowEditor.tsx +242 -0
  115. package/src/components/studio/TimelineEditor.tsx +122 -0
  116. package/src/components/studio/TimelineKeyframeCard.tsx +99 -0
  117. package/src/components/studio/VariablePanel.tsx +181 -0
  118. package/src/components/studio/blueprint/BlueprintCard.tsx +82 -0
  119. package/src/components/studio/editor/CanvasContextMenu.tsx +107 -0
  120. package/src/components/studio/editor/EditorToolbar.tsx +80 -0
  121. package/src/components/studio/editor/StageContentRenderer.tsx +134 -0
  122. package/src/components/studio/editor/TrackPropertyEditors.tsx +133 -0
  123. package/src/components/studio/editor/TreeNodeItem.tsx +91 -0
  124. package/src/components/studio/editor/edgeStyles.ts +43 -0
  125. package/src/components/studio/editor/editorKeyHandler.ts +95 -0
  126. package/src/components/studio/editor/nodeTypeRegistry.ts +137 -0
  127. package/src/components/studio/editor/paletteCatalog.tsx +84 -0
  128. package/src/components/studio/nodes/shell/InteractionNodes.tsx +82 -0
  129. package/src/components/studio/nodes/shell/LayoutControlNodes.tsx +69 -0
  130. package/src/components/studio/nodes/shell/RegisterActionNode.tsx +20 -0
  131. package/src/components/studio/nodes/shell/RegisterButtonNode.tsx +22 -0
  132. package/src/components/studio/nodes/shell/RegisterPanelNode.tsx +19 -0
  133. package/src/components/studio/nodes/shell/RegisterSidebarNode.tsx +19 -0
  134. package/src/components/studio/nodes/shell/RegisterStatusBarNode.tsx +22 -0
  135. package/src/components/studio/nodes/shell/RegisterTabNode.tsx +21 -0
  136. package/src/components/studio/nodes/shell/RegisterTopBarNode.tsx +22 -0
  137. package/src/components/studio/nodes/shell/ShellConfigNode.tsx +51 -0
  138. package/src/components/studio/nodes/shell/ShellNodeBase.tsx +100 -0
  139. package/src/components/studio/nodes/shell/ThemeNodes.tsx +51 -0
  140. package/src/components/studio/nodes/shell/index.ts +12 -0
  141. package/src/components/widgets/BroadcastWidget.tsx +93 -0
  142. package/src/components/widgets/MarketplaceWidget.tsx +298 -0
  143. package/src/components/widgets/McpToolsWidget.tsx +231 -0
  144. package/src/components/widgets/OpsDashboard.tsx +59 -0
  145. package/src/components/widgets/QuickActionsWidget.tsx +60 -0
  146. package/src/components/widgets/UsageWidget.tsx +112 -0
  147. package/src/components/widgets/WidgetRenderer.tsx +892 -0
  148. package/src/components/widgets/WidgetSlotPanel.tsx +213 -0
  149. package/src/config/IconRegistry.ts +126 -0
  150. package/src/contexts/NetworkProvider.tsx +162 -0
  151. package/src/core/AIDirector.ts +71 -0
  152. package/src/core/EventBus.ts +37 -0
  153. package/src/core/PluginContext.tsx +141 -0
  154. package/src/hooks/listeners/useUIStateListener.ts +59 -0
  155. package/src/hooks/listeners/useWhatsAppListener.ts +110 -0
  156. package/src/hooks/morphBridge.ts +82 -0
  157. package/src/hooks/useAIModelSelector.ts +144 -0
  158. package/src/hooks/useAgentStream.ts +220 -0
  159. package/src/hooks/useAutoUpdater.ts +89 -0
  160. package/src/hooks/useBootSequence.ts +20 -0
  161. package/src/hooks/useExportDSD.ts +53 -0
  162. package/src/hooks/useFullscreen.ts +35 -0
  163. package/src/hooks/useGeminiStream.ts +282 -0
  164. package/src/hooks/useIntentLens.ts +224 -0
  165. package/src/hooks/useKeyboardShortcuts.ts +69 -0
  166. package/src/hooks/useLoggerBridge.ts +32 -0
  167. package/src/hooks/useMcpClient.ts +112 -0
  168. package/src/hooks/useNexusaiDeploy.ts +118 -0
  169. package/src/hooks/usePlaybackEngine.ts +21 -0
  170. package/src/hooks/usePlaygroundCommander.ts +475 -0
  171. package/src/hooks/usePluginEngine.ts +165 -0
  172. package/src/hooks/useScreenRecorder.ts +73 -0
  173. package/src/hooks/useShellKeyboard.ts +40 -0
  174. package/src/hooks/useShellShortcuts.ts +118 -0
  175. package/src/hooks/useSoundEffects.ts +35 -0
  176. package/src/hooks/useStudioConfig.ts +72 -0
  177. package/src/hooks/useSystemBoot.ts +84 -0
  178. package/src/hooks/useSystemTelemetry.ts +62 -0
  179. package/src/index.ts +97 -0
  180. package/src/lib/debugLogger.ts +80 -0
  181. package/src/lib/networkInterceptor.ts +100 -0
  182. package/src/mocks/decido.tsx +41 -0
  183. package/src/plugins/pluginAPI.ts +190 -0
  184. package/src/store/McpStore.ts +69 -0
  185. package/src/store/UpdaterStore.ts +60 -0
  186. package/src/store/engine.ts +392 -0
  187. package/src/store/index.ts +4 -0
  188. package/src/store/layoutPresets.ts +66 -0
  189. package/src/store/playgroundTypes.ts +98 -0
  190. package/src/store/useActionTimelineStore.ts +48 -0
  191. package/src/store/useDebugPanelStore.ts +98 -0
  192. package/src/store/useDebugProfileStore.ts +130 -0
  193. package/src/store/useLayoutStore.ts +205 -0
  194. package/src/store/useMorphInstanceStore.ts +289 -0
  195. package/src/store/useMorphologyStore.ts +103 -0
  196. package/src/store/usePlaygroundStore.ts +236 -0
  197. package/src/store/useShellRegistry.ts +123 -0
  198. package/src/store/useSuggestionsStore.ts +57 -0
  199. package/src/store/useThemeStore.ts +399 -0
  200. package/src/store/useUIComponentStore.ts +179 -0
  201. package/src/types/DecidoStoryDefinition.ts +43 -0
  202. package/src/utils/ai/ai-architect.ts +92 -0
  203. package/src/utils/ai/ai-code.ts +187 -0
  204. package/src/utils/ai/ai-core.ts +50 -0
  205. package/src/utils/ai/ai-media.ts +292 -0
  206. package/src/utils/layoutGraph.ts +67 -0
  207. package/tsconfig.json +17 -0
  208. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,163 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { BaseNode } from '@decido/macia-core';
3
+ import {
4
+ Car, DollarSign, Camera, ClipboardCheck, TrendingUp,
5
+ Clock, Calendar, ArrowRight, BarChart3, RefreshCw
6
+ } from 'lucide-react';
7
+
8
+ /* ═══════════════════════════════════════════════════════════════
9
+ KIA USED VEHICLES NODE — Trade-In & Seminuevos · Grecco Motors
10
+ Stock usados, pricing AI, pipeline retomas, evaluación
11
+ ═══════════════════════════════════════════════════════════════ */
12
+
13
+ const USED_STOCK = [
14
+ { model: 'Sportage 2023', km: 18500, price: 128000000, market: 132000000, days: 12, status: 'published', photos: 24, condition: 'A' },
15
+ { model: 'Seltos 2022', km: 34200, price: 82000000, market: 85000000, days: 28, status: 'published', photos: 18, condition: 'A' },
16
+ { model: 'Picanto 2023', km: 8900, price: 48000000, market: 51000000, days: 5, status: 'reconditioning', photos: 0, condition: 'A+' },
17
+ { model: 'K3 2021', km: 52000, price: 62000000, market: 65000000, days: 45, status: 'published', photos: 20, condition: 'B+' },
18
+ { model: 'Sorento 2022', km: 41000, price: 152000000, market: 158000000, days: 8, status: 'evaluation', photos: 12, condition: 'B' },
19
+ ];
20
+
21
+ const PIPELINE = [
22
+ { stage: 'Avalúo', count: 3, color: '#3b82f6' },
23
+ { stage: 'Negociación', count: 2, color: '#f59e0b' },
24
+ { stage: 'Reconditioning', count: 1, color: '#a855f7' },
25
+ { stage: 'Publicación', count: 2, color: '#22c55e' },
26
+ { stage: 'Vendido', count: 8, color: '#10b981' },
27
+ ];
28
+
29
+ const EVALUATIONS = [
30
+ { client: 'Mario López', vehicleIn: 'Sportage 2021 · 42k km', vehicleOut: 'EV6 GT', appraisal: 95000000, fasecolda: 98000000, delta: -3, status: 'En negociación' },
31
+ { client: 'Sandra Castillo', vehicleIn: 'Picanto 2022 · 15k km', vehicleOut: 'Seltos', appraisal: 42000000, fasecolda: 44500000, delta: -5.6, status: 'Avalúo listo' },
32
+ { client: 'Andrés Mejía', vehicleIn: 'Rio 2020 · 60k km', vehicleOut: 'K3 Cross', appraisal: 38000000, fasecolda: 40000000, delta: -5, status: 'Pendiente fotos' },
33
+ ];
34
+
35
+ const fmtPrice = (n: number) => `$${(n / 1000000).toFixed(0)}M`;
36
+
37
+ export const KiaUsedVehiclesNode = (props: any) => {
38
+ const [tab, setTab] = useState<'stock' | 'pipeline' | 'tradein'>('stock');
39
+ const [stock, setStock] = useState(USED_STOCK.map(v => ({ ...v })));
40
+
41
+ const totalStock = stock.length;
42
+ const avgDays = Math.round(stock.reduce((s, v) => s + v.days, 0) / stock.length);
43
+ const totalValue = stock.reduce((s, v) => s + v.price, 0);
44
+
45
+ useEffect(() => {
46
+ const interval = setInterval(() => {
47
+ setStock(prev => prev.map(v => ({ ...v, days: v.days + (Math.random() > 0.9 ? 1 : 0) })));
48
+ }, 10000);
49
+ return () => clearInterval(interval);
50
+ }, []);
51
+
52
+ return (
53
+ <BaseNode {...props} title="Kia Used Vehicles" width={500} height={620}>
54
+ <div className="flex flex-col h-full bg-[#060a12] text-white overflow-hidden">
55
+
56
+ {/* Header */}
57
+ <div className="flex items-center gap-3 p-3 bg-[#0c1222] border-b border-slate-800">
58
+ <div className="w-9 h-9 rounded-full bg-amber-600/20 flex items-center justify-center border border-amber-500/30">
59
+ <RefreshCw size={16} className="text-amber-400" />
60
+ </div>
61
+ <div className="flex-1">
62
+ <div className="text-xs font-bold tracking-wide">VEHÍCULOS USADOS & RETOMAS</div>
63
+ <div className="text-[10px] text-slate-400">Grecco Motors · {totalStock} en stock · {fmtPrice(totalValue)} valor</div>
64
+ </div>
65
+ </div>
66
+
67
+ {/* Tabs */}
68
+ <div className="flex gap-1 p-2 bg-[#0a0f1a] border-b border-slate-800">
69
+ {([
70
+ { key: 'stock' as const, label: '🚗 Stock' },
71
+ { key: 'pipeline' as const, label: '📊 Pipeline' },
72
+ { key: 'tradein' as const, label: '🔄 Trade-In' },
73
+ ]).map(t => (
74
+ <button key={t.key} onClick={() => setTab(t.key)}
75
+ className={`flex-1 py-1.5 rounded text-[9px] font-bold transition-all ${tab === t.key ? 'bg-amber-600/20 text-amber-400 border border-amber-500/30' : 'text-slate-500'
76
+ }`}>
77
+ {t.label}
78
+ </button>
79
+ ))}
80
+ </div>
81
+
82
+ {/* KPIs */}
83
+ <div className="flex gap-1 px-3 py-2 border-b border-slate-800">
84
+ {[
85
+ { label: 'En Stock', val: totalStock.toString(), color: 'text-blue-400' },
86
+ { label: 'Días Prom', val: `${avgDays}d`, color: avgDays > 30 ? 'text-red-400' : 'text-green-400' },
87
+ { label: 'Valor Total', val: fmtPrice(totalValue), color: 'text-yellow-400' },
88
+ { label: 'Vendidos/Mes', val: '8', color: 'text-green-400' },
89
+ ].map(s => (
90
+ <div key={s.label} className="flex-1 text-center bg-slate-900/50 rounded p-1.5 border border-slate-800/50">
91
+ <div className={`text-sm font-bold ${s.color}`}>{s.val}</div>
92
+ <div className="text-[8px] text-slate-500">{s.label}</div>
93
+ </div>
94
+ ))}
95
+ </div>
96
+
97
+ <div className="flex-1 overflow-y-auto p-3 space-y-1.5">
98
+
99
+ {tab === 'stock' && stock.map(v => (
100
+ <div key={v.model} className="bg-slate-900/50 rounded-lg p-2.5 border border-slate-800"
101
+ style={{ borderLeftWidth: '2px', borderLeftColor: v.days > 30 ? '#ef4444' : v.days > 14 ? '#f59e0b' : '#22c55e' }}>
102
+ <div className="flex items-center justify-between mb-1">
103
+ <div>
104
+ <span className="text-[11px] font-bold">{v.model}</span>
105
+ <span className="text-[9px] text-slate-500 ml-1">{(v.km / 1000).toFixed(0)}k km · {v.condition}</span>
106
+ </div>
107
+ <span className={`text-[8px] px-1.5 py-0.5 rounded font-bold ${v.status === 'published' ? 'bg-green-500/20 text-green-400' :
108
+ v.status === 'reconditioning' ? 'bg-purple-500/20 text-purple-400' :
109
+ 'bg-blue-500/20 text-blue-400'
110
+ }`}>{v.status}</span>
111
+ </div>
112
+ <div className="flex gap-3 text-[9px]">
113
+ <span className="text-slate-400">Precio: <span className="font-bold text-yellow-400">{fmtPrice(v.price)}</span></span>
114
+ <span className="text-slate-400">Mercado: <span className="font-bold text-green-400">{fmtPrice(v.market)}</span></span>
115
+ <span className={`font-bold ${v.days > 30 ? 'text-red-400' : 'text-slate-300'}`}>{v.days}d</span>
116
+ <span className="text-slate-500">📸 {v.photos}</span>
117
+ </div>
118
+ </div>
119
+ ))}
120
+
121
+ {tab === 'pipeline' && (
122
+ <>
123
+ <div className="text-[9px] text-slate-500 font-bold uppercase mb-2">Pipeline Retomas</div>
124
+ <div className="flex gap-0.5 mb-3">
125
+ {PIPELINE.map(p => (
126
+ <div key={p.stage} className="flex-1 text-center">
127
+ <div className="h-12 rounded flex items-end justify-center pb-1"
128
+ style={{ background: `${p.color}15`, border: `1px solid ${p.color}30` }}>
129
+ <span className="text-lg font-black" style={{ color: p.color }}>{p.count}</span>
130
+ </div>
131
+ <div className="text-[7px] text-slate-500 mt-1">{p.stage}</div>
132
+ </div>
133
+ ))}
134
+ </div>
135
+ <div className="bg-blue-500/5 rounded-lg p-2.5 border border-blue-500/20 text-[9px] text-blue-400">
136
+ 💡 Total pipeline: {PIPELINE.reduce((s, p) => s + p.count, 0)} vehículos · Ciclo promedio: 18 días
137
+ </div>
138
+ </>
139
+ )}
140
+
141
+ {tab === 'tradein' && EVALUATIONS.map((e, i) => (
142
+ <div key={i} className="bg-slate-900/50 rounded-lg p-2.5 border border-slate-800">
143
+ <div className="flex items-center justify-between mb-1">
144
+ <span className="text-[10px] font-bold">{e.client}</span>
145
+ <span className="text-[8px] text-yellow-400 font-bold">{e.status}</span>
146
+ </div>
147
+ <div className="flex items-center gap-1 text-[9px] text-slate-400 mb-1">
148
+ <span>{e.vehicleIn}</span>
149
+ <ArrowRight size={10} className="text-slate-600" />
150
+ <span className="text-indigo-400 font-bold">{e.vehicleOut}</span>
151
+ </div>
152
+ <div className="flex gap-3 text-[9px]">
153
+ <span className="text-slate-400">Avalúo: <span className="font-bold text-yellow-400">{fmtPrice(e.appraisal)}</span></span>
154
+ <span className="text-slate-400">Fasecolda: <span className="font-bold text-slate-300">{fmtPrice(e.fasecolda)}</span></span>
155
+ <span className="text-red-400 font-bold">{e.delta}%</span>
156
+ </div>
157
+ </div>
158
+ ))}
159
+ </div>
160
+ </div>
161
+ </BaseNode>
162
+ );
163
+ };
@@ -0,0 +1,221 @@
1
+ import React, { useState, useEffect, useCallback } from 'react';
2
+ import { BaseNode } from '@decido/macia-core';
3
+ import {
4
+ Wrench, CheckCircle2, Clock, MessageCircle, Car, ClipboardList,
5
+ AlertTriangle, Activity, Timer, Users, TrendingUp, Zap,
6
+ ArrowRight, Eye, Settings, BarChart3
7
+ } from 'lucide-react';
8
+
9
+ /* ═══════════════════════════════════════════════════════════════
10
+ KIA WORKSHOP NODE — Posventa Predictiva · Grecco Motors
11
+ Monitor de taller con SLA tracking, bahías y notificaciones
12
+ ═══════════════════════════════════════════════════════════════ */
13
+
14
+ const STEPS = [
15
+ { id: 1, label: 'Recepción', icon: ClipboardList, color: '#6366f1' },
16
+ { id: 2, label: 'Diagnóstico', icon: Eye, color: '#3b82f6' },
17
+ { id: 3, label: 'Autorización', icon: CheckCircle2, color: '#0ea5e9' },
18
+ { id: 4, label: 'Reparación', icon: Wrench, color: '#f59e0b' },
19
+ { id: 5, label: 'Control QC', icon: Settings, color: '#22c55e' },
20
+ { id: 6, label: 'Entrega', icon: ArrowRight, color: '#10b981' },
21
+ ];
22
+
23
+ interface Vehicle {
24
+ id: string; model: string; owner: string; phone: string;
25
+ step: number; type: string; time: string; slaHours: number;
26
+ elapsed: number; priority: 'normal' | 'urgente' | 'recall';
27
+ notified: boolean;
28
+ }
29
+
30
+ const jitter = (n: number, r: number) => n + Math.round((Math.random() - 0.5) * r);
31
+
32
+ export const KiaWorkshopNode = (props: any) => {
33
+ const [vehicles, setVehicles] = useState<Vehicle[]>([
34
+ { id: 'KIA-882', model: 'Sportage GT', owner: 'Mauricio Díaz', phone: '+57 3XX', step: 4, type: 'Mantenimiento 30K', time: '2h 15m', slaHours: 4, elapsed: 2.25, priority: 'normal', notified: false },
35
+ { id: 'KIA-104', model: 'Picanto Ion', owner: 'Ana Torres', phone: '+57 3XX', step: 1, type: 'Recall Airbag', time: '10m', slaHours: 3, elapsed: 0.17, priority: 'recall', notified: false },
36
+ { id: 'KIA-993', model: 'Seltos HEV', owner: 'Jorge Vélez', phone: '+57 3XX', step: 5, type: 'Garantía Motor', time: '4h 30m', slaHours: 6, elapsed: 4.5, priority: 'normal', notified: true },
37
+ { id: 'KIA-551', model: 'Stonic', owner: 'Luisa Perea', phone: '+57 3XX', step: 6, type: 'Revisión Pre-entrega', time: '1h 00m', slaHours: 2, elapsed: 1, priority: 'normal', notified: true },
38
+ { id: 'KIA-220', model: 'EV6 GT', owner: 'Carlos Ruiz', phone: '+57 3XX', step: 2, type: 'Diagnóstico ADAS', time: '45m', slaHours: 3, elapsed: 0.75, priority: 'urgente', notified: false },
39
+ { id: 'KIA-711', model: 'K3 Cross', owner: 'Sandra Gómez', phone: '+57 3XX', step: 3, type: 'Servicio Express', time: '1h 20m', slaHours: 2, elapsed: 1.33, priority: 'normal', notified: false },
40
+ ]);
41
+
42
+ const [tick, setTick] = useState(0);
43
+
44
+ /* Simulated progress */
45
+ useEffect(() => {
46
+ const iv = setInterval(() => {
47
+ setTick(t => t + 1);
48
+ setVehicles(prev => prev.map(v => {
49
+ if (v.step < 6 && Math.random() > 0.75) {
50
+ const newStep = v.step + 1;
51
+ return { ...v, step: newStep, notified: newStep >= 5 ? true : v.notified };
52
+ }
53
+ return v;
54
+ }));
55
+ }, 6000);
56
+ return () => clearInterval(iv);
57
+ }, []);
58
+
59
+ const sendNotification = useCallback((vehicle: Vehicle) => {
60
+ setVehicles(prev => prev.map(v => v.id === vehicle.id ? { ...v, notified: true } : v));
61
+ }, []);
62
+
63
+ /* Stats */
64
+ const inShop = vehicles.filter(v => v.step < 6).length;
65
+ const ready = vehicles.filter(v => v.step >= 6).length;
66
+ const overSLA = vehicles.filter(v => v.elapsed > v.slaHours).length;
67
+ const recalls = vehicles.filter(v => v.priority === 'recall').length;
68
+
69
+ const priorityBorder = (p: string) =>
70
+ p === 'recall' ? 'border-l-red-500' : p === 'urgente' ? 'border-l-orange-500' : 'border-l-transparent';
71
+
72
+ return (
73
+ <BaseNode {...props} title="Kia Service Tracker" width={560} height={680}>
74
+ <div className="flex flex-col h-full bg-slate-900 text-white p-4 gap-3 overflow-hidden">
75
+
76
+ {/* Header */}
77
+ <div className="flex justify-between items-center">
78
+ <div>
79
+ <h2 className="text-sm font-bold tracking-wide">MONITOR DE TALLER</h2>
80
+ <div className="flex items-center gap-2 mt-0.5">
81
+ <span className="text-[10px] text-slate-400">Grecco Motors · Sede Norte</span>
82
+ <span className="flex items-center gap-1 text-[10px] text-green-400 bg-green-500/10 px-1.5 rounded">
83
+ <Activity size={8} className="animate-pulse" /> LIVE
84
+ </span>
85
+ </div>
86
+ </div>
87
+ <div className="flex gap-2">
88
+ <StatChip label="En Taller" value={inShop} color="#3b82f6" icon={Car} />
89
+ <StatChip label="Listos" value={ready} color="#22c55e" icon={CheckCircle2} />
90
+ <StatChip label="SLA ⚠️" value={overSLA} color="#ef4444" icon={AlertTriangle} />
91
+ </div>
92
+ </div>
93
+
94
+ {/* Bahías Overview */}
95
+ <div className="bg-slate-800 rounded-xl p-3 border border-slate-700">
96
+ <div className="flex justify-between items-center mb-2">
97
+ <span className="text-[10px] uppercase text-slate-400 font-bold">Bahías de Servicio — Capacidad</span>
98
+ <span className="text-[10px] text-slate-500">{inShop}/8 ocupadas</span>
99
+ </div>
100
+ <div className="flex gap-1">
101
+ {Array.from({ length: 8 }).map((_, i) => (
102
+ <div
103
+ key={i}
104
+ className={`flex-1 h-3 rounded transition-all ${i < inShop
105
+ ? i < inShop - overSLA ? 'bg-blue-500' : 'bg-red-500 animate-pulse'
106
+ : 'bg-slate-700'
107
+ }`}
108
+ />
109
+ ))}
110
+ </div>
111
+ {recalls > 0 && (
112
+ <div className="mt-2 text-[10px] text-red-400 flex items-center gap-1">
113
+ <AlertTriangle size={10} /> {recalls} recall(s) activo(s) — prioridad máxima
114
+ </div>
115
+ )}
116
+ </div>
117
+
118
+ {/* Vehicle Cards */}
119
+ <div className="flex-1 overflow-y-auto space-y-2 pr-1" key={tick}>
120
+ {vehicles.sort((a, b) => {
121
+ const prio = { recall: 0, urgente: 1, normal: 2 };
122
+ return prio[a.priority] - prio[b.priority] || a.step - b.step;
123
+ }).map(vehicle => {
124
+ const slaUsed = Math.min(100, (vehicle.elapsed / vehicle.slaHours) * 100);
125
+ const overdue = vehicle.elapsed > vehicle.slaHours;
126
+ const currentStep = STEPS[vehicle.step - 1];
127
+
128
+ return (
129
+ <div
130
+ key={vehicle.id}
131
+ className={`bg-slate-800 rounded-lg p-3 border border-slate-700 border-l-2 ${priorityBorder(vehicle.priority)} hover:border-slate-500 transition-all`}
132
+ >
133
+ {/* Vehicle Info */}
134
+ <div className="flex justify-between items-start mb-2">
135
+ <div className="flex items-center gap-2">
136
+ <div className="w-8 h-8 rounded-full bg-slate-700 flex items-center justify-center">
137
+ <Car size={14} className="text-slate-300" />
138
+ </div>
139
+ <div>
140
+ <div className="text-xs font-semibold flex items-center gap-1.5">
141
+ {vehicle.model}
142
+ {vehicle.priority === 'recall' && <span className="text-[8px] bg-red-500 text-white px-1 rounded font-bold">RECALL</span>}
143
+ {vehicle.priority === 'urgente' && <span className="text-[8px] bg-orange-500 text-white px-1 rounded font-bold">URGENTE</span>}
144
+ </div>
145
+ <div className="text-[10px] text-slate-500">{vehicle.owner} · {vehicle.id} · {vehicle.type}</div>
146
+ </div>
147
+ </div>
148
+ <div className="flex items-center gap-1.5">
149
+ <span className="text-[10px] text-slate-400 flex items-center gap-1">
150
+ <Clock size={9} /> {vehicle.time}
151
+ </span>
152
+ <button
153
+ onClick={() => sendNotification(vehicle)}
154
+ className={`flex items-center gap-1 px-2 py-1 text-[10px] font-bold rounded-full transition-all ${vehicle.notified
155
+ ? 'bg-green-500/10 text-green-400 border border-green-500/20'
156
+ : 'bg-green-600 text-white hover:bg-green-500'
157
+ }`}
158
+ >
159
+ <MessageCircle size={10} />
160
+ {vehicle.notified ? '✓' : 'WA'}
161
+ </button>
162
+ </div>
163
+ </div>
164
+
165
+ {/* Step Progress */}
166
+ <div className="flex items-center gap-0.5 mb-1.5">
167
+ {STEPS.map((step, i) => {
168
+ const done = step.id <= vehicle.step;
169
+ const current = step.id === vehicle.step;
170
+ return (
171
+ <div key={step.id} className="flex items-center flex-1">
172
+ <div
173
+ className={`flex-1 h-1.5 rounded-full transition-all duration-700 ${done ? '' : 'bg-slate-700'}`}
174
+ style={done ? { background: step.color } : {}}
175
+ />
176
+ </div>
177
+ );
178
+ })}
179
+ </div>
180
+ <div className="flex justify-between items-center">
181
+ <span className="text-[9px] flex items-center gap-1" style={{ color: currentStep.color }}>
182
+ <currentStep.icon size={9} /> {currentStep.label}
183
+ </span>
184
+
185
+ {/* SLA Bar */}
186
+ <div className="flex items-center gap-1.5">
187
+ <div className="w-14 h-1 bg-slate-700 rounded-full overflow-hidden">
188
+ <div
189
+ className={`h-full rounded-full transition-all ${overdue ? 'bg-red-500' : 'bg-green-500'}`}
190
+ style={{ width: `${Math.min(slaUsed, 100)}%` }}
191
+ />
192
+ </div>
193
+ <span className={`text-[8px] font-mono ${overdue ? 'text-red-400' : 'text-green-400'}`}>
194
+ {overdue ? 'OVER' : `${Math.round(100 - slaUsed)}%`}
195
+ </span>
196
+ </div>
197
+ </div>
198
+ </div>
199
+ );
200
+ })}
201
+ </div>
202
+
203
+ {/* Footer Stats */}
204
+ <div className="flex items-center justify-between text-[10px] text-slate-500 pt-1 border-t border-slate-800">
205
+ <span>Tiempo Promedio: <span className="text-blue-400 font-bold">3.2h</span></span>
206
+ <span>NPS Servicio: <span className="text-green-400 font-bold">92.1%</span></span>
207
+ <span>Entradas Hoy: <span className="text-purple-400 font-bold">{jitter(49, 5)}</span></span>
208
+ </div>
209
+ </div>
210
+ </BaseNode>
211
+ );
212
+ };
213
+
214
+ /* ─── Sub-components ───────────────────────────────────────── */
215
+ const StatChip = ({ label, value, color, icon: Icon }: any) => (
216
+ <div className="bg-slate-800 px-2 py-1 rounded border border-slate-700 text-center min-w-[50px]">
217
+ <Icon size={10} className="mx-auto mb-0.5" style={{ color }} />
218
+ <div className="text-sm font-bold" style={{ color }}>{value}</div>
219
+ <div className="text-[8px] text-slate-500">{label}</div>
220
+ </div>
221
+ );
@@ -0,0 +1,205 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { BaseNode } from '@decido/macia-core';
3
+ import {
4
+ Car, MapPin, Zap, Battery, Wifi, AlertTriangle,
5
+ CheckCircle2, Radio, Navigation, Clock, Route,
6
+ Plug, TrendingUp, ThermometerSun, Cloud
7
+ } from 'lucide-react';
8
+
9
+ /* ═══════════════════════════════════════════════════════════════
10
+ KIA SMART MOBILITY NODE — Connected Mobility Hub · Grecco Motors
11
+ Flota conectada, estaciones de carga, V2X, alertas live
12
+ ═══════════════════════════════════════════════════════════════ */
13
+
14
+ const CONNECTED_CARS = [
15
+ { id: 'EV6-001', model: 'EV6 GT', driver: 'Carlos Ruiz', battery: 78, speed: 62, location: 'Av. El Poblado', charging: false, range: 340, temp: 24 },
16
+ { id: 'EV9-002', model: 'EV9', driver: 'Laura Mejía', battery: 23, speed: 0, location: 'Kia Charge CC Santafé', charging: true, range: 95, temp: 22 },
17
+ { id: 'NE-003', model: 'Niro EV', driver: 'Pedro Gómez', battery: 91, speed: 45, location: 'Autopista Sur', charging: false, range: 380, temp: 26 },
18
+ { id: 'SP-004', model: 'Sportage HEV', driver: 'Ana Torres', battery: 55, speed: 78, location: 'Vía Las Palmas', charging: false, range: 210, temp: 19 },
19
+ { id: 'EV3-005', model: 'EV3', driver: 'Andrea López', battery: 88, speed: 35, location: 'Calle 10 Envigado', charging: false, range: 310, temp: 25 },
20
+ { id: 'SO-006', model: 'Sorento HEV', driver: 'Mauricio Díaz', battery: 42, speed: 0, location: 'Grecco Motors Taller', charging: false, range: 155, temp: 21 },
21
+ ];
22
+
23
+ const CHARGING_STATIONS = [
24
+ { id: 'CS-01', name: 'Kia Charge CC Santafé', available: 2, total: 4, power: '150kW', type: 'Ultra' },
25
+ { id: 'CS-02', name: 'Kia Charge Av 80', available: 3, total: 3, power: '50kW', type: 'DC' },
26
+ { id: 'CS-03', name: 'Kia Charge Laureles', available: 0, total: 2, power: '150kW', type: 'Ultra' },
27
+ { id: 'CS-04', name: 'Grecco Motors HQ', available: 4, total: 6, power: '350kW', type: 'V2G' },
28
+ { id: 'CS-05', name: 'Kia Charge El Tesoro', available: 1, total: 2, power: '50kW', type: 'DC' },
29
+ ];
30
+
31
+ const ALERT_TEMPLATES = [
32
+ { type: 'warning', msg: 'EV9-002: Batería al 23% — ruta a estación más cercana activada' },
33
+ { type: 'info', msg: 'EV6-001: OTA v3.2.1 disponible — programada para 2:00 AM' },
34
+ { type: 'critical', msg: 'CS-03 Laureles: Todos los cargadores ocupados — cola 15 min' },
35
+ { type: 'info', msg: 'EV3-005: Pre-acondicionamiento de cabina activado — 24°C' },
36
+ { type: 'warning', msg: 'SO-006: Mantenimiento programado en 200 km — cita auto-agendada' },
37
+ { type: 'info', msg: 'CS-04 HQ: V2G grid balancing activo — exportando 12 kW a red' },
38
+ ];
39
+
40
+ export const KiaSmartMobilityNode = (props: any) => {
41
+ const [cars, setCars] = useState(CONNECTED_CARS);
42
+ const [selectedCar, setSelectedCar] = useState<string>('EV6-001');
43
+ const [alerts] = useState(ALERT_TEMPLATES);
44
+ const [v2gExport, setV2gExport] = useState(12.4);
45
+
46
+ const car = cars.find(c => c.id === selectedCar)!;
47
+
48
+ useEffect(() => {
49
+ const interval = setInterval(() => {
50
+ setCars(prev => prev.map(c => ({
51
+ ...c,
52
+ speed: c.charging ? 0 : Math.max(0, c.speed + Math.floor(Math.random() * 20 - 10)),
53
+ battery: c.charging ? Math.min(100, c.battery + 0.5) : Math.max(0, c.battery - (c.speed > 0 ? 0.1 : 0)),
54
+ })));
55
+ setV2gExport(v => Math.max(0, v + (Math.random() - 0.5) * 2));
56
+ }, 3000);
57
+ return () => clearInterval(interval);
58
+ }, []);
59
+
60
+ const totalMoving = cars.filter(c => c.speed > 0).length;
61
+ const totalCharging = cars.filter(c => c.charging).length;
62
+ const avgBattery = Math.round(cars.reduce((s, c) => s + c.battery, 0) / cars.length);
63
+
64
+ return (
65
+ <BaseNode {...props} title="Kia Connected Mobility" width={600} height={580}>
66
+ <div className="flex flex-col h-full bg-[#070b14] text-white overflow-hidden">
67
+
68
+ {/* Header */}
69
+ <div className="flex items-center justify-between p-3 bg-[#0c1222] border-b border-slate-800">
70
+ <div className="flex items-center gap-3">
71
+ <div className="w-9 h-9 rounded-full bg-red-600/20 flex items-center justify-center border border-red-500/30">
72
+ <span className="text-red-500 font-bold text-[7px] tracking-widest">KIA</span>
73
+ </div>
74
+ <div>
75
+ <div className="text-xs font-bold tracking-wide">SMART MOBILITY HUB</div>
76
+ <div className="text-[10px] text-slate-500">Kia Connect · Grecco Motors · {cars.length} conectados</div>
77
+ </div>
78
+ </div>
79
+ <div className="flex gap-2">
80
+ <div className="bg-green-500/10 border border-green-500/20 rounded px-2 py-1 text-center">
81
+ <div className="text-xs font-bold text-green-400">{totalMoving}</div>
82
+ <div className="text-[8px] text-slate-500">En ruta</div>
83
+ </div>
84
+ <div className="bg-blue-500/10 border border-blue-500/20 rounded px-2 py-1 text-center">
85
+ <div className="text-xs font-bold text-blue-400">{totalCharging}</div>
86
+ <div className="text-[8px] text-slate-500">Cargando</div>
87
+ </div>
88
+ <div className="bg-violet-500/10 border border-violet-500/20 rounded px-2 py-1 text-center">
89
+ <div className="text-xs font-bold text-violet-400">{avgBattery}%</div>
90
+ <div className="text-[8px] text-slate-500">Bat Prom</div>
91
+ </div>
92
+ </div>
93
+ </div>
94
+
95
+ <div className="flex flex-1 overflow-hidden">
96
+ {/* Left: Fleet + Stations */}
97
+ <div className="w-[45%] border-r border-slate-800 flex flex-col overflow-hidden">
98
+ <div className="p-2 border-b border-slate-800">
99
+ <div className="text-[9px] text-slate-500 font-bold uppercase flex items-center gap-1"><Car size={10} /> Flota Conectada</div>
100
+ </div>
101
+ <div className="flex-1 overflow-y-auto">
102
+ {cars.map(c => (
103
+ <div key={c.id} onClick={() => setSelectedCar(c.id)}
104
+ className={`p-2 border-b border-slate-800/50 cursor-pointer transition-all ${selectedCar === c.id ? 'bg-red-500/5 border-l-2 border-l-red-500' : 'hover:bg-slate-900/50'}`}>
105
+ <div className="flex items-center justify-between">
106
+ <div>
107
+ <div className="text-[11px] font-semibold">{c.model}</div>
108
+ <div className="text-[9px] text-slate-500">{c.driver}</div>
109
+ </div>
110
+ <div className="text-right">
111
+ <div className={`text-[10px] font-bold ${c.charging ? 'text-blue-400' : c.speed > 0 ? 'text-green-400' : 'text-slate-500'}`}>
112
+ {c.charging ? '⚡ Cargando' : c.speed > 0 ? `${c.speed} km/h` : 'Detenido'}
113
+ </div>
114
+ <div className="flex items-center gap-1 text-[9px] text-slate-500">
115
+ <Battery size={9} /> {Math.round(c.battery)}%
116
+ </div>
117
+ </div>
118
+ </div>
119
+ <div className="flex items-center gap-1 mt-1 text-[9px] text-slate-500"><MapPin size={8} /> {c.location}</div>
120
+ </div>
121
+ ))}
122
+ </div>
123
+
124
+ {/* Charging stations */}
125
+ <div className="border-t border-slate-800 max-h-[35%] overflow-y-auto">
126
+ <div className="p-2 text-[9px] text-slate-500 font-bold uppercase flex items-center gap-1 sticky top-0 bg-[#070b14]"><Zap size={10} /> Kia Charge ({CHARGING_STATIONS.length})</div>
127
+ {CHARGING_STATIONS.map(s => (
128
+ <div key={s.id} className="px-2 py-1.5 flex items-center justify-between text-[10px] border-t border-slate-800/30">
129
+ <div>
130
+ <div className="text-slate-300">{s.name}</div>
131
+ <div className="text-[9px] text-slate-500">{s.power} · {s.type}</div>
132
+ </div>
133
+ <span className={`font-bold ${s.available > 0 ? 'text-green-400' : 'text-red-400'}`}>
134
+ {s.available}/{s.total}
135
+ </span>
136
+ </div>
137
+ ))}
138
+ </div>
139
+ </div>
140
+
141
+ {/* Right: Detail + Alerts */}
142
+ <div className="flex-1 flex flex-col overflow-y-auto">
143
+ <div className="p-3 border-b border-slate-800">
144
+ <div className="flex items-center justify-between mb-2">
145
+ <div>
146
+ <div className="text-sm font-bold">{car.model}</div>
147
+ <div className="text-[10px] text-slate-500">{car.id} · {car.driver}</div>
148
+ </div>
149
+ <div className="flex items-center gap-1 text-[9px] text-green-400"><Wifi size={10} className="animate-pulse" /> LIVE</div>
150
+ </div>
151
+
152
+ <div className="grid grid-cols-4 gap-1.5">
153
+ <div className="bg-slate-900 rounded p-2 text-center border border-slate-800">
154
+ <Navigation size={12} className="mx-auto text-cyan-400 mb-0.5" />
155
+ <div className="text-base font-bold">{car.speed}</div>
156
+ <div className="text-[8px] text-slate-500">km/h</div>
157
+ </div>
158
+ <div className="bg-slate-900 rounded p-2 text-center border border-slate-800">
159
+ <Battery size={12} className={`mx-auto mb-0.5 ${car.battery > 50 ? 'text-green-400' : car.battery > 20 ? 'text-yellow-400' : 'text-red-400'}`} />
160
+ <div className="text-base font-bold">{Math.round(car.battery)}%</div>
161
+ <div className="text-[8px] text-slate-500">Batería</div>
162
+ </div>
163
+ <div className="bg-slate-900 rounded p-2 text-center border border-slate-800">
164
+ <Route size={12} className="mx-auto text-violet-400 mb-0.5" />
165
+ <div className="text-base font-bold">{car.range}</div>
166
+ <div className="text-[8px] text-slate-500">km rango</div>
167
+ </div>
168
+ <div className="bg-slate-900 rounded p-2 text-center border border-slate-800">
169
+ <ThermometerSun size={12} className="mx-auto text-orange-400 mb-0.5" />
170
+ <div className="text-base font-bold">{car.temp}°</div>
171
+ <div className="text-[8px] text-slate-500">Cabina</div>
172
+ </div>
173
+ </div>
174
+
175
+ <div className="mt-2 flex items-center gap-1 text-[10px] text-slate-400"><MapPin size={10} /> {car.location}</div>
176
+ </div>
177
+
178
+ {/* V2G Status */}
179
+ <div className="px-3 py-2 border-b border-slate-800 bg-green-500/5">
180
+ <div className="flex items-center justify-between text-[10px]">
181
+ <span className="text-green-400 font-bold flex items-center gap-1"><Plug size={10} /> V2G Grid Balancing</span>
182
+ <span className="text-green-300 font-mono">{v2gExport.toFixed(1)} kW → Red</span>
183
+ </div>
184
+ </div>
185
+
186
+ {/* Alerts */}
187
+ <div className="flex-1 p-2">
188
+ <div className="text-[9px] text-slate-500 font-bold uppercase mb-2 flex items-center gap-1"><AlertTriangle size={10} /> Alertas Live</div>
189
+ <div className="space-y-1.5">
190
+ {alerts.map((a, i) => (
191
+ <div key={i}
192
+ className={`p-2 rounded border text-[10px] leading-relaxed ${a.type === 'critical' ? 'bg-red-500/10 border-red-500/20 text-red-200' :
193
+ a.type === 'warning' ? 'bg-yellow-500/10 border-yellow-500/20 text-yellow-200' :
194
+ 'bg-blue-500/10 border-blue-500/20 text-blue-200'}`}>
195
+ {a.msg}
196
+ </div>
197
+ ))}
198
+ </div>
199
+ </div>
200
+ </div>
201
+ </div>
202
+ </div>
203
+ </BaseNode>
204
+ );
205
+ };