File size: 1,933 Bytes
917af0c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<html>

<head>
    <title>Sync Status</title>
    <script type="module">
        import { store } from "/components/sync/sync-store.js";
    </script>

    <style>
        .status-icon {
            display: inline-flex;
            align-items: center;
            gap: 0.1rem;
        }

        .status-icon svg {
            pointer-events: none;
        }

        .status-icon > x-extension {
            display: contents;
        }

        .pending-ring {
            animation: pendingPulse 1.2s infinite ease-in-out;
        }

        @keyframes pendingPulse {
            0% {
                stroke-opacity: 1;
                stroke-width: 3;
            }

            50% {
                stroke-opacity: 0.25;
                stroke-width: 5;
            }

            100% {
                stroke-opacity: 1;
                stroke-width: 3;
            }
        }
    </style>
</head>

<body>
    <div x-data>
        <template x-if="$store.sync">
            <div
                class="status-icon"
                x-create="$store.sync.init()"
            >
                <svg viewBox="0 0 30 30" width="20" height="20" aria-label="sync status">
                    <circle
                        cx="15" cy="15" r="12" fill="none" stroke="#e40138" stroke-width="3"
                        :class="{ 'pending-ring': $store.sync.mode === 'HANDSHAKE_PENDING' }"
                        :r="['HEALTHY', 'DEGRADED'].includes($store.sync.mode) ? 8 : 12"
                        :fill="$store.sync.mode === 'HEALTHY' ? '#00c340' : $store.sync.mode === 'DEGRADED' ? '#ff6b00' : 'none'"
                        :stroke="$store.sync.mode === 'HANDSHAKE_PENDING' ? '#f0a000' : $store.sync.mode === 'DISCONNECTED' ? '#e40138' : 'none'"
                    />
                </svg>
                <x-extension id="sync-status-end"></x-extension>
            </div>
        </template>
    </div>
</body>

</html>