Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
510 lines (454 loc) · 30.8 KB
/
Copy pathindex.html
File metadata and controls
510 lines (454 loc) · 30.8 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Observation Deck — JS</title>
<meta name="description" content="Observation Deck — every project JS (00xJS) has built on one board: data and automation work, live market and Pokémon GO tools, Saints Row reverse engineering, games, retro ports and everyday tools.">
<meta name="theme-color" content="#0a0c0f">
<!-- Open Graph / Twitter -->
<meta property="og:type" content="website">
<meta property="og:site_name" content="Observation Deck">
<meta property="og:title" content="Observation Deck — JS">
<meta property="og:description" content="Everything I've built, on one board — with live status for every site.">
<meta property="og:url" content="https://observation-deck.netlify.app/">
<meta property="og:image" content="https://observation-deck.netlify.app/images/og.jpg">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="Observation Deck — everything I've built, on one board">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Observation Deck — JS">
<meta name="twitter:description" content="Everything I've built, on one board — with live status for every site.">
<meta name="twitter:image" content="https://observation-deck.netlify.app/images/og.jpg">
<link rel="canonical" href="https://observation-deck.netlify.app/">
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebSite",
"name": "Observation Deck",
"url": "https://observation-deck.netlify.app/",
"description": "Everything I've built, on one board — with live status for every site.",
"author": { "@type": "Person", "name": "JS", "url": "https://github.com/00xJS" }
}
</script>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🔭</text></svg>">
<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=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
color-scheme: dark; /* dark-only deck: native controls, scrollbars, form widgets follow */
--bg: #0a0c0f;
--panel: #111419;
--panel-2: #161a21;
--line: rgba(255, 255, 255, 0.07);
--line-2: rgba(255, 255, 255, 0.14);
--text: #e9edf2;
--muted: #9aa4b2;
--faint: #7c8695; /* 5:1 on --bg — clears AA for small text */
--accent: #c6f45b;
--live: #4ade80;
--warn: #fbbf24;
--down: #f87171;
--mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
--sans: "IBM Plex Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); line-height: 1.5; -webkit-font-smoothing: antialiased; }
body.locked { overflow: hidden; }
a { color: inherit; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent); color: var(--bg); }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 50; padding: 8px 14px; background: var(--panel); color: var(--accent); border: 1px solid var(--line-2); border-radius: 8px; font-size: 13px; font-weight: 600; text-decoration: none; }
.skip-link:focus { left: 20px; top: 10px; }
/* ---------- Top bar ---------- */
.bar { border-bottom: 1px solid var(--line); background: rgba(10, 12, 15, 0.85); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 10; }
.bar .wrap { display: flex; align-items: center; justify-content: space-between; height: 52px; gap: 12px; }
.logo { font-family: var(--mono); font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-decoration: none; white-space: nowrap; }
.logo b { color: var(--accent); }
.sys { font-family: var(--mono); font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.pulse.ok { background: var(--live); box-shadow: 0 0 10px var(--live); animation: pulse 2s infinite; }
.pulse.warn { background: var(--warn); box-shadow: 0 0 10px var(--warn); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
/* ---------- Header ---------- */
header.intro { padding: 30px 0 18px; }
.who { font-family: var(--mono); font-size: 12px; color: var(--accent); letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 8px; }
header.intro h1 { margin: 0; font-size: clamp(26px, 4vw, 38px); font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; }
header.intro p.lede { margin: 6px 0 0; color: var(--muted); max-width: 640px; }
/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.kpi .l { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.kpi .v { font-size: 26px; font-weight: 600; margin-top: 2px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v.sm { font-size: 18px; padding-top: 5px; }
.kpi .v.ok { color: var(--live); }
.kpi .v.warn { color: var(--warn); }
.kpi .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars { display: flex; gap: 3px; height: 6px; margin-top: 8px; border-radius: 3px; overflow: hidden; }
.bars span { display: block; height: 100%; }
/* ---------- Controls ---------- */
.controls { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 22px 0 14px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { background: var(--panel); border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 6px 11px; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.seg button:hover { color: var(--text); border-color: var(--line-2); }
.seg button[aria-pressed="true"] { color: var(--bg); background: var(--accent); border-color: var(--accent); font-weight: 600; }
.seg .dot { width: 8px; height: 8px; border-radius: 2px; }
.seg .n { font-family: var(--mono); font-size: 11px; opacity: 0.7; }
.search { display: flex; gap: 8px; }
.search input, .search select { background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 13px; }
.search input { width: 210px; }
.search input::placeholder { color: var(--faint); }
/* ---------- Bento grid ---------- */
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 150px; grid-auto-flow: dense; gap: 10px; padding-bottom: 40px; }
.tile { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; text-align: left; color: inherit; padding: 0; transition: border-color 0.15s, transform 0.15s; min-width: 0; font-size: inherit; }
.tile:hover { border-color: var(--c); transform: translateY(-2px); }
.tile.big { grid-column: span 2; grid-row: span 2; }
.tile.tall { grid-row: span 2; }
.tile .img { flex: 1; min-height: 0; background: var(--panel-2); overflow: hidden; position: relative; }
.tile .img img, .tile .img svg { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; transition: transform 0.3s ease; }
.tile:hover .img img { transform: scale(1.03); }
.tile .img img.contain { object-fit: contain; object-position: center; }
.tile .meta { padding: 10px 12px 11px; display: flex; flex-direction: column; gap: 3px; }
.top { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); }
.cat { display: inline-flex; align-items: center; gap: 6px; color: var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--c); flex: none; }
.tile h3 { margin: 0; font-size: 15.5px; font-weight: 600; }
.tile.big h3 { font-size: 20px; }
.tile p { margin: 0; font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile.compact { justify-content: space-between; padding: 12px; border-left: 3px solid var(--c); }
.tile.compact .meta { padding: 0; }
.tile.compact p { -webkit-line-clamp: 3; }
.st { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st.live { color: var(--live); }
.st.down { color: var(--down); }
.st.priv { color: #b39dff; }
.st.work { color: #fdba74; }
.st.oss { color: var(--muted); }
.empty { grid-column: 1 / -1; color: var(--faint); text-align: center; padding: 40px 0; font-family: var(--mono); font-size: 13px; }
/* ---------- Drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 30; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100%); background: var(--panel); border-left: 1px solid var(--line-2); z-index: 31; transform: translateX(100%); visibility: hidden; transition: transform 0.25s ease, visibility 0s 0.25s; overflow-y: auto; }
.drawer.on { transform: none; visibility: visible; transition: transform 0.25s ease; }
.drawer .head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 1; font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.drawer .head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer .x { background: none; border: 1px solid var(--line-2); color: var(--muted); border-radius: 6px; padding: 3px 9px; cursor: pointer; font-family: var(--mono); font-size: 11.5px; flex: none; }
.drawer .x:hover { color: var(--text); border-color: var(--accent); }
.drawer .shot { aspect-ratio: 16 / 10; background: var(--panel-2); }
.drawer .shot img, .drawer .shot svg { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.drawer .shot img.contain { object-fit: contain; }
.drawer .body { padding: 16px 18px 26px; display: flex; flex-direction: column; gap: 14px; }
.drawer .top { font-size: 11px; color: var(--c); letter-spacing: 0.08em; }
.drawer h2 { margin: 2px 0 0; font-size: 22px; }
.drawer h4 { margin: 0 0 4px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); font-weight: 500; }
.drawer p { margin: 0; color: var(--muted); font-size: 14px; }
.drawer ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13.5px; display: flex; flex-direction: column; gap: 5px; }
.drawer ul li::marker { color: var(--c); }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fact { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.fact .l { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.fact .v { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line-2); border-radius: 6px; padding: 2px 8px; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; font-size: 13.5px; font-weight: 600; text-decoration: none; background: var(--accent); color: var(--bg); border: 1px solid var(--accent); }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn.ghost:hover { border-color: var(--accent); }
.note { font-size: 12.5px; color: var(--faint); }
/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--line); padding: 18px 0 30px; color: var(--faint); font-size: 12.5px; font-family: var(--mono); }
footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }
/* ---------- Small screens & motion ---------- */
@media (max-width: 1000px) {
.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis .kpi:nth-child(n+4) { display: none; }
}
@media (max-width: 720px) {
.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 140px; }
.search { width: 100%; }
.search input { flex: 1; width: auto; }
}
@media (max-width: 480px) {
.wrap { padding: 0 16px; }
.grid { grid-template-columns: 1fr; }
.tile.big { grid-column: span 1; }
.kpi { padding: 10px; }
.kpi .v { font-size: 20px; }
.kpi .s { display: none; }
.sys .txt { display: none; }
}
@media (prefers-reduced-motion: reduce) {
.pulse.ok, .pulse.warn { animation: none; }
.tile:hover, .tile:hover .img img { transform: none; }
.drawer, .drawer.on, .scrim { transition: none; }
}
</style>
</head>
<body>
<a class="skip-link" href="#grid">Skip to projects</a>
<div class="bar">
<div class="wrap">
<a class="logo" href="#">🔭 OBSERVATION <b>/</b> DECK</a>
<div class="sys" role="status"><span class="pulse" id="sysDot"></span><span class="txt" id="sysText">checking systems…</span></div>
</div>
</div>
<div class="wrap">
<header class="intro">
<p class="who" id="who">JS · 00xJS</p>
<h1>Everything I've built, on one board.</h1>
<p class="lede">Data work by day, web tools and reverse engineering by night. Filter by interest, search by stack, and click any tile for the story behind it.</p>
</header>
<section class="kpis" id="kpis" aria-label="Portfolio stats"></section>
<div class="controls">
<div class="seg" id="seg" role="group" aria-label="Filter by interest"></div>
<div class="search">
<input id="q" type="search" placeholder="Search name or stack…" aria-label="Search projects">
<select id="sort" aria-label="Sort projects">
<option value="featured">Featured</option>
<option value="newest">Newest</option>
<option value="name">A–Z</option>
</select>
</div>
</div>
<main class="grid" id="grid" aria-live="polite">
<noscript><p class="empty">Enable JavaScript to view the deck, or browse the <a href="https://github.com/00xJS">projects on GitHub</a>.</p></noscript>
</main>
</div>
<footer>
<div class="wrap">
<span>JS · <a href="https://github.com/00xJS" rel="me">GitHub</a></span>
<span>Screenshots, live status and repo stats refresh weekly via GitHub Actions</span>
</div>
</footer>
<div class="scrim" id="scrim"></div>
<aside class="drawer" id="drawer" role="dialog" aria-modal="true" aria-labelledby="dTitle" aria-hidden="true" tabindex="-1"></aside>
<script>
const $ = (id) => document.getElementById(id);
const GH = 'https://github.com/00xJS/';
const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
const load = (p) => fetch(p, { cache: 'no-cache' }).then((r) => (r.ok ? r.json() : null)).catch(() => null);
const rel = (iso) => {
if (!iso) return '';
const d = Math.floor((Date.now() - new Date(iso)) / 864e5);
return d <= 0 ? 'today' : d === 1 ? '1d ago' : d < 60 ? d + 'd ago' : Math.round(d / 30) + 'mo ago';
};
let D = null; // projects.json
let S = null; // status.json — liveness + response time, weekly
let G = null; // github.json — stars + last push, weekly
const CAT = new Map();
const BY_ID = new Map();
let filter = 'all';
let lastTile = null;
const img = (p) => (p.image ? p.image : p.url ? 'images/' + p.id + '.webp' : null);
const stat = (p) => (p.url && S && S.projects ? S.projects[p.id] : null);
const repo = (p) => (p.repo && G && G.repos ? G.repos[p.repo] : null);
function status(p) {
if (p.work) return ''; // the At Work section label already says it
if (p.private) return '<span class="st priv">private</span>';
const s = stat(p);
if (s) return s.up ? '<span class="st live">live</span>' : '<span class="st down">down</span>';
return '<span class="st oss">open source</span>';
}
/* Stand-in visual for projects without a screenshot: a bar chart in the project's colour */
function chartSVG(p, color) {
let h = 7;
for (const ch of p.id) h = (h * 31 + ch.charCodeAt(0)) >>> 0;
const rnd = () => ((h = (h * 1103515245 + 12345) >>> 0) / 4294967296);
let bars = '';
for (let i = 0; i < 24; i++) {
const v = 20 + rnd() * 70 + i * 2;
bars += `<rect x="${12 + i * 16}" y="${190 - v}" width="10" height="${v}" rx="2" fill="${color}" opacity="${(0.35 + i / 40).toFixed(2)}"/>`;
}
return `<svg viewBox="0 0 400 210" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
<rect width="400" height="210" fill="#161a21"/>
${[50, 90, 130, 170].map((y) => `<line x1="0" x2="400" y1="${y}" y2="${y}" stroke="rgba(255,255,255,0.06)"/>`).join('')}
${bars}
<text x="200" y="28" text-anchor="middle" font-family="IBM Plex Mono, monospace" font-size="11" letter-spacing="1" fill="${color}">${esc(p.kind.toUpperCase())}</text>
</svg>`;
}
/* Screenshot (or the chart if there is none / it fails to load) */
function visual(box, p, color, alt) {
const src = img(p);
if (!src) { box.innerHTML = chartSVG(p, color); return; }
box.innerHTML = `<img src="${esc(src)}" alt="${esc(alt)}" loading="lazy" class="${p.imageFit === 'portrait' ? 'contain' : ''}">`;
box.querySelector('img').addEventListener('error', () => { box.innerHTML = chartSVG(p, color); }, { once: true });
}
/* ---------- Tiles ---------- */
function tile(p) {
const c = CAT.get(p.constellation);
const b = document.createElement('button');
b.type = 'button';
b.id = 'p-' + p.id;
b.style.setProperty('--c', c.color);
const size = p.flagship ? 'big' : img(p) ? 'tall' : 'compact';
b.className = 'tile ' + size;
const meta = `<div class="meta">
<div class="top"><span class="cat">${esc(c.name)}</span>${status(p)}</div>
<h3>${esc(p.name)}</h3>
<p>${esc(p.description)}</p>
</div>`;
if (size === 'compact') {
b.innerHTML = `${meta}<div class="top">${esc(p.kind)}</div>`;
} else {
b.innerHTML = `<div class="img"></div>${meta}`;
visual(b.querySelector('.img'), p, c.color, '');
}
b.addEventListener('click', () => openDrawer(p, b));
return b;
}
function render() {
const q = $('q').value.trim().toLowerCase();
const sort = $('sort').value;
let list = D.projects
.filter((p) => filter === 'all' || p.constellation === filter)
.filter((p) => !q || [p.name, p.description, p.kind, ...(p.stack || [])].join(' ').toLowerCase().includes(q));
if (sort === 'newest') list = [...list].sort((a, b) => (b.started || '').localeCompare(a.started || ''));
if (sort === 'name') list = [...list].sort((a, b) => a.name.localeCompare(b.name));
const grid = $('grid');
grid.innerHTML = '';
list.forEach((p) => grid.appendChild(tile(p)));
if (!list.length) grid.innerHTML = '<p class="empty">No projects match that search.</p>';
}
/* ---------- KPIs + system status ---------- */
function kpis() {
const P = D.projects;
const sites = P.filter((p) => p.url);
const checked = sites.filter(stat);
const up = checked.filter((p) => stat(p).up).length;
const allUp = checked.length > 0 && up === checked.length;
const pushed = P.filter(repo).sort((a, b) => repo(b).pushedAt.localeCompare(repo(a).pushedAt))[0];
// Live count from github.json when the weekly sync has one; the manifest's figure otherwise
const contrib = G && G.contributions
? { value: G.contributions.total.toLocaleString('en-US') }
: (D.profile.stats || []).find((s) => /contribution/.test(s.label));
const bars = D.constellations.map((c) => {
const n = P.filter((p) => p.constellation === c.id).length;
return n ? `<span title="${esc(c.name)}: ${n}" style="flex:${n};background:${c.color}"></span>` : '';
}).join('');
$('kpis').innerHTML = `
<div class="kpi"><div class="l">Projects</div><div class="v">${P.length}</div><div class="bars" aria-hidden="true">${bars}</div></div>
<div class="kpi"><div class="l">Live sites</div><div class="v ${checked.length ? (allUp ? 'ok' : 'warn') : ''}">${checked.length ? `${up}/${sites.length}` : '—'}</div><div class="s">${S ? 'scanned ' + rel(S.generatedAt) : 'no scan yet'}</div></div>
<div class="kpi"><div class="l">Interests</div><div class="v">${D.constellations.length}</div><div class="s">from GIS to game engines</div></div>
<div class="kpi"><div class="l">Contributions</div><div class="v">${esc(contrib ? contrib.value : '—')}</div><div class="s">in the last year</div></div>
<div class="kpi"><div class="l">Latest push</div><div class="v sm">${pushed ? esc(pushed.name) : '—'}</div><div class="s">${pushed ? rel(repo(pushed).pushedAt) : ''}</div></div>`;
if (checked.length) {
$('sysDot').classList.add(allUp ? 'ok' : 'warn');
$('sysText').textContent = `${allUp ? 'all systems live' : `${up}/${sites.length} sites live`} · scan ${rel(S.generatedAt)}`;
} else {
$('sysText').textContent = 'status unavailable';
}
}
function seg() {
const box = $('seg');
const mk = (id, label, n, color) => {
const b = document.createElement('button');
b.type = 'button';
b.dataset.id = id;
b.setAttribute('aria-pressed', String(id === filter));
b.innerHTML = `${color ? `<span class="dot" style="background:${color}"></span>` : ''}${esc(label)} <span class="n">${n}</span>`;
b.addEventListener('click', () => {
filter = id;
box.querySelectorAll('button').forEach((x) => x.setAttribute('aria-pressed', String(x.dataset.id === id)));
render();
});
box.appendChild(b);
};
mk('all', 'All', D.projects.length);
D.constellations.forEach((c) => {
const n = D.projects.filter((p) => p.constellation === c.id).length;
if (n) mk(c.id, c.name, n, c.color);
});
}
/* ---------- Drawer ---------- */
const drawer = $('drawer');
function openDrawer(p, from) {
const c = CAT.get(p.constellation);
const cs = p.caseStudy || {};
const s = stat(p), r = repo(p);
lastTile = from || null;
const facts = [['Kind', p.kind]];
if (s) facts.push(['Response', s.responseMs + ' ms']);
if (r) facts.push(['Last push', rel(r.pushedAt)]);
if (facts.length < 3 && r && r.stars) facts.push(['Stars', '★ ' + r.stars]);
if (facts.length < 3) facts.push(['Started', p.started ? p.started.slice(0, 7) : (p.work ? 'At work' : '—')]);
const where = p.url ? new URL(p.url).hostname : p.repo ? 'github.com/00xJS/' + p.repo : p.work ? 'internal work project' : 'private build';
drawer.style.setProperty('--c', c.color);
drawer.innerHTML = `
<div class="head"><span>${esc(where)}</span><button class="x" type="button" id="dx" aria-label="Close">esc ✕</button></div>
<div class="shot"></div>
<div class="body">
<div><div class="top"><span>${esc(c.name)} · ${esc(c.subtitle)}</span>${status(p)}</div><h2 id="dTitle">${esc(p.name)}</h2></div>
<div class="facts">${facts.slice(0, 3).map(([l, v]) => `<div class="fact"><div class="l">${esc(l)}</div><div class="v">${esc(v)}</div></div>`).join('')}</div>
<div><h4>Why it exists</h4><p>${esc(cs.why || p.description)}</p></div>
${(cs.highlights || []).length ? `<div><h4>Highlights</h4><ul>${cs.highlights.map((h) => `<li>${esc(h)}</li>`).join('')}</ul></div>` : ''}
${cs.learned ? `<div><h4>What it taught me</h4><p><em>${esc(cs.learned)}</em></p></div>` : ''}
<div class="chips">${(p.stack || []).map((t) => `<span class="chip">${esc(t)}</span>`).join('')}</div>
<div class="actions">
${p.url ? `<a class="btn" href="${esc(p.url)}" target="_blank" rel="noopener">Open site ↗</a>` : ''}
${p.repo ? `<a class="btn ${p.url ? 'ghost' : ''}" href="${GH + esc(p.repo)}" target="_blank" rel="noopener">Source on GitHub ↗</a>` : ''}
${p.work ? '<span class="note">Internal work project — no public link.</span>' : p.private ? '<span class="note">Private repository — source isn\'t public.</span>' : ''}
</div>
</div>`;
visual(drawer.querySelector('.shot'), p, c.color, p.name + ' screenshot');
drawer.classList.add('on');
drawer.setAttribute('aria-hidden', 'false');
$('scrim').classList.add('on');
document.body.classList.add('locked');
drawer.scrollTop = 0;
$('dx').addEventListener('click', closeDrawer);
$('dx').focus();
history.replaceState(null, '', '#p-' + p.id);
}
function closeDrawer() {
if (!drawer.classList.contains('on')) return;
drawer.classList.remove('on');
drawer.setAttribute('aria-hidden', 'true');
$('scrim').classList.remove('on');
document.body.classList.remove('locked');
history.replaceState(null, '', location.pathname + location.search);
if (lastTile && document.body.contains(lastTile)) lastTile.focus();
}
$('scrim').addEventListener('click', closeDrawer);
document.addEventListener('keydown', (e) => {
if (!drawer.classList.contains('on')) return;
if (e.key === 'Escape') { closeDrawer(); return; }
if (e.key === 'Tab') {
// Keep focus inside the open drawer
const f = [...drawer.querySelectorAll('a[href], button')];
if (!f.length) return;
const first = f[0], last = f[f.length - 1];
if (e.shiftKey && document.activeElement === first) { e.preventDefault(); last.focus(); }
else if (!e.shiftKey && document.activeElement === last) { e.preventDefault(); first.focus(); }
}
});
$('q').addEventListener('input', render);
$('sort').addEventListener('change', render);
/* ---------- Boot ---------- */
(async () => {
[D, S, G] = await Promise.all([load('projects.json'), load('status.json'), load('github.json')]);
if (!D || !Array.isArray(D.projects)) {
$('grid').innerHTML = '<p class="empty">Could not load the deck manifest. Browse the <a href="https://github.com/00xJS">projects on GitHub</a> instead.</p>';
return;
}
D.projects = D.projects.filter((p) => !p.hidden); // hidden: kept in the manifest, not shown
D.constellations.forEach((c) => CAT.set(c.id, c));
D.projects.forEach((p) => BY_ID.set(p.id, p));
if (D.profile) $('who').textContent = `${D.profile.name} · ${D.profile.handle}`;
kpis();
seg();
render();
// Deep link: #p-<id> opens that project
const m = location.hash.match(/^#p-(.+)$/);
if (m && BY_ID.has(m[1])) openDrawer(BY_ID.get(m[1]), $('p-' + m[1]));
})();
</script>
</body>
</html>