File size: 4,015 Bytes
7ee531a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Offline - Zenith Fraud Detection</title>
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      min-height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 20px;
    }

    .container {
      background: white;
      border-radius: 16px;
      padding: 48px;
      max-width: 500px;
      text-align: center;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    }

    .icon {
      width: 80px;
      height: 80px;
      margin: 0 auto 24px;
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 40px;
    }

    h1 {
      font-size: 28px;
      color: #1a202c;
      margin-bottom: 16px;
      font-weight: 700;
    }

    p {
      font-size: 16px;
      color: #4a5568;
      line-height: 1.6;
      margin-bottom: 24px;
    }

    .retry-button {
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      color: white;
      border: none;
      padding: 14px 32px;
      border-radius: 8px;
      font-size: 16px;
      font-weight: 600;
      cursor: pointer;
      transition: transform 0.2s, box-shadow 0.2s;
    }

    .retry-button:hover {
      transform: translateY(-2px);
      box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
    }

    .retry-button:active {
      transform: translateY(0);
    }

    .status {
      margin-top: 24px;
      padding: 12px;
      background: #f7fafc;
      border-radius: 8px;
      font-size: 14px;
      color: #718096;
    }

    .spinner {
      display: inline-block;
      width: 16px;
      height: 16px;
      border: 2px solid #e2e8f0;
      border-top-color: #667eea;
      border-radius: 50%;
      animation: spin 1s linear infinite;
      margin-right: 8px;
      vertical-align: middle;
    }

    @keyframes spin {
      to { transform: rotate(360deg); }
    }

    .hidden {
      display: none;
    }
  </style>
</head>
<body>
  <div class="container">
    <div class="icon">📡</div>
    <h1>You're Offline</h1>
    <p>
      It looks like you've lost your internet connection. 
      Zenith requires an active connection to access fraud detection services.
    </p>
    <p>
      Don't worry - your work is saved locally and will sync when you're back online.
    </p>
    
    <button class="retry-button" onclick="retryConnection()">
      Retry Connection
    </button>

    <div class="status hidden" id="status">
      <span class="spinner"></span>
      <span id="statusText">Checking connection...</span>
    </div>
  </div>

  <script>
    function retryConnection() {
      const status = document.getElementById('status');
      const statusText = document.getElementById('statusText');
      
      status.classList.remove('hidden');
      statusText.textContent = 'Checking connection...';

      fetch('/api/v1/health', { method: 'HEAD' })
        .then(() => {
          statusText.textContent = 'Connection restored! Redirecting...';
          setTimeout(() => {
            window.location.href = '/';
          }, 1000);
        })
        .catch(() => {
          statusText.textContent = 'Still offline. Please try again.';
          setTimeout(() => {
            status.classList.add('hidden');
          }, 3000);
        });
    }

    // Auto-retry every 30 seconds
    setInterval(() => {
      fetch('/api/v1/health', { method: 'HEAD' })
        .then(() => {
          window.location.href = '/';
        })
        .catch(() => {
          console.log('Still offline...');
        });
    }, 30000);
  </script>
</body>
</html>