@decido/plugin-chameleon 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.
- package/.turbo/turbo-build.log +13 -0
- package/package.json +47 -0
- package/src/App.tsx +116 -0
- package/src/components/DatawayDashboard.tsx +152 -0
- package/src/components/DatawayFilterModal.tsx +132 -0
- package/src/components/DatawayMathModal.tsx +120 -0
- package/src/components/DatawayOrchestratorCanvas.tsx +345 -0
- package/src/components/DatawayPipelineManager.tsx +227 -0
- package/src/components/DatawaySchemaMapper.tsx +291 -0
- package/src/components/FormulaBar.tsx +242 -0
- package/src/hooks/useSocketSync.ts +104 -0
- package/src/index.css +18 -0
- package/src/index.ts +121 -0
- package/src/logic/rules.ts +39 -0
- package/src/logic/workflowGuard.ts +45 -0
- package/src/main.tsx +10 -0
- package/src/services/gemini.ts +110 -0
- package/src/store/datawayStore.ts +26 -0
- package/src/stores/authStore.ts +26 -0
- package/src/stores/orderStore.ts +263 -0
- package/src/stores/uiStore.ts +19 -0
- package/src/types.ts +39 -0
- package/src/useAgent.ts +89 -0
- package/src/utils/sounds.ts +52 -0
- package/src/views/DatabaseAdminView.tsx +707 -0
- package/src/views/DatawayStudioView.tsx +959 -0
- package/src/views/DiscoveryAdminView.tsx +59 -0
- package/src/views/KuspideDashboardView.tsx +144 -0
- package/src/views/LoginView.tsx +122 -0
- package/src/views/MadefrontChatView.tsx +174 -0
- package/src/views/MadefrontExcelView.tsx +95 -0
- package/src/views/MadefrontKanbanView.tsx +292 -0
- package/src/views/roles/CajaView.tsx +76 -0
- package/src/views/roles/DespachoView.tsx +100 -0
- package/src/views/roles/PlantaView.tsx +83 -0
- package/src/views/roles/VentasView.tsx +101 -0
- package/src/views/roles/WorkflowAdminView.tsx +62 -0
- package/tsconfig.json +34 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { ReactFlow, Background, Controls, Node, Edge, Handle, Position } from '@xyflow/react';
|
|
3
|
+
import '@xyflow/react/dist/style.css';
|
|
4
|
+
import { useOrderStore } from '../../stores/orderStore';
|
|
5
|
+
import { OrderStatus } from '../../types';
|
|
6
|
+
|
|
7
|
+
// Un nodo personalizado para mostrar el conteo de pedidos
|
|
8
|
+
const StageNode = ({ data }: { data: { label: string; count: number; isWarning: boolean } }) => (
|
|
9
|
+
<div className={`px-6 py-4 rounded-2xl border-2 shadow-lg bg-white ${data.isWarning ? 'border-red-500 shadow-red-200' : 'border-indigo-200 shadow-indigo-100'}`}>
|
|
10
|
+
<Handle type="target" position={Position.Left} className="w-2 h-1/2 rounded-md bg-indigo-400 border-none -ml-1" />
|
|
11
|
+
<h3 className="font-black text-slate-800 text-sm">{data.label}</h3>
|
|
12
|
+
<div className={`text-3xl font-black mt-2 ${data.isWarning ? 'text-red-500' : 'text-indigo-600'}`}>
|
|
13
|
+
{data.count}
|
|
14
|
+
</div>
|
|
15
|
+
<p className="text-[10px] text-slate-500 font-mono mt-1 uppercase">Pedidos Activos</p>
|
|
16
|
+
<Handle type="source" position={Position.Right} className="w-2 h-1/2 rounded-md bg-indigo-400 border-none -mr-1" />
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const nodeTypes = { stage: StageNode };
|
|
21
|
+
|
|
22
|
+
export const WorkflowAdminView = () => {
|
|
23
|
+
const { orders } = useOrderStore();
|
|
24
|
+
|
|
25
|
+
// Calculamos cuántos pedidos hay en cada etapa dinámicamente
|
|
26
|
+
const counts = useMemo(() => {
|
|
27
|
+
return orders.reduce((acc, order) => {
|
|
28
|
+
acc[order.status] = (acc[order.status] || 0) + 1;
|
|
29
|
+
return acc;
|
|
30
|
+
}, {} as Record<OrderStatus, number>);
|
|
31
|
+
}, [orders]);
|
|
32
|
+
|
|
33
|
+
const initialNodes: Node[] = [
|
|
34
|
+
{ id: '1', type: 'stage', position: { x: 50, y: 200 }, data: { label: 'Diseño', count: counts['DISEÑO'] || 0, isWarning: false } },
|
|
35
|
+
{ id: '2', type: 'stage', position: { x: 300, y: 200 }, data: { label: 'Optimización', count: counts['OPTIMIZACION'] || 0, isWarning: false } },
|
|
36
|
+
{ id: '3', type: 'stage', position: { x: 550, y: 200 }, data: { label: 'Caja', count: counts['CAJA'] || 0, isWarning: (counts['CAJA'] || 0) > 5 } }, // Alerta si hay > 5 por pagar
|
|
37
|
+
{ id: '4', type: 'stage', position: { x: 800, y: 200 }, data: { label: 'Producción', count: counts['PRODUCCION'] || 0, isWarning: false } },
|
|
38
|
+
{ id: '5', type: 'stage', position: { x: 1050, y: 200 }, data: { label: 'Despacho', count: counts['DESPACHO'] || 0, isWarning: false } },
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
const initialEdges: Edge[] = [
|
|
42
|
+
{ id: 'e1-2', source: '1', target: '2', animated: true, style: { stroke: '#818cf8', strokeWidth: 3 } },
|
|
43
|
+
{ id: 'e2-3', source: '2', target: '3', animated: true, style: { stroke: '#818cf8', strokeWidth: 3 } },
|
|
44
|
+
{ id: 'e3-4', source: '3', target: '4', animated: true, style: { stroke: '#818cf8', strokeWidth: 3 } },
|
|
45
|
+
{ id: 'e4-5', source: '4', target: '5', animated: true, style: { stroke: '#818cf8', strokeWidth: 3 } },
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<div className="h-full w-full bg-slate-50 flex flex-col">
|
|
50
|
+
<div className="p-6 border-b border-slate-200 bg-white">
|
|
51
|
+
<h1 className="text-2xl font-black text-slate-800">Cerebro de Operaciones (Digital Twin)</h1>
|
|
52
|
+
<p className="text-slate-500 text-sm">Monitoreo en tiempo real del flujo de planta y cuellos de botella.</p>
|
|
53
|
+
</div>
|
|
54
|
+
<div className="flex-1 relative min-h-[500px] h-full">
|
|
55
|
+
<ReactFlow nodes={initialNodes} edges={initialEdges} nodeTypes={nodeTypes} fitView>
|
|
56
|
+
<Background color="#cbd5e1" gap={24} />
|
|
57
|
+
<Controls />
|
|
58
|
+
</ReactFlow>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "ES2020",
|
|
5
|
+
"useDefineForClassFields": true,
|
|
6
|
+
"lib": [
|
|
7
|
+
"ES2020",
|
|
8
|
+
"DOM",
|
|
9
|
+
"DOM.Iterable"
|
|
10
|
+
],
|
|
11
|
+
"module": "ESNext",
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"moduleResolution": "bundler",
|
|
14
|
+
"allowImportingTsExtensions": true,
|
|
15
|
+
"resolveJsonModule": true,
|
|
16
|
+
"isolatedModules": true,
|
|
17
|
+
"noEmit": true,
|
|
18
|
+
"jsx": "react-jsx",
|
|
19
|
+
"strict": false,
|
|
20
|
+
"noImplicitAny": false,
|
|
21
|
+
"noUnusedLocals": false,
|
|
22
|
+
"noUnusedParameters": false,
|
|
23
|
+
"noFallthroughCasesInSwitch": true,
|
|
24
|
+
"baseUrl": ".",
|
|
25
|
+
"paths": {
|
|
26
|
+
"@/*": [
|
|
27
|
+
"./src/*"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"include": [
|
|
32
|
+
"src"
|
|
33
|
+
]
|
|
34
|
+
}
|