83 lines
17 KiB
JavaScript
83 lines
17 KiB
JavaScript
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 => ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[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';
|
||
document.querySelector('.skip').addEventListener('click', event => { event.preventDefault(); main.focus(); main.scrollIntoView(); });
|
||
const go = (id, label, cls = '') => `<a class="${cls}" href="#${esc(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="#${esc(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 = `<p>Alvin Zilverstand · VISTA college, Heerlen</p><div class="footer-links">${ext(profile.github,'GitHub')}${ext(profile.gitea,'Gitea')}${go('evidence',tx(['Bewijsindex','Evidence index']))}</div>`;
|
||
}
|
||
function system(p, large = false) {
|
||
return `<div class="system ${esc(p.id)} ${large ? 'large' : ''}" role="img" aria-label="${esc(t(['Schematische weergave: ','Schematic view: ']) + p.nodes.join(' → '))}"><div class="system-top mono"><span>SYS.${esc(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>${esc(p.stack.slice(0,2).join(' / '))}</span><span>${p.challenge === '—' ? tx(['EXPERIMENT','EXPERIMENT']) : `CH.${esc(p.challenge)}`}</span></div></div>`;
|
||
}
|
||
function projectRow(p) {
|
||
return `<article class="project-row"><div class="project-copy"><p class="project-kicker">${tx(p.setting || ['Schoolproject · leerjaar 2','School project · year 2'])} · ${tx(p.kind)}</p><h3>${go(`project/${p.id}`,tx(p.name))}</h3><p>${tx(p.intro)}</p></div><div class="project-side"><span>${esc(p.stack.slice(0,2).join(' · '))}</span>${go(`project/${p.id}`,`${tx(['Lees het project','Read the project'])} <span aria-hidden="true">↗</span>`,'row-link')}</div></article>`;
|
||
}
|
||
function home() {
|
||
const featured = projects.find(p => p.id === 'warehouse') || projects[0];
|
||
const selected = ['narrowcasting','clipforge'].map(id => projects.find(p => p.id === id)).filter(Boolean).filter(p => p !== featured);
|
||
return `<section class="hero"><p class="eyebrow">Alvin Zilverstand · Software Developer</p><h1>${tx(['Ik bouw software die een concreet probleem oplost.','I build software around real problems.'])}</h1><div class="hero-bottom"><p>${tx(['Van een magazijnapp voor school tot een eigen tool voor gameclips: ik werk aan webapplicaties, systemen en kleine hulpmiddelen. Hier kun je per project lezen wat de opdracht was, hoe het is opgebouwd en welke bronnen beschikbaar zijn.','From a school warehouse application to my own game clip tool, I work on web applications, systems, and small utilities. Each project shows the problem, how it was built, and the sources you can inspect.'])}</p>${go('work',`${tx(['Bekijk alle projecten','Browse all projects'])} <span aria-hidden="true">↗</span>`,'text-link')}</div></section>
|
||
${featured ? `<section class="feature"><div class="feature-intro"><p class="eyebrow">${tx(['Uitgelicht project','Featured project'])}</p><h2>${go(`project/${featured.id}`,tx(featured.name))}</h2><p>${tx(featured.intro)}</p>${go(`project/${featured.id}`,`${tx(['Lees het dossier','Read the project file'])} <span aria-hidden="true">↗</span>`,'text-link')}</div><div class="feature-note"><span>${tx(['Waarom dit project','Why this project'])}</span><p>${tx(['De repository volgt het werk van klantgesprekken en requirements tot de applicatie en database. Daardoor is niet alleen het eindresultaat te bekijken, maar ook het traject ernaartoe.','The repository follows the work from client conversations and requirements through to the application and database. You can inspect the route to the result as well as the code.'])}</p></div></section>` : ''}
|
||
<section class="section"><div class="section-heading"><h2>${tx(['Nog twee kanten van mijn werk','Two other sides of my work'])}</h2></div>${selected.length ? selected.map(projectRow).join('') : emptyProjects()}<p class="all-work">${go('work',`${tx(['Volledig archief: alle projecten','Complete archive: all projects'])} <span aria-hidden="true">↗</span>`,'text-link')}</p></section>
|
||
<section class="exam-callout"><div><h2>${tx(['Bronnen voor mijn examen','Sources for my exam'])}</h2><p>${tx(['Naast de projecten houd ik een voorlopige index bij van bronnen per werkproces. De koppelingen zijn nog geen beoordeling.','Alongside the projects, I keep a provisional index of sources by work process. These mappings are not an assessment.'])}</p></div>${go('evidence',`${tx(['Bekijk de bewijsindex','View the evidence index'])} <span aria-hidden="true">↗</span>`,'text-link')}</section>`;
|
||
}
|
||
function emptyProjects() { return `<p class="empty-state">${tx(['Nog geen projecten toegevoegd.','No projects added yet.'])}</p>`; }
|
||
function work() {
|
||
return `<section class="page-heading"><p class="eyebrow">${tx(['Alle projecten','All projects'])}</p><h1>${tx(['Projectarchief','Project archive'])}</h1><p>${tx(['School- en persoonlijke projecten. Open een dossier voor de opdracht, technische opbouw en concrete bronbestanden.','School and personal projects. Open a project file for the problem, implementation, and specific source files.'])}</p></section><section class="work-list">${projects.length ? projects.map(projectRow).join('') : emptyProjects()}</section>`;
|
||
}
|
||
function detail(p) {
|
||
return `<section class="page-heading project-heading">${go('work',`← ${tx(['Alle projecten','All projects'])}`,'back-link')}<p class="eyebrow">${tx(p.setting || ['Schoolproject · leerjaar 2','School project · year 2'])} · ${tx(p.kind)}</p><h1>${tx(p.name)}</h1><p>${tx(p.intro)}</p><div class="project-actions">${ext(source(p.path,true,p),tx(['Open repository','Open repository']),'text-link')}<span>${esc(p.stack.join(' · '))}</span></div></section><div class="project-layout"><div class="project-story"><section><h2>${tx(['De opdracht','The assignment'])}</h2><p>${tx(p.context)}</p></section><section><h2>${tx(['Hoe het is opgebouwd','How it is built'])}</h2><p>${tx(p.implementation)}</p>${p.nodes.length === 3 ? `<div class="architecture"><p>${tx(['Schematische opbouw','Schematic structure'])}</p><ol>${p.nodes.map(node=>`<li>${esc(node)}</li>`).join('')}</ol></div>` : ''}</section><section><h2>${tx(['Bronbestanden','Source files'])}</h2><p class="muted">${tx(['Deze links verwijzen naar gevonden bestanden en mappen. Ze zijn geen goedgekeurd examenbewijs; inhoud, eigen bijdrage en resultaten moeten nog worden gecontroleerd.','These links point to located files and folders. They are not approved exam evidence; contents, personal contribution, and results still need review.'])}</p><div class="evidence-links">${p.evidence.map(e=>ext(source(e.path,e.directory,p),`<span><small class="mono">${esc(e.type)}</small>${tx(e.label)}</span>`)).join('')}</div></section><section><h2>${tx(['Keuzes en aandachtspunten','Decisions and considerations'])}</h2><p>${tx(p.decisions)}</p></section><section class="reflection"><h2>${tx(['Eigen bijdrage en reflectie','My contribution and reflection'])}</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><aside class="project-meta"><h2>${tx(['Projectcontext','Project context'])}</h2><dl><dt>${tx(['Opleiding','Course'])}</dt><dd>Software Developer</dd><dt>${tx(['Context','Context'])}</dt><dd>${tx(p.setting || ['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(['Beoordeling','Assessment'])}</dt><dd>${tx(['Niet vastgesteld','Not established'])}</dd></dl>${p.codes.length ? `<p>${tx(['Voorlopig gekoppelde werkprocessen','Provisionally mapped work processes'])}</p><div class="tags">${p.codes.map(c=>go(`evidence/${c}`,esc(c),'tag')).join('')}</div>` : ''}</aside></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="${esc(p.code)}" ${p.code===selected?'selected':''}>${esc(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">${esc(p.code)}</span><span class="process-title">${tx(p.title)}</span><span class="evidence-status ${found.length?'located':'missing'}">${found.length ? `${found.length} ${tx(found.length === 1 ? ['bron','source'] : ['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,project),`<span><small class="mono">${esc(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 projecten lopen uiteen van websites en PHP-applicaties tot narrowcasting, een muziekgame, desktopsoftware en beheerscripts. Dit portfolio brengt de projecten en de bijbehorende bronnen bij elkaar.','My projects range from websites and PHP applications to narrowcasting, a music game, desktop software, and administration scripts. 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();
|