Implemented path remapping

This commit is contained in:
patben8 committed 2026-07-08 21:54:58 +02:00
1 parent 1e8c53e693
commit b130f1469e
12 files changed
+968 -16

No files matched your search

+9 -7
View File
@@ -2,14 +2,20 @@ import { useEffect } from 'react'
export interface ToastMsg {
id: number
kind: 'success' | 'error'
kind: 'success' | 'error' | 'warning'
text: string
}
const KIND_CLS: Record<ToastMsg['kind'], string> = {
error: 'border-pink/40 bg-ink-800 text-pink',
warning: 'border-gold/40 bg-ink-800 text-gold',
success: 'border-mint/40 bg-ink-800 text-mint',
}
export function Toast({ toast, onClose }: { toast: ToastMsg | null; onClose: () => void }) {
useEffect(() => {
if (!toast) return
const t = setTimeout(onClose, toast.kind === 'error' ? 6000 : 4000)
const t = setTimeout(onClose, toast.kind === 'success' ? 4000 : 6000)
return () => clearTimeout(t)
}, [toast, onClose])
@@ -17,11 +23,7 @@ export function Toast({ toast, onClose }: { toast: ToastMsg | null; onClose: ()
return (
<div className="pointer-events-none fixed inset-x-0 top-4 z-50 flex justify-center">
<div
className={`pointer-events-auto max-w-lg rounded-lg border px-4 py-2.5 text-sm shadow-xl ${
toast.kind === 'error'
? 'border-pink/40 bg-ink-800 text-pink'
: 'border-mint/40 bg-ink-800 text-mint'
}`}
className={`pointer-events-auto max-w-lg rounded-lg border px-4 py-2.5 text-sm shadow-xl ${KIND_CLS[toast.kind]}`}
>
{toast.text}
</div>