Spaces:
Sleeping
Sleeping
Naufal Arhab commited on
Commit ·
bbf8ecc
1
Parent(s): c132c62
fix(ui): improve WSIndicator colors and add descriptive tooltips
Browse files
frontend/src/components/layout/Header.tsx
CHANGED
|
@@ -23,41 +23,42 @@ function WSIndicator({ status }: { status: WSStatus }) {
|
|
| 23 |
const config = {
|
| 24 |
connected: {
|
| 25 |
color: 'text-signal-long',
|
|
|
|
| 26 |
dot: 'bg-signal-long animate-pulse',
|
| 27 |
label: 'Live',
|
|
|
|
| 28 |
icon: <Wifi size={12} />,
|
| 29 |
},
|
| 30 |
connecting: {
|
| 31 |
color: 'text-accent-yellow',
|
|
|
|
| 32 |
dot: 'bg-accent-yellow animate-pulse',
|
| 33 |
label: 'Sync...',
|
|
|
|
| 34 |
icon: <RefreshCw size={12} className="animate-spin" />,
|
| 35 |
},
|
| 36 |
disconnected: {
|
| 37 |
-
color: 'text-
|
| 38 |
-
|
|
|
|
| 39 |
label: 'Sync',
|
| 40 |
-
|
|
|
|
| 41 |
},
|
| 42 |
error: {
|
| 43 |
-
color: 'text-
|
| 44 |
-
|
| 45 |
-
|
|
|
|
|
|
|
| 46 |
icon: <RefreshCw size={12} />,
|
| 47 |
},
|
| 48 |
}[status];
|
| 49 |
|
| 50 |
return (
|
| 51 |
<div
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
status === 'connected'
|
| 55 |
-
? 'border-signal-long/20 bg-signal-long-bg'
|
| 56 |
-
: status === 'connecting'
|
| 57 |
-
? 'border-accent-yellow/20 bg-yellow-500/5'
|
| 58 |
-
: 'border-signal-short/20 bg-signal-short-bg'
|
| 59 |
-
}
|
| 60 |
-
${config.color}`}
|
| 61 |
>
|
| 62 |
<span className={`w-1.5 h-1.5 rounded-full ${config.dot}`} />
|
| 63 |
{config.icon}
|
|
|
|
| 23 |
const config = {
|
| 24 |
connected: {
|
| 25 |
color: 'text-signal-long',
|
| 26 |
+
bg: 'border-signal-long/20 bg-signal-long-bg',
|
| 27 |
dot: 'bg-signal-long animate-pulse',
|
| 28 |
label: 'Live',
|
| 29 |
+
tooltip: 'Koneksi real-time aktif (WebSocket Live)',
|
| 30 |
icon: <Wifi size={12} />,
|
| 31 |
},
|
| 32 |
connecting: {
|
| 33 |
color: 'text-accent-yellow',
|
| 34 |
+
bg: 'border-accent-yellow/20 bg-yellow-500/10',
|
| 35 |
dot: 'bg-accent-yellow animate-pulse',
|
| 36 |
label: 'Sync...',
|
| 37 |
+
tooltip: 'Menghubungkan ke server pasar...',
|
| 38 |
icon: <RefreshCw size={12} className="animate-spin" />,
|
| 39 |
},
|
| 40 |
disconnected: {
|
| 41 |
+
color: 'text-amber-400',
|
| 42 |
+
bg: 'border-amber-500/25 bg-amber-500/10',
|
| 43 |
+
dot: 'bg-amber-400 animate-pulse',
|
| 44 |
label: 'Sync',
|
| 45 |
+
tooltip: 'Koneksi terputus. Mencoba rekoneksi otomatis...',
|
| 46 |
+
icon: <RefreshCw size={12} className="animate-spin" />,
|
| 47 |
},
|
| 48 |
error: {
|
| 49 |
+
color: 'text-signal-short',
|
| 50 |
+
bg: 'border-signal-short/20 bg-signal-short-bg',
|
| 51 |
+
dot: 'bg-signal-short',
|
| 52 |
+
label: 'Offline',
|
| 53 |
+
tooltip: 'Koneksi ke backend server terputus',
|
| 54 |
icon: <RefreshCw size={12} />,
|
| 55 |
},
|
| 56 |
}[status];
|
| 57 |
|
| 58 |
return (
|
| 59 |
<div
|
| 60 |
+
title={config.tooltip}
|
| 61 |
+
className={`flex items-center gap-1.5 px-2 sm:px-3 py-1 sm:py-1.5 rounded-full border text-[11px] font-medium shrink-0 ${config.bg} ${config.color}`}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
>
|
| 63 |
<span className={`w-1.5 h-1.5 rounded-full ${config.dot}`} />
|
| 64 |
{config.icon}
|