diff --git a/public/app.js b/public/app.js index 6d9e9c4..258d118 100644 --- a/public/app.js +++ b/public/app.js @@ -264,7 +264,11 @@ async function load() { // last-change dates are still being collected in the background → refresh once more clearTimeout(load.again) if (data.activityPending > 0) load.again = setTimeout(load, 2500) - if (data.setupNeeded) openSettings(true) // first start: choose the projects folder + // first start: choose the projects folder – with the guided setup tour (once per session) + if (data.setupNeeded) { + const opening = openSettings(true) + if (!load.setupToured) { load.setupToured = true; Promise.resolve(opening).then(() => setTimeout(() => startTour('setup'), 400)) } + } // projects found in subfolders that were never looked at: one hint per session if (data.nestedHint > 0 && !load.nestedHinted && !data.setupNeeded) { load.nestedHinted = true @@ -659,6 +663,7 @@ function closeSettings() { panel.classList.remove('open') panel.setAttribute('aria-hidden', 'true') if (!editing && !document.getElementById('bpanel').classList.contains('open')) document.getElementById('overlay').classList.remove('open') + if (tour?.def === TOURS.setup) endTour() // saved / closed: the setup tour is done } async function saveSettings() { @@ -1008,6 +1013,7 @@ const HELP_PAGES = [ { id: 'project', t: 'help.g.project', rows: [['pencil', 'help.edit'], ['info', 'help.info'], ['play', 'help.actions'], ['folder-open', 'help.quick']] }, { id: 'backup', t: 'help.g.backup', rows: [['hard-drive-upload', 'help.backup'], ['clock-alert', 'help.due']] }, { id: 'misc', t: 'help.g.misc', rows: [['folders', 'help.folders'], ['languages', 'help.lang'], ['keyboard', 'help.keys']] }, + { id: 'setup', t: 'help.g.setup', rows: [['folders', 'tour.setup.folders'], ['hard-drive-upload', 'tour.setup.backup'], ['sliders-horizontal', 'tour.setup.general']] }, ] let helpPage = 0 function renderHelp() { @@ -1065,19 +1071,36 @@ const TOURS = { { sel: '#btnSettings', key: 'help.lang' }, { sel: '#btnHelp', key: 'help.keys' }, ] }, + // first start (and Help → Setup): walks through the settings panel; manual pace, user types meanwhile + setup: { auto: false, keepView: true, before: () => (document.getElementById('spanel').classList.contains('open') ? null : openSettings(false)), steps: [ + { key: 'tour.setup.welcome' }, + { before: () => setSettingsTab('folders'), wait: 150, sel: '#fRoots', key: 'tour.setup.folders' }, + { sel: '#fImportOpen', key: 'tour.setup.import' }, + { before: () => setSettingsTab('backup'), wait: 150, sel: '#fTargets:not(:empty), #fAddTarget', key: 'tour.setup.backup' }, + { sel: '#fAutoInt', key: 'tour.setup.auto' }, + { before: () => setSettingsTab('general'), wait: 150, sel: '#fLang', key: 'tour.setup.general' }, + { sel: '.featrow:has(#fFeatItch)', key: 'tour.setup.features' }, + { before: () => setSettingsTab('folders'), wait: 150, sel: '#spSave', key: 'tour.setup.save' }, + ] }, } const AUTO_MS = 3400 let tour = null -function startTour(id) { +async function startTour(id) { const def = TOURS[id] if (!def) return document.getElementById('helpDlg').close() - tour = { def, steps: def.steps, i: -1, playing: true, timer: null, prevView: activeView, prevMode: uiMode, openedEditor: false } - try { def.before?.() } catch {} + tour = { def, steps: def.steps, i: -1, playing: def.auto !== false, timer: null, prevView: activeView, prevMode: uiMode, openedEditor: false } + try { await def.before?.() } catch {} + if (!tour) return document.getElementById('tour').hidden = false - setTimeout(() => tourGo(1), 320) // let a view/mode switch render first + setTimeout(() => tourGo(1), 320) // let a view/mode switch (or the panel sliding in) render first +} +// only elements that are actually on screen (hidden sections are skipped) +const tourTarget = (s) => { + if (!s.sel) return null + const el = document.querySelector(s.sel) + return el && el.getClientRects().length ? el : null } -const tourTarget = (s) => (s.sel ? document.querySelector(s.sel) : null) async function tourGo(dir) { if (!tour) return clearTimeout(tour.timer) @@ -1134,10 +1157,11 @@ function positionSpot(el) { function endTour() { if (!tour) return clearTimeout(tour.timer) - const opened = tour.openedEditor, pv = tour.prevView, pm = tour.prevMode + const opened = tour.openedEditor, pv = tour.prevView, pm = tour.prevMode, keep = tour.def.keepView tour = null document.getElementById('tour').hidden = true if (opened) try { closeEditor() } catch {} + if (keep) return try { applyUiMode(pm) } catch {} try { setView(pv) } catch {} } @@ -1152,6 +1176,7 @@ document.getElementById('tourPause').onclick = () => { addEventListener('resize', () => { if (tour) tourShow() }) addEventListener('keydown', (e) => { if (!tour) return + if (e.target.closest?.('input, textarea, select, [contenteditable]')) return // typing a path etc. if (e.key === 'Escape') { e.preventDefault(); endTour() } else if (e.key === 'ArrowRight') tourGo(1) else if (e.key === 'ArrowLeft') tourGo(-1) diff --git a/public/index.html b/public/index.html index 3b8e1e9..ec2fc2e 100644 --- a/public/index.html +++ b/public/index.html @@ -822,7 +822,9 @@ @media (max-width: 560px) { .sitem .fico, .kbd { display: none; } .sitem { grid-template-columns: minmax(0, 1fr) auto; } } .rowbtns { display: flex; gap: 6px; flex-wrap: wrap; } /* interactive tour */ - #tour { position: fixed; inset: 0; z-index: 60; } + /* click-through: the page stays usable during a tour (e.g. typing a folder in the setup tour) */ + #tour { position: fixed; inset: 0; z-index: 60; pointer-events: none; } + #tour .tour-bubble { pointer-events: auto; } #tour[hidden] { display: none; } .tour-spot { position: fixed; top: 50%; left: 50%; width: 0; height: 0; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(8, 10, 16, .66); outline: 2px solid var(--accent); transition: top .45s cubic-bezier(.4,0,.2,1), left .45s cubic-bezier(.4,0,.2,1), width .45s cubic-bezier(.4,0,.2,1), height .45s cubic-bezier(.4,0,.2,1); pointer-events: none; } .tour-spot::after { content: ""; position: absolute; inset: -3px; border-radius: 12px; outline: 2px solid var(--accent); opacity: .8; animation: tourPulse 1.7s ease-out infinite; } diff --git a/public/lang.js b/public/lang.js index d1f35cf..1b01a69 100644 --- a/public/lang.js +++ b/public/lang.js @@ -758,6 +758,15 @@ window.LANG = { 'help.prev': 'Back', 'help.next': 'Next', 'help.show': 'Show me this section', + 'help.g.setup': 'Setup', + 'tour.setup.welcome': 'Welcome! Let’s set up the dashboard in three short steps: project folders, backup (optional) and general settings. Use “Next” whenever you’re ready.', + 'tour.setup.folders': '1 · Project folders – enter the folder that holds your projects (or “Browse…”). Every subfolder becomes a project. You can add several.', + 'tour.setup.import': 'Several at once? “Import several…” lists the subfolders to tick; “Projects in subfolders…” finds projects one level deeper.', + 'tour.setup.backup': '2 · Backup (optional) – add an external disk, NAS or another drive as a target. You can skip this and do it later.', + 'tour.setup.auto': 'Automatic backup – choose how often it runs (off, on start, daily …). Only new and changed files are copied.', + 'tour.setup.general': '3 · General – pick your language here.', + 'tour.setup.features': 'Features – optional extras such as itch.io. When off, they stay out of your way.', + 'tour.setup.save': 'Done? Click Save and your projects appear. You can come back any time via the gear icon at the top.', 'tour.finish': 'Done', 'tour.pause': 'Pause / play', }, @@ -1516,6 +1525,15 @@ window.LANG = { 'help.prev': 'Zurück', 'help.next': 'Weiter', 'help.show': 'Diesen Bereich zeigen', + 'help.g.setup': 'Einrichten', + 'tour.setup.welcome': 'Willkommen! Wir richten das Dashboard in drei kurzen Schritten ein: Projektordner, Backup (optional) und Allgemein. Klick auf „Weiter“, wenn du bereit bist.', + 'tour.setup.folders': '1 · Projektordner – trag den Ordner ein, in dem deine Projekte liegen (oder „Durchsuchen…“). Jeder Unterordner wird ein Projekt. Mehrere sind möglich.', + 'tour.setup.import': 'Mehrere auf einmal? „Mehrere einlesen…“ listet die Unterordner zum Ankreuzen; „Projekte in Unterordnern…“ findet Projekte eine Ebene tiefer.', + 'tour.setup.backup': '2 · Backup (optional) – externe Platte, NAS oder ein anderes Laufwerk als Ziel hinzufügen. Kannst du auch überspringen und später machen.', + 'tour.setup.auto': 'Automatisch sichern – wähle, wie oft es läuft (aus, bei jedem Start, täglich …). Kopiert werden nur neue und geänderte Dateien.', + 'tour.setup.general': '3 · Allgemein – hier wählst du deine Sprache.', + 'tour.setup.features': 'Funktionen – optionale Extras wie itch.io. Ausgeschaltet stören sie nicht.', + 'tour.setup.save': 'Fertig? Klick auf Speichern und deine Projekte erscheinen. Über das Zahnrad oben kommst du jederzeit zurück.', 'tour.finish': 'Fertig', 'tour.pause': 'Pause / Abspielen', },