mirror of
https://github.com/deunix-educ/PyQuest.git
synced 2026-11-25 08:19:44 +01:00
Add graphical progress map and illustrated badges shelf
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user