feat(frontend): error banners persist until manually dismissed
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,8 @@ export interface BannerEntry {
|
|||||||
message: string;
|
message: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Non-error banners clean themselves up; errors stay until the user
|
||||||
|
// dismisses them, so a failure can't silently vanish before it's read.
|
||||||
const DISMISS_AFTER_MS = 8000;
|
const DISMISS_AFTER_MS = 8000;
|
||||||
|
|
||||||
let banners: BannerEntry[] = [];
|
let banners: BannerEntry[] = [];
|
||||||
@@ -25,7 +27,9 @@ function show(severity: BannerSeverity, message: string): void {
|
|||||||
const id = nextId++;
|
const id = nextId++;
|
||||||
banners = [{ id, severity, message }, ...banners];
|
banners = [{ id, severity, message }, ...banners];
|
||||||
notify();
|
notify();
|
||||||
|
if (severity !== "error") {
|
||||||
setTimeout(() => dismiss(id), DISMISS_AFTER_MS);
|
setTimeout(() => dismiss(id), DISMISS_AFTER_MS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showError(message: string): void {
|
export function showError(message: string): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user