From 90220ff525fa733e634b4cc061bacbd66c0d7e40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pr=C3=A4zisionskatze?= Date: Wed, 29 Apr 2026 04:51:28 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20welcome=5Fversion=3D2=20=E2=80=94=20Pol?= =?UTF-8?q?ish-Refresh=20sichtbar=20f=C3=BCr=20returning=20users?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config.yaml | 3 ++- www/app.js | 19 ++++++++++++++----- www/index.html | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/config.yaml b/src/config.yaml index f01052d..7503b9d 100644 --- a/src/config.yaml +++ b/src/config.yaml @@ -9,7 +9,8 @@ meta_description: "Ava — Awareness- und Club-Manager-Coach. Policy, Incident-R bot_key_var: __AVA_KEY__ bot_key_value: qb_cbfx31vpj6z5 ls_prefix: ava -bot_version: "2026-04-21" +bot_version: "2026-04-29" +welcome_version: 2 # Color theme (Ava — purple) accent: "#7c3aed" diff --git a/www/app.js b/www/app.js index 0745776..02a01f8 100644 --- a/www/app.js +++ b/www/app.js @@ -53,6 +53,7 @@ flashCardsRated: s.flashCardsRated || 0, badges: s.badges || {}, seenWelcome: s.seenWelcome || false, + seenWelcomeVersion: s.seenWelcomeVersion || 0, completedCurricula: s.completedCurricula || [] }; } catch (e) { @@ -62,10 +63,16 @@ quizStreak: 0, maxQuizStreak: 0, mastery: {}, moduleCorrect: {}, moduleTotal: {}, modulePassedFlash: {}, completedQuizzes: 0, flashCardsRated: 0, - badges: {}, seenWelcome: false, completedCurricula: [] + badges: {}, seenWelcome: false, seenWelcomeVersion: 0, completedCurricula: [] }; } } + + // Welcome-version bump: bump this number whenever a bot's welcome.html gets a + // non-trivial visual refresh, so returning users see the new intro once. + // Per-bot value injected at render time from config.yaml welcome_version + // (default 1). After dismiss, state.seenWelcomeVersion catches up. + const WELCOME_VERSION = Number(window.__WELCOME_VERSION__ || 1); function saveState() { localStorage.setItem(LS_KEY, JSON.stringify(state)); } function loadChatHistory() { @@ -369,7 +376,8 @@ } function renderWelcome() { - if (state.xp === 0 && chatHistory.length === 0 && !state.seenWelcome) { + const newWelcomeAvailable = (state.seenWelcomeVersion || 0) < WELCOME_VERSION; + if ((state.xp === 0 && chatHistory.length === 0 && !state.seenWelcome) || newWelcomeAvailable) { $('#welcome-screen').classList.remove('hidden'); $('#welcome-screen').setAttribute('aria-hidden', 'false'); } else { @@ -391,6 +399,7 @@ if (!text.trim() && attaches.length === 0) return; $('#welcome-screen').classList.add('hidden'); state.seenWelcome = true; + state.seenWelcomeVersion = WELCOME_VERSION; addMsg('user', text || '(nur Anhang)', { attachments: attaches }); chatHistory.push({ @@ -1726,13 +1735,13 @@ // Welcome-card shortcuts $$('[data-goto]').forEach(b => b.addEventListener('click', () => { - state.seenWelcome = true; saveState(); + state.seenWelcome = true; state.seenWelcomeVersion = WELCOME_VERSION; saveState(); switchMode(b.dataset.goto); })); // Welcome-card prompt-fillers (special *_REQUEST modes) $$('[data-prompt]').forEach(b => b.addEventListener('click', () => { - state.seenWelcome = true; saveState(); + state.seenWelcome = true; state.seenWelcomeVersion = WELCOME_VERSION; saveState(); switchMode('chat'); const composer = $('#composer'); if (composer) { @@ -1813,7 +1822,7 @@ // Update status once per min (visual cue) setInterval(() => { /* placeholder for future heartbeat */ }, 60000); - console.log('Ava v2026-04-21 ready. XP:', state.xp, 'Streak:', state.currentStreak); + console.log('Ava v2026-04-29 ready. XP:', state.xp, 'Streak:', state.currentStreak); } if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', boot); diff --git a/www/index.html b/www/index.html index 1c5a4dd..b8e9118 100644 --- a/www/index.html +++ b/www/index.html @@ -7,7 +7,7 @@ - +