-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSnfHubPage.jsx
More file actions
293 lines (277 loc) · 10.7 KB
/
Copy pathSnfHubPage.jsx
File metadata and controls
293 lines (277 loc) · 10.7 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
import React, { useEffect, useMemo } from 'react';
import { Link } from 'react-router-dom';
import {
ArchiveIcon,
UsersThreeIcon,
MapTrifoldIcon,
ToolboxIcon,
UserFocusIcon,
PushPinIcon,
GearSixIcon,
ArrowRightIcon,
FileTextIcon,
CaretRightIcon,
} from '@phosphor-icons/react';
import SnfLayout from '../../components/snf/SnfLayout';
import SnfDecryptText from '../../components/snf/SnfDecryptText';
import { SnfButton, SnfReveal } from '../../components/snf/SnfPrimitives';
import Seo from '../../components/Seo';
import { useSnf } from '../../context/SnfContext';
import { useAchievements } from '../../context/AchievementContext';
import {
useBooks,
useCharacters,
usePlaces,
useItems,
useAuthors,
} from '../../hooks/useStoriesData';
const SECTIONS = [
{
to: '/snf/archive',
icon: ArchiveIcon,
en: { title: 'THE ARCHIVE', desc: 'Case files & decrypted field reports.' },
tr: { title: 'ARŞİV', desc: 'Dosyalar ve çözülmüş saha raporları.' },
count: 'dossiers',
},
{
to: '/snf/personnel',
icon: UsersThreeIcon,
en: { title: 'PERSONNEL', desc: 'Persons of interest. Trust no one.' },
tr: { title: 'PERSONEL', desc: 'İlgi çeken kişiler. Kimseye güvenme.' },
count: 'personnel',
},
{
to: '/snf/sites',
icon: MapTrifoldIcon,
en: { title: 'SITES', desc: 'Mapped locations across the territory.' },
tr: { title: 'BÖLGELER', desc: 'Bölge genelinde işaretli konumlar.' },
count: 'sites',
},
{
to: '/snf/evidence',
icon: ToolboxIcon,
en: { title: 'EVIDENCE', desc: 'Recovered assets & flagged artifacts.' },
tr: { title: 'KANIT', desc: 'Ele geçirilen varlıklar ve eserler.' },
count: 'evidence',
},
{
to: '/snf/agents',
icon: UserFocusIcon,
en: { title: 'OPERATORS', desc: 'The scribes who filed these reports.' },
tr: { title: 'AJANLAR', desc: 'Bu raporları yazan kâtipler.' },
count: 'operators',
},
{
to: '/snf/board',
icon: PushPinIcon,
en: { title: 'CASE BOARD', desc: 'Trace the strings between everything.' },
tr: { title: 'KANIT PANOSU', desc: 'Her şey arasındaki ipleri izle.' },
count: null,
},
];
const SnfHubPage = () => {
const { language, setBreadcrumbs } = useSnf();
const { unlockAchievement } = useAchievements();
const { data: books } = useBooks(language);
const { data: characters } = useCharacters();
const { data: places } = usePlaces();
const { data: items } = useItems();
const { data: authors } = useAuthors();
useEffect(() => {
setBreadcrumbs([]);
unlockAchievement('story_explorer');
}, [setBreadcrumbs, unlockAchievement]);
const dossiers = useMemo(
() => (books || []).reduce((n, b) => n + (b.episodes?.length || 0), 0),
[books],
);
const counts = {
dossiers,
volumes: books?.length ?? null,
personnel: characters?.length ?? null,
sites: places?.length ?? null,
evidence: items?.length ?? null,
operators: authors?.length ?? null,
};
const latest = useMemo(() => {
let best = null;
(books || []).forEach((b) => {
(b.episodes || []).forEach((ep) => {
if (!best || (ep.date || '') > (best.ep.date || '')) {
best = { book: b, ep };
}
});
});
return best;
}, [books]);
const fmt = (n) => (n == null ? '––' : String(n).padStart(2, '0'));
const t = (item) => (language === 'tr' ? item.tr : item.en);
return (
<SnfLayout>
<Seo
title="From Serfs and Frauds | Archive Terminal"
description="A retro-futuristic intelligence terminal for the neo-noir anthology From Serfs and Frauds."
keywords={['fezcodex', 'serfs and frauds', 'snf', 'terminal', 'noir']}
/>
{/* HERO */}
<section className="relative mb-12 md:mb-16">
<div className="snf-vt snf-phos-text text-lg md:text-xl mb-4 flex items-center gap-3">
<span className="snf-led snf-led-blink" />
BLACK_RAGNAROK // CLEARANCE LVL 20
</div>
<h1 className="snf-display snf-glow snf-aberrate text-[clamp(2.6rem,9vw,7rem)] font-bold uppercase leading-[0.86] text-[var(--snf-phos)]">
<SnfDecryptText text="FROM SERFS" speedMs={26} as="span" />
<br />
<span className="text-[var(--snf-ink)]">
<SnfDecryptText text="& FRAUDS" speedMs={26} as="span" />
</span>
</h1>
<p className="snf-serif italic text-lg md:text-2xl snf-dim mt-6 max-w-2xl leading-relaxed">
“Every serf has a story, and every fraud a hidden truth.”
<span className="block snf-mono not-italic text-xs uppercase tracking-[0.3em] mt-3 snf-phos-text">
— recovered transmission, source redacted
</span>
</p>
<div className="flex flex-wrap items-center gap-3 mt-8">
<SnfButton to="/snf/archive" primary>
<span className="flex items-center gap-2">
{language === 'tr' ? 'ARŞİVE GİR' : 'ENTER ARCHIVE'}
<ArrowRightIcon size={16} weight="bold" />
</span>
</SnfButton>
<SnfButton to="/snf/settings">
<span className="flex items-center gap-2">
<GearSixIcon size={15} weight="bold" />
{language === 'tr' ? 'YAPILANDIR' : 'CONFIGURE'}
</span>
</SnfButton>
<Link
to="/stories"
className="snf-mono text-[10px] uppercase tracking-[0.25em] snf-dim hover:text-[var(--snf-phos)] transition-colors ml-1"
title="The original medieval archive"
>
{'// legacy_archive'}
</Link>
</div>
</section>
{/* READOUT STRIP */}
<SnfReveal className="mb-12">
<div className="snf-panel snf-panel-bracket grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6">
{[
['VOLUMES', counts.volumes],
['DOSSIERS', counts.dossiers],
['PERSONNEL', counts.personnel],
['SITES', counts.sites],
['EVIDENCE', counts.evidence],
['OPERATORS', counts.operators],
].map(([k, v], i) => (
<div
key={k}
className={`px-4 py-5 border-[var(--snf-line)] ${
i % 2 === 0 ? 'border-r' : 'sm:border-r'
} ${i < 3 ? 'border-b lg:border-b-0' : ''} border-r last:border-r-0`}
>
<div className="snf-display snf-glow text-3xl md:text-4xl font-bold text-[var(--snf-phos)] tabular-nums">
{fmt(v)}
</div>
<div className="snf-mono text-[9px] tracking-[0.2em] snf-dim mt-1">
{k}
</div>
</div>
))}
</div>
</SnfReveal>
{/* DIRECTORY */}
<div className="grid grid-cols-1 lg:grid-cols-3 gap-8 lg:gap-10">
<div className="lg:col-span-2">
<div className="flex items-center gap-3 mb-4">
<span className="snf-vt snf-phos-text text-lg">DIRECTORY</span>
<span className="snf-divider flex-grow" />
<span className="snf-mono text-[10px] snf-dim tracking-[0.2em]">
SELECT_NODE
</span>
</div>
<div className="grid sm:grid-cols-2 gap-3">
{SECTIONS.map((s, i) => {
const Icon = s.icon;
return (
<SnfReveal key={s.to} delay={i * 0.05}>
<Link
to={s.to}
className="snf-row group flex items-start gap-4 p-4 md:p-5 h-full"
>
<span className="snf-phos-text snf-glow-soft mt-0.5 flex-none">
<Icon size={28} weight="duotone" />
</span>
<span className="min-w-0 flex-grow">
<span className="flex items-center justify-between gap-2">
<span className="snf-display text-base md:text-lg font-semibold uppercase tracking-wide text-[var(--snf-ink)] group-hover:text-[var(--snf-phos)] transition-colors">
{t(s).title}
</span>
{s.count && (
<span className="snf-mono text-[10px] snf-dim tabular-nums">
[{fmt(counts[s.count])}]
</span>
)}
</span>
<span className="block snf-mono text-[11px] snf-dim leading-relaxed mt-1">
{t(s).desc}
</span>
</span>
<CaretRightIcon
size={16}
className="snf-row-arrow snf-dim mt-1 flex-none"
weight="bold"
/>
</Link>
</SnfReveal>
);
})}
</div>
</div>
{/* LATEST INTERCEPT */}
<div>
<div className="flex items-center gap-3 mb-4">
<span className="snf-vt snf-phos-text text-lg">LATEST</span>
<span className="snf-divider flex-grow" />
</div>
{latest ? (
<SnfReveal>
<Link
to={`/snf/archive/${latest.book.bookId}/${latest.ep.id}`}
className="snf-panel snf-panel-bracket block p-5 group hover:border-[rgba(var(--snf-phos-rgb),0.5)] transition-colors"
>
<div className="flex items-center gap-2 snf-mono text-[10px] tracking-[0.2em] snf-phos-text mb-4">
<FileTextIcon size={14} weight="bold" />
INCOMING DOSSIER
<span className="snf-rec ml-auto" />
</div>
<div className="snf-display text-xl md:text-2xl font-bold uppercase leading-tight text-[var(--snf-ink)] group-hover:text-[var(--snf-phos)] transition-colors">
{latest.ep.title}
</div>
<div className="snf-mono text-[11px] snf-dim mt-3 space-y-1">
<div>SCRIBE :: {latest.ep.author}</div>
<div>FILED :: {latest.ep.date}</div>
<div className="truncate">VOL :: {latest.book.bookTitle}</div>
</div>
<div className="mt-5 snf-mono text-[10px] uppercase tracking-[0.3em] snf-phos-text flex items-center gap-2">
DECRYPT
<ArrowRightIcon
size={13}
weight="bold"
className="group-hover:translate-x-1 transition-transform"
/>
</div>
</Link>
</SnfReveal>
) : (
<div className="snf-panel p-5 snf-mono text-xs snf-dim">
awaiting transmission…
</div>
)}
</div>
</div>
</SnfLayout>
);
};
export default SnfHubPage;