813 lines
47 KiB
JavaScript
813 lines
47 KiB
JavaScript
const $ = (s) => document.querySelector(s),
|
||
q = new URLSearchParams(location.search);
|
||
const screens = [
|
||
"home",
|
||
"discover",
|
||
"applications",
|
||
"detail",
|
||
"profile",
|
||
"cv",
|
||
"letter",
|
||
"calendar",
|
||
"mail",
|
||
"settings",
|
||
"admin",
|
||
"onboarding",
|
||
];
|
||
const selected = (key, allowed, fallback) =>
|
||
allowed.includes(q.get(key)) ? q.get(key) : fallback;
|
||
const state = {
|
||
concept: selected("concept", "ABCDE".split(""), ""),
|
||
screen: selected("screen", screens, "home"),
|
||
lang: selected("lang", ["en", "nb"], "en"),
|
||
theme: selected("theme", ["light", "dark"], "light"),
|
||
phone: q.get("mobile") === "1",
|
||
calendarView: "agenda",
|
||
trackerView: "list",
|
||
query: "",
|
||
summary:
|
||
"I help people feel welcome, supported and confident. Six years of experience coordinating services, supporting colleagues and improving everyday care.",
|
||
title: "Community care coordinator",
|
||
name: "Amira Olsen",
|
||
letter:
|
||
"Dear hiring team,\n\nI am excited to apply for the Community care coordinator position. My experience supporting patients and coordinating multidisciplinary teams would help me contribute to your local service.\n\nI would welcome the opportunity to meet your team.\n\nKind regards,\nAmira Olsen",
|
||
};
|
||
state.profileSummary = state.summary;
|
||
state.country = "";
|
||
state.discoveryState = "ready";
|
||
const concepts = {
|
||
A: {
|
||
name: "Clear Desk",
|
||
tag: "Minimal productivity workspace",
|
||
detail:
|
||
"A compact top bar and one working surface. Lists, fast actions and a quiet daily brief.",
|
||
trade: "Fast for experienced users; guidance is secondary.",
|
||
},
|
||
B: {
|
||
name: "Next Chapter",
|
||
tag: "Friendly career workspace",
|
||
detail:
|
||
"A guided home, human language and step-by-step preparation. A welcoming companion for a new beginning.",
|
||
trade: "Clear next steps; takes more space than a dense tracker.",
|
||
},
|
||
C: {
|
||
name: "Career Atelier",
|
||
tag: "Career and document studio",
|
||
detail:
|
||
"Your professional story is the centre. A document canvas, collection navigation and contextual editing tools.",
|
||
trade:
|
||
"Excellent for preparing documents; discovery is one room in the studio.",
|
||
},
|
||
D: {
|
||
name: "Northstar",
|
||
tag: "Premium career platform",
|
||
detail:
|
||
"A spacious, editorial opportunity brief with a confident top-level navigation and focused application dossiers.",
|
||
trade: "Strong hierarchy and breathing room; fewer items visible at once.",
|
||
},
|
||
E: {
|
||
name: "The Next Move",
|
||
tag: "Journey-first career workspace",
|
||
detail:
|
||
"Organise work around the next meaningful action. A task path connects opportunities, documents, conversations and dates.",
|
||
trade: "Reduces disconnected pages; requires learning the journey model.",
|
||
},
|
||
};
|
||
const en = {
|
||
home: "Home",
|
||
discover: "Explore jobs",
|
||
applications: "Applications",
|
||
detail: "Application workspace",
|
||
profile: "Career Profile",
|
||
cv: "CV studio",
|
||
letter: "Cover letter",
|
||
calendar: "Calendar",
|
||
mail: "Correspondence",
|
||
settings: "Settings",
|
||
admin: "Administration",
|
||
onboarding: "Get started",
|
||
greeting: "Good morning, Amira.",
|
||
intro: "Make room for your next opportunity.",
|
||
today: "Your next steps",
|
||
week: "Coming up",
|
||
explore: "Find an opportunity",
|
||
prepare: "Prepare your CV",
|
||
view: "View details",
|
||
save: "Save to applications",
|
||
saved: "Saved to applications",
|
||
apply: "Mark as applied",
|
||
applied: "Applied",
|
||
review: "Review application",
|
||
edit: "Edit",
|
||
export: "Export preview",
|
||
preview: "Preview",
|
||
content: "Content",
|
||
design: "Design",
|
||
history: "History",
|
||
search: "Role, skill or employer",
|
||
country: "Search country",
|
||
language: "Job-ad language",
|
||
all: "All occupations",
|
||
filters: "More filters",
|
||
results: "opportunities",
|
||
summary: "Professional summary",
|
||
experience: "Experience",
|
||
skills: "Skills",
|
||
contact: "Contact details",
|
||
name: "Full name",
|
||
title: "Professional title",
|
||
saveChanges: "Save changes",
|
||
saveDraft: "Save draft",
|
||
send: "Review before sending",
|
||
agenda: "Agenda",
|
||
month: "Month",
|
||
follow: "Schedule follow-up",
|
||
reply: "Draft a reply",
|
||
complete: "Complete",
|
||
continue: "Continue",
|
||
skip: "Do this later",
|
||
uiLanguage: "Interface language",
|
||
docLanguage: "Document language",
|
||
privacy: "Privacy & assistance",
|
||
notifications: "Notifications",
|
||
connections: "Connected accounts",
|
||
security: "Security & sessions",
|
||
data: "Your data",
|
||
settingsIntro: "Your preferences, your pace.",
|
||
adminIntro: "Service health and account management.",
|
||
synthetic: "Interactive design study · synthetic data · no live service",
|
||
back: "All five concepts",
|
||
theme: "Theme",
|
||
layout: "Preview",
|
||
desktop: "Desktop",
|
||
mobile: "Mobile",
|
||
help: "Help & advanced tools",
|
||
board: "Board",
|
||
list: "List",
|
||
savedCount: "saved",
|
||
interviews: "interviews",
|
||
drafts: "documents ready",
|
||
new: "New",
|
||
status: "Status",
|
||
source: "Source",
|
||
deadline: "Application deadline",
|
||
documents: "Documents",
|
||
notes: "Notes",
|
||
timeline: "Timeline",
|
||
details: "Job details",
|
||
company: "Employer",
|
||
location: "Location",
|
||
type: "Working arrangement",
|
||
required: "What you will bring",
|
||
benefits: "What the role offers",
|
||
progress: "Your progress",
|
||
sourceNote:
|
||
"Synthetic vacancy for concept review. Provider availability is not implied.",
|
||
mapNote: "Illustrative location view, not a geographic boundary map.",
|
||
exportNote:
|
||
"Preview opened. This prototype does not generate a qualified PDF.",
|
||
feedback: "Saved in this prototype only.",
|
||
reviewNote:
|
||
"Review your message and recipient. No email will be sent from this prototype.",
|
||
};
|
||
const nb = {
|
||
...en,
|
||
home: "Hjem",
|
||
discover: "Finn jobber",
|
||
applications: "Søknader",
|
||
detail: "Søknadsområde",
|
||
profile: "Karriereprofil",
|
||
cv: "CV-studio",
|
||
letter: "Søknadsbrev",
|
||
calendar: "Kalender",
|
||
mail: "Korrespondanse",
|
||
settings: "Innstillinger",
|
||
admin: "Administrasjon",
|
||
onboarding: "Kom i gang",
|
||
greeting: "God morgen, Amira.",
|
||
intro: "Gjør plass til din neste mulighet.",
|
||
today: "Dine neste steg",
|
||
week: "Dette skjer snart",
|
||
explore: "Finn en mulighet",
|
||
prepare: "Forbered CV-en",
|
||
view: "Se detaljer",
|
||
save: "Lagre i søknader",
|
||
saved: "Lagret i søknader",
|
||
apply: "Marker som søkt",
|
||
applied: "Søkt",
|
||
review: "Gjennomgå søknaden",
|
||
edit: "Rediger",
|
||
export: "Eksporter forhåndsvisning",
|
||
preview: "Forhåndsvisning",
|
||
content: "Innhold",
|
||
design: "Utforming",
|
||
history: "Historikk",
|
||
search: "Stilling, ferdighet eller arbeidsgiver",
|
||
country: "Søkeland",
|
||
language: "Språk i annonsen",
|
||
all: "Alle yrker",
|
||
filters: "Flere filtre",
|
||
results: "muligheter",
|
||
summary: "Profesjonelt sammendrag",
|
||
experience: "Erfaring",
|
||
skills: "Ferdigheter",
|
||
contact: "Kontaktinformasjon",
|
||
name: "Fullt navn",
|
||
title: "Yrkestittel",
|
||
saveChanges: "Lagre endringer",
|
||
saveDraft: "Lagre utkast",
|
||
send: "Gjennomgå før sending",
|
||
agenda: "Agenda",
|
||
month: "Måned",
|
||
follow: "Planlegg oppfølging",
|
||
reply: "Skriv et svar",
|
||
complete: "Fullfør",
|
||
continue: "Fortsett",
|
||
skip: "Gjør dette senere",
|
||
uiLanguage: "Grensesnittspråk",
|
||
docLanguage: "Dokumentspråk",
|
||
privacy: "Personvern og assistanse",
|
||
notifications: "Varsler",
|
||
connections: "Tilkoblede kontoer",
|
||
security: "Sikkerhet og økter",
|
||
data: "Dine data",
|
||
settingsIntro: "Dine innstillinger, ditt tempo.",
|
||
adminIntro: "Tjenestestatus og kontoadministrasjon.",
|
||
synthetic:
|
||
"Interaktiv designstudie · syntetiske data · ingen aktive tjenester",
|
||
back: "Alle fem konsepter",
|
||
theme: "Tema",
|
||
layout: "Visning",
|
||
desktop: "Datamaskin",
|
||
mobile: "Mobil",
|
||
help: "Hjelp og avanserte verktøy",
|
||
board: "Tavle",
|
||
list: "Liste",
|
||
savedCount: "lagret",
|
||
interviews: "intervjuer",
|
||
drafts: "dokumenter klare",
|
||
new: "Ny",
|
||
status: "Status",
|
||
source: "Kilde",
|
||
deadline: "Søknadsfrist",
|
||
documents: "Dokumenter",
|
||
notes: "Notater",
|
||
timeline: "Tidslinje",
|
||
details: "Stillingsdetaljer",
|
||
company: "Arbeidsgiver",
|
||
location: "Sted",
|
||
type: "Arbeidsform",
|
||
required: "Dette tar du med deg",
|
||
benefits: "Dette tilbyr rollen",
|
||
progress: "Din fremgang",
|
||
sourceNote:
|
||
"Syntetisk stilling for konseptvurdering. Ingen påstand om leverandørtilgang.",
|
||
mapNote: "Illustrert stedsvisning, ikke et geografisk grensekart.",
|
||
exportNote:
|
||
"Forhåndsvisning åpnet. Prototypen lager ikke en kvalifisert PDF.",
|
||
feedback: "Kun lagret i denne prototypen.",
|
||
reviewNote:
|
||
"Gjennomgå melding og mottaker. Ingen e-post sendes fra prototypen.",
|
||
};
|
||
const t = (k) => (state.lang === "nb" ? nb : en)[k] || k;
|
||
const esc = (s) =>
|
||
String(s).replace(
|
||
/[&<>"']/g,
|
||
(c) =>
|
||
({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[
|
||
c
|
||
],
|
||
);
|
||
const jobs = [
|
||
[
|
||
"Community care coordinator",
|
||
"Fjord Community Health",
|
||
"Bergen, Norway",
|
||
"Healthcare",
|
||
"⌘",
|
||
],
|
||
[
|
||
"Primary school teacher",
|
||
"Oakfield Learning Centre",
|
||
"Cork, Ireland",
|
||
"Education",
|
||
"◈",
|
||
],
|
||
[
|
||
"Front-of-house supervisor",
|
||
"Harbour House",
|
||
"Copenhagen, Denmark",
|
||
"Hospitality",
|
||
"◒",
|
||
],
|
||
[
|
||
"Electrician",
|
||
"North Coast Energy",
|
||
"Trondheim, Norway",
|
||
"Skilled trades",
|
||
"ϟ",
|
||
],
|
||
[
|
||
"Service designer",
|
||
"Civic Services Lab",
|
||
"Helsinki, Finland",
|
||
"Public services",
|
||
"◎",
|
||
],
|
||
[
|
||
"Retail team leader",
|
||
"Neighbourhood Market",
|
||
"Utrecht, Netherlands",
|
||
"Retail",
|
||
"◇",
|
||
],
|
||
];
|
||
// Each synthetic opportunity keeps its own tracker state for this review session.
|
||
const ids = [
|
||
"fjord-care",
|
||
"oakfield-teacher",
|
||
"harbour-supervisor",
|
||
"north-coast-electrician",
|
||
"civic-designer",
|
||
"market-lead",
|
||
];
|
||
const records = jobs.map((job, i) => ({
|
||
id: ids[i],
|
||
job,
|
||
stage: ["", "applied", "interview", "", "saved", ""][i],
|
||
followup: false,
|
||
notes: "",
|
||
cvSummary: state.summary,
|
||
letter: state.letter.replace("Community care coordinator", job[0]),
|
||
}));
|
||
function trackedCount() {
|
||
return records.filter((r) => r.stage === "saved").length;
|
||
}
|
||
let current = records.find((r) => r.id === q.get("job")) || records[0];
|
||
const detailText = [
|
||
[
|
||
"Coordinate community care, support families and work with local healthcare teams.",
|
||
"Koordiner omsorgstjenester, støtt familier og samarbeid med lokale helseteam.",
|
||
],
|
||
[
|
||
"Plan lessons and support pupils in a small primary school team.",
|
||
"Planlegg undervisning og følg opp elever i et lite barneskoleteam.",
|
||
],
|
||
[
|
||
"Lead the reception team and coordinate a welcoming guest experience.",
|
||
"Led resepsjonsteamet og sørg for at gjestene blir godt tatt imot.",
|
||
],
|
||
[
|
||
"Maintain electrical installations and coordinate repairs with the field team.",
|
||
"Vedlikehold elektriske anlegg og koordiner reparasjoner med feltteamet.",
|
||
],
|
||
[
|
||
"Design accessible public services with residents and municipal teams.",
|
||
"Utform tilgjengelige offentlige tjenester sammen med innbyggere og kommunale team.",
|
||
],
|
||
[
|
||
"Coordinate shop-floor shifts and coach colleagues in customer service.",
|
||
"Koordiner vakter i butikken og veiled kolleger i kundeservice.",
|
||
],
|
||
];
|
||
function jobLink(job, label) {
|
||
const id = ids[jobs.indexOf(job)];
|
||
return `<a href="?concept=${state.concept}&screen=detail&lang=${state.lang}&theme=${state.theme}&job=${id}${state.phone ? "&mobile=1" : ""}" data-screen="detail" data-job="${id}">${label}</a>`;
|
||
}
|
||
function stageLabel(stage) {
|
||
return stage === "interview"
|
||
? state.lang === "nb"
|
||
? "Intervju"
|
||
: "Interview"
|
||
: stage === "saved"
|
||
? t("savedCount")
|
||
: t("applied");
|
||
}
|
||
const link = (screen, label, cls = "", id = current.id) =>
|
||
`<a class="${cls}" href="?concept=${state.concept}&screen=${screen}&lang=${state.lang}&theme=${state.theme}&job=${id}${state.phone ? "&mobile=1" : ""}" data-screen="${screen}" data-job="${id}">${label || t(screen)}</a>`;
|
||
const btn = (label, action, primary = false) =>
|
||
`<button class="${primary ? "primary" : ""}" data-action="${action}">${label}</button>`;
|
||
function toast(message) {
|
||
$(".toast")?.remove();
|
||
const el = document.createElement("div");
|
||
el.className = "toast";
|
||
el.setAttribute("role", "status");
|
||
el.textContent = message;
|
||
document.body.append(el);
|
||
setTimeout(() => el.remove(), 4500);
|
||
}
|
||
function field(label, value, id, area = false) {
|
||
return `<label class="field">${label}${area ? `<textarea id="${id}">${esc(value)}</textarea>` : `<input id="${id}" value="${esc(value)}">`}</label>`;
|
||
}
|
||
function heading(title, sub = "", actions = "") {
|
||
return `<div class="heading"><div><h1>${title}</h1>${sub ? `<p class="muted">${sub}</p>` : ""}</div><div class="actions">${actions}</div></div>`;
|
||
}
|
||
function jobRows(items = jobs) {
|
||
return `<div class="list">${items.map((j) => `<div class="row"><div class="logo">${j[4]}</div><div class="grow"><h3>${jobLink(j, j[0])}</h3><p class="muted">${j[1]} · ${j[2]}</p></div><span class="badge">${records[jobs.indexOf(j)].stage ? stageLabel(records[jobs.indexOf(j)].stage) : j[3]}</span>${jobLink(j, t("view"))}</div>`).join("")}</div>`;
|
||
}
|
||
function agenda() {
|
||
return `<div class="agenda">${records
|
||
.filter((r) => r.followup)
|
||
.map(
|
||
(r) =>
|
||
`<div class="row"><div class="date">27<br>Nov</div><div><h3>${jobLink(r.job, (state.lang === "nb" ? "Følg opp " : "Follow up with ") + r.job[1])}</h3><p>${state.lang === "nb" ? "Lagt til i denne prototypen" : "Added in this prototype"}</p></div></div>`,
|
||
)
|
||
.join(
|
||
"",
|
||
)}<div class="row"><div class="date">20<br>Nov</div><div><h3>${state.lang === "nb" ? "Møt teamet i Fjord" : "Meet the Fjord team"}</h3><p class="muted">10:00–10:45 · Europe/Oslo</p>${jobLink(jobs[0], t("review"))}</div></div><div class="row"><div class="date">22<br>Nov</div><div><h3>${state.lang === "nb" ? "Søknadsfrist: Lærer" : "Deadline: Primary school teacher"}</h3><p class="muted">Oakfield Learning Centre</p>${jobLink(jobs[1], t("view"))}</div></div><div class="row"><div class="date">25<br>Nov</div><div><h3>${state.lang === "nb" ? "Følg opp Harbour House" : "Follow up with Harbour House"}</h3><p class="muted">${state.lang === "nb" ? "Påminnelse, ingen automatisk melding" : "Reminder only, no automatic message"}</p></div></div></div>`;
|
||
}
|
||
function tasks() {
|
||
return `<div class="task"><input id="task1" type="checkbox"><label for="task1">${state.lang === "nb" ? "Velg erfaring til CV-en for Fjord" : "Choose experience for your Fjord CV"}<br>${link("cv", t("prepare"))}</label></div><div class="task"><input id="task2" type="checkbox"><label for="task2">${state.lang === "nb" ? "Svar på intervjuinvitasjonen" : "Reply to your interview invitation"}<br>${link("mail", t("reply"))}</label></div><div class="task"><input id="task3" type="checkbox"><label for="task3">${state.lang === "nb" ? "Se gjennom tre nye muligheter" : "Review three new opportunities"}<br>${link("discover", t("explore"))}</label></div>`;
|
||
}
|
||
function home() {
|
||
let main = `${heading(t("greeting"), t("intro"), link("discover", t("explore")))}<div class="metric-strip"><div class="metric"><strong>${trackedCount()}</strong>${t("savedCount")}</div><div class="metric"><strong>2</strong>${t("interviews")}</div><div class="metric"><strong>3</strong>${t("drafts")}</div></div><div class="split"><section><div class="section-title"><h2>${t("today")}</h2>${link("applications", t("applications"))}</div>${tasks()}<div class="section" style="margin-top:35px"><h2>${state.lang === "nb" ? "Nylig aktivitet" : "Recent activity"}</h2>${jobRows(jobs.slice(0, 3))}</div></section><aside><h2>${t("week")}</h2>${agenda()}</aside></div>`;
|
||
if (state.concept === "B")
|
||
main = `<div class="welcome">${heading(state.lang === "nb" ? "Et nytt kapittel begynner her." : "Your next chapter starts here.", state.lang === "nb" ? "Ta ett steg i dag. Vi holder orden på resten." : "Take one step today. We’ll help keep everything together.")}<div class="actions">${btn(t("prepare"), "cv", true)}${link("onboarding", state.lang === "nb" ? "Finn din vei" : "Find your starting point")}</div></div><div class="split"><section><h2>${t("today")}</h2>${tasks()}<div class="notice"><h3>${state.lang === "nb" ? "Du trenger ikke gjøre alt på én gang." : "You don’t need to do everything at once."}</h3><p>${state.lang === "nb" ? "Profilen din er et godt sted å begynne. Du kan alltid komme tilbake." : "Your profile is a good place to begin. You can always come back."}</p>${link("profile", t("profile"))}</div></section><aside><h2>${t("week")}</h2>${agenda()}</aside></div>`;
|
||
if (state.concept === "C")
|
||
main = `${heading(state.lang === "nb" ? "Arbeidet bak din neste jobb." : "The work behind your next role.", state.lang === "nb" ? "Din erfaring. Dine dokumenter. En tydelig historie." : "Your experience. Your documents. One coherent story.", btn(t("prepare"), "cv", true))}<div class="split"><div><div class="grid3">${["cv", "letter", "profile"].map((s, i) => `<a class="tile" data-screen="${s}" href="#"><div style="height:150px;background:var(--soft);padding:20px;margin-bottom:20px"><div style="background:var(--paper);height:100%;padding:12px"><strong>Amira Olsen</strong><hr><small>${["Community care", "Fjord Health", "6 years experience"][i]}</small><hr><hr></div></div><h3>${t(s)}</h3><small>${state.lang === "nb" ? "Sist redigert i dag" : "Edited today"}</small></a>`).join("")}</div><h2 style="margin-top:35px">${t("applications")}</h2>${jobRows(jobs.slice(0, 2))}</div><aside><h2>${t("today")}</h2>${tasks()}${agenda()}</aside></div>`;
|
||
if (state.concept === "D")
|
||
main = `<div class="heading"><div><h1 class="hero-title">${state.lang === "nb" ? "Et arbeidsliv som passer deg." : "A working life that fits you."}</h1><p class="muted">${state.lang === "nb" ? "Ditt personlige overblikk, onsdag 18. november." : "Your personal brief, Wednesday 18 November."}</p></div>${link("profile", "Amira Olsen")}</div><div class="split"><section class="feature"><p>${state.lang === "nb" ? "Neste samtale" : "Your next conversation"}</p><h2 style="font-size:34px">Fjord Community Health</h2><p>${state.lang === "nb" ? "Et lokalt team. En meningsfull rolle. Forbered deg til fredag." : "A local team. A meaningful role. Get ready for Friday."}</p>${btn(t("review"), "detail")}</section><section><h2>${t("today")}</h2>${tasks()}</section></div><section style="margin-top:40px"><h2>${state.lang === "nb" ? "Muligheter verdt å utforske" : "Opportunities worth exploring"}</h2>${jobRows(jobs.slice(0, 3))}</section>`;
|
||
if (state.concept === "E")
|
||
main = `${heading(state.lang === "nb" ? "Hva er ditt neste steg?" : "What’s your next move?", state.lang === "nb" ? "Samle alt rundt muligheten du jobber med." : "Keep everything together around the opportunity you’re working on.")}<div class="task-path"><section class="tile"><span class="badge">${state.lang === "nb" ? "Pågående" : "In progress"}</span><h2 style="margin-top:20px">Fjord Community Health</h2><p>Community care coordinator</p><div class="steps"><span>✓ ${t("savedCount")}</span><span>✓ CV</span><span>○ ${t("interviews")}</span></div>${btn(state.lang === "nb" ? "Fortsett forberedelsen" : "Continue preparing", "detail", true)}<hr style="border:0;border-top:1px solid var(--line);margin:25px 0">${link("mail", state.lang === "nb" ? "Ny invitasjon fra Elise" : "New invitation from Elise")}</section><section><h2>${state.lang === "nb" ? "Velg en retning" : "Choose a direction"}</h2><div class="list">${["discover", "profile", "calendar"].map((s) => `<div class="row"><div class="grow"><h3>${link(s, t(s))}</h3><p class="muted">${s === "discover" ? (state.lang === "nb" ? "Finn noe du vil gå videre med" : "Find something worth pursuing") : s === "profile" ? (state.lang === "nb" ? "Samle det du kan" : "Bring your experience together") : state.lang === "nb" ? "Gjør plass til det som kommer" : "Make space for what comes next"}</p></div></div>`).join("")}</div></section></div>`;
|
||
return main;
|
||
}
|
||
function discoveryBase() {
|
||
return `${heading(t("discover"), state.lang === "nb" ? "Finn arbeid som passer livet ditt." : "Find work that fits your life.")}<div class="filters"><input aria-label="${t("search")}" id="search" placeholder="${t("search")}" value="${esc(state.query)}"><select aria-label="${t("country")}" id="country">${["", "Norway", "Ireland", "Denmark", "Finland", "Netherlands"].map((v) => `<option value="${v}" ${state.country === v ? "selected" : ""}>${v || (state.lang === "nb" ? "Alle land" : "All countries")}</option>`).join("")}</select>${btn(t("filters"), "filters")}</div><div class="split"><section><p class="muted" id="resultCount">${filteredJobs().length} ${t("results")} · ${t("sourceNote")}</p><div id="discoveryLive" class="sr-only" role="status"></div><div id="jobResults">${discoveryMarkup()}</div></section><aside><div class="map"><svg viewBox="0 0 300 240" role="img" aria-label="Illustrative Nordic locations"><path d="M90 210L110 160 100 120 150 50 185 20 205 40 180 80 165 125 145 160 135 220Z" fill="var(--paper)" stroke="var(--line)" stroke-width="2"/><path d="M190 70L240 45 260 100 220 150 190 130Z" fill="var(--paper)" stroke="var(--line)"/><g fill="var(--accent)"><circle cx="116" cy="150" r="7"/><circle cx="145" cy="120" r="7"/><circle cx="135" cy="195" r="7"/><circle cx="225" cy="115" r="7"/></g><g fill="var(--ink)" font-size="12"><text x="45" y="153">Bergen</text><text x="151" y="118">Trondheim</text><text x="145" y="199">Copenhagen</text><text x="232" y="114">Helsinki</text></g></svg><p>${t("mapNote")}</p></div><div class="notice" style="margin-top:20px"><h3>${t("language")}</h3><label><input type="checkbox" checked> English</label><br><label><input type="checkbox" checked> Norsk bokmål</label><p style="margin:15px 0 0">${state.lang === "nb" ? "Grensesnittspråket endrer ikke hvilke annonser du ser." : "Your interface language does not change which adverts you see."}</p></div></aside></div>`;
|
||
}
|
||
function applications() {
|
||
return `${heading(t("applications"), state.lang === "nb" ? "Fra første interesse til neste samtale." : "From first interest to your next conversation.", btn(t("list"), "list") + btn(t("board"), "board"))}${
|
||
state.trackerView === "board"
|
||
? `<div class="board">${["saved", "applied", "interview"]
|
||
.map(
|
||
(stage) =>
|
||
`<section><h2>${stageLabel(stage)}</h2>${records
|
||
.filter((r) => r.stage === stage)
|
||
.map(
|
||
({ job: j }) =>
|
||
`<article><h3>${jobLink(j, j[0])}</h3><p>${j[1]}</p><small>${j[2]}</small><div style="margin-top:15px">${link("cv", t("prepare"), "", ids[jobs.indexOf(j)])}</div></article>`,
|
||
)
|
||
.join("")}</section>`,
|
||
)
|
||
.join("")}</div>`
|
||
: jobRows(records.filter((r) => r.stage).map((r) => r.job))
|
||
}`;
|
||
}
|
||
function detail() {
|
||
return `${heading(current.job[0], current.job[1] + " · " + current.job[2], btn(current.stage ? t("saved") : t("save"), "save", !current.stage))}<div class="steps">${["detail", "cv", "letter", "mail", "calendar"].map((s) => link(s, t(s), s === "detail" ? "active" : "")).join("")}</div><div class="split"><section><div class="notice"><h2>${current.stage === "applied" || current.stage === "interview" ? stageLabel(current.stage) : state.lang === "nb" ? "Gjør søknaden klar" : "Make your application ready"}</h2><p>${state.lang === "nb" ? "Velg CV og brev. Gjennomgå alt før du sender via arbeidsgiveren." : "Choose your CV and letter. Review everything before applying through the employer."}</p><div class="actions">${btn(t("prepare"), "cv", true)}${btn(["applied", "interview"].includes(current.stage) ? t("follow") : t("apply"), ["applied", "interview"].includes(current.stage) ? "follow" : "apply")}</div></div><h2 style="margin-top:30px">${t("details")}</h2><p>${detailText[jobs.indexOf(current.job)][state.lang === "nb" ? 1 : 0]}</p><h3>${t("notes")}</h3>${field(state.lang === "nb" ? "Dine egne notater" : "Your private notes", current.notes, "notes", true)}${btn(t("saveChanges"), "saveNotes")}</section><aside><h2>${state.lang === "nb" ? "Alt på ett sted" : "Everything in one place"}</h2>${agenda()}<div class="row"><div><small>${t("deadline")}</small><h3>${current.id === "oakfield-teacher" ? 22 : 24} November 2026</h3></div></div><div class="row"><div><small>${t("source")}</small><p>${t("sourceNote")}</p></div></div>${link("mail", t("mail"))}</aside></div>`;
|
||
}
|
||
function profile() {
|
||
return `${heading(t("profile"), state.lang === "nb" ? "Din erfaring er utgangspunktet. Dokumentene er dine valg." : "Your experience is the source. Your documents are your choices.", btn(t("prepare"), "cv", true))}<div class="split"><section>${field(t("name"), state.name, "name")}${field(t("title"), state.title, "title")}${field(t("summary"), state.profileSummary, "summary", true)}${btn(t("saveChanges"), "profileSave", true)}<h2 style="margin-top:35px">${t("experience")}</h2><div class="row"><div class="logo">⌘</div><div class="grow"><h3>Care services coordinator</h3><p>Westside Community Centre · 2020–2026</p><small>Patient support · Scheduling · Team coordination</small></div>${btn(t("edit"), "feedback")}</div><details style="margin-top:20px"><summary>${state.lang === "nb" ? "Utdanning, språk og mer" : "Education, languages and more"}</summary><p>BSc Health & Social Care · Norsk B2 · English C1</p><p>First aid · Volunteer mentor · Community gardening</p></details></section><aside><div class="notice"><h2>${t("progress")}</h2><progress value="4" max="6" style="width:100%"></progress><p>${state.lang === "nb" ? "4 av 6 viktige deler klare" : "4 of 6 key sections ready"}</p><p>${state.lang === "nb" ? "Du kan bruke profilen nå. Legg til mer når det passer." : "You can use your profile now. Add more when you’re ready."}</p></div><h3 style="margin-top:30px">${t("documents")}</h3>${link("cv", "Fjord Health CV", "", "fjord-care")}<hr>${link("letter", "Fjord Health cover letter", "", "fjord-care")}</aside></div>`;
|
||
}
|
||
function paper(letter = false) {
|
||
return `<article class="document"><h2>${esc(state.name)}</h2><p>${esc(state.title)}</p><small>Bergen, Norway · amira@example.test</small><hr>${letter ? `<p style="white-space:pre-line" id="letterPreview">${esc(current.letter)}</p>` : `<h3>${t("summary")}</h3><p id="summaryPreview">${esc(current.cvSummary)}</p><h3>${t("experience")}</h3><strong>Care services coordinator</strong><p>Westside Community Centre<br>2020–2026</p><ul><li>Coordinated care schedules for a team of twelve.</li><li>Helped families navigate local support services.</li><li>Introduced a clearer weekly handover.</li></ul><h3>${state.lang === "nb" ? "Utdanning" : "Education"}</h3><p>BSc Health & Social Care<br>2016–2019</p><h3>${t("skills")}</h3><p>Patient support · Team coordination · Scheduling</p>`}</article>`;
|
||
}
|
||
function studio(letter = false) {
|
||
const edit = `<section class="editor"><div class="editor-tabs">${btn(t("content"), "content")}${btn(t("design"), "design")}${btn(t("history"), "history")}</div><p class="muted">${state.lang === "nb" ? "Dette er en dokumentkopi. Karriereprofilen endres ikke." : "This is a document copy. Your Career Profile stays unchanged."}</p>${letter ? field(t("letter"), current.letter, "letter", true) : field(t("summary"), current.cvSummary, "summary", true)}<label class="field">${t("docLanguage")}<select><option>English</option><option>Norsk bokmål</option><option>Deutsch</option><option>Français</option><option>Ελληνικά</option><option>Български</option></select></label><details><summary>${state.lang === "nb" ? "Velg innhold fra profilen" : "Choose content from your profile"}</summary>${["contact", "experience", "skills"].map((k) => `<label class="task"><input type="checkbox" checked>${t(k)}</label>`).join("")}</details><div class="actions" style="margin-top:25px">${btn(t("saveDraft"), "feedback", true)}${btn(t("export"), "export")}</div></section>`;
|
||
const doc = paper(letter);
|
||
return `${heading(letter ? t("letter") : t("cv"), current.job[1] + " · " + (state.lang === "nb" ? "Utkast, kun prototype" : "Draft, prototype only"), link("detail", t("review")))}<div class="studio">${state.concept === "C" ? doc + edit : edit + doc}</div>`;
|
||
}
|
||
function calendar() {
|
||
return `${heading(t("calendar"), state.lang === "nb" ? "Samtaler, frister og plass til forberedelse." : "Conversations, deadlines and time to prepare.", btn(t("agenda"), "agenda") + btn(t("month"), "month"))}${
|
||
state.calendarView === "month"
|
||
? `<h2>November 2026</h2><div class="calendar">${Array.from(
|
||
{ length: 30 },
|
||
(_, i) =>
|
||
`<div class="day"><strong>${i + 1}</strong>${
|
||
i === 26
|
||
? records
|
||
.filter((r) => r.followup)
|
||
.map((r) => "<p>" + jobLink(r.job, r.job[1]) + "</p>")
|
||
.join("")
|
||
: i === 19
|
||
? "<p>10:00 Fjord</p>"
|
||
: i === 21
|
||
? "<p>Oakfield deadline</p>"
|
||
: i === 24
|
||
? "<p>Harbour follow-up</p>"
|
||
: ""
|
||
}</div>`,
|
||
).join("")}</div>`
|
||
: `<div class="split"><section>${agenda()}</section><aside class="notice"><h2>${state.lang === "nb" ? "Tid til å forberede deg" : "Time to prepare"}</h2><p>${state.lang === "nb" ? "Sett av 30 minutter før intervjuet. Samle spørsmål og dokumenter i søknadsområdet." : "Set aside 30 minutes before your interview. Keep questions and documents in the application workspace."}</p>${btn(t("review"), "detail", true)}</aside></div>`
|
||
}`;
|
||
}
|
||
function mail() {
|
||
return `${heading(t("mail"), state.lang === "nb" ? "Samtaler knyttet til mulighetene dine." : "Conversations connected to your opportunities.")}<div class="mail-layout"><aside><div class="mail active"><h3>Elise · Fjord Health</h3><p>${state.lang === "nb" ? "Vi vil gjerne møte deg" : "We’d love to meet you"}</p><small>Today, 09:12</small></div><div class="mail"><h3>Oakfield Learning</h3><p>Application received</p><small>Yesterday</small></div></aside><section><span class="badge">Fjord Community Health</span><h2 style="margin-top:20px">${state.lang === "nb" ? "Vi vil gjerne møte deg" : "We’d love to meet you"}</h2><p>${state.lang === "nb" ? "Hei Amira, takk for interessen din. Har du anledning til en samtale fredag klokken 10? Vi gleder oss til å høre mer om erfaringen din." : "Hi Amira, thank you for your interest. Would you be available for a conversation on Friday at 10? We look forward to learning more about your experience."}</p><p>Elise<br>Fjord Community Health</p><div class="actions">${btn(t("calendar"), "calendar")}${jobLink(jobs[0], t("review"))}</div><hr style="margin:30px 0;border:0;border-top:1px solid var(--line)">${field(t("reply"), state.lang === "nb" ? "Hei Elise, fredag klokken 10 passer fint. Takk for invitasjonen!" : "Hi Elise, Friday at 10 works well. Thank you for the invitation!", "reply", true)}${btn(t("send"), "send", true)}</section></div>`;
|
||
}
|
||
function settings() {
|
||
return `${heading(t("settings"), t("settingsIntro"))}<div class="wide-split"><aside class="list">${["uiLanguage", "privacy", "notifications", "connections", "security", "data"].map((k) => `<div class="row"><a href="#${k}">${t(k)}</a></div>`).join("")}</aside><section><h2 id="uiLanguage">${t("uiLanguage")}</h2><label class="field">${t("uiLanguage")}<select id="settingLanguage"><option value="en" ${state.lang === "en" ? "selected" : ""}>English</option><option value="nb" ${state.lang === "nb" ? "selected" : ""}>Norsk bokmål</option></select></label><p class="muted">${state.lang === "nb" ? "Søkeland, annonsespråk og dokumentspråk velges uavhengig." : "Search country, advert language and document language are independent choices."}</p><h2 id="privacy">${t("privacy")}</h2><label class="task"><input type="checkbox">${state.lang === "nb" ? "Tillat forslag fra AI etter at jeg ber om det" : "Allow AI suggestions when I explicitly ask"}</label><h2 id="notifications">${t("notifications")}</h2><label class="task"><input type="checkbox" checked>${state.lang === "nb" ? "Minn meg på frister og oppfølging" : "Remind me about deadlines and follow-ups"}</label>${["connections", "security", "data"].map((k) => `<details id="${k}" style="padding:18px 0;border-top:1px solid var(--line)"><summary>${t(k)}</summary><p>${state.lang === "nb" ? "Disse kontrollene er en del av den bevarte funksjonaliteten. Ingen kontoer endres i prototypen." : "These controls remain part of the preserved functionality. No accounts are changed in this prototype."}</p>${btn(t("view"), "feedback")}</details>`).join("")}${btn(t("saveChanges"), "feedback", true)}</section></div>`;
|
||
}
|
||
function admin() {
|
||
return `${heading(t("admin"), t("adminIntro"))}<div class="notice"><strong>${state.lang === "nb" ? "Kun demonstrasjon" : "Demonstration only"}</strong><p>${state.lang === "nb" ? "Alle kontoer og statuser nedenfor er syntetiske." : "All accounts and statuses below are synthetic."}</p></div><div class="metric-strip"><div class="metric"><strong>24</strong>${state.lang === "nb" ? "kontoer" : "accounts"}</div><div class="metric"><strong>3</strong>${state.lang === "nb" ? "oppgaver i kø" : "queued tasks"}</div><div class="metric"><strong>0</strong>${state.lang === "nb" ? "kjente hendelser" : "known incidents"}</div></div><div class="split"><section><h2>${state.lang === "nb" ? "Kontoadministrasjon" : "Account management"}</h2>${["Amira Olsen", "Lukas Weber", "Sofia Silva"].map((n, i) => `<div class="row"><div class="avatar">${n[0]}</div><div class="grow"><h3>${n}</h3><small>${i === 0 ? "Administrator" : "Member"} · ${state.lang === "nb" ? "Bekreftet" : "Confirmed"}</small></div>${btn(t("view"), "adminDetail")}</div>`).join("")}</section><aside><h2>${state.lang === "nb" ? "Behandling" : "Processing"}</h2><div class="list"><div class="row">CV import <span class="badge">Waiting</span></div><div class="row">Document export <span class="badge">Completed</span></div></div>${btn(state.lang === "nb" ? "Se revisjonslogg" : "View audit log", "history")}</aside></div>`;
|
||
}
|
||
function onboarding() {
|
||
return `${heading(state.lang === "nb" ? "La oss finne ditt utgangspunkt." : "Let’s find your starting point.", state.lang === "nb" ? "Ingen riktig rekkefølge. Velg det som hjelper deg nå." : "There’s no right order. Choose what helps you now.")}<div class="grid3">${[
|
||
[
|
||
"discover",
|
||
state.lang === "nb"
|
||
? "Jeg ser etter nye muligheter"
|
||
: "I’m exploring opportunities",
|
||
state.lang === "nb"
|
||
? "Bla gjennom jobber og lagre det som passer."
|
||
: "Browse jobs and save the ones that feel right.",
|
||
],
|
||
[
|
||
"profile",
|
||
state.lang === "nb"
|
||
? "Jeg vil samle erfaringen min"
|
||
: "I want to gather my experience",
|
||
state.lang === "nb"
|
||
? "Bygg et utgangspunkt du kan bruke igjen."
|
||
: "Build a foundation you can reuse.",
|
||
],
|
||
[
|
||
"cv",
|
||
state.lang === "nb"
|
||
? "Jeg har en søknad å forberede"
|
||
: "I have an application to prepare",
|
||
state.lang === "nb"
|
||
? "Gå rett til CV og søknadsbrev."
|
||
: "Go straight to your CV and cover letter.",
|
||
],
|
||
]
|
||
.map(
|
||
([s, h, p]) =>
|
||
`<section class="tile"><div class="logo" style="margin-bottom:25px">${s === "discover" ? "◎" : s === "profile" ? "◈" : "▤"}</div><h2>${h}</h2><p>${p}</p>${btn(t("continue"), s, true)}</section>`,
|
||
)
|
||
.join(
|
||
"",
|
||
)}</div><div style="margin-top:30px">${link("home", t("skip"))}</div>`;
|
||
}
|
||
function gallery() {
|
||
document.body.className = "A";
|
||
return `<main class="gallery"><p>Jobjakt design reassessment · November 2026</p><h1>Five ways to make your next move.</h1><p>Five distinct working prototypes. Explore the same career journeys through different navigation, density and document workflows. Nothing here replaces the current application.</p><div class="gallery-grid">${Object.entries(
|
||
concepts,
|
||
)
|
||
.map(
|
||
([id, c]) =>
|
||
`<a class="concept-card ${id}" href="?concept=${id}" data-concept="${id}"><img class="concept-shot" src="captures/${id}-home-1440.png" alt="" width="1440" height="1000"><div class="description"><small>Concept ${id}</small><h2>${c.name}</h2><p>${c.detail}</p><strong>Explore this direction</strong></div></a>`,
|
||
)
|
||
.join(
|
||
"",
|
||
)}</div><section style="margin-top:45px"><h2>What to compare</h2><p>Try finding a job, saving it, preparing a CV, reviewing a letter and scheduling a follow-up. Switch between desktop and mobile, English and Bokmål, light and dark. These are design prototypes with synthetic data, not provider or production qualification.</p><a href="compare.html">Compare screenshots and tradeoffs</a> · <a href="RESEARCH.md">Research notes</a></section></main>`;
|
||
}
|
||
function render() {
|
||
if (!state.concept) {
|
||
$("#app").innerHTML = gallery();
|
||
return;
|
||
}
|
||
const c = concepts[state.concept];
|
||
document.documentElement.lang = state.lang === "nb" ? "nb-NO" : "en";
|
||
document.body.className = `${state.concept} ${state.theme === "dark" ? "dark" : ""} ${state.phone ? "phone" : ""}`;
|
||
const nav =
|
||
state.concept === "C"
|
||
? [
|
||
"home",
|
||
"profile",
|
||
"cv",
|
||
"letter",
|
||
"applications",
|
||
"discover",
|
||
"calendar",
|
||
"mail",
|
||
"settings",
|
||
"admin",
|
||
]
|
||
: ["home", "discover", "applications", "profile", "calendar"];
|
||
const screens = {
|
||
home,
|
||
discover,
|
||
applications,
|
||
detail,
|
||
profile,
|
||
cv: () => studio(),
|
||
letter: () => studio(true),
|
||
calendar,
|
||
mail,
|
||
settings,
|
||
admin,
|
||
onboarding,
|
||
};
|
||
$("#app").innerHTML =
|
||
`<div class="lab"><a href="index.html">${t("back")}</a><label>Concept <select id="concept">${Object.entries(
|
||
concepts,
|
||
)
|
||
.map(
|
||
([id, v]) =>
|
||
`<option value="${id}" ${id === state.concept ? "selected" : ""}>${id} · ${v.name}</option>`,
|
||
)
|
||
.join(
|
||
"",
|
||
)}</select></label><label><select aria-label="Screen" id="screen">${Object.keys(
|
||
screens,
|
||
)
|
||
.map(
|
||
(s) =>
|
||
`<option value="${s}" ${s === state.screen ? "selected" : ""}>${t(s)}</option>`,
|
||
)
|
||
.join(
|
||
"",
|
||
)}</select></label><label><select aria-label="Language" id="lang"><option value="en" ${state.lang === "en" ? "selected" : ""}>English</option><option value="nb" ${state.lang === "nb" ? "selected" : ""}>Norsk</option></select></label><button data-action="theme">${state.theme === "dark" ? "☀ Light" : "☾ Dark"}</button><button data-action="mobile">${state.phone ? t("desktop") : t("mobile")}</button></div><div class="shell"><header class="top"><a class="brand" href="#" data-screen="home"><span>${state.concept === "E" ? "↗" : "j"}</span>${c.name}</a><nav class="nav" aria-label="Primary">${nav.map((s) => link(s, t(s), state.screen === s ? "active" : "")).join("")}</nav><div class="actions">${link("mail", "✉ " + t("mail"))}${link("settings", t("settings"))}<span class="avatar">AO</span></div></header><main class="content" id="main">${(screens[state.screen] || home)()}<details style="margin-top:35px"><summary>${t("help")}</summary><div class="actions" style="margin-top:12px">${["cv", "letter", "mail", "settings", "admin", "onboarding"].map((s) => link(s, t(s))).join("")}</div></details></main>${state.concept === "E" ? `<nav class="journey-nav" aria-label="Journey">${["home", "discover", "applications", "profile", "calendar"].map((s) => link(s, t(s), state.screen === s ? "active" : "")).join("")}</nav>` : ""}</div><footer class="footnote">${t("synthetic")}</footer>`;
|
||
history.replaceState(
|
||
null,
|
||
"",
|
||
`?concept=${state.concept}&screen=${state.screen}&lang=${state.lang}&theme=${state.theme}&job=${current.id}${state.phone ? "&mobile=1" : ""}`,
|
||
);
|
||
}
|
||
document.addEventListener("click", (event) => {
|
||
const a = event.target.closest("[data-screen]");
|
||
if (a) {
|
||
event.preventDefault();
|
||
if (a.dataset.job)
|
||
current = records.find((r) => r.id === a.dataset.job) || records[0];
|
||
state.screen = a.dataset.screen;
|
||
render();
|
||
window.scrollTo(0, 0);
|
||
return;
|
||
}
|
||
const b = event.target.closest("[data-action]");
|
||
if (!b) return;
|
||
const action = b.dataset.action;
|
||
if (screens.includes(action)) {
|
||
if (state.screen === "home" && action === "detail") current = records[0];
|
||
state.screen = action;
|
||
render();
|
||
window.scrollTo(0, 0);
|
||
} else if (action === "theme") {
|
||
state.theme = state.theme === "light" ? "dark" : "light";
|
||
render();
|
||
} else if (action === "mobile") {
|
||
state.phone = !state.phone;
|
||
render();
|
||
} else if (action === "save") {
|
||
current.stage ||= "saved";
|
||
render();
|
||
toast(t("saved"));
|
||
} else if (action === "apply") {
|
||
current.stage = "applied";
|
||
render();
|
||
toast(t("applied"));
|
||
} else if (["agenda", "month", "board", "list"].includes(action)) {
|
||
if (["agenda", "month"].includes(action)) state.calendarView = action;
|
||
else state.trackerView = action;
|
||
render();
|
||
} else if (action === "profileSave") {
|
||
state.name = $("#name").value;
|
||
state.title = $("#title").value;
|
||
state.profileSummary = $("#summary").value;
|
||
toast(t("feedback"));
|
||
} else if (action === "follow") {
|
||
current.followup = true;
|
||
state.calendarView = "agenda";
|
||
state.screen = "calendar";
|
||
render();
|
||
toast(
|
||
state.lang === "nb"
|
||
? "Oppfølging lagt til i prototypen"
|
||
: "Follow-up added in this prototype",
|
||
);
|
||
} else if (action === "saveNotes") {
|
||
current.notes = $("#notes").value;
|
||
toast(t("feedback"));
|
||
} else if (action === "export") {
|
||
toast(t("exportNote"));
|
||
$(".document")?.scrollIntoView({ block: "start" });
|
||
} else if (action === "send") {
|
||
toast(t("reviewNote"));
|
||
} else if (action === "filters") {
|
||
toast(
|
||
state.lang === "nb"
|
||
? "Land og annonsespråk kan velges uavhengig. Kartet er illustrativt."
|
||
: "Country and advert language are independent. The map is illustrative.",
|
||
);
|
||
} else if (action === "design") {
|
||
toast(
|
||
state.lang === "nb"
|
||
? "Ren dokumentstil valgt. Innhold og språk beholdes."
|
||
: "Clean document style selected. Content and language retained.",
|
||
);
|
||
} else if (action === "history") {
|
||
toast(
|
||
state.lang === "nb"
|
||
? "Utkast 3 · I dag 09:40. Prototypen endrer ingen lagrede versjoner."
|
||
: "Draft 3 · Today 09:40. No stored revisions are changed by this prototype.",
|
||
);
|
||
} else if (action === "adminDetail") {
|
||
toast(
|
||
state.lang === "nb"
|
||
? "Siste administrator er beskyttet. Ingen kontoendringer utføres."
|
||
: "The last administrator is protected. No account changes are performed.",
|
||
);
|
||
} else toast(t("feedback"));
|
||
});
|
||
document.addEventListener("change", (e) => {
|
||
if (e.target.id === "country") {
|
||
state.country = e.target.value;
|
||
render();
|
||
}
|
||
if (["concept", "screen", "lang"].includes(e.target.id)) {
|
||
state[e.target.id] = e.target.value;
|
||
render();
|
||
}
|
||
if (e.target.id === "settingLanguage") {
|
||
state.lang = e.target.value;
|
||
render();
|
||
}
|
||
});
|
||
document.addEventListener("input", (e) => {
|
||
if (e.target.id === "search") {
|
||
state.query = e.target.value;
|
||
state.discoveryState = "ready";
|
||
updateDiscoveryResults();
|
||
}
|
||
if (e.target.id === "summary" && $("#summaryPreview")) {
|
||
current.cvSummary = e.target.value;
|
||
$("#summaryPreview").textContent = current.cvSummary;
|
||
}
|
||
if (e.target.id === "letter" && $("#letterPreview")) {
|
||
current.letter = e.target.value;
|
||
$("#letterPreview").textContent = current.letter;
|
||
}
|
||
});
|
||
render();
|
||
|
||
function filteredJobs() {
|
||
return jobs.filter(
|
||
(j) =>
|
||
(!state.country || j[2].endsWith(state.country)) &&
|
||
j.join(" ").toLowerCase().includes(state.query.toLowerCase()),
|
||
);
|
||
}
|
||
|
||
// Synthetic recovery states; no provider requests are made.
|
||
let discoveryTimer;
|
||
function discoveryCopy(enText, nbText) {
|
||
return state.lang === "nb" ? nbText : enText;
|
||
}
|
||
function discoveryMarkup() {
|
||
const mode = state.discoveryState;
|
||
if (mode === "loading")
|
||
return `<section aria-busy="true" aria-labelledby="discoveryStatus"><h2 id="discoveryStatus" tabindex="-1">${discoveryCopy("Finding opportunities…", "Finner muligheter…")}</h2><p>${discoveryCopy("Synthetic loading preview. Your search is retained.", "Syntetisk lastevisning. Søket ditt beholdes.")}</p><button data-recovery="cancel">${discoveryCopy("Cancel search", "Avbryt søket")}</button></section>`;
|
||
if (mode === "error")
|
||
return `<section aria-labelledby="discoveryStatus"><h2 id="discoveryStatus" tabindex="-1">${discoveryCopy("We could not load these jobs", "Vi kunne ikke laste disse stillingene")}</h2><p>${discoveryCopy("Simulated connection failure. Your filters and saved applications are unchanged.", "Simulert tilkoblingsfeil. Filtrene og lagrede søknader er uendret.")}</p><button class="primary" data-recovery="retry">${discoveryCopy("Try again", "Prøv igjen")}</button></section>`;
|
||
const rows = mode === "empty" ? [] : filteredJobs();
|
||
if (!rows.length)
|
||
return `<section aria-labelledby="discoveryStatus"><h2 id="discoveryStatus" tabindex="-1">${discoveryCopy("No matching jobs yet", "Ingen passende stillinger ennå")}</h2><p>${discoveryCopy("Try a broader phrase or another country. You can keep your current search.", "Prøv et bredere søk eller et annet land. Du kan beholde søket ditt.")}</p><button data-recovery="clear">${discoveryCopy("Clear filters and show all jobs", "Nullstill filtre og vis alle stillinger")}</button><button data-recovery="edit">${discoveryCopy("Edit search", "Endre søket")}</button></section>`;
|
||
return (
|
||
`<h2 id="discoveryStatus" tabindex="-1">${discoveryCopy("Opportunities to explore", "Muligheter å utforske")}</h2>` +
|
||
jobRows(rows)
|
||
);
|
||
}
|
||
function discover() {
|
||
return (
|
||
`<label class="field" style="max-width:280px">${discoveryCopy("Prototype discovery state", "Prototypens søketilstand")}<select id="discoveryState">${["ready", "loading", "empty", "error"].map((v, i) => `<option value="${v}" ${state.discoveryState === v ? "selected" : ""}>${(state.lang === "nb" ? ["Klar", "Laster", "Tomt", "Feil"] : ["Ready", "Loading", "Empty", "Error"])[i]}</option>`).join("")}</select></label>` +
|
||
discoveryBase()
|
||
);
|
||
}
|
||
function updateDiscoveryResults(focus = false) {
|
||
if (!$("#jobResults")) return;
|
||
$("#jobResults").innerHTML = discoveryMarkup();
|
||
const mode = state.discoveryState;
|
||
$("#resultCount").textContent =
|
||
(mode === "ready"
|
||
? filteredJobs().length + " " + t("results")
|
||
: discoveryCopy("Prototype state: ", "Prototypetilstand: ") + mode) +
|
||
" · " +
|
||
t("sourceNote");
|
||
const status = $("#discoveryStatus");
|
||
$("#discoveryLive").textContent = status?.textContent || "";
|
||
if (focus) status?.focus();
|
||
}
|
||
document.addEventListener("change", (e) => {
|
||
if (e.target.id === "discoveryState") {
|
||
clearTimeout(discoveryTimer);
|
||
state.discoveryState = e.target.value;
|
||
updateDiscoveryResults(true);
|
||
}
|
||
});
|
||
document.addEventListener("click", (e) => {
|
||
const action = e.target.closest("[data-recovery]")?.dataset.recovery;
|
||
if (!action) return;
|
||
clearTimeout(discoveryTimer);
|
||
if (action === "edit") {
|
||
$("#search").focus();
|
||
return;
|
||
}
|
||
if (action === "retry") {
|
||
state.discoveryState = "loading";
|
||
updateDiscoveryResults(true);
|
||
discoveryTimer = setTimeout(() => {
|
||
state.discoveryState = "ready";
|
||
updateDiscoveryResults(true);
|
||
}, 700);
|
||
return;
|
||
}
|
||
state.discoveryState = "ready";
|
||
if (action === "clear") {
|
||
state.country = "";
|
||
state.query = "";
|
||
$("#search").value = "";
|
||
$("#country").value = "";
|
||
}
|
||
updateDiscoveryResults(true);
|
||
});
|