feat: welcome_version=2 — Polish-Refresh sichtbar für returning users
This commit is contained in:
parent
25bb61feaf
commit
90220ff525
3 changed files with 17 additions and 7 deletions
|
|
@ -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"
|
||||
|
|
|
|||
19
www/app.js
19
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);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<meta name="theme-color" content="#0a0a0f">
|
||||
<meta name="description" content="Ava — Awareness- und Club-Manager-Coach. Policy, Incident-Response, Haftung, Safer Spaces. Läuft im deutschen Bunker.">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<script>window.__AVA_KEY__ = 'qb_cbfx31vpj6z5';</script>
|
||||
<script>window.__AVA_KEY__ = 'qb_cbfx31vpj6z5'; window.__WELCOME_VERSION__ = 2;</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="app" role="application" aria-label="Ava Awareness-Coach">
|
||||
|
|
|
|||
Loading…
Reference in a new issue