feat: improve error reporting for wallet payments

This commit is contained in:
2023-05-17 16:30:23 +01:00
parent 202b9933e0
commit 167f1c5e65
4 changed files with 46 additions and 6 deletions

View File

@ -1,6 +1,7 @@
import { ReactNode, useSyncExternalStore } from "react";
import { v4 as uuid } from "uuid";
import ExternalStore from "ExternalStore";
import Icon from "Icons/Icon";
import { ReactNode, useSyncExternalStore } from "react";
import { unixNow } from "Util";
import "./Toaster.css";
@ -9,6 +10,7 @@ interface ToastNotification {
element: ReactNode;
expire?: number;
icon?: string;
id?: string;
}
class ToasterSlots extends ExternalStore<Array<ToastNotification>> {
@ -17,6 +19,7 @@ class ToasterSlots extends ExternalStore<Array<ToastNotification>> {
push(n: ToastNotification) {
n.expire ??= unixNow() + 3;
n.id ??= uuid();
this.#stack.push(n);
this.notifyChange();
}
@ -43,7 +46,7 @@ export default function Toaster() {
return (
<div className="toaster">
{toast.map(a => (
<div className="card flex">
<div className="card flex" key={a.id}>
<Icon name={a.icon ?? "bell"} className="mr5" />
{a.element}
</div>