V1.25.0: the DM approves a level, each player takes their own

- "Level up..." beside Rest approves a level for any of the party at once;
  with XP tracked, those who have the XP start ticked
- Each player is told with a notice and picks for themselves in the checklist:
  class (multiclass), subclass, Boon, spells within the level's allowance,
  the weapon upgrade; a waiting level shows on the sheet and campaign page
- The DM sees who still has picks to make, and can finish or take back any
- Hit points on a level up can be rolled (campaign setting): by the site, or
  at the table and typed in with physical dice
- Toasts: notices that slide in over any page

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-12 08:30:31 +02:00
co-authored by Claude Opus 5.5
parent 86ef106969
commit c3f2b0dfa7
24 changed files with 782 additions and 66 deletions
+45
View File
@@ -0,0 +1,45 @@
// Toasts: short notices that slide in over any page ("Aria can level up").
// A tiny store of its own, so anything can raise one (a socket event, a
// mutation) without being inside a particular component. <Toasts />
// (components/Toasts.tsx), mounted once in the layout, shows them.
export interface Toast {
id: number;
text: string;
// Where "tone" is 'good' the toast is a piece of good news; default is neutral.
tone?: 'good' | 'warn';
// A link to follow up on it: its label and where it goes.
action?: { label: string; to: string };
}
type Listener = (toasts: Toast[]) => void;
let toasts: Toast[] = [];
let nextId = 1;
const listeners = new Set<Listener>();
const publish = () => listeners.forEach((listener) => listener(toasts));
// How long a toast stays before it goes by itself.
const TOAST_MS = 12000;
export function showToast(toast: Omit<Toast, 'id'>): number {
const id = nextId++;
toasts = [...toasts, { ...toast, id }].slice(-5);
publish();
setTimeout(() => dismissToast(id), TOAST_MS);
return id;
}
export function dismissToast(id: number) {
if (!toasts.some((toast) => toast.id === id)) return;
toasts = toasts.filter((toast) => toast.id !== id);
publish();
}
export function subscribeToasts(listener: Listener): () => void {
listeners.add(listener);
listener(toasts);
return () => {
listeners.delete(listener);
};
}