-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.html
More file actions
777 lines (710 loc) · 44.5 KB
/
app.html
File metadata and controls
777 lines (710 loc) · 44.5 KB
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
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>TrueRecord — Grievance Reporting</title>
<link rel="preconnect" href="https://fonts.googleapis.com"/>
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet"/>
<script src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: #080c14; color: #e2e8f0; font-family: 'DM Sans', 'Helvetica Neue', sans-serif; font-size: 14px; line-height: 1.5; }
input, select, textarea, button { font-family: inherit; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0a111c; }
::-webkit-scrollbar-thumb { background: #1e2d3d; border-radius: 99px; }
select option { background: #0d1520; color: #e2e8f0; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideUp { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:none; } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }
@keyframes chainGrow { from { height:0 } to { height:100% } }
.slide-up { animation: slideUp 0.25s ease forwards; }
.fade-in { animation: fadeIn 0.2s ease forwards; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #2563eb !important; box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
</style>
</head>
<body>
<div id="root"></div>
<script type="text/babel">
const { useState, useEffect, useMemo, useRef, useCallback } = React;
// ─── Constants ────────────────────────────────────────────────────────────────
const LS_KEY = "truerecord_v2";
const LS_IDS = "truerecord_myids_v2";
const INCIDENT_TYPES = ["Harassment","Discrimination","Safety / Hazard","Wage & Hour","Retaliation","Policy Violation","Workplace Violence","Ethics Concern","Other"];
const DEPTS = ["Operations","Sales","Marketing","HR","Finance","Engineering","Support","Legal","Executive"];
const STATUSES = ["New","Under Review","In Progress","Resolved","Closed"];
const PRIORITIES = ["Low","Medium","High","Critical"];
const STATUS_META = {
"New": { bg:"#1e3a5f", text:"#60a5fa", border:"#2563eb" },
"Under Review": { bg:"#3b2a0a", text:"#fbbf24", border:"#d97706" },
"In Progress": { bg:"#2d1b69", text:"#a78bfa", border:"#7c3aed" },
"Resolved": { bg:"#064e3b", text:"#34d399", border:"#059669" },
"Closed": { bg:"#1e293b", text:"#94a3b8", border:"#475569" },
};
const PRIORITY_META = {
"Low": { text:"#94a3b8", dot:"#475569" },
"Medium": { text:"#60a5fa", dot:"#3b82f6" },
"High": { text:"#fbbf24", dot:"#f59e0b" },
"Critical": { text:"#f87171", dot:"#ef4444" },
};
// ─── Utilities ────────────────────────────────────────────────────────────────
const uid = () => Math.random().toString(36).slice(2,10).toUpperCase();
const sleep = ms => new Promise(r => setTimeout(r, ms));
function hashStr(s) {
let h = 5381;
for (let i = 0; i < s.length; i++) h = ((h << 5) + h) ^ s.charCodeAt(i);
return (h >>> 0).toString(16).padStart(8,"0").toUpperCase();
}
function makeCommitment(data) {
const salt = uid() + uid();
const payload = JSON.stringify(data) + salt + Date.now();
return { hash: hashStr(payload), salt, ts: Date.now() };
}
const fmt = ts => new Date(ts).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"});
const fmtDate = ts => new Date(ts).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});
// ─── Storage ──────────────────────────────────────────────────────────────────
const loadAll = () => { try { return JSON.parse(localStorage.getItem(LS_KEY)||"[]"); } catch { return []; } };
const saveAll = items => localStorage.setItem(LS_KEY, JSON.stringify(items));
const loadMyIds = () => { try { return JSON.parse(localStorage.getItem(LS_IDS)||"[]"); } catch { return []; } };
const saveMyIds = ids => localStorage.setItem(LS_IDS, JSON.stringify(ids));
async function apiCreate(payload) {
await sleep(700);
const items = loadAll();
const commitment = makeCommitment(payload.data);
const item = {
id: uid(), createdAt: Date.now(), updatedAt: Date.now(), status:"New",
priority: payload.priority||"Medium", commitment,
auditLog:[{ ts:Date.now(), action:"SUBMITTED", actor: payload.anonymous?"ANON":(payload.data.name||"Reporter"), hash:commitment.hash }],
...payload,
};
items.unshift(item); saveAll(items); return item;
}
async function apiUpdate(id, patch) {
await sleep(250);
const items = loadAll();
const idx = items.findIndex(g=>g.id===id);
if (idx<0) throw new Error("Not found");
const newLog = [...(items[idx].auditLog||[]), {
ts:Date.now(), action: patch.status?`STATUS → ${patch.status}`:"UPDATED",
actor:"HR Admin", hash: hashStr(JSON.stringify(patch)+Date.now()),
}];
items[idx] = { ...items[idx], ...patch, updatedAt:Date.now(), auditLog:newLog };
saveAll(items); return items[idx];
}
async function apiDelete(id) {
await sleep(150);
saveAll(loadAll().filter(g=>g.id!==id));
}
function exportCSV(items) {
const h = ["ID","Status","Priority","IncidentType","Department","Location","Date","Anonymous","Confidential","Submitted","Hash","Description"];
const rows = items.map(g=>[
g.id, g.status, g.priority||"",
g.data.incidentType||"", g.data.department||"", g.data.location||"",
g.data.date||"", g.anonymous?"Yes":"No", g.confidential?"Yes":"No",
fmtDate(g.createdAt), g.commitment?.hash||"",
`"${(g.data.description||"").replace(/"/g,'""')}"`,
]);
const csv = [h,...rows].map(r=>r.join(",")).join("\n");
const a = document.createElement("a");
a.href = URL.createObjectURL(new Blob([csv],{type:"text/csv"}));
a.download = `truerecord_${Date.now()}.csv`; a.click();
}
// ─── Styles ───────────────────────────────────────────────────────────────────
const S = {
card: { background:"#0d1520", border:"1px solid #1e2d3d", borderRadius:16, padding:24 },
input: { width:"100%", background:"#080c14", border:"1px solid #1e2d3d", borderRadius:10, padding:"10px 14px", color:"#e2e8f0", fontSize:14 },
select: { width:"100%", background:"#080c14", border:"1px solid #1e2d3d", borderRadius:10, padding:"10px 14px", color:"#e2e8f0", fontSize:14, appearance:"none", cursor:"pointer" },
label: { display:"block", fontSize:11, fontWeight:700, color:"#475569", letterSpacing:"0.09em", textTransform:"uppercase", marginBottom:6 },
btn: { background:"linear-gradient(135deg,#1d4ed8,#4f46e5)", color:"#fff", border:"none", borderRadius:10, padding:"11px 22px", fontSize:14, fontWeight:600, cursor:"pointer", display:"inline-flex", alignItems:"center", gap:8 },
btnOut: { background:"transparent", color:"#94a3b8", border:"1px solid #1e2d3d", borderRadius:10, padding:"10px 18px", fontSize:14, fontWeight:500, cursor:"pointer", display:"inline-flex", alignItems:"center", gap:8 },
btnSm: { background:"transparent", color:"#64748b", border:"1px solid #1e2d3d", borderRadius:8, padding:"5px 10px", fontSize:12, cursor:"pointer", display:"inline-flex", alignItems:"center", gap:5 },
mono: { fontFamily:"'JetBrains Mono','Fira Code',monospace", fontSize:12 },
pill: { display:"inline-flex", alignItems:"center", gap:4, padding:"3px 10px", borderRadius:99, fontSize:12, fontWeight:600, border:"1px solid" },
};
// ─── Icon helpers ─────────────────────────────────────────────────────────────
const Icon = ({ d, size=16, color="currentColor", stroke=2, fill="none" }) => (
<svg width={size} height={size} viewBox="0 0 24 24" fill={fill} stroke={color} strokeWidth={stroke} strokeLinecap="round" strokeLinejoin="round">
<path d={d}/>
</svg>
);
// ─── Toast ────────────────────────────────────────────────────────────────────
function useToasts() {
const [toasts, setToasts] = useState([]);
const push = useCallback((title, desc) => {
const id = uid();
setToasts(t=>[...t,{id,title,desc}]);
setTimeout(()=>setToasts(t=>t.filter(x=>x.id!==id)), 3500);
},[]);
return { toasts, push };
}
function Toasts({ toasts }) {
return (
<div style={{ position:"fixed", bottom:24, right:24, zIndex:200, display:"flex", flexDirection:"column", gap:8 }}>
{toasts.map(t=>(
<div key={t.id} className="slide-up" style={{ background:"#0d1520", border:"1px solid #1e2d3d", borderRadius:12, padding:"12px 18px", minWidth:260, boxShadow:"0 8px 32px rgba(0,0,0,.5)" }}>
<div style={{ fontWeight:600, fontSize:13, color:"#e2e8f0" }}>{t.title}</div>
{t.desc && <div style={{ fontSize:12, color:"#64748b", marginTop:3 }}>{t.desc}</div>}
</div>
))}
</div>
);
}
// ─── Components ───────────────────────────────────────────────────────────────
function StatusPill({ status }) {
const m = STATUS_META[status]||STATUS_META["New"];
return <span style={{ ...S.pill, background:m.bg, color:m.text, borderColor:m.border }}>{status}</span>;
}
function PriorityDot({ priority }) {
const p = PRIORITY_META[priority]||PRIORITY_META["Medium"];
return (
<span style={{ display:"inline-flex", alignItems:"center", gap:5, fontSize:12, color:p.text, fontWeight:600 }}>
<span style={{ width:7, height:7, borderRadius:"50%", background:p.dot, display:"inline-block" }}/>
{priority}
</span>
);
}
function Toggle({ checked, onChange, label, sub }) {
return (
<div style={{ background:"#080c14", border:"1px solid #1e2d3d", borderRadius:12, padding:"14px 16px", display:"flex", alignItems:"center", justifyContent:"space-between", gap:12 }}>
<div>
<div style={{ fontWeight:600, fontSize:13, color:"#e2e8f0" }}>{label}</div>
{sub && <div style={{ fontSize:12, color:"#64748b", marginTop:2 }}>{sub}</div>}
</div>
<button onClick={()=>onChange(!checked)} style={{ width:44, height:24, borderRadius:99, border:"none", cursor:"pointer", position:"relative", background:checked?"#1d4ed8":"#1e2d3d", transition:"background .2s", flexShrink:0 }}>
<span style={{ position:"absolute", top:3, left:checked?22:3, width:18, height:18, borderRadius:"50%", background:"#fff", transition:"left .2s" }}/>
</button>
</div>
);
}
function Check({ checked, onChange, label }) {
return (
<label style={{ display:"flex", alignItems:"flex-start", gap:10, cursor:"pointer", fontSize:13, color:"#94a3b8" }}>
<span onClick={()=>onChange(!checked)} style={{ width:18, height:18, minWidth:18, borderRadius:5, border:checked?"none":"1px solid #334155", background:checked?"#1d4ed8":"transparent", display:"flex", alignItems:"center", justifyContent:"center", marginTop:1, cursor:"pointer", flexShrink:0 }}>
{checked && <svg width="11" height="9" viewBox="0 0 11 9" fill="none"><path d="M1 4L4 7L10 1" stroke="#fff" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"/></svg>}
</span>
<span>{label}</span>
</label>
);
}
function TagInput({ tags, onChange }) {
const [val, setVal] = useState("");
const add = () => { const t=val.trim(); if(t&&!tags.includes(t)) onChange([...tags,t]); setVal(""); };
return (
<div>
<div style={{ display:"flex", gap:8, marginBottom:8 }}>
<input style={{ ...S.input, flex:1 }} placeholder="Type a tag and press Enter" value={val}
onChange={e=>setVal(e.target.value)} onKeyDown={e=>e.key==="Enter"&&(e.preventDefault(),add())} />
<button style={S.btnOut} onClick={add}>Add</button>
</div>
<div style={{ display:"flex", flexWrap:"wrap", gap:6 }}>
{tags.map(t=>(
<span key={t} style={{ background:"#1e2d3d", color:"#94a3b8", borderRadius:99, padding:"3px 10px", fontSize:12, display:"inline-flex", alignItems:"center", gap:5 }}>
{t}
<button onClick={()=>onChange(tags.filter(x=>x!==t))} style={{ background:"none", border:"none", color:"#64748b", cursor:"pointer", padding:0, fontSize:14, lineHeight:1 }}>×</button>
</span>
))}
</div>
</div>
);
}
// ─── ZK Confirmation ──────────────────────────────────────────────────────────
function ZKConfirm({ item, onClose }) {
const [step, setStep] = useState(0);
useEffect(()=>{
const t=[400,900,1400,2000].map((ms,i)=>setTimeout(()=>setStep(i+1),ms));
return ()=>t.forEach(clearTimeout);
},[]);
const rows = [
["Report ID", item.id, 1],
["Cryptographic Hash", item.commitment?.hash, 2],
["Nonce / Salt", item.commitment?.salt, 3],
["Chain Entry", `Block #${Math.floor(Math.abs(hashStr(item.id)%9000))+1000} · CONFIRMED`, 4],
];
return (
<div style={{ position:"fixed", inset:0, background:"rgba(0,0,0,.8)", backdropFilter:"blur(12px)", zIndex:100, display:"flex", alignItems:"center", justifyContent:"center", padding:24 }}>
<div className="slide-up" style={{ ...S.card, maxWidth:480, width:"100%", borderRadius:20, padding:32, border:"1px solid #1e3a5f" }}>
<div style={{ textAlign:"center", marginBottom:24 }}>
<div style={{ width:60, height:60, borderRadius:18, background:"linear-gradient(135deg,#1d4ed8,#4f46e5)", display:"flex", alignItems:"center", justifyContent:"center", margin:"0 auto 16px" }}>
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="#fff" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/>
{step>=4 && <path d="M9 12l2 2 4-4"/>}
</svg>
</div>
<div style={{ fontSize:20, fontWeight:700, color:"#e2e8f0" }}>Report Secured</div>
<div style={{ fontSize:13, color:"#64748b", marginTop:6 }}>Your submission has been cryptographically committed. Save your Report ID to track status.</div>
</div>
<div style={{ background:"#080c14", borderRadius:12, padding:16, marginBottom:20, border:"1px solid #1e2d3d" }}>
{rows.map(([label, val, threshold])=>{
const visible = step >= threshold;
return (
<div key={label} style={{ display:"flex", justifyContent:"space-between", alignItems:"center", padding:"8px 0", borderBottom:"1px solid #0d1520", opacity: visible?1:0.2, transition:"opacity .4s" }}>
<span style={{ fontSize:11, color:"#475569", fontWeight:600, textTransform:"uppercase", letterSpacing:"0.06em" }}>{label}</span>
<span style={{ ...S.mono, color: visible?"#60a5fa":"#1e2d3d", maxWidth:200, overflow:"hidden", textOverflow:"ellipsis" }}>
{visible ? val : "computing…"}
</span>
</div>
);
})}
</div>
<div style={{ fontSize:12, color:"#334155", marginBottom:20, padding:12, background:"rgba(37,99,235,0.05)", borderRadius:10, border:"1px solid rgba(37,99,235,0.1)" }}>
⚠️ Do not share your salt value. Your hash serves as a tamper-evident proof of submission time and content.
</div>
<button style={{ ...S.btn, width:"100%", justifyContent:"center", opacity: step<4?0.6:1 }} onClick={onClose} disabled={step<4}>
{step<4 ? <><span style={{ width:14, height:14, border:"2px solid rgba(255,255,255,.3)", borderTopColor:"#fff", borderRadius:"50%", display:"inline-block", animation:"spin .7s linear infinite" }}/> Committing…</> : "View My Reports →"}
</button>
</div>
</div>
);
}
// ─── Audit Log ────────────────────────────────────────────────────────────────
function AuditLog({ log }) {
return (
<div style={{ marginTop:18 }}>
<div style={{ fontSize:11, fontWeight:700, color:"#334155", letterSpacing:"0.1em", textTransform:"uppercase", marginBottom:10 }}>Audit Chain</div>
<div style={{ position:"relative", paddingLeft:20 }}>
<div style={{ position:"absolute", left:7, top:6, bottom:6, width:1, background:"linear-gradient(to bottom, #1d4ed8, #0d1520)" }}/>
{(log||[]).map((e,i)=>(
<div key={i} style={{ position:"relative", paddingLeft:20, paddingBottom:14 }}>
<div style={{ position:"absolute", left:-5, top:4, width:10, height:10, borderRadius:"50%", background:"#1d4ed8", border:"2px solid #3b82f6", zIndex:1 }}/>
<div style={{ fontSize:12, fontWeight:600, color:"#e2e8f0" }}>{e.action}</div>
<div style={{ ...S.mono, color:"#475569", fontSize:11, marginTop:2 }}>{e.hash} · {e.actor} · {fmt(e.ts)}</div>
</div>
))}
</div>
</div>
);
}
// ─── Report Row ───────────────────────────────────────────────────────────────
function ReportRow({ g, onUpdate, onDelete, readOnly }) {
const [open, setOpen] = useState(false);
const [updating, setUpdating] = useState(false);
const handleUpdate = async (val) => {
setUpdating(true);
await onUpdate(g.id, val);
setUpdating(false);
};
return (
<div style={{ ...S.card, borderColor: open?"#2563eb":"#1e2d3d", transition:"border-color .2s" }}>
<div style={{ display:"flex", flexWrap:"wrap", alignItems:"center", gap:10, justifyContent:"space-between" }}>
<div style={{ display:"flex", alignItems:"center", gap:10, minWidth:0, flex:1 }}>
<span style={{ ...S.mono, fontSize:11, color:"#334155", background:"#080c14", border:"1px solid #1e2d3d", borderRadius:6, padding:"2px 8px", flexShrink:0 }}>#{g.id}</span>
<span style={{ fontWeight:600, fontSize:13, color:"#e2e8f0", overflow:"hidden", textOverflow:"ellipsis", whiteSpace:"nowrap" }}>
{g.data.incidentType||"(Unspecified)"}{g.data.location ? ` · ${g.data.location}` : ""}
</span>
</div>
<div style={{ display:"flex", alignItems:"center", gap:8, flexWrap:"wrap", flexShrink:0 }}>
<PriorityDot priority={g.priority||"Medium"}/>
<StatusPill status={g.status}/>
{!readOnly && (
<select style={{ ...S.select, width:"auto", fontSize:12, padding:"5px 10px" }} value={g.status} onChange={e=>handleUpdate(e.target.value)} disabled={updating}>
{STATUSES.map(s=><option key={s}>{s}</option>)}
</select>
)}
<button style={S.btnSm} onClick={()=>setOpen(!open)}>
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
{open ? <><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></> : <><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></>}
</svg>
{open?"Hide":"Details"}
</button>
{!readOnly && (
<button onClick={()=>onDelete(g.id)} style={{ background:"rgba(239,68,68,0.08)", color:"#f87171", border:"1px solid rgba(239,68,68,0.15)", borderRadius:8, padding:"5px 8px", fontSize:12, cursor:"pointer", display:"inline-flex", alignItems:"center" }}>
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14H6L5 6"/><path d="M10 11v6M14 11v6M9 6V4h6v2"/></svg>
</button>
)}
</div>
</div>
{open && (
<div className="fade-in" style={{ borderTop:"1px solid #1e2d3d", marginTop:16, paddingTop:16 }}>
<div style={{ display:"grid", gridTemplateColumns:"repeat(3,1fr)", gap:16, fontSize:12, marginBottom:16 }}>
<div style={{ display:"flex", flexDirection:"column", gap:5 }}>
{[["Submitted", fmt(g.createdAt)],["Updated", fmt(g.updatedAt)],["Confidential", g.confidential?"Yes":"No"],["Anonymous", g.anonymous?"Yes":"No"]].map(([k,v])=>(
<div key={k}><span style={{ color:"#475569" }}>{k}: </span><span style={{ color:"#94a3b8" }}>{v}</span></div>
))}
</div>
<div style={{ display:"flex", flexDirection:"column", gap:5 }}>
{[["Reporter", g.anonymous?"(Anonymous)":g.data.name||"—"],["Department", g.data.department||"—"],["Incident Date", g.data.date||"—"],["Follow-up OK", g.data.allowFollowUp?"Yes":"No"]].map(([k,v])=>(
<div key={k}><span style={{ color:"#475569" }}>{k}: </span><span style={{ color:"#94a3b8" }}>{v}</span></div>
))}
</div>
<div style={{ display:"flex", flexDirection:"column", gap:5 }}>
{[["Tags", (g.data.tags||[]).join(", ")||"—"],["Attachments", (g.data.attachments||[]).map(a=>a.name).join(", ")||"—"]].map(([k,v])=>(
<div key={k}><span style={{ color:"#475569" }}>{k}: </span><span style={{ color:"#94a3b8" }}>{v}</span></div>
))}
<div><span style={{ color:"#475569" }}>Hash: </span><span style={{ ...S.mono, color:"#60a5fa" }}>{g.commitment?.hash||"—"}</span></div>
</div>
</div>
<div style={{ background:"#080c14", border:"1px solid #1e2d3d", borderRadius:10, padding:16, fontSize:13, color:"#94a3b8", lineHeight:1.7, whiteSpace:"pre-wrap" }}>
{g.data.description}
</div>
<AuditLog log={g.auditLog}/>
</div>
)}
</div>
);
}
// ─── Report Form ──────────────────────────────────────────────────────────────
function ReportForm({ onSubmit }) {
const [loading, setLoading] = useState(false);
const [anonymous, setAnonymous] = useState(false);
const [confidential, setConfidential] = useState(true);
const [allowFollowUp, setAllowFollowUp] = useState(true);
const [consent, setConsent] = useState(false);
const [priority, setPriority] = useState("Medium");
const [tags, setTags] = useState([]);
const [attachments, setAttachments] = useState([]);
const [form, setForm] = useState({});
const [error, setError] = useState(null);
const fileRef = useRef();
const f = k => e => setForm(s=>({...s,[k]:e.target.value}));
const descLen = (form.description||"").length;
const canSubmit = useMemo(()=>{
if (descLen < 30) return false;
if (!anonymous && (!form.name||!form.email)) return false;
return consent;
},[form, anonymous, consent, descLen]);
const submit = async () => {
setError(null); setLoading(true);
try {
const g = await apiCreate({ confidential, anonymous, priority, data:{ ...form, tags, attachments, allowFollowUp, consent }});
onSubmit(g);
setForm({}); setTags([]); setAttachments([]); setConsent(false); setAnonymous(false); setPriority("Medium");
} catch(e) { setError(e?.message||"Submission failed"); }
finally { setLoading(false); }
};
const sectionHead = label => (
<div style={{ fontSize:11, fontWeight:700, color:"#334155", letterSpacing:"0.1em", textTransform:"uppercase", marginBottom:12, marginTop:4 }}>{label}</div>
);
return (
<div style={S.card}>
<div style={{ fontWeight:700, fontSize:16, color:"#e2e8f0", marginBottom:22, display:"flex", alignItems:"center", gap:8 }}>
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#60a5fa" strokeWidth="2" strokeLinecap="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/><polyline points="10 9 9 9 8 9"/></svg>
Submit a Grievance
</div>
{sectionHead("Reporter Identity")}
<div style={{ display:"grid", gridTemplateColumns:"1fr 1fr", gap:14, marginBottom:20 }}>
<div>
<label style={S.label}>Full Name</label>
<input style={{ ...S.input, opacity:anonymous?0.35:1 }} disabled={anonymous} placeholder={anonymous?"Hidden — anonymous":"Jane Doe"} value={form.name||""} onChange={f("name")}/>
</div>
<div>
<label style={S.label}>Email</label>
<input style={{ ...S.input, opacity:anonymous?0.35:1 }} disabled={anonymous} type="email" placeholder={anonymous?"Hidden — anonymous":"jane@company.com"} value={form.email||""} onChange={f("email")}/>
</div>
</div>
{sectionHead("Incident Details")}
<div style={{ display:"grid", gridTemplateColumns:"1fr 1fr", gap:14, marginBottom:20 }}>
<div>
<label style={S.label}>Department</label>
<select style={S.select} value={form.department||""} onChange={f("department")}>
<option value="">Select department</option>
{DEPTS.map(d=><option key={d}>{d}</option>)}
</select>
</div>
<div>
<label style={S.label}>Incident Type</label>
<select style={S.select} value={form.incidentType||""} onChange={f("incidentType")}>
<option value="">Choose type</option>
{INCIDENT_TYPES.map(t=><option key={t}>{t}</option>)}
</select>
</div>
<div>
<label style={S.label}>Date of Incident</label>
<input style={S.input} type="date" value={form.date||""} onChange={f("date")}/>
</div>
<div>
<label style={S.label}>Location / Site</label>
<input style={S.input} placeholder="Office, facility, remote…" value={form.location||""} onChange={f("location")}/>
</div>
</div>
{sectionHead("Priority Level")}
<div style={{ display:"flex", gap:8, marginBottom:20 }}>
{PRIORITIES.map(p=>(
<button key={p} onClick={()=>setPriority(p)} style={{
flex:1, padding:"9px 0", border:`1px solid ${priority===p?PRIORITY_META[p].dot:"#1e2d3d"}`,
borderRadius:9, background:priority===p?"rgba(0,0,0,.35)":"transparent",
color:priority===p?PRIORITY_META[p].text:"#64748b", fontSize:12, fontWeight:600, cursor:"pointer",
}}>{p}</button>
))}
</div>
{sectionHead("Description")}
<div style={{ marginBottom:20 }}>
<textarea style={{ ...S.input, minHeight:140, resize:"vertical", lineHeight:1.7 }}
placeholder="Describe what happened. Include dates, names if relevant, context, and any prior reporting attempts. (30+ characters required)"
value={form.description||""} onChange={f("description")}/>
<div style={{ display:"flex", justifyContent:"space-between", fontSize:11, marginTop:5 }}>
<span style={{ color:descLen>=30?"#34d399":"#64748b" }}>
{descLen} chars {descLen>=30?"✓":`— ${30-descLen} more needed`}
</span>
<span style={{ color:"#334155" }}>Specifics help resolution</span>
</div>
</div>
{sectionHead("Tags (optional)")}
<div style={{ marginBottom:20 }}>
<TagInput tags={tags} onChange={setTags}/>
</div>
{sectionHead("Attachments")}
<div style={{ marginBottom:20 }}>
<input ref={fileRef} type="file" multiple style={{ display:"none" }} onChange={e=>setAttachments(a=>[...a,...Array.from(e.target.files).map(f=>({name:f.name,size:f.size}))])}/>
<button style={S.btnOut} onClick={()=>fileRef.current?.click()}>
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>
Attach files
</button>
{attachments.length>0 && (
<div style={{ display:"flex", flexWrap:"wrap", gap:6, marginTop:8 }}>
{attachments.map((f,i)=>(
<span key={i} style={{ background:"#1e2d3d", borderRadius:99, padding:"3px 10px", fontSize:12, color:"#94a3b8", display:"inline-flex", alignItems:"center", gap:5 }}>
{f.name}
<button onClick={()=>setAttachments(a=>a.filter((_,j)=>j!==i))} style={{ background:"none", border:"none", color:"#64748b", cursor:"pointer", padding:0, fontSize:14, lineHeight:1 }}>×</button>
</span>
))}
</div>
)}
</div>
<div style={{ borderTop:"1px solid #1e2d3d", paddingTop:20, marginBottom:20 }}>
<div style={{ display:"grid", gridTemplateColumns:"1fr 1fr", gap:10, marginBottom:14 }}>
<Toggle checked={confidential} onChange={setConfidential} label="🔒 Confidential to HR" sub="Access limited to authorized reviewers"/>
<Toggle checked={anonymous} onChange={setAnonymous} label="👁 Submit Anonymously" sub="Your identity will not be stored"/>
</div>
<div style={{ display:"flex", flexDirection:"column", gap:10 }}>
<Check checked={allowFollowUp} onChange={setAllowFollowUp} label="Allow HR to follow up for additional details (only if identity is provided)"/>
<Check checked={consent} onChange={setConsent} label="I affirm this report is accurate to the best of my knowledge and understand that submitting false information may constitute a policy violation."/>
</div>
</div>
{error && <div style={{ color:"#f87171", fontSize:13, marginBottom:14, padding:12, background:"rgba(239,68,68,.05)", borderRadius:8, border:"1px solid rgba(239,68,68,.15)" }}>{error}</div>}
<div style={{ display:"flex", justifyContent:"flex-end", gap:10 }}>
<button style={S.btnOut} onClick={()=>{setForm({});setTags([]);setAttachments([]);setConsent(false);}}>Clear</button>
<button style={S.btn} disabled={!canSubmit||loading} onClick={submit}>
{loading
? <><span style={{ width:14,height:14,border:"2px solid rgba(255,255,255,.3)",borderTopColor:"#fff",borderRadius:"50%",animation:"spin .7s linear infinite",display:"inline-block" }}/> Securing…</>
: <><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg> Submit Report</>
}
</button>
</div>
<div style={{ marginTop:20, padding:14, background:"rgba(29,78,216,0.05)", borderRadius:10, border:"1px solid rgba(29,78,216,0.12)", fontSize:12, color:"#64748b", lineHeight:1.7 }}>
<strong style={{ color:"#60a5fa" }}>Zero Retaliation Policy:</strong> Retaliation against anyone who raises a concern in good faith is strictly prohibited. All reports are reviewed fairly and confidentially. Each submission generates a blockchain-backed cryptographic commitment as tamper-evident proof.
</div>
</div>
);
}
// ─── My Reports ───────────────────────────────────────────────────────────────
function MyReports() {
const [items, setItems] = useState(()=>{
const ids = new Set(loadMyIds());
return loadAll().filter(g=>ids.has(g.id));
});
if (!items.length) return (
<div style={{ ...S.card, textAlign:"center", padding:60, color:"#475569" }}>
<svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" style={{ marginBottom:12, opacity:.3 }}><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>
<div style={{ fontWeight:600, color:"#64748b" }}>No submissions yet</div>
<div style={{ fontSize:13, marginTop:6 }}>Once you submit a report, you can track its status here.</div>
</div>
);
return (
<div style={{ display:"flex", flexDirection:"column", gap:10 }}>
{items.map(g=><ReportRow key={g.id} g={g} onUpdate={()=>{}} onDelete={()=>{}} readOnly/>)}
</div>
);
}
// ─── Admin Panel ──────────────────────────────────────────────────────────────
function AdminPanel({ push }) {
const [items, setItems] = useState(loadAll());
const [q, setQ] = useState("");
const [sf, setSf] = useState("All");
const [pf, setPf] = useState("All");
const refresh = () => setItems(loadAll());
const filtered = useMemo(()=>{
const needle = q.toLowerCase();
return items.filter(g=>{
const ms = sf==="All"||g.status===sf;
const mp = pf==="All"||(g.priority||"Medium")===pf;
const mq = [g.id,g.data.description,g.data.location,g.data.incidentType,g.data.department,g.data.name,g.data.email].filter(Boolean).join(" ").toLowerCase().includes(needle);
return ms&&mp&&mq;
});
},[items,q,sf,pf]);
const update = async (id, status) => { await apiUpdate(id,{status}); refresh(); push("Status updated",`#${id} → ${status}`); };
const del = async (id) => { await apiDelete(id); refresh(); push("Report deleted"); };
return (
<div>
<div style={{ display:"flex", flexWrap:"wrap", gap:10, alignItems:"center", justifyContent:"space-between", marginBottom:18 }}>
<div style={{ fontWeight:700, fontSize:16, color:"#e2e8f0" }}>
Inbox <span style={{ fontWeight:400, fontSize:13, color:"#475569" }}>({filtered.length}/{items.length})</span>
</div>
<div style={{ display:"flex", gap:8, flexWrap:"wrap" }}>
<div style={{ position:"relative" }}>
<svg style={{ position:"absolute", left:10, top:"50%", transform:"translateY(-50%)" }} width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="#64748b" strokeWidth="2"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
<input style={{ ...S.input, paddingLeft:32, width:180 }} placeholder="Search…" value={q} onChange={e=>setQ(e.target.value)}/>
</div>
<select style={{ ...S.select, width:"auto" }} value={sf} onChange={e=>setSf(e.target.value)}>
<option>All</option>
{STATUSES.map(s=><option key={s}>{s}</option>)}
</select>
<select style={{ ...S.select, width:"auto" }} value={pf} onChange={e=>setPf(e.target.value)}>
<option>All</option>
{PRIORITIES.map(p=><option key={p}>{p}</option>)}
</select>
<button style={S.btnOut} onClick={()=>exportCSV(filtered)}>
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
Export CSV
</button>
</div>
</div>
{filtered.length===0 ? (
<div style={{ ...S.card, textAlign:"center", padding:60, color:"#475569" }}>
<svg width="36" height="36" style={{ opacity:.3, marginBottom:10 }} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5"><path d="M22 12h-4l-3 9L9 3l-3 9H2"/></svg>
<div style={{ fontWeight:600 }}>No reports found</div>
<div style={{ fontSize:13, marginTop:4 }}>Adjust your filters.</div>
</div>
) : (
<div style={{ display:"flex", flexDirection:"column", gap:10 }}>
{filtered.map(g=><ReportRow key={g.id} g={g} onUpdate={update} onDelete={del}/>)}
</div>
)}
</div>
);
}
// ─── Analytics ────────────────────────────────────────────────────────────────
function Bar({ label, value, max, color }) {
return (
<div style={{ marginBottom:9 }}>
<div style={{ display:"flex", justifyContent:"space-between", fontSize:12, marginBottom:4 }}>
<span style={{ color:"#94a3b8" }}>{label}</span>
<span style={{ color:"#e2e8f0", fontWeight:600 }}>{value}</span>
</div>
<div style={{ height:5, background:"#1e2d3d", borderRadius:99 }}>
<div style={{ height:"100%", width:`${max>0?(value/max)*100:0}%`, background:color, borderRadius:99, transition:"width .6s ease" }}/>
</div>
</div>
);
}
function Analytics() {
const items = loadAll();
const total = items.length;
const byStat = STATUSES.reduce((a,s)=>({...a,[s]:items.filter(g=>g.status===s).length}),{});
const byPri = PRIORITIES.reduce((a,p)=>({...a,[p]:items.filter(g=>(g.priority||"Medium")===p).length}),{});
const byType = INCIDENT_TYPES.reduce((a,t)=>({...a,[t]:items.filter(g=>g.data.incidentType===t).length}),{});
const maxType = Math.max(...Object.values(byType),1);
const anonPct = total?Math.round(items.filter(g=>g.anonymous).length/total*100):0;
const resPct = total?Math.round(((byStat["Resolved"]||0)+(byStat["Closed"]||0))/total*100):0;
const critN = byPri["Critical"]||0;
const cards = [
{e:"📋",v:total,l:"Total Reports"},
{e:"🔍",v:(byStat["New"]||0)+(byStat["Under Review"]||0)+(byStat["In Progress"]||0),l:"Open Cases"},
{e:"✅",v:(byStat["Resolved"]||0)+(byStat["Closed"]||0),l:"Resolved / Closed"},
{e:"👁",v:`${anonPct}%`,l:"Anonymous Rate"},
{e:"📈",v:`${resPct}%`,l:"Resolution Rate"},
{e:"🚨",v:critN,l:"Critical Issues"},
];
return (
<div>
<div style={{ display:"grid", gridTemplateColumns:"repeat(3,1fr)", gap:12, marginBottom:20 }}>
{cards.map(({e,v,l})=>(
<div key={l} style={S.card}>
<div style={{ fontSize:20, marginBottom:6 }}>{e}</div>
<div style={{ fontSize:26, fontWeight:700, color:"#e2e8f0" }}>{v}</div>
<div style={{ fontSize:12, color:"#64748b", marginTop:2 }}>{l}</div>
</div>
))}
</div>
<div style={{ display:"grid", gridTemplateColumns:"1fr 1fr", gap:14 }}>
<div style={S.card}>
<div style={{ fontWeight:700, fontSize:13, color:"#e2e8f0", marginBottom:14 }}>By Status</div>
{STATUSES.map(s=><Bar key={s} label={s} value={byStat[s]||0} max={total} color={STATUS_META[s]?.border||"#3b82f6"}/>)}
</div>
<div style={S.card}>
<div style={{ fontWeight:700, fontSize:13, color:"#e2e8f0", marginBottom:14 }}>By Priority</div>
{PRIORITIES.map(p=><Bar key={p} label={p} value={byPri[p]||0} max={total} color={PRIORITY_META[p]?.dot||"#3b82f6"}/>)}
</div>
<div style={{ ...S.card, gridColumn:"1/-1" }}>
<div style={{ fontWeight:700, fontSize:13, color:"#e2e8f0", marginBottom:14 }}>By Incident Type</div>
<div style={{ display:"grid", gridTemplateColumns:"1fr 1fr", gap:"0 28px" }}>
{INCIDENT_TYPES.map(t=><Bar key={t} label={t} value={byType[t]||0} max={maxType} color="#2563eb"/>)}
</div>
</div>
</div>
</div>
);
}
// ─── App Shell ─────────────────────────────────────────────────────────────────
function App() {
const [tab, setTab] = useState("report");
const [confirming, setConfirming] = useState(null);
const { toasts, push } = useToasts();
const handleSubmit = g => {
saveMyIds([g.id, ...loadMyIds()]);
setConfirming(g);
};
const TABS = [["report","Report"],["mine","My Reports"],["admin","Admin"],["analytics","Analytics"]];
return (
<div style={{ minHeight:"100vh" }}>
{/* Header */}
<header style={{ background:"rgba(8,12,20,0.92)", backdropFilter:"blur(16px)", borderBottom:"1px solid #1e2d3d", position:"sticky", top:0, zIndex:50 }}>
<div style={{ maxWidth:1100, margin:"0 auto", padding:"14px 24px", display:"flex", alignItems:"center", justifyContent:"space-between", gap:16 }}>
<div style={{ display:"flex", alignItems:"center", gap:12 }}>
<div style={{ width:36, height:36, borderRadius:10, background:"linear-gradient(135deg,#1d4ed8,#4f46e5)", display:"flex", alignItems:"center", justifyContent:"center", flexShrink:0 }}>
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#fff" strokeWidth="2" strokeLinecap="round"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg>
</div>
<div>
<div style={{ fontWeight:700, fontSize:15, letterSpacing:"-0.02em" }}>TrueRecord</div>
<div style={{ fontSize:11, color:"#475569", marginTop:-1 }}>Grievance Portal</div>
</div>
</div>
<nav style={{ display:"flex", gap:3 }}>
{TABS.map(([k,l])=>(
<button key={k} onClick={()=>setTab(k)} style={{ background:tab===k?"#0d1520":"transparent", border:tab===k?"1px solid #1e2d3d":"1px solid transparent", borderRadius:8, padding:"7px 14px", fontSize:13, fontWeight:600, color:tab===k?"#e2e8f0":"#64748b", cursor:"pointer" }}>{l}</button>
))}
</nav>
</div>
</header>
{/* Main */}
<main style={{ maxWidth:1100, margin:"0 auto", padding:"32px 24px" }}>
{tab==="report" && (
<div style={{ display:"grid", gridTemplateColumns:"2fr 1fr", gap:24, alignItems:"start" }}>
<ReportForm onSubmit={handleSubmit}/>
<div style={{ display:"flex", flexDirection:"column", gap:14 }}>
<div style={S.card}>
<div style={{ fontWeight:700, fontSize:13, color:"#e2e8f0", marginBottom:14 }}>How it works</div>
{[["1","Submit","Fill the form and submit. Your report is cryptographically committed at submission time.",true],
["2","Review","Authorized HR reviewers triage and may follow up if permitted.",false],
["3","Track","Monitor status changes under My Reports using your report ID.",false],
].map(([n,t,d])=>(
<div key={n} style={{ display:"flex", gap:12, marginBottom:13 }}>
<div style={{ width:24, height:24, minWidth:24, borderRadius:99, background:"#1e2d3d", display:"flex", alignItems:"center", justifyContent:"center", fontSize:11, fontWeight:700, color:"#60a5fa" }}>{n}</div>
<div><div style={{ fontWeight:600, fontSize:13, color:"#e2e8f0" }}>{t}</div><div style={{ fontSize:12, color:"#64748b", marginTop:2 }}>{d}</div></div>
</div>
))}
</div>
<div style={S.card}>
<div style={{ fontWeight:700, fontSize:13, color:"#e2e8f0", marginBottom:12 }}>Privacy Guarantees</div>
{[["🔒","Confidential by default","Only authorized HR reviewers can access submissions"],
["👤","Full anonymity option","Identity never recorded when enabled"],
["🔗","Blockchain-backed commitment","Each report generates a cryptographic hash — tamper-evident proof of content and time"],
["⚡","Zero retaliation","Policy enforced and logged on every status change"],
].map(([icon,t,d])=>(
<div key={t} style={{ display:"flex", gap:10, marginBottom:11 }}>
<span style={{ fontSize:16, flexShrink:0 }}>{icon}</span>
<div><div style={{ fontSize:12, fontWeight:600, color:"#94a3b8" }}>{t}</div><div style={{ fontSize:11, color:"#475569", marginTop:2 }}>{d}</div></div>
</div>
))}
</div>
</div>
</div>
)}
{tab==="mine" && <MyReports/>}
{tab==="admin" && <AdminPanel push={push}/>}
{tab==="analytics" && <Analytics/>}
</main>
{confirming && <ZKConfirm item={confirming} onClose={()=>{ setConfirming(null); setTab("mine"); push("Report saved",`#${confirming.id} — now tracking in My Reports`); }}/>}
<Toasts toasts={toasts}/>
</div>
);
}
ReactDOM.createRoot(document.getElementById("root")).render(<App/>);
</script>
</body>
</html>