File size: 13,971 Bytes
1a0914a
 
 
 
 
 
9e3916d
 
 
1a0914a
 
 
 
 
9e3916d
 
 
 
 
 
 
 
 
 
 
 
1a0914a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9e3916d
 
1a0914a
9e3916d
1a0914a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9e3916d
 
 
1a0914a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9e3916d
 
 
 
 
1a0914a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Claim Link - AstraPay</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Erica+One&display=swap" rel="stylesheet">
    <style>
        body {
            margin: 0;
            padding: 0;
            min-height: 100vh;
            background: linear-gradient(180deg, 
                #0f0514 0%,
                #1a0a1a 15%,
                #2d1a3d 35%,
                #4a2a5a 50%,
                #3d2a4a 60%,
                #2d1a3d 70%,
                #1a0a1a 80%,
                #0f0514 85%,
                #000000 100%
            );
            background-attachment: fixed;
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            color: #ffffff;
            line-height: 1.6;
        }
        .main-content {
            margin-top: 0;
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 2rem 0;
        }
        .container {
            text-align: center;
            max-width: 500px;
            padding: 2rem;
        }
        .title {
            font-size: 2.2rem;
            font-weight: normal;
            font-family: 'Erica One', cursive;
            margin-bottom: 1.5rem;
            letter-spacing: 0.02em;
        }
        .claim-card {
            background: rgba(255, 255, 255, 0.02);
            backdrop-filter: blur(20px);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 16px;
            padding: 2.5rem;
            margin-bottom: 2rem;
            position: relative;
            overflow: hidden;
        }
        .claim-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 1px;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
        }
        .amount {
            font-size: 3.2rem;
            font-weight: 700;
            background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            margin-bottom: 0.5rem;
            letter-spacing: -0.02em;
        }
        .status {
            font-size: 0.95rem;
            padding: 0.5rem 1.2rem;
            border-radius: 20px;
            display: inline-block;
            margin-bottom: 2rem;
            font-weight: 500;
            letter-spacing: 0.01em;
        }
        .status.pending {
            background: rgba(255, 193, 7, 0.15);
            color: #ffc107;
            border: 1px solid rgba(255, 193, 7, 0.3);
        }
        .status.verified {
            background: rgba(0, 255, 136, 0.15);
            color: #00ff88;
            border: 1px solid rgba(0, 255, 136, 0.3);
        }
        .status.claimed {
            background: rgba(100, 100, 255, 0.15);
            color: #6464ff;
            border: 1px solid rgba(100, 100, 255, 0.3);
        }
        .claim-button {
            background: linear-gradient(135deg, #ffffff 0%, #f8f8f8 100%);
            color: #000000;
            border: none;
            padding: 1rem 2.5rem;
            font-size: 1rem;
            font-weight: 600;
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.3s ease;
            letter-spacing: 0.01em;
            box-shadow: 0 4px 20px rgba(255, 255, 255, 0.1);
        }
        .claim-button:hover:not(:disabled) {
            transform: translateY(-2px);
            box-shadow: 0 8px 30px rgba(255, 255, 255, 0.2);
        }
        .claim-button:disabled {
            background: rgba(255, 255, 255, 0.3);
            color: rgba(255, 255, 255, 0.5);
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }
        .info-text {
            font-size: 0.9rem;
            color: rgba(255, 255, 255, 0.7);
            margin-bottom: 1rem;
        }
        .back-link {
            color: rgba(255, 255, 255, 0.6);
            text-decoration: none;
            font-size: 0.9rem;
            margin-top: 2rem;
            display: inline-block;
            font-weight: 500;
            transition: color 0.3s ease;
        }
        .back-link:hover {
            color: rgba(255, 255, 255, 0.9);
        }
        .claim-modal {
            display: none;
            position: fixed;
            z-index: 1;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.9);
        }
        .claim-modal-content {
            background-color: #1a1a1a;
            margin: 15% auto;
            padding: 2rem;
            border-radius: 12px;
            width: 90%;
            max-width: 500px;
            border: 1px solid rgba(255, 255, 255, 0.1);
            text-align: center;
        }
        .claim-modal-title {
            font-family: 'Erica One', cursive;
            font-weight: normal;
            letter-spacing: 0.02em;
            color: #ffffff;
            font-size: 1.5rem;
            font-weight: bold;
            margin-bottom: 1.5rem;
        }
        .form-input {
            width: 100%;
            padding: 0.75rem;
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 8px;
            background-color: rgba(255, 255, 255, 0.05);
            color: #ffffff;
            font-size: 1rem;
            margin: 1rem 0;
            box-sizing: border-box;
        }
        .form-input:focus {
            outline: none;
            border-color: rgba(255, 255, 255, 0.4);
            background-color: rgba(255, 255, 255, 0.1);
        }
        .claim-modal-buttons {
            display: flex;
            gap: 1rem;
            justify-content: center;
            margin-top: 2rem;
        }
        .btn-secondary {
            background-color: transparent;
            color: rgba(255, 255, 255, 0.9);
            border: 1px solid rgba(255, 255, 255, 0.2);
            padding: 0.75rem 1.5rem;
            border-radius: 8px;
            cursor: pointer;
            font-size: 1rem;
            transition: all 0.2s ease;
        }
        .btn-secondary:hover {
            background-color: rgba(255, 255, 255, 0.1);
        }
        .success-message {
            font-size: 1.2rem;
            color: #00ff88;
            font-weight: 500;
            margin-top: 1rem;
        }
    </style>
</head>
<body>
    <div class="main-content">
        <div class="container">
        <h1 class="title">AstraPay Claim</h1>

        <div class="claim-card">
            <div class="amount">{{ claim_amount }} Astra{{ 's' if claim_amount > 1 else '' }}</div>
            {% if fee > 0 %}
                <div class="info-text" style="margin-bottom: 0.5rem; color: rgba(255, 255, 255, 0.6); font-size: 0.85rem;">
                    Fee: {{ fee }} Astra{{ 's' if fee > 1 else '' }} ({{ fee_percent }}%)
                </div>
            {% endif %}
            {% if not claimed %}
                <div class="info-text" style="margin-bottom: 1rem;">
                    Send {{ send_amount }} Astra{{ 's' if send_amount > 1 else '' }} to astrapay@astranova.org to verify
                </div>
            {% endif %}
            <div class="status {{ 'claimed' if claimed else ('verified' if verified else 'pending') }}">
                {% if claimed %}
                    Claimed
                {% elif verified %}
                    Verified - Ready to Claim
                {% else %}
                    Pending Verification
                {% endif %}
            </div>

            {% if not claimed %}
                {% if verified %}
                    <button class="claim-button" onclick="openClaimModal()" style="margin-top: 1rem; display: flex; align-items: center; gap: 0.5rem; justify-content: center;">
                        <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                            <polyline points="20 6 9 17 4 12"></polyline>
                        </svg>
                        Claim {{ claim_amount }} Astra{{ 's' if claim_amount > 1 else '' }}
                    </button>
                {% else %}
                    <div class="info-text" style="margin-top: 1rem;">Waiting for payment verification...</div>
                {% endif %}
            {% else %}
                <div class="success-message" style="margin-top: 1rem;">βœ“ Claimed{% if claimer_email %} by {{ claimer_email }}{% endif %}</div>
            {% endif %}
        </div>

        <a href="/" class="back-link">← Back to AstraPay</a>
    </div>

    <div id="claimModal" class="claim-modal">
        <div class="claim-modal-content">
            <div class="claim-modal-title">Claim Astras</div>
            <div style="color: #cccccc; margin-bottom: 1.5rem;">
                Enter your AstraNova email to receive {{ claim_amount }} Astra{{ 's' if claim_amount > 1 else '' }}
            </div>
            <input type="email" id="claimer-email" class="form-input" placeholder="Enter your AstraNova email" required>
            <div class="claim-modal-buttons">
                <button class="btn-secondary" onclick="closeClaimModal()" style="display: flex; align-items: center; gap: 0.5rem;">
                    <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                        <line x1="18" y1="6" x2="6" y2="18"></line>
                        <line x1="6" y1="6" x2="18" y2="18"></line>
                    </svg>
                    Cancel
                </button>
                <button class="claim-button" onclick="processClaim()" style="display: flex; align-items: center; gap: 0.5rem;">
                    <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                        <polyline points="20 6 9 17 4 12"></polyline>
                    </svg>
                    Claim
                </button>
            </div>
        </div>
    </div>

    <script>
        let verificationInterval;

        {% if not verified and not claimed %}
        function startVerificationCheck() {
            verificationInterval = setInterval(async () => {
                try {
                    const response = await fetch('/check-claim-verification/{{ claim_id }}');
                    const data = await response.json();

                    if (data.verified) {
                        stopVerificationCheck();
                        location.reload();
                    }
                } catch (error) {
                    console.log('Error checking verification:', error);
                }
            }, 2000);
        }

        function stopVerificationCheck() {
            if (verificationInterval) {
                clearInterval(verificationInterval);
                verificationInterval = null;
            }
        }

        startVerificationCheck();

        window.onbeforeunload = function() {
            stopVerificationCheck();
        };
        {% endif %}

        function openClaimModal() {
            document.getElementById('claimModal').style.display = 'block';
        }

        function closeClaimModal() {
            document.getElementById('claimModal').style.display = 'none';
            document.getElementById('claimer-email').value = '';
        }

        async function processClaim() {
            const email = document.getElementById('claimer-email').value.trim();

            if (!email) {
                alert('Please enter your email address');
                return;
            }

            const claimButton = document.querySelector('#claimModal .claim-button');
            claimButton.disabled = true;
            claimButton.textContent = 'Claiming...';

            try {
                const response = await fetch('/claim/{{ claim_id }}', {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json',
                    },
                    body: JSON.stringify({
                        email: email
                    })
                });

                const data = await response.json();

                if (response.ok) {
                    document.querySelector('.claim-modal-content').innerHTML = `
                        <div class="claim-modal-title">Claim Successful!</div>
                        <div class="success-message" style="margin-top: 1rem;">
                            ${data.message}
                        </div>
                    `;
                    setTimeout(() => {
                        location.reload();
                    }, 2000);
                } else {
                    alert('Claim failed: ' + data.error);
                    claimButton.disabled = false;
                    claimButton.textContent = 'Claim';
                }
            } catch (error) {
                alert('Claim failed: ' + error.message);
                claimButton.disabled = false;
                claimButton.textContent = 'Claim';
            }
        }

        window.onclick = function(event) {
            const modal = document.getElementById('claimModal');
            if (event.target == modal) {
                closeClaimModal();
            }
        }
    </script>
    </div>
</body>
</html>