Files
portfolio/app.js
T
2026-11-09 14:57:00 +01:00

79 lines
16 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { profile, projects, processes, source } from './content.js';
const main = document.querySelector('main');
let lang = new URLSearchParams(location.search).get('lang') === 'en' ? 'en' : 'nl';
const t = pair => pair[lang === 'nl' ? 0 : 1];
const esc = value => String(value).replace(/[&<>"']/g, c => ({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c]));
const tx = pair => esc(t(pair));
const ext = (url, label, cls = '') => `<a class="${cls}" href="${esc(url)}" target="_blank" rel="noopener noreferrer">${label}<span aria-hidden="true"> ↗</span></a>`;
const badge = text => `<span class="tag">${esc(text)}</span>`;
const route = () => location.hash.slice(1) || 'home';
const go = (id, label, cls = '') => `<a class="${cls}" href="#${id}">${label}</a>`;
function header() {
const current = route();
document.querySelector('#header').innerHTML = `<div class="header-inner">
${go('home', '<span class="monogram">az<span>_</span></span><span class="brand-name">Alvin Zilverstand</span>', 'brand')}
<nav aria-label="${t(['Hoofdnavigatie','Main navigation'])}">${[['work',['Werk','Work']],['evidence',['Bewijsindex','Evidence']],['about',['Over mij','About']]].map(([id,label]) => `<a href="#${id}" ${current === id || (id === 'work' && current.startsWith('project/')) ? 'aria-current="page"' : ''}>${tx(label)}</a>`).join('')}</nav>
<div class="languages" aria-label="Language">${['nl','en'].map(l => `<button type="button" data-lang="${l}" lang="${l}" aria-pressed="${lang === l}">${l.toUpperCase()}</button>`).join('')}</div>
</div>`;
document.querySelectorAll('[data-lang]').forEach(button => button.addEventListener('click', () => {
lang = button.dataset.lang;
const url = new URL(location.href); url.searchParams.set('lang', lang); history.replaceState(null, '', url);
render(false);
document.querySelector(`[data-lang="${lang}"]`).focus();
}));
}
function footer() {
document.querySelector('footer').innerHTML = `<div><span class="mono">AZ / PORTFOLIO</span><p>Alvin Zilverstand <span class="muted">· VISTA college, Heerlen</span></p></div><div class="footer-links">${ext(profile.github,'GitHub')}${ext(profile.gitea,'Gitea')}${go('evidence',tx(['Bewijsindex','Evidence index']))}</div><span class="mono muted">${tx(['In ontwikkeling','Work in progress'])} / 2026</span>`;
}
function system(p, large = false) {
return `<div class="system ${p.id} ${large ? 'large' : ''}" role="img" aria-label="${esc(t(['Schematische weergave: ','Schematic view: ']) + p.nodes.join(' → '))}"><div class="system-top mono"><span>SYS.${p.number}</span><span>${tx(['SYSTEEMSCHEMA','SYSTEM MAP'])}</span><span class="dot"></span></div><div class="diagram">${p.nodes.map((node,i)=>`${i ? '<span class="wire" aria-hidden="true"></span>' : ''}<div class="node"><span class="node-icon" aria-hidden="true">${['◫','⌘','▤'][i]}</span><span>${esc(node)}</span><small class="mono">0${i+1}</small></div>`).join('')}</div><div class="system-bottom mono"><span>${p.stack.slice(0,2).join(' / ')}</span><span>CH.${p.challenge}</span></div></div>`;
}
function projectRow(p) {
return `<article class="project-row"><span class="project-number mono">/${p.number}</span><div class="project-copy"><p class="eyebrow">CHALLENGE ${p.challenge} <span>· ${tx(p.kind)}</span></p><h3>${go(`project/${p.id}`,tx(p.name))}</h3><p>${tx(p.intro)}</p><div class="tags">${p.stack.map(badge).join('')}</div></div>${go(`project/${p.id}`,`<span>${tx(['Bekijk project','Explore project'])}</span><span aria-hidden="true">↗</span>`,'row-link')}</article>`;
}
function home() {
const p = projects[0];
return `<section class="hero"><div class="hero-copy"><p class="eyebrow"><span class="dot"></span> SOFTWARE DEVELOPER / ${tx(['IN OPLEIDING','IN TRAINING'])}</p><h1>${tx(['Van idee','From idea'])}<br>${tx(['naar iets','to something'])}<br><em>${tx(['dat werkt.','that works.'])}</em></h1><p class="hero-intro">${tx(['Ik ben Alvin. Derdejaars Software Developer bij VISTA college in Heerlen. Hier laat ik zien wat ik bouw, hoe het in elkaar zit en wat ik nog leer.','I’m Alvin, a third-year Software Developer student at VISTA college in Heerlen. This is what I build, how it fits together, and what I’m still learning.'])}</p><div class="actions">${go('work',`${tx(['Ontdek mijn werk','Explore my work'])} <span aria-hidden="true">↗</span>`,'button primary')}${go('evidence',tx(['Naar de bewijsindex','View the evidence index']),'text-link')}</div></div><div class="hero-aside"><div class="edition mono"><span>FIELDNOTES / 001</span><span>2024—2026</span></div>${system(p,true)}<div class="aside-caption"><span class="mono">01 /</span><div><strong>${tx(p.name)}</strong><p>${tx(['Van requirements naar reserveringen.','From requirements to reservations.'])}</p></div>${go('project/warehouse','↗','circle-link')}</div><div class="study-stamp"><span class="mono">${tx(['NU','NOW'])}</span><span>VISTA college · Heerlen</span><span>${tx(['Leerjaar 3','Year 3'])}</span></div></div></section>
<section class="section"><div class="section-heading"><div><p class="eyebrow">01 / ${tx(['SELECTIE','SELECTED'])}</p><h2>${tx(['Werk met een verhaal.','Work with a story.'])}</h2></div><span class="mono muted">03 ${tx(['PROJECTEN','PROJECTS'])}</span></div>${projects.map(projectRow).join('')}</section>
<section class="exam-callout"><div><p class="eyebrow">02 / ${tx(['VAN PROJECT NAAR BEWIJS','FROM PROJECT TO EVIDENCE'])}</p><h2>${tx(['De code is het begin.','The code is the starting point.'])}</h2><p>${tx(['Een project vertelt meer met de keuzes, documenten en tests ernaast. De bewijsindex verbindt die onderdelen met de acht beroepsspecifieke SBB-werkprocessen.','A project says more with its decisions, documents, and tests alongside it. The evidence index connects those artifacts to the eight vocational SBB work processes.'])}</p>${go('evidence',`${tx(['Open bewijsindex','Open evidence index'])} ↗`,'text-link')}</div><div class="index-preview" aria-hidden="true">${[['01','SCOPE'],['02','DESIGN'],['03','BUILD'],['04','TEST']].map(([n,s])=>`<div><span>${n}</span><strong>${s}</strong><span class="small-line"></span></div>`).join('')}</div></section>`;
}
function work() {
return `<section class="page-heading"><p class="eyebrow">01 / ${tx(['PROJECTARCHIEF','PROJECT ARCHIVE'])}</p><h1>${tx(['Gebouwd. Getest.','Built. Tested.'])}<br><em>${tx(['Verder geleerd.','Still learning.'])}</em></h1><p>${tx(['Drie schoolprojecten, bekeken vanuit het probleem, de uitvoering en het beschikbare bewijs. De broncode blijft één klik verder.','Three school projects, through their problems, implementation, and available evidence. The source code is always one click away.'])}</p></section><section class="section work-list">${projects.map(p=>`<div>${system(p)}${projectRow(p)}</div>`).join('')}</section><div class="archive-link">${ext(profile.school,tx(['Bekijk het volledige schoolarchief','Browse the full school archive']),'text-link')}</div>`;
}
function detail(p) {
return `<section class="page-heading project-heading">${go('work',`← ${tx(['Alle projecten','All projects'])}`,'back-link')}<p class="eyebrow">PROJECT ${p.number} / CHALLENGE ${p.challenge}</p><h1>${tx(p.name)}<span class="accent">.</span></h1><p>${tx(p.intro)}</p><div class="tags">${p.stack.map(badge).join('')}</div></section>${system(p,true)}<div class="project-layout"><aside class="project-meta"><span class="eyebrow">${tx(['PROJECTDOSSIER','PROJECT FILE'])}</span><dl><dt>${tx(['Opleiding','Course'])}</dt><dd>Software Developer</dd><dt>${tx(['Context','Context'])}</dt><dd>${tx(['Schoolproject · leerjaar 2','School project · year 2'])}</dd><dt>${tx(['Eigen bijdrage','My contribution'])}</dt><dd>${tx(['Nog te beschrijven','Still to be documented'])}</dd><dt>${tx(['Beoordelingsstatus','Assessment status'])}</dt><dd>${tx(['Niet vastgesteld','Not established'])}</dd></dl>${ext(source(p.path,true),tx(['Open broncode','Open source code']),'text-link')}</aside><div class="project-story">${[[['De opdracht','The assignment'],p.context],[['Hoe het is opgebouwd','How it is built'],p.implementation],[['Keuzes & aandachtspunten','Decisions & considerations'],p.decisions]].map(([title,body],i)=>`<section><p class="eyebrow">0${i+1}</p><h2>${tx(title)}</h2><p>${tx(body)}</p></section>`).join('')}<section><p class="eyebrow">04</p><h2>${tx(['Bronnen & bewijs','Sources & evidence'])}</h2><p class="muted">${tx(['Dit zijn gevonden bronnen, geen goedgekeurde examenbewijzen. Documentinhoud en testresultaten moeten nog worden gecontroleerd.','These are located sources, not approved exam evidence. Document contents and test results still need review.'])}</p><div class="evidence-links">${p.evidence.map(e=>ext(source(e.path,e.directory),`<span><small class="mono">${e.type}</small>${tx(e.label)}</span>`)).join('')}</div></section><section class="reflection"><p class="eyebrow">05 / ${tx(['PERSOONLIJKE REFLECTIE','PERSONAL REFLECTION'])}</p><h2>${tx(['Het verhaal achter mijn bijdrage.','The story behind my contribution.'])}</h2><p>${tx(['Nog aan te vullen door Alvin: welke onderdelen heb ik zelf gemaakt, met wie werkte ik samen, welke feedback kreeg ik en wat zou ik anders doen?','To be completed by Alvin: which parts did I build myself, who did I work with, what feedback did I receive, and what would I do differently?'])}</p></section><div class="tags">${p.codes.map(c=>go(`evidence/${c}`,c,'tag')).join('')}</div></div></div>`;
}
function evidence(filter = '') {
const selected = processes.some(p=>p.code === filter) ? filter : '';
return `<section class="page-heading"><p class="eyebrow">02 / ${tx(['EXAMENPORTFOLIO','EXAM PORTFOLIO'])}</p><h1>${tx(['Van werk','From work'])}<br><em>${tx(['naar bewijs.','to evidence.'])}</em></h1><p>${tx(['Bronnen per werkproces. Een navigeerbare voorbereiding op mijn examen, met zichtbaar onderscheid tussen gevonden materiaal en wat nog ontbreekt.','Sources by work process. A navigable preparation for my exam, making the distinction between located material and missing evidence visible.'])}</p></section><div class="evidence-toolbar"><div><label for="process-filter">${tx(['Werkproces','Work process'])}</label><select id="process-filter"><option value="">${tx(['Alle werkprocessen','All work processes'])}</option>${processes.map(p=>`<option value="${p.code}" ${p.code===selected?'selected':''}>${p.code} · ${tx(p.title)}</option>`).join('')}</select></div><button id="print" class="button">${tx(['Afdrukken / PDF','Print / PDF'])} ↗</button></div><div class="notice"><span class="status-dot"></span><p>${tx(['In opbouw. Koppelingen zijn voorlopig; aanwezigheid van code of een document bewijst nog geen beheersing. Persoonlijke bijdrage, resultaten en beoordeling moeten worden toegevoegd. Stem de definitieve bewijslast af met de examinator.','In progress. Mappings are provisional; code or a document alone does not demonstrate competence. Personal contributions, results, and assessment need to be added. Agree the final evidence requirements with the examiner.'])}</p></div><section id="process-list" class="process-list">${processes.filter(p=>!selected||p.code===selected).map(processRow).join('')}</section><div class="source-note"><p class="mono">SBB / 25998 / 2024</p><p>${tx(['Deze index volgt de acht beroepsspecifieke werkprocessen uit het gekoppelde dossier. Generieke vakken, keuzedelen en VISTA-examenafspraken vallen buiten deze index. Engelse labels zijn eigen vertalingen.','This index follows the eight vocational work processes in the linked qualification. General subjects, electives, and VISTA exam arrangements are outside this index. English labels are informal translations.'])}</p>${ext(profile.qualification,tx(['Lees het officiële kwalificatiedossier','Read the official qualification document']),'text-link')}</div>`;
}
function processRow(p) {
const found = projects.flatMap(project=>project.evidence.filter(e=>e.codes.includes(p.code)).map(e=>({project,e})));
return `<details class="process" ${route()===`evidence/${p.code}`?'open':''}><summary><span class="mono process-code">${p.code}</span><span class="process-title">${tx(p.title)}</span><span class="evidence-status ${found.length?'located':'missing'}">${found.length ? `${found.length} ${tx(['bronnen','sources'])}` : tx(['Aanvullen','To add'])}</span><span class="expand" aria-hidden="true">+</span></summary><div class="process-content"><p>${tx(p.description)}</p>${found.length?`<div class="evidence-links">${found.map(({project,e})=>`<div class="evidence-entry">${ext(source(e.path,e.directory),`<span><small class="mono">${e.type}</small>${tx(e.label)}</span>`)}${go(`project/${project.id}`,tx(project.name),'evidence-project')}</div>`).join('')}</div><p class="pending">${tx(['Te controleren: inhoud, eigen bijdrage en geschiktheid voor het examen.','To verify: contents, personal contribution, and suitability for the exam.'])}</p>`:`<div class="empty-state">${tx(['Nog geen bewijs geselecteerd. Voeg een eigen document, feedback of een concreet projectvoorbeeld toe.','No evidence selected yet. Add your own document, feedback, or a specific project example.'])}</div>`}</div></details>`;
}
function about() {
return `<section class="page-heading"><p class="eyebrow">03 / ${tx(['OVER MIJ','ABOUT ME'])}</p><h1>Alvin<br><em>Zilverstand.</em></h1><p>${tx(['Software Developer in opleiding. Derdejaars bij VISTA college in Heerlen.','Software Developer in training. Third-year student at VISTA college in Heerlen.'])}</p></section><section class="about-grid"><div><h2>${tx(['Leren door te bouwen.','Learning by building.'])}</h2><p>${tx(['Mijn schoolwerk loopt uiteen van websites en PHP-applicaties tot een magazijnsysteem en narrowcasting. Dit portfolio brengt de projecten en de bijbehorende bronnen bij elkaar.','My schoolwork ranges from websites and PHP applications to a warehouse system and narrowcasting. This portfolio brings those projects and their sources together.'])}</p><p>${tx(['Ik bouw dit portfolio voor mijn eindexamen. Daarna wil ik het verder gebruiken om mijn werk aan toekomstige werkgevers te laten zien.','I’m building this portfolio for my final exam. After that, I want to keep using it to show my work to future employers.'])}</p></div><div class="profile-facts"><div><span>${tx(['Opleiding','Course'])}</span><strong>Software Developer</strong></div><div><span>Campus</span><strong>VISTA · Heerlen</strong></div><div><span>${tx(['Studiefase','Study stage'])}</span><strong>${tx(['Leerjaar 3','Year 3'])}</strong></div><div><span>${tx(['Werk & broncode','Work & source'])}</span><strong>GitHub + Gitea</strong></div></div></section><section class="contact-section"><p class="eyebrow">${tx(['VERDER KIJKEN','TAKE A CLOSER LOOK'])}</p><h2>${tx(['De rest staat in de repositories.','There’s more in the repositories.'])}</h2><div class="actions">${ext(profile.github,'GitHub','button primary')}${ext(profile.gitea,'Gitea','button')}</div><p class="muted">${tx(['Een rechtstreeks contactadres en cv worden later toegevoegd.','A direct contact address and CV will be added later.'])}</p></section>`;
}
function render(focus = false) {
document.documentElement.lang = lang;
header(); footer();
const r = route();
let title = t(['Portfolio','Portfolio']);
if (r === 'home') main.innerHTML = home();
else if (r === 'work') { main.innerHTML = work(); title = t(['Werk','Work']); }
else if (r === 'about') { main.innerHTML = about(); title = t(['Over mij','About']); }
else if (r === 'evidence' || r.startsWith('evidence/')) {
main.innerHTML = evidence(r.split('/')[1]); title = t(['Bewijsindex','Evidence index']);
document.querySelector('#process-filter').addEventListener('change', e => { location.hash = e.target.value ? `evidence/${e.target.value}` : 'evidence'; });
document.querySelector('#print').addEventListener('click', () => { document.querySelectorAll('.process').forEach(d=>d.open=true); window.print(); });
} else {
const p = projects.find(p=>r === `project/${p.id}`);
if (p) { main.innerHTML = detail(p); title = t(p.name); }
else main.innerHTML = `<section class="page-heading"><h1>404</h1><p>${tx(['Deze pagina bestaat niet.','This page does not exist.'])}</p>${go('home',tx(['Terug naar het begin','Back to home']),'button')}</section>`;
}
document.title = `${title} — Alvin Zilverstand`;
if (focus) { main.focus({preventScroll:true}); window.scrollTo(0,0); }
}
window.addEventListener('hashchange',()=>render(true));
render();