// Preferences (synced to the server), per-device display options, data export/import, about. import { html, extLink, local } from '../ui.js'; import { LANG_NAMES } from '../metrics.js'; const LEVELS = ['A1', 'A2', 'B1', 'B2', 'C1', 'C2']; export function render(root, app) { const s = app.settings; const theme = local.get('theme', 'system'); const researched = app.data.schools.filter((x) => x.research).length; const f = app.data.funding; root.innerHTML = String(html`

Your situation

Currency
${['EUR', 'CZK'].map((c) => html``)}
Your languages
Next pair

Smart shows rarely compared schools first, then close contests: fewer picks for the same ranking quality.

This device

Theme
${['system', 'light', 'dark'].map((t) => html``)}

Your data

Picks, notes and settings live on your server (DATA_DIR). Export a backup now and then.

Export backup ${app.config.authRequired ? html`` : ''}

About the data

Elorasmus ${app.config.version}

`); const update = (patch) => app.updateSettings(patch); root.onchange = async (e) => { const el = e.target; if (el.name === 'stayMonths') { const v = Number(el.value); if (v >= 1 && v <= 12) update({ stayMonths: v }); } else if (el.name === 'currency' || el.name === 'pairing') update({ [el.name]: el.value }); else if (el.name === 'fewerOpportunities' || el.name === 'countHostFunding') update({ [el.name]: el.checked }); else if (el.name === 'level') { const langs = s.languages.map((l, i) => (i === Number(el.dataset.i) ? { ...l, level: el.value } : l)); update({ languages: langs }); } else if (el.name === 'theme') { local.set('theme', el.value); app.applyTheme(); } else if (el.name === 'import' && el.files?.[0]) { app.importBackup(el.files[0]); el.value = ''; } }; root.onclick = (e) => { const t = e.target.closest('[data-action]'); if (!t) return; if (t.dataset.action === 'rmlang') update({ languages: s.languages.filter((_, i) => i !== Number(t.dataset.i)) }); if (t.dataset.action === 'addlang') { const lang = root.querySelector('select[name="newlang"]').value; if (lang) update({ languages: [...s.languages, { lang, level: 'B1' }] }); } if (t.dataset.action === 'logout') app.logout(); }; }