diff --git a/apps/sim/components/emcn/components/toast/toast.tsx b/apps/sim/components/emcn/components/toast/toast.tsx index 965f6ede819..163f05858b5 100644 --- a/apps/sim/components/emcn/components/toast/toast.tsx +++ b/apps/sim/components/emcn/components/toast/toast.tsx @@ -18,6 +18,9 @@ const AUTO_DISMISS_MS = 0 const EXIT_ANIMATION_MS = 200 const MAX_VISIBLE = 20 +const RING_RADIUS = 5.5 +const RING_CIRCUMFERENCE = 2 * Math.PI * RING_RADIUS + type ToastVariant = 'default' | 'success' | 'error' interface ToastAction { @@ -28,7 +31,6 @@ interface ToastAction { interface ToastData { id: string message: string - description?: string variant: ToastVariant action?: ToastAction duration: number @@ -36,7 +38,6 @@ interface ToastData { type ToastInput = { message: string - description?: string variant?: ToastVariant action?: ToastAction duration?: number @@ -90,12 +91,31 @@ export function useToast() { return ctx } -const VARIANT_STYLES: Record = { - default: 'border-[var(--border)] bg-[var(--bg)] text-[var(--text-primary)]', - success: - 'border-emerald-200 bg-emerald-50 text-emerald-900 dark:border-emerald-800/40 dark:bg-emerald-950/30 dark:text-emerald-200', - error: - 'border-red-200 bg-red-50 text-red-900 dark:border-red-800/40 dark:bg-red-950/30 dark:text-red-200', +function CountdownRing({ duration }: { duration: number }) { + return ( + + + + + ) } function ToastItem({ toast: t, onDismiss }: { toast: ToastData; onDismiss: (id: string) => void }) { @@ -117,38 +137,48 @@ function ToastItem({ toast: t, onDismiss }: { toast: ToastData; onDismiss: (id: return (
-
-

{t.message}

- {t.description && ( -

{t.description}

+
+
+
+ {t.variant === 'error' && ( + + )} + {t.variant === 'success' && ( + + )} + {t.message} +
+
+ {t.duration > 0 && } + +
+
+ {t.action && ( + )}
- {t.action && ( - - )} -
) } @@ -175,7 +205,6 @@ export function ToastProvider({ children }: { children?: ReactNode }) { const data: ToastData = { id, message: input.message, - description: input.description, variant: input.variant ?? 'default', action: input.action, duration: input.duration ?? AUTO_DISMISS_MS,