Add graphical progress map and illustrated badges shelf

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
denis
2026-10-16 16:10:46 +02:00
parent f732a5a765
commit 1e4d2600c5
18 changed files with 521 additions and 71 deletions
+5 -2
View File
@@ -1,5 +1,6 @@
// Notifications éphémères (badges, XP). Région role="status" : annoncée sans voler le focus.
import { createBadgeIcon } from './badgeArt.js';
import { el } from './dom.js';
const DISPLAY_MS = 7000;
@@ -18,10 +19,11 @@ export class BadgeToast {
}
/** Affiche un message ; se ferme seul après quelques secondes ou au clic sur « Fermer ». */
show(message) {
show(message, { icon = null } = {}) {
const toast = el(
'div',
{ class: 'toast' },
icon,
el('span', { text: message }),
el('button', { type: 'button', class: 'btn', text: this.#i18n.t('toast.close'), onclick: () => toast.remove() }),
);
@@ -30,6 +32,7 @@ export class BadgeToast {
}
showBadge(badgeId) {
this.show(this.#i18n.t('badge.earned', { name: this.#i18n.t(`badge.${badgeId}`) }));
const medal = el('span', { class: 'toast-badge' }, createBadgeIcon(badgeId, { earned: true }));
this.show(this.#i18n.t('badge.earned', { name: this.#i18n.t(`badge.${badgeId}`) }), { icon: medal });
}
}