);
});
+
+function cardSurface(isError: boolean): string {
+ return `border shadow-popover bg-raised ${isError ? "border-danger/40" : "border-border"}`;
+}
diff --git a/packages/studio/src/hooks/useToast.ts b/packages/studio/src/hooks/useToast.ts
index 209bfc7e21..24d6683d62 100644
--- a/packages/studio/src/hooks/useToast.ts
+++ b/packages/studio/src/hooks/useToast.ts
@@ -4,19 +4,18 @@ import type { AppToast } from "../utils/studioHelpers";
interface ToastItem extends AppToast {
id: number;
- /** True while the exit animation plays, just before removal. */
- leaving?: boolean;
}
const AUTO_DISMISS_MS = 4000;
-const EXIT_MS = 160;
const MAX_TOASTS = 3;
+/** Error toasts persist until dismissed so failures can't silently vanish. */
+export const toastPersists = (tone: AppToast["tone"]) => tone === "error";
+
let nextToastId = 1;
/**
- * Stacked toasts (max 3). Info toasts auto-dismiss after 4s; error toasts
- * persist until explicitly dismissed so failures can't silently vanish.
+ * Stacked toasts (max 3). Info toasts auto-dismiss after 4s; error toasts persist.
*/
export function useToast() {
const [toasts, setToasts] = useState([]);
@@ -30,7 +29,7 @@ export function useToast() {
}
}, []);
- const removeToast = useCallback(
+ const dismissToast = useCallback(
(id: number) => {
clearTimer(id);
setToasts((prev) => prev.filter((t) => t.id !== id));
@@ -38,17 +37,6 @@ export function useToast() {
[clearTimer],
);
- const dismissToast = useCallback(
- (id: number) => {
- clearTimer(id);
- // Mark leaving so the exit animation plays, then remove.
- setToasts((prev) => prev.map((t) => (t.id === id ? { ...t, leaving: true } : t)));
- const timer = setTimeout(() => removeToast(id), EXIT_MS);
- timersRef.current.set(id, timer);
- },
- [clearTimer, removeToast],
- );
-
const showToast = useCallback(
(message: string, tone: AppToast["tone"] = "error"): number => {
const id = nextToastId++;
@@ -61,7 +49,7 @@ export function useToast() {
}
return next;
});
- if (tone !== "error") {
+ if (!toastPersists(tone)) {
const timer = setTimeout(() => dismissToast(id), AUTO_DISMISS_MS);
timersRef.current.set(id, timer);
}
diff --git a/packages/studio/src/styles/components.css b/packages/studio/src/styles/components.css
index ae76e180bc..b1f31c060d 100644
--- a/packages/studio/src/styles/components.css
+++ b/packages/studio/src/styles/components.css
@@ -605,7 +605,7 @@
}
}
-/* Toast enter/exit (StudioToast) */
+/* Feedback card enter/exit (StudioFeedbackCard) */
@keyframes hf-toast-in {
from {
opacity: 0;
@@ -646,6 +646,24 @@
}
}
+/* A toast rises in and leaves at once (StudioToast). */
+@keyframes hf-notice-in {
+ from {
+ opacity: 0;
+ transform: translateY(8px) scale(0.98);
+ }
+}
+
+.hf-notice-in {
+ animation: hf-notice-in 200ms cubic-bezier(0.32, 0.72, 0, 1) backwards;
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .hf-notice-in {
+ animation: none;
+ }
+}
+
/* Overlay/backdrop entrance — the heaviest visual changes shouldn't pop in */
@keyframes hf-backdrop-in {
from {
diff --git a/packages/studio/src/styles/theme.css b/packages/studio/src/styles/theme.css
index d62a08ca82..fc95e02386 100644
--- a/packages/studio/src/styles/theme.css
+++ b/packages/studio/src/styles/theme.css
@@ -285,6 +285,9 @@
0 16px 40px light-dark(rgb(0 0 0 / 0.14), rgb(0 0 0 / 0.55)),
0 0 0 1px light-dark(rgb(0 0 0 / 0.07), rgb(0 0 0 / 0.45));
+ /* The toast pill: a close contact shadow under a soft lift. */
+ --shadow-notice: 0 2px 4px rgb(0 0 0 / 0.12), 0 14px 36px -8px rgb(0 0 0 / 0.4);
+
/* The primary button reads as a raised key rather than a floating panel: a tight
* contact shadow, a soft ambient one, and an inner top highlight. */
--shadow-btn-primary: