Replace sonner toasts with one top-centre notification stack

The app said things in two places: sonner's bottom-right toasts and the
custom top-centre chrome. This is the second of those, generalised — a
module-level store anyone can call, drawn as a stack of frosted cards that go
on their own unless raised as persistent, with room for buttons and for a
message longer than a line.

useCustomToast keeps its signatures, so the forty-odd call sites behind it and
handleError are untouched. The component and its store are byte-identical with
the portal's copy and checked by `make design-check`.
This commit is contained in:
2026-08-27 16:00:47 +02:00
parent c1410f6a0b
commit 8ef78678a0
7 changed files with 249 additions and 60 deletions
+11 -7
View File
@@ -1,16 +1,20 @@
import { toast } from "sonner"
import { notify } from "@/lib/notificationStore"
/**
* The two things most call sites have to say.
*
* A thin front on `notify` — the description is the whole message now, since a
* card that leads with "Success!" spends its first line saying nothing. Kept as
* a hook because that is how it is called everywhere; anything needing a
* severity, a button or a persistent card calls `notify` directly.
*/
const useCustomToast = () => {
const showSuccessToast = (description: string) => {
toast.success("Success!", {
description,
})
notify(description, "success")
}
const showErrorToast = (description: string) => {
toast.error("Something went wrong!", {
description,
})
notify(description, "error")
}
return { showSuccessToast, showErrorToast }