AssanaliAidarkhan commited on
Commit
f1b1560
·
verified ·
1 Parent(s): f57da70

Upload index.html

Browse files
Files changed (1) hide show
  1. index.html +668 -0
index.html ADDED
@@ -0,0 +1,668 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Eye = ({ 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="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
67
+ <circle cx="12" cy="12" r="3"/>
68
+ </svg>
69
+ );
70
+
71
+ const Camera = ({ size = 24, className = "" }) => (
72
+ <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={className}>
73
+ <path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/>
74
+ <circle cx="12" cy="13" r="4"/>
75
+ </svg>
76
+ );
77
+
78
+ const Settings = ({ size = 24, className = "" }) => (
79
+ <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={className}>
80
+ <circle cx="12" cy="12" r="3"/>
81
+ <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"/>
82
+ </svg>
83
+ );
84
+
85
+ const Zap = ({ size = 24, className = "" }) => (
86
+ <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={className}>
87
+ <polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/>
88
+ </svg>
89
+ );
90
+
91
+ const CheckCircle = ({ size = 24, className = "" }) => (
92
+ <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={className}>
93
+ <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/>
94
+ <polyline points="22 4 12 14.01 9 11.01"/>
95
+ </svg>
96
+ );
97
+
98
+ const Tool = ({ size = 24, className = "" }) => (
99
+ <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={className}>
100
+ <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"/>
101
+ </svg>
102
+ );
103
+
104
+ const Brain = ({ size = 24, className = "" }) => (
105
+ <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={className}>
106
+ <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"/>
107
+ <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"/>
108
+ </svg>
109
+ );
110
+
111
+ const PredictiveMaintenanceDashboard = () => {
112
+ const [currentTime, setCurrentTime] = useState(new Date());
113
+ const [status, setStatus] = useState('warning');
114
+ const [wearLevel, setWearLevel] = useState(68);
115
+ const [timeToFailure, setTimeToFailure] = useState('72-96');
116
+ const [wearHistory, setWearHistory] = useState([]);
117
+ const [currentWear, setCurrentWear] = useState(68);
118
+
119
+ const visualCanvasRef = useRef(null);
120
+ const chartCanvasRef = useRef(null);
121
+
122
+ useEffect(() => {
123
+ const timer = setInterval(() => {
124
+ setCurrentTime(new Date());
125
+ }, 1000);
126
+ return () => clearInterval(timer);
127
+ }, []);
128
+
129
+ // Generate wear history data
130
+ useEffect(() => {
131
+ const generateData = () => {
132
+ const data = [];
133
+ const now = Date.now();
134
+ const dayInMs = 24 * 60 * 60 * 1000;
135
+
136
+ for (let i = 7; i >= 0; i--) {
137
+ const baseWear = 45;
138
+ const wearIncrease = Math.max(0, 7 - i) * 3;
139
+ const wear = baseWear + wearIncrease + Math.random() * 2;
140
+ data.push({
141
+ time: new Date(now - i * dayInMs),
142
+ wear: wear
143
+ });
144
+ }
145
+ return data;
146
+ };
147
+
148
+ setWearHistory(generateData());
149
+
150
+ const wearInterval = setInterval(() => {
151
+ setCurrentWear(prev => {
152
+ const newWear = prev + (Math.random() - 0.3) * 0.2;
153
+ return Math.max(65, Math.min(70, newWear));
154
+ });
155
+ }, 2000);
156
+
157
+ return () => clearInterval(wearInterval);
158
+ }, []);
159
+
160
+ // Draw visual inspection view
161
+ useEffect(() => {
162
+ const canvas = visualCanvasRef.current;
163
+ if (!canvas) return;
164
+
165
+ const ctx = canvas.getContext('2d');
166
+ let animationFrame;
167
+ let scanLine = 0;
168
+
169
+ const animate = () => {
170
+ // Background
171
+ const bgGradient = ctx.createLinearGradient(0, 0, 0, canvas.height);
172
+ bgGradient.addColorStop(0, '#1e293b');
173
+ bgGradient.addColorStop(1, '#0f172a');
174
+ ctx.fillStyle = bgGradient;
175
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
176
+
177
+ // Draw bearing/part visualization
178
+ const centerX = canvas.width / 2;
179
+ const centerY = canvas.height / 2;
180
+
181
+ // Main bearing circle
182
+ const bearingGradient = ctx.createRadialGradient(centerX, centerY, 50, centerX, centerY, 120);
183
+ bearingGradient.addColorStop(0, '#475569');
184
+ bearingGradient.addColorStop(0.7, '#334155');
185
+ bearingGradient.addColorStop(1, '#1e293b');
186
+
187
+ ctx.fillStyle = bearingGradient;
188
+ ctx.beginPath();
189
+ ctx.arc(centerX, centerY, 120, 0, Math.PI * 2);
190
+ ctx.fill();
191
+
192
+ // Inner circle
193
+ ctx.fillStyle = '#1e293b';
194
+ ctx.beginPath();
195
+ ctx.arc(centerX, centerY, 50, 0, Math.PI * 2);
196
+ ctx.fill();
197
+
198
+ // Bearing segments
199
+ ctx.strokeStyle = '#64748b';
200
+ ctx.lineWidth = 2;
201
+ for (let i = 0; i < 8; i++) {
202
+ const angle = (Math.PI * 2 / 8) * i;
203
+ ctx.beginPath();
204
+ ctx.moveTo(centerX + Math.cos(angle) * 50, centerY + Math.sin(angle) * 50);
205
+ ctx.lineTo(centerX + Math.cos(angle) * 120, centerY + Math.sin(angle) * 120);
206
+ ctx.stroke();
207
+ }
208
+
209
+ // Draw wear zones
210
+ const drawWearZone = (angle, radius, severity) => {
211
+ let colors;
212
+ if (severity === 'critical') {
213
+ colors = ['rgba(239, 68, 68, 0.8)', 'rgba(220, 38, 38, 0.4)'];
214
+ } else if (severity === 'warning') {
215
+ colors = ['rgba(234, 179, 8, 0.8)', 'rgba(202, 138, 4, 0.4)'];
216
+ } else {
217
+ colors = ['rgba(34, 197, 94, 0.6)', 'rgba(22, 163, 74, 0.3)'];
218
+ }
219
+
220
+ const gradient = ctx.createRadialGradient(
221
+ centerX + Math.cos(angle) * radius,
222
+ centerY + Math.sin(angle) * radius,
223
+ 0,
224
+ centerX + Math.cos(angle) * radius,
225
+ centerY + Math.sin(angle) * radius,
226
+ 35
227
+ );
228
+ gradient.addColorStop(0, colors[0]);
229
+ gradient.addColorStop(1, colors[1]);
230
+ ctx.fillStyle = gradient;
231
+ ctx.beginPath();
232
+ ctx.arc(
233
+ centerX + Math.cos(angle) * radius,
234
+ centerY + Math.sin(angle) * radius,
235
+ 35,
236
+ 0,
237
+ Math.PI * 2
238
+ );
239
+ ctx.fill();
240
+ };
241
+
242
+ // Normal wear zones
243
+ drawWearZone(0, 85, 'normal');
244
+ drawWearZone(Math.PI / 2, 85, 'normal');
245
+ drawWearZone(Math.PI, 85, 'normal');
246
+
247
+ // Critical wear zone (bottom right)
248
+ const criticalAngle = -Math.PI / 4;
249
+ drawWearZone(criticalAngle, 85, 'critical');
250
+
251
+ // Detection box around critical zone
252
+ const boxX = centerX + Math.cos(criticalAngle) * 85;
253
+ const boxY = centerY + Math.sin(criticalAngle) * 85;
254
+
255
+ ctx.strokeStyle = '#ef4444';
256
+ ctx.lineWidth = 4;
257
+ ctx.setLineDash([10, 5]);
258
+ ctx.strokeRect(boxX - 50, boxY - 50, 100, 100);
259
+ ctx.setLineDash([]);
260
+
261
+ // Warning badge
262
+ ctx.fillStyle = '#ef4444';
263
+ ctx.beginPath();
264
+ ctx.arc(boxX + 45, boxY - 45, 20, 0, Math.PI * 2);
265
+ ctx.fill();
266
+ ctx.fillStyle = '#ffffff';
267
+ ctx.font = 'bold 24px Arial';
268
+ ctx.fillText('!', boxX + 40, boxY - 37);
269
+
270
+ // Wear percentage label
271
+ ctx.fillStyle = '#ef4444';
272
+ ctx.font = 'bold 18px Arial';
273
+ ctx.fillText(`${currentWear.toFixed(0)}% износ`, boxX - 40, boxY + 70);
274
+
275
+ // AI scanning line
276
+ scanLine = (scanLine + 3) % canvas.height;
277
+ const scanGradient = ctx.createLinearGradient(0, scanLine - 2, 0, scanLine + 2);
278
+ scanGradient.addColorStop(0, 'rgba(59, 130, 246, 0)');
279
+ scanGradient.addColorStop(0.5, 'rgba(59, 130, 246, 0.8)');
280
+ scanGradient.addColorStop(1, 'rgba(59, 130, 246, 0)');
281
+ ctx.fillStyle = scanGradient;
282
+ ctx.fillRect(0, scanLine - 2, canvas.width, 4);
283
+
284
+ // Camera overlay
285
+ ctx.fillStyle = 'rgba(255, 255, 255, 0.9)';
286
+ ctx.font = 'bold 14px monospace';
287
+ ctx.fillText('CAMERA 1', 10, 25);
288
+ ctx.font = '12px monospace';
289
+ ctx.fillText('Computer Vision Analysis', 10, 45);
290
+
291
+ // Status indicator
292
+ ctx.fillStyle = '#ef4444';
293
+ ctx.beginPath();
294
+ ctx.arc(canvas.width - 15, 15, 8, 0, Math.PI * 2);
295
+ ctx.fill();
296
+
297
+ // Grid overlay
298
+ ctx.strokeStyle = 'rgba(59, 130, 246, 0.2)';
299
+ ctx.lineWidth = 1;
300
+ const gridSize = 50;
301
+ for (let x = 0; x < canvas.width; x += gridSize) {
302
+ ctx.beginPath();
303
+ ctx.moveTo(x, 0);
304
+ ctx.lineTo(x, canvas.height);
305
+ ctx.stroke();
306
+ }
307
+ for (let y = 0; y < canvas.height; y += gridSize) {
308
+ ctx.beginPath();
309
+ ctx.moveTo(0, y);
310
+ ctx.lineTo(canvas.width, y);
311
+ ctx.stroke();
312
+ }
313
+
314
+ animationFrame = requestAnimationFrame(animate);
315
+ };
316
+
317
+ animate();
318
+ return () => cancelAnimationFrame(animationFrame);
319
+ }, [currentWear]);
320
+
321
+ // Draw wear progression chart
322
+ useEffect(() => {
323
+ const canvas = chartCanvasRef.current;
324
+ if (!canvas || wearHistory.length === 0) return;
325
+
326
+ const ctx = canvas.getContext('2d');
327
+
328
+ ctx.fillStyle = '#f8fafc';
329
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
330
+
331
+ ctx.strokeStyle = '#e2e8f0';
332
+ ctx.lineWidth = 1;
333
+
334
+ for (let i = 0; i <= 5; i++) {
335
+ const y = (canvas.height - 40) * (i / 5) + 20;
336
+ ctx.beginPath();
337
+ ctx.moveTo(50, y);
338
+ ctx.lineTo(canvas.width - 20, y);
339
+ ctx.stroke();
340
+
341
+ const wear = 100 - (i * 10);
342
+ ctx.fillStyle = '#64748b';
343
+ ctx.font = '11px Arial';
344
+ ctx.fillText(`${wear}%`, 10, y + 4);
345
+ }
346
+
347
+ for (let i = 0; i <= 7; i++) {
348
+ const x = 50 + (canvas.width - 70) * (i / 7);
349
+ ctx.beginPath();
350
+ ctx.moveTo(x, 20);
351
+ ctx.lineTo(x, canvas.height - 20);
352
+ ctx.stroke();
353
+
354
+ if (i % 2 === 0) {
355
+ ctx.fillStyle = '#64748b';
356
+ ctx.font = '10px Arial';
357
+ ctx.fillText(`-${7-i}д`, x - 10, canvas.height - 5);
358
+ }
359
+ }
360
+
361
+ const normalThreshold = 50;
362
+ const thresholdY = canvas.height - 20 - ((normalThreshold) / 100) * (canvas.height - 40);
363
+ ctx.strokeStyle = '#22c55e';
364
+ ctx.lineWidth = 2;
365
+ ctx.setLineDash([5, 5]);
366
+ ctx.beginPath();
367
+ ctx.moveTo(50, thresholdY);
368
+ ctx.lineTo(canvas.width - 20, thresholdY);
369
+ ctx.stroke();
370
+ ctx.setLineDash([]);
371
+
372
+ ctx.fillStyle = '#22c55e';
373
+ ctx.font = '10px Arial';
374
+ ctx.fillText('Норма: 50%', canvas.width - 100, thresholdY - 5);
375
+
376
+ ctx.beginPath();
377
+ ctx.strokeStyle = '#3b82f6';
378
+ ctx.lineWidth = 3;
379
+
380
+ wearHistory.forEach((point, index) => {
381
+ const x = 50 + (canvas.width - 70) * (index / 7);
382
+ const y = canvas.height - 20 - ((point.wear) / 100) * (canvas.height - 40);
383
+
384
+ if (index === 0) {
385
+ ctx.moveTo(x, y);
386
+ } else {
387
+ ctx.lineTo(x, y);
388
+ }
389
+ });
390
+ ctx.stroke();
391
+
392
+ wearHistory.forEach((point, index) => {
393
+ const x = 50 + (canvas.width - 70) * (index / 7);
394
+ const y = canvas.height - 20 - ((point.wear) / 100) * (canvas.height - 40);
395
+
396
+ if (point.wear >= 65) {
397
+ ctx.fillStyle = '#ef4444';
398
+ } else if (point.wear >= 50) {
399
+ ctx.fillStyle = '#eab308';
400
+ } else {
401
+ ctx.fillStyle = '#3b82f6';
402
+ }
403
+
404
+ ctx.beginPath();
405
+ ctx.arc(x, y, 5, 0, Math.PI * 2);
406
+ ctx.fill();
407
+ ctx.strokeStyle = '#fff';
408
+ ctx.lineWidth = 2;
409
+ ctx.stroke();
410
+ });
411
+
412
+ const lastPoint = wearHistory[wearHistory.length - 1];
413
+ const lastX = 50 + (canvas.width - 70) * (7 / 7);
414
+ const lastY = canvas.height - 20 - ((lastPoint.wear) / 100) * (canvas.height - 40);
415
+
416
+ ctx.fillStyle = '#ef4444';
417
+ ctx.font = 'bold 12px Arial';
418
+ ctx.fillText('⚠ КРИТИЧЕСКИЙ ИЗНОС', lastX - 120, lastY - 15);
419
+
420
+ ctx.strokeStyle = '#ef4444';
421
+ ctx.fillStyle = '#ef4444';
422
+ ctx.lineWidth = 2;
423
+ ctx.beginPath();
424
+ ctx.moveTo(lastX - 20, lastY - 10);
425
+ ctx.lineTo(lastX - 10, lastY);
426
+ ctx.lineTo(lastX - 20, lastY + 10);
427
+ ctx.fill();
428
+
429
+ }, [wearHistory]);
430
+
431
+ const getStatusConfig = () => {
432
+ switch(status) {
433
+ case 'critical':
434
+ return {
435
+ color: 'from-red-500 to-red-700',
436
+ borderColor: 'border-red-400',
437
+ textColor: 'text-red-600',
438
+ bgColor: 'bg-red-50',
439
+ icon: AlertTriangle,
440
+ label: 'КРИТИЧНО'
441
+ };
442
+ case 'warning':
443
+ return {
444
+ color: 'from-yellow-500 to-orange-600',
445
+ borderColor: 'border-yellow-400',
446
+ textColor: 'text-yellow-600',
447
+ bgColor: 'bg-yellow-50',
448
+ icon: AlertTriangle,
449
+ label: 'ПРЕДУПРЕЖДЕНИЕ'
450
+ };
451
+ default:
452
+ return {
453
+ color: 'from-green-500 to-green-700',
454
+ borderColor: 'border-green-400',
455
+ textColor: 'text-green-600',
456
+ bgColor: 'bg-green-50',
457
+ icon: CheckCircle,
458
+ label: 'НОРМА'
459
+ };
460
+ }
461
+ };
462
+
463
+ const statusConfig = getStatusConfig();
464
+ const StatusIcon = statusConfig.icon;
465
+
466
+ return (
467
+ <div className="min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50 p-6">
468
+ <div className="max-w-7xl mx-auto">
469
+ <div className={`bg-gradient-to-r ${statusConfig.color} rounded-xl shadow-xl p-6 mb-6 border-2 ${statusConfig.borderColor}`}>
470
+ <div className="flex justify-between items-center">
471
+ <div className="flex items-center gap-4">
472
+ <div className="bg-white p-2 rounded-lg">
473
+ <Eye size={32} className={statusConfig.textColor} />
474
+ </div>
475
+ <div>
476
+ <h1 className="text-3xl font-bold text-white">Компьютерное зрение • Детекция износа</h1>
477
+ <p className="text-white text-sm font-medium">Оборудование: Двигатель ДП-45 • Подшипник №2</p>
478
+ </div>
479
+ </div>
480
+ <div className="flex items-center gap-4">
481
+ <div className="bg-white px-4 py-2 rounded-lg shadow-md">
482
+ <Clock size={20} className={`inline ${statusConfig.textColor} mr-2`} />
483
+ <span className="font-mono text-lg text-gray-800 font-semibold">
484
+ {currentTime.toLocaleTimeString('ru-RU')}
485
+ </span>
486
+ </div>
487
+ </div>
488
+ </div>
489
+ </div>
490
+
491
+ <div className="grid grid-cols-3 gap-6">
492
+ <div className="col-span-2 space-y-6">
493
+ <div className="bg-white rounded-xl shadow-xl p-6 border-2 border-blue-200">
494
+ <div className="flex items-center justify-between mb-4">
495
+ <h2 className="text-xl font-bold text-gray-800 flex items-center gap-2">
496
+ <Camera className="text-blue-600" />
497
+ Визуальная инспекция в реальном времени
498
+ </h2>
499
+ <span className="text-sm bg-blue-100 text-blue-700 px-3 py-1 rounded-full font-semibold flex items-center gap-2">
500
+ <span className="w-2 h-2 bg-blue-500 rounded-full animate-pulse"></span>
501
+ AI Анализ
502
+ </span>
503
+ </div>
504
+ <div className="bg-slate-900 rounded-lg overflow-hidden border-2 border-slate-700">
505
+ <canvas
506
+ ref={visualCanvasRef}
507
+ width={800}
508
+ height={400}
509
+ className="w-full"
510
+ />
511
+ </div>
512
+ <div className="mt-4 grid grid-cols-4 gap-3">
513
+ <div className="bg-blue-50 p-3 rounded-lg border border-blue-200">
514
+ <p className="text-xs text-gray-600 mb-1">Сектор 1</p>
515
+ <p className="text-xl font-bold text-blue-600">28%</p>
516
+ <p className="text-xs text-green-600">✓ Норма</p>
517
+ </div>
518
+ <div className={`${statusConfig.bgColor} p-3 rounded-lg border-2 ${statusConfig.borderColor} animate-pulse-yellow`}>
519
+ <p className="text-xs text-gray-600 mb-1">Сектор 2</p>
520
+ <p className={`text-xl font-bold ${statusConfig.textColor}`}>{currentWear.toFixed(0)}%</p>
521
+ <p className={`text-xs ${statusConfig.textColor}`}>⚠ Износ</p>
522
+ </div>
523
+ <div className="bg-blue-50 p-3 rounded-lg border border-blue-200">
524
+ <p className="text-xs text-gray-600 mb-1">Сектор 3</p>
525
+ <p className="text-xl font-bold text-blue-600">32%</p>
526
+ <p className="text-xs text-green-600">✓ Норма</p>
527
+ </div>
528
+ <div className="bg-green-50 p-3 rounded-lg border border-green-200">
529
+ <p className="text-xs text-gray-600 mb-1">Сектор 4</p>
530
+ <p className="text-xl font-bold text-green-600">25%</p>
531
+ <p className="text-xs text-green-600">✓ Норма</p>
532
+ </div>
533
+ </div>
534
+ </div>
535
+
536
+ <div className="bg-white rounded-xl shadow-xl p-6 border-2 border-blue-200">
537
+ <h2 className="text-xl font-bold text-gray-800 mb-4 flex items-center gap-2">
538
+ <TrendingUp className="text-red-600" />
539
+ График износа (Подшипник №2) за 7 дней
540
+ </h2>
541
+ <div className="bg-white rounded-lg border-2 border-gray-200">
542
+ <canvas
543
+ ref={chartCanvasRef}
544
+ width={800}
545
+ height={300}
546
+ className="w-full"
547
+ />
548
+ </div>
549
+ </div>
550
+
551
+ <div className="bg-white rounded-xl shadow-xl p-6 border-2 border-blue-200">
552
+ <h2 className="text-xl font-bold text-gray-800 mb-4 flex items-center gap-2">
553
+ <Settings className="text-blue-600" />
554
+ Эффективность системы
555
+ </h2>
556
+ <div className="grid grid-cols-3 gap-4">
557
+ <div className="bg-gradient-to-br from-green-500 to-green-600 rounded-xl p-5 shadow-lg">
558
+ <p className="text-green-50 text-sm mb-1 font-semibold">Предотвращено аварий</p>
559
+ <p className="text-4xl font-bold text-white">8/10</p>
560
+ <p className="text-green-100 text-xs mt-1">80% успешности</p>
561
+ </div>
562
+ <div className="bg-gradient-to-br from-blue-500 to-blue-600 rounded-xl p-5 shadow-lg">
563
+ <p className="text-blue-50 text-sm mb-1 font-semibold">Точность детекции</p>
564
+ <p className="text-4xl font-bold text-white">95%</p>
565
+ <p className="text-blue-100 text-xs mt-1">Computer Vision</p>
566
+ </div>
567
+ <div className="bg-gradient-to-br from-purple-500 to-purple-600 rounded-xl p-5 shadow-lg">
568
+ <p className="text-purple-50 text-sm mb-1 font-semibold">Время анализа</p>
569
+ <p className="text-4xl font-bold text-white">0.3с</p>
570
+ <p className="text-purple-100 text-xs mt-1">На изображение</p>
571
+ </div>
572
+ </div>
573
+ </div>
574
+ </div>
575
+
576
+ <div className="col-span-1 space-y-6">
577
+ <div className={`bg-gradient-to-br ${statusConfig.color} rounded-xl shadow-2xl p-6 border-4 ${statusConfig.borderColor}`}>
578
+ <div className="flex items-center gap-3 mb-4">
579
+ <StatusIcon size={32} className="text-white" />
580
+ <h2 className="text-2xl font-bold text-white">СТАТУС</h2>
581
+ </div>
582
+ <div className="bg-white rounded-lg p-4 space-y-4">
583
+ <div>
584
+ <p className={`text-2xl font-bold ${statusConfig.textColor}`}>
585
+ {statusConfig.label}
586
+ </p>
587
+ </div>
588
+ <div className="border-t-2 border-gray-200 pt-3">
589
+ <p className="text-xs text-gray-600 font-semibold mb-1">Обнаружено:</p>
590
+ <p className="text-sm font-bold text-gray-800">
591
+ Критический износ поверхности
592
+ </p>
593
+ </div>
594
+ <div className="border-t-2 border-gray-200 pt-3">
595
+ <p className="text-xs text-gray-600 font-semibold mb-1">Прогноз отказа:</p>
596
+ <p className={`text-lg font-bold ${statusConfig.textColor}`}>
597
+ {timeToFailure} часов
598
+ </p>
599
+ </div>
600
+ <div className="border-t-2 border-gray-200 pt-3">
601
+ <p className="text-xs text-gray-600 font-semibold mb-1">Уровень износа:</p>
602
+ <p className="text-2xl font-bold text-red-600">
603
+ {currentWear.toFixed(0)}%
604
+ </p>
605
+ </div>
606
+ </div>
607
+ </div>
608
+
609
+ <div className="bg-white rounded-xl shadow-xl p-6 border-2 border-purple-200">
610
+ <div className="flex items-center gap-2 mb-4">
611
+ <Brain className="text-purple-600" size={24} />
612
+ <h2 className="text-lg font-bold text-gray-800">Рекомендация Neurobox AI</h2>
613
+ </div>
614
+ <div className="bg-purple-50 rounded-lg p-4 border-2 border-purple-200">
615
+ <p className="text-gray-800 text-sm leading-relaxed">
616
+ "Обнаружен критический износ поверхности подшипника №2 (сектор 2).
617
+ Рекомендуется срочная замена подшипника в течение 48-72 часов для предотвращения аварийного отказа."
618
+ </p>
619
+ </div>
620
+ <div className="mt-4 space-y-2">
621
+ <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">
622
+ <Tool size={18} />
623
+ Создать заявку на ремонт
624
+ </button>
625
+ <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">
626
+ <Zap size={18} />
627
+ Запланировать техпаузу
628
+ </button>
629
+ </div>
630
+ </div>
631
+
632
+ <div className="bg-white rounded-xl shadow-xl p-6 border-2 border-gray-200">
633
+ <h2 className="text-lg font-bold text-gray-800 mb-4">Информация об оборудовании</h2>
634
+ <div className="space-y-3 text-sm">
635
+ <div className="flex justify-between">
636
+ <span className="text-gray-600">Модель:</span>
637
+ <span className="font-semibold">ДП-45</span>
638
+ </div>
639
+ <div className="flex justify-between">
640
+ <span className="text-gray-600">Компонент:</span>
641
+ <span className="font-semibold">Подшипник №2</span>
642
+ </div>
643
+ <div className="flex justify-between">
644
+ <span className="text-gray-600">Наработка:</span>
645
+ <span className="font-semibold">18,420 ч</span>
646
+ </div>
647
+ <div className="flex justify-between">
648
+ <span className="text-gray-600">Последнее ТО:</span>
649
+ <span className="font-semibold">15.09.2024</span>
650
+ </div>
651
+ <div className="flex justify-between">
652
+ <span className="text-gray-600">Метод контроля:</span>
653
+ <span className="font-semibold text-blue-600">Computer Vision</span>
654
+ </div>
655
+ </div>
656
+ </div>
657
+ </div>
658
+ </div>
659
+ </div>
660
+ </div>
661
+ );
662
+ };
663
+
664
+ const root = ReactDOM.createRoot(document.getElementById('root'));
665
+ root.render(<PredictiveMaintenanceDashboard />);
666
+ </script>
667
+ </body>
668
+ </html>