Remove useNavigate everywhere, and make request a query param. And convert dialog to Jotai

This commit is contained in:
Gregory Schier
2025-01-06 16:54:07 -08:00
parent 806a8eb801
commit bc50891edb
54 changed files with 592 additions and 545 deletions

View File

@@ -1,11 +1,18 @@
import { atom } from 'jotai/index';
import type { PrivateToastEntry, ToastEntry } from '../components/Toasts';
import type { ToastInstance } from '../components/Toasts';
import { generateId } from './generateId';
import { jotaiStore } from './jotai';
export const toastsAtom = atom<PrivateToastEntry[]>([]);
export const toastsAtom = atom<ToastInstance[]>([]);
export function showToast({ id, timeout = 5000, ...props }: ToastEntry) {
export function showToast({
id,
timeout = 5000,
...props
}: Omit<ToastInstance, 'id' | 'timeout'> & {
id?: ToastInstance['id'];
timeout?: ToastInstance['timeout'];
}) {
id = id ?? generateId();
if (timeout != null) {
setTimeout(() => hideToast(id), timeout);