AssanaliAidarkhan commited on
Commit
fcea995
·
verified ·
1 Parent(s): 037faf8

Upload index.html

Browse files
Files changed (1) hide show
  1. index.html +675 -0
index.html ADDED
@@ -0,0 +1,675 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="ru">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Neurobox AI - Предиктивная диагностика</title>
7
+ <script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
8
+ <script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
9
+ <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
10
+ <script src="https://cdn.tailwindcss.com"></script>
11
+ <style>
12
+ * {
13
+ margin: 0;
14
+ padding: 0;
15
+ box-sizing: border-box;
16
+ }
17
+ body {
18
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
19
+ }
20
+ @keyframes pulse-yellow {
21
+ 0%, 100% { opacity: 1; }
22
+ 50% { opacity: 0.6; }
23
+ }
24
+ .animate-pulse-yellow {
25
+ animation: pulse-yellow 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
26
+ }
27
+ </style>
28
+ </head>
29
+ <body>
30
+ <div id="root"></div>
31
+
32
+ <script type="text/babel">
33
+ const { useState, useEffect, useRef } = React;
34
+
35
+ // Icons
36
+ const Activity = ({ size = 24, className = "" }) => (
37
+ <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={className}>
38
+ <polyline points="22 12 18 12 15 21 9 3 6 12 2 12"/>
39
+ </svg>
40
+ );
41
+
42
+ const AlertTriangle = ({ size = 24, className = "" }) => (
43
+ <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={className}>
44
+ <path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/>
45
+ <line x1="12" y1="9" x2="12" y2="13"/>
46
+ <line x1="12" y1="17" x2="12.01" y2="17"/>
47
+ </svg>
48
+ );
49
+
50
+ const TrendingUp = ({ size = 24, className = "" }) => (
51
+ <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={className}>
52
+ <polyline points="23 6 13.5 15.5 8.5 10.5 1 18"/>
53
+ <polyline points="17 6 23 6 23 12"/>
54
+ </svg>
55
+ );
56
+
57
+ const Clock = ({ size = 24, className = "" }) => (
58
+ <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={className}>
59
+ <circle cx="12" cy="12" r="10"/>
60
+ <polyline points="12 6 12 12 16 14"/>
61
+ </svg>
62
+ );
63
+
64
+ const Thermometer = ({ size = 24, className = "" }) => (
65
+ <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={className}>
66
+ <path d="M14 14.76V3.5a2.5 2.5 0 0 0-5 0v11.26a4.5 4.5 0 1 0 5 0z"/>
67
+ </svg>
68
+ );
69
+
70
+ const Settings = ({ size = 24, className = "" }) => (
71
+ <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={className}>
72
+ <circle cx="12" cy="12" r="3"/>
73
+ <path d="M12 1v6m0 6v6m9.22-9.22l-4.24 4.24m-5.96 0L6.78 9.78m12.44 0l-4.24 4.24m-5.96 0L6.78 14.22"/>
74
+ </svg>
75
+ );
76
+
77
+ const Zap = ({ size = 24, className = "" }) => (
78
+ <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={className}>
79
+ <polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/>
80
+ </svg>
81
+ );
82
+
83
+ const CheckCircle = ({ size = 24, className = "" }) => (
84
+ <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={className}>
85
+ <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/>
86
+ <polyline points="22 4 12 14.01 9 11.01"/>
87
+ </svg>
88
+ );
89
+
90
+ const Tool = ({ size = 24, className = "" }) => (
91
+ <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={className}>
92
+ <path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/>
93
+ </svg>
94
+ );
95
+
96
+ const Brain = ({ size = 24, className = "" }) => (
97
+ <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={className}>
98
+ <path d="M9.5 2A2.5 2.5 0 0 1 12 4.5v15a2.5 2.5 0 0 1-4.96.44 2.5 2.5 0 0 1-2.96-3.08 3 3 0 0 1-.34-5.58 2.5 2.5 0 0 1 1.32-4.24 2.5 2.5 0 0 1 1.98-3A2.5 2.5 0 0 1 9.5 2Z"/>
99
+ <path d="M14.5 2A2.5 2.5 0 0 0 12 4.5v15a2.5 2.5 0 0 0 4.96.44 2.5 2.5 0 0 0 2.96-3.08 3 3 0 0 0 .34-5.58 2.5 2.5 0 0 0-1.32-4.24 2.5 2.5 0 0 0-1.98-3A2.5 2.5 0 0 0 14.5 2Z"/>
100
+ </svg>
101
+ );
102
+
103
+ const PredictiveMaintenanceDashboard = () => {
104
+ const [currentTime, setCurrentTime] = useState(new Date());
105
+ const [status, setStatus] = useState('warning'); // normal, warning, critical
106
+ const [anomalyTemp, setAnomalyTemp] = useState(7);
107
+ const [timeToFailure, setTimeToFailure] = useState('72-96');
108
+ const [temperatureData, setTemperatureData] = useState([]);
109
+ const [currentBearingTemp, setCurrentBearingTemp] = useState(65);
110
+
111
+ const thermalCanvasRef = useRef(null);
112
+ const chartCanvasRef = useRef(null);
113
+
114
+ useEffect(() => {
115
+ const timer = setInterval(() => {
116
+ setCurrentTime(new Date());
117
+ }, 1000);
118
+ return () => clearInterval(timer);
119
+ }, []);
120
+
121
+ // Generate temperature history data
122
+ useEffect(() => {
123
+ const generateData = () => {
124
+ const data = [];
125
+ const now = Date.now();
126
+ const dayInMs = 24 * 60 * 60 * 1000;
127
+
128
+ for (let i = 7; i >= 0; i--) {
129
+ const baseTemp = 58;
130
+ const anomalyFactor = Math.max(0, 7 - i) * 0.8;
131
+ const temp = baseTemp + anomalyFactor + Math.random() * 2;
132
+ data.push({
133
+ time: new Date(now - i * dayInMs),
134
+ temp: temp
135
+ });
136
+ }
137
+ return data;
138
+ };
139
+
140
+ setTemperatureData(generateData());
141
+
142
+ // Update current temperature periodically
143
+ const tempInterval = setInterval(() => {
144
+ setCurrentBearingTemp(prev => {
145
+ const newTemp = prev + (Math.random() - 0.3) * 0.5;
146
+ return Math.max(62, Math.min(68, newTemp));
147
+ });
148
+ }, 2000);
149
+
150
+ return () => clearInterval(tempInterval);
151
+ }, []);
152
+
153
+ // Draw thermal map
154
+ useEffect(() => {
155
+ const canvas = thermalCanvasRef.current;
156
+ if (!canvas) return;
157
+
158
+ const ctx = canvas.getContext('2d');
159
+ let animationFrame;
160
+ let hotspotPulse = 0;
161
+
162
+ const animate = () => {
163
+ // Background
164
+ const bgGradient = ctx.createLinearGradient(0, 0, 0, canvas.height);
165
+ bgGradient.addColorStop(0, '#1e293b');
166
+ bgGradient.addColorStop(1, '#0f172a');
167
+ ctx.fillStyle = bgGradient;
168
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
169
+
170
+ // Draw motor outline
171
+ const motorX = canvas.width / 2;
172
+ const motorY = canvas.height / 2;
173
+
174
+ // Motor body (cylinder)
175
+ const motorGradient = ctx.createRadialGradient(motorX, motorY, 50, motorX, motorY, 120);
176
+ motorGradient.addColorStop(0, '#1e40af');
177
+ motorGradient.addColorStop(0.5, '#1e3a8a');
178
+ motorGradient.addColorStop(1, '#1e293b');
179
+
180
+ ctx.fillStyle = motorGradient;
181
+ ctx.fillRect(motorX - 120, motorY - 80, 240, 160);
182
+
183
+ // Motor ends
184
+ ctx.beginPath();
185
+ ctx.ellipse(motorX - 120, motorY, 25, 80, 0, 0, Math.PI * 2);
186
+ ctx.fill();
187
+
188
+ ctx.beginPath();
189
+ ctx.ellipse(motorX + 120, motorY, 25, 80, 0, 0, Math.PI * 2);
190
+ ctx.fill();
191
+
192
+ // Thermal overlay - normal areas (blue-green)
193
+ const drawThermalZone = (x, y, size, temp) => {
194
+ let colors;
195
+ if (temp < 45) {
196
+ colors = ['rgba(59, 130, 246, 0.6)', 'rgba(37, 99, 235, 0.4)'];
197
+ } else if (temp < 55) {
198
+ colors = ['rgba(34, 197, 94, 0.6)', 'rgba(22, 163, 74, 0.4)'];
199
+ } else if (temp < 65) {
200
+ colors = ['rgba(234, 179, 8, 0.6)', 'rgba(202, 138, 4, 0.4)'];
201
+ } else {
202
+ colors = ['rgba(239, 68, 68, 0.8)', 'rgba(220, 38, 38, 0.6)'];
203
+ }
204
+
205
+ const gradient = ctx.createRadialGradient(x, y, 0, x, y, size);
206
+ gradient.addColorStop(0, colors[0]);
207
+ gradient.addColorStop(1, colors[1]);
208
+ ctx.fillStyle = gradient;
209
+ ctx.beginPath();
210
+ ctx.arc(x, y, size, 0, Math.PI * 2);
211
+ ctx.fill();
212
+ };
213
+
214
+ // Normal temperature zones
215
+ drawThermalZone(motorX - 80, motorY - 40, 40, 42);
216
+ drawThermalZone(motorX - 80, motorY + 40, 40, 43);
217
+ drawThermalZone(motorX, motorY, 50, 48);
218
+ drawThermalZone(motorX + 80, motorY - 40, 40, 44);
219
+
220
+ // Bearing #2 - HOTSPOT (pulsating)
221
+ hotspotPulse += 0.05;
222
+ const pulseSize = 45 + Math.sin(hotspotPulse) * 8;
223
+ const pulseAlpha = 0.7 + Math.sin(hotspotPulse) * 0.2;
224
+
225
+ const hotspotGradient = ctx.createRadialGradient(
226
+ motorX + 80, motorY + 40, 0,
227
+ motorX + 80, motorY + 40, pulseSize
228
+ );
229
+ hotspotGradient.addColorStop(0, `rgba(239, 68, 68, ${pulseAlpha})`);
230
+ hotspotGradient.addColorStop(0.5, `rgba(234, 179, 8, ${pulseAlpha * 0.7})`);
231
+ hotspotGradient.addColorStop(1, 'rgba(234, 179, 8, 0)');
232
+
233
+ ctx.fillStyle = hotspotGradient;
234
+ ctx.beginPath();
235
+ ctx.arc(motorX + 80, motorY + 40, pulseSize, 0, Math.PI * 2);
236
+ ctx.fill();
237
+
238
+ // Warning marker on hotspot
239
+ ctx.strokeStyle = '#ef4444';
240
+ ctx.lineWidth = 3;
241
+ ctx.setLineDash([5, 5]);
242
+ ctx.beginPath();
243
+ ctx.arc(motorX + 80, motorY + 40, 55, 0, Math.PI * 2);
244
+ ctx.stroke();
245
+ ctx.setLineDash([]);
246
+
247
+ // Labels
248
+ ctx.fillStyle = 'rgba(255, 255, 255, 0.9)';
249
+ ctx.font = 'bold 12px Arial';
250
+
251
+ // Bearing labels
252
+ ctx.fillText('Подшипник №1', motorX - 120, motorY - 100);
253
+ ctx.fillText('Подшипник №2', motorX + 40, motorY + 80);
254
+ ctx.fillText('Обмотка', motorX - 30, motorY - 100);
255
+ ctx.fillText('Подшипник №3', motorX + 140, motorY - 100);
256
+
257
+ // Temperature readings
258
+ ctx.font = 'bold 14px monospace';
259
+ ctx.fillStyle = '#3b82f6';
260
+ ctx.fillText('43°C', motorX - 120, motorY - 85);
261
+ ctx.fillStyle = '#22c55e';
262
+ ctx.fillText('48°C', motorX - 30, motorY - 85);
263
+ ctx.fillStyle = '#3b82f6';
264
+ ctx.fillText('44°C', motorX + 140, motorY - 85);
265
+
266
+ // Hotspot temperature
267
+ ctx.fillStyle = '#ef4444';
268
+ ctx.font = 'bold 18px monospace';
269
+ ctx.fillText(`${currentBearingTemp.toFixed(1)}°C`, motorX + 40, motorY + 95);
270
+ ctx.fillStyle = '#fbbf24';
271
+ ctx.font = 'bold 12px Arial';
272
+ ctx.fillText('⚠ АНОМАЛИЯ', motorX + 30, motorY + 110);
273
+
274
+ // Temperature scale legend
275
+ const legendX = 20;
276
+ const legendY = canvas.height - 80;
277
+ const legendWidth = 40;
278
+ const legendHeight = 60;
279
+
280
+ // Gradient bar
281
+ const scaleGradient = ctx.createLinearGradient(legendX, legendY + legendHeight, legendX, legendY);
282
+ scaleGradient.addColorStop(0, '#3b82f6');
283
+ scaleGradient.addColorStop(0.33, '#22c55e');
284
+ scaleGradient.addColorStop(0.66, '#eab308');
285
+ scaleGradient.addColorStop(1, '#ef4444');
286
+
287
+ ctx.fillStyle = scaleGradient;
288
+ ctx.fillRect(legendX, legendY, legendWidth, legendHeight);
289
+ ctx.strokeStyle = '#fff';
290
+ ctx.lineWidth = 2;
291
+ ctx.strokeRect(legendX, legendY, legendWidth, legendHeight);
292
+
293
+ // Scale labels
294
+ ctx.fillStyle = '#fff';
295
+ ctx.font = '10px Arial';
296
+ ctx.fillText('70°C', legendX + legendWidth + 5, legendY + 5);
297
+ ctx.fillText('55°C', legendX + legendWidth + 5, legendY + legendHeight/2);
298
+ ctx.fillText('40°C', legendX + legendWidth + 5, legendY + legendHeight);
299
+
300
+ animationFrame = requestAnimationFrame(animate);
301
+ };
302
+
303
+ animate();
304
+ return () => cancelAnimationFrame(animationFrame);
305
+ }, [currentBearingTemp]);
306
+
307
+ // Draw temperature chart
308
+ useEffect(() => {
309
+ const canvas = chartCanvasRef.current;
310
+ if (!canvas || temperatureData.length === 0) return;
311
+
312
+ const ctx = canvas.getContext('2d');
313
+
314
+ // Background
315
+ ctx.fillStyle = '#f8fafc';
316
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
317
+
318
+ // Grid
319
+ ctx.strokeStyle = '#e2e8f0';
320
+ ctx.lineWidth = 1;
321
+
322
+ // Horizontal lines
323
+ for (let i = 0; i <= 5; i++) {
324
+ const y = (canvas.height - 40) * (i / 5) + 20;
325
+ ctx.beginPath();
326
+ ctx.moveTo(50, y);
327
+ ctx.lineTo(canvas.width - 20, y);
328
+ ctx.stroke();
329
+
330
+ // Y-axis labels
331
+ const temp = 70 - (i * 5);
332
+ ctx.fillStyle = '#64748b';
333
+ ctx.font = '11px Arial';
334
+ ctx.fillText(`${temp}°C`, 10, y + 4);
335
+ }
336
+
337
+ // Vertical lines (days)
338
+ for (let i = 0; i <= 7; i++) {
339
+ const x = 50 + (canvas.width - 70) * (i / 7);
340
+ ctx.beginPath();
341
+ ctx.moveTo(x, 20);
342
+ ctx.lineTo(x, canvas.height - 20);
343
+ ctx.stroke();
344
+
345
+ // X-axis labels
346
+ if (i % 2 === 0) {
347
+ ctx.fillStyle = '#64748b';
348
+ ctx.font = '10px Arial';
349
+ ctx.fillText(`-${7-i}д`, x - 10, canvas.height - 5);
350
+ }
351
+ }
352
+
353
+ // Normal threshold line
354
+ const normalThreshold = 58;
355
+ const thresholdY = canvas.height - 20 - ((normalThreshold - 45) / 25) * (canvas.height - 40);
356
+ ctx.strokeStyle = '#22c55e';
357
+ ctx.lineWidth = 2;
358
+ ctx.setLineDash([5, 5]);
359
+ ctx.beginPath();
360
+ ctx.moveTo(50, thresholdY);
361
+ ctx.lineTo(canvas.width - 20, thresholdY);
362
+ ctx.stroke();
363
+ ctx.setLineDash([]);
364
+
365
+ ctx.fillStyle = '#22c55e';
366
+ ctx.font = '10px Arial';
367
+ ctx.fillText('Норма: 58°C', canvas.width - 100, thresholdY - 5);
368
+
369
+ // Plot temperature line
370
+ ctx.beginPath();
371
+ ctx.strokeStyle = '#3b82f6';
372
+ ctx.lineWidth = 3;
373
+
374
+ temperatureData.forEach((point, index) => {
375
+ const x = 50 + (canvas.width - 70) * (index / 7);
376
+ const y = canvas.height - 20 - ((point.temp - 45) / 25) * (canvas.height - 40);
377
+
378
+ if (index === 0) {
379
+ ctx.moveTo(x, y);
380
+ } else {
381
+ ctx.lineTo(x, y);
382
+ }
383
+ });
384
+ ctx.stroke();
385
+
386
+ // Plot points
387
+ temperatureData.forEach((point, index) => {
388
+ const x = 50 + (canvas.width - 70) * (index / 7);
389
+ const y = canvas.height - 20 - ((point.temp - 45) / 25) * (canvas.height - 40);
390
+
391
+ // Color based on temperature
392
+ if (point.temp >= 62) {
393
+ ctx.fillStyle = '#ef4444';
394
+ } else if (point.temp >= 58) {
395
+ ctx.fillStyle = '#eab308';
396
+ } else {
397
+ ctx.fillStyle = '#3b82f6';
398
+ }
399
+
400
+ ctx.beginPath();
401
+ ctx.arc(x, y, 5, 0, Math.PI * 2);
402
+ ctx.fill();
403
+ ctx.strokeStyle = '#fff';
404
+ ctx.lineWidth = 2;
405
+ ctx.stroke();
406
+ });
407
+
408
+ // Warning arrow
409
+ const lastPoint = temperatureData[temperatureData.length - 1];
410
+ const lastX = 50 + (canvas.width - 70) * (7 / 7);
411
+ const lastY = canvas.height - 20 - ((lastPoint.temp - 45) / 25) * (canvas.height - 40);
412
+
413
+ ctx.fillStyle = '#ef4444';
414
+ ctx.font = 'bold 12px Arial';
415
+ ctx.fillText('⚠ ПРЕДУПРЕЖДЕНИЕ', lastX - 100, lastY - 15);
416
+
417
+ // Arrow pointing to anomaly
418
+ ctx.strokeStyle = '#ef4444';
419
+ ctx.fillStyle = '#ef4444';
420
+ ctx.lineWidth = 2;
421
+ ctx.beginPath();
422
+ ctx.moveTo(lastX - 20, lastY - 10);
423
+ ctx.lineTo(lastX - 10, lastY);
424
+ ctx.lineTo(lastX - 20, lastY + 10);
425
+ ctx.fill();
426
+
427
+ }, [temperatureData]);
428
+
429
+ const getStatusConfig = () => {
430
+ switch(status) {
431
+ case 'critical':
432
+ return {
433
+ color: 'from-red-500 to-red-700',
434
+ borderColor: 'border-red-400',
435
+ textColor: 'text-red-600',
436
+ bgColor: 'bg-red-50',
437
+ icon: AlertTriangle,
438
+ label: 'КРИТИЧНО'
439
+ };
440
+ case 'warning':
441
+ return {
442
+ color: 'from-yellow-500 to-orange-600',
443
+ borderColor: 'border-yellow-400',
444
+ textColor: 'text-yellow-600',
445
+ bgColor: 'bg-yellow-50',
446
+ icon: AlertTriangle,
447
+ label: 'ПРЕДУПРЕЖДЕНИЕ'
448
+ };
449
+ default:
450
+ return {
451
+ color: 'from-green-500 to-green-700',
452
+ borderColor: 'border-green-400',
453
+ textColor: 'text-green-600',
454
+ bgColor: 'bg-green-50',
455
+ icon: CheckCircle,
456
+ label: 'НОРМА'
457
+ };
458
+ }
459
+ };
460
+
461
+ const statusConfig = getStatusConfig();
462
+ const StatusIcon = statusConfig.icon;
463
+
464
+ return (
465
+ <div className="min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50 p-6">
466
+ <div className="max-w-7xl mx-auto">
467
+ {/* Header */}
468
+ <div className={`bg-gradient-to-r ${statusConfig.color} rounded-xl shadow-xl p-6 mb-6 border-2 ${statusConfig.borderColor}`}>
469
+ <div className="flex justify-between items-center">
470
+ <div className="flex items-center gap-4">
471
+ <div className="bg-white p-2 rounded-lg">
472
+ <Activity size={32} className={statusConfig.textColor} />
473
+ </div>
474
+ <div>
475
+ <h1 className="text-3xl font-bold text-white">Предиктивная аналитика</h1>
476
+ <p className="text-white text-sm font-medium">Оборудование: Двигатель ДП-45 (Линия 3)</p>
477
+ </div>
478
+ </div>
479
+ <div className="flex items-center gap-4">
480
+ <div className="bg-white px-4 py-2 rounded-lg shadow-md">
481
+ <Clock size={20} className={`inline ${statusConfig.textColor} mr-2`} />
482
+ <span className="font-mono text-lg text-gray-800 font-semibold">
483
+ {currentTime.toLocaleTimeString('ru-RU')}
484
+ </span>
485
+ </div>
486
+ </div>
487
+ </div>
488
+ </div>
489
+
490
+ <div className="grid grid-cols-3 gap-6">
491
+ {/* Left Column - Thermal Map */}
492
+ <div className="col-span-2 space-y-6">
493
+ {/* Thermal Camera View */}
494
+ <div className="bg-white rounded-xl shadow-xl p-6 border-2 border-blue-200">
495
+ <div className="flex items-center justify-between mb-4">
496
+ <h2 className="text-xl font-bold text-gray-800 flex items-center gap-2">
497
+ <Thermometer className="text-blue-600" />
498
+ Тепловая карта в реальном времени
499
+ </h2>
500
+ <span className="text-sm bg-blue-100 text-blue-700 px-3 py-1 rounded-full font-semibold flex items-center gap-2">
501
+ <span className="w-2 h-2 bg-blue-500 rounded-full animate-pulse"></span>
502
+ Онлайн
503
+ </span>
504
+ </div>
505
+ <div className="bg-slate-900 rounded-lg overflow-hidden border-2 border-slate-700">
506
+ <canvas
507
+ ref={thermalCanvasRef}
508
+ width={800}
509
+ height={400}
510
+ className="w-full"
511
+ />
512
+ </div>
513
+ <div className="mt-4 grid grid-cols-4 gap-3">
514
+ <div className="bg-blue-50 p-3 rounded-lg border border-blue-200">
515
+ <p className="text-xs text-gray-600 mb-1">Подшипник №1</p>
516
+ <p className="text-xl font-bold text-blue-600">43°C</p>
517
+ <p className="text-xs text-green-600">✓ Норма</p>
518
+ </div>
519
+ <div className={`${statusConfig.bgColor} p-3 rounded-lg border-2 ${statusConfig.borderColor} animate-pulse-yellow`}>
520
+ <p className="text-xs text-gray-600 mb-1">Подшипник №2</p>
521
+ <p className={`text-xl font-bold ${statusConfig.textColor}`}>{currentBearingTemp.toFixed(1)}°C</p>
522
+ <p className={`text-xs ${statusConfig.textColor}`}>⚠ Аномалия</p>
523
+ </div>
524
+ <div className="bg-blue-50 p-3 rounded-lg border border-blue-200">
525
+ <p className="text-xs text-gray-600 mb-1">Подшипник №3</p>
526
+ <p className="text-xl font-bold text-blue-600">44°C</p>
527
+ <p className="text-xs text-green-600">✓ Норма</p>
528
+ </div>
529
+ <div className="bg-green-50 p-3 rounded-lg border border-green-200">
530
+ <p className="text-xs text-gray-600 mb-1">Обмотка</p>
531
+ <p className="text-xl font-bold text-green-600">48°C</p>
532
+ <p className="text-xs text-green-600">✓ Норма</p>
533
+ </div>
534
+ </div>
535
+ </div>
536
+
537
+ {/* Temperature Chart */}
538
+ <div className="bg-white rounded-xl shadow-xl p-6 border-2 border-blue-200">
539
+ <h2 className="text-xl font-bold text-gray-800 mb-4 flex items-center gap-2">
540
+ <TrendingUp className="text-red-600" />
541
+ График температуры (Подшипник №2) за 7 дней
542
+ </h2>
543
+ <div className="bg-white rounded-lg border-2 border-gray-200">
544
+ <canvas
545
+ ref={chartCanvasRef}
546
+ width={800}
547
+ height={300}
548
+ className="w-full"
549
+ />
550
+ </div>
551
+ </div>
552
+
553
+ {/* Statistics */}
554
+ <div className="bg-white rounded-xl shadow-xl p-6 border-2 border-blue-200">
555
+ <h2 className="text-xl font-bold text-gray-800 mb-4 flex items-center gap-2">
556
+ <Settings className="text-blue-600" />
557
+ Эффективность системы
558
+ </h2>
559
+ <div className="grid grid-cols-3 gap-4">
560
+ <div className="bg-gradient-to-br from-green-500 to-green-600 rounded-xl p-5 shadow-lg">
561
+ <p className="text-green-50 text-sm mb-1 font-semibold">Предотвращено аварий</p>
562
+ <p className="text-4xl font-bold text-white">8/10</p>
563
+ <p className="text-green-100 text-xs mt-1">80% успешности</p>
564
+ </div>
565
+ <div className="bg-gradient-to-br from-blue-500 to-blue-600 rounded-xl p-5 shadow-lg">
566
+ <p className="text-blue-50 text-sm mb-1 font-semibold">Экономия на ремонте</p>
567
+ <p className="text-4xl font-bold text-white">₽2.4M</p>
568
+ <p className="text-blue-100 text-xs mt-1">За квартал</p>
569
+ </div>
570
+ <div className="bg-gradient-to-br from-purple-500 to-purple-600 rounded-xl p-5 shadow-lg">
571
+ <p className="text-purple-50 text-sm mb-1 font-semibold">Время простоя</p>
572
+ <p className="text-4xl font-bold text-white">-75%</p>
573
+ <p className="text-purple-100 text-xs mt-1">Снижение</p>
574
+ </div>
575
+ </div>
576
+ </div>
577
+ </div>
578
+
579
+ {/* Right Column - Status and Recommendations */}
580
+ <div className="col-span-1 space-y-6">
581
+ {/* Status Alert */}
582
+ <div className={`bg-gradient-to-br ${statusConfig.color} rounded-xl shadow-2xl p-6 border-4 ${statusConfig.borderColor}`}>
583
+ <div className="flex items-center gap-3 mb-4">
584
+ <StatusIcon size={32} className="text-white" />
585
+ <h2 className="text-2xl font-bold text-white">СТАТУС</h2>
586
+ </div>
587
+ <div className="bg-white rounded-lg p-4 space-y-4">
588
+ <div>
589
+ <p className={`text-2xl font-bold ${statusConfig.textColor}`}>
590
+ {statusConfig.label}
591
+ </p>
592
+ </div>
593
+ <div className="border-t-2 border-gray-200 pt-3">
594
+ <p className="text-xs text-gray-600 font-semibold mb-1">Аномалия:</p>
595
+ <p className="text-sm font-bold text-gray-800">
596
+ Повышение t° на {anomalyTemp}°C за 48 часов
597
+ </p>
598
+ </div>
599
+ <div className="border-t-2 border-gray-200 pt-3">
600
+ <p className="text-xs text-gray-600 font-semibold mb-1">Прогноз отказа:</p>
601
+ <p className={`text-lg font-bold ${statusConfig.textColor}`}>
602
+ {timeToFailure} часов
603
+ </p>
604
+ </div>
605
+ <div className="border-t-2 border-gray-200 pt-3">
606
+ <p className="text-xs text-gray-600 font-semibold mb-1">Текущая температура:</p>
607
+ <p className="text-2xl font-bold text-red-600">
608
+ {currentBearingTemp.toFixed(1)}°C
609
+ </p>
610
+ </div>
611
+ </div>
612
+ </div>
613
+
614
+ {/* AI Recommendation */}
615
+ <div className="bg-white rounded-xl shadow-xl p-6 border-2 border-purple-200">
616
+ <div className="flex items-center gap-2 mb-4">
617
+ <Brain className="text-purple-600" size={24} />
618
+ <h2 className="text-lg font-bold text-gray-800">Рекомендация Neurobox AI</h2>
619
+ </div>
620
+ <div className="bg-purple-50 rounded-lg p-4 border-2 border-purple-200">
621
+ <p className="text-gray-800 text-sm leading-relaxed">
622
+ "Проверить смазку и вибрацию подшипника №2 в ближ��йшую техническую паузу.
623
+ Рекомендуется замена подшипника в течение 48-72 часов для предотвращения аварийного отказа."
624
+ </p>
625
+ </div>
626
+ <div className="mt-4 space-y-2">
627
+ <button className="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-lg flex items-center justify-center gap-2 transition-colors">
628
+ <Tool size={18} />
629
+ Создать заявку на ремонт
630
+ </button>
631
+ <button className="w-full bg-green-600 hover:bg-green-700 text-white font-bold py-3 px-4 rounded-lg flex items-center justify-center gap-2 transition-colors">
632
+ <Zap size={18} />
633
+ Запланировать техпаузу
634
+ </button>
635
+ </div>
636
+ </div>
637
+
638
+ {/* Equipment Info */}
639
+ <div className="bg-white rounded-xl shadow-xl p-6 border-2 border-gray-200">
640
+ <h2 className="text-lg font-bold text-gray-800 mb-4">Информация об оборудовании</h2>
641
+ <div className="space-y-3 text-sm">
642
+ <div className="flex justify-between">
643
+ <span className="text-gray-600">Модель:</span>
644
+ <span className="font-semibold">ДП-45</span>
645
+ </div>
646
+ <div className="flex justify-between">
647
+ <span className="text-gray-600">Мощность:</span>
648
+ <span className="font-semibold">45 кВт</span>
649
+ </div>
650
+ <div className="flex justify-between">
651
+ <span className="text-gray-600">Наработка:</span>
652
+ <span className="font-semibold">18,420 ч</span>
653
+ </div>
654
+ <div className="flex justify-between">
655
+ <span className="text-gray-600">Последнее ТО:</span>
656
+ <span className="font-semibold">15.09.2024</span>
657
+ </div>
658
+ <div className="flex justify-between">
659
+ <span className="text-gray-600">Следующее ТО:</span>
660
+ <span className="font-semibold text-yellow-600">25.11.2024</span>
661
+ </div>
662
+ </div>
663
+ </div>
664
+ </div>
665
+ </div>
666
+ </div>
667
+ </div>
668
+ );
669
+ };
670
+
671
+ const root = ReactDOM.createRoot(document.getElementById('root'));
672
+ root.render(<PredictiveMaintenanceDashboard />);
673
+ </script>
674
+ </body>
675
+ </html>