From 3209e088e5eebd26f4ed845cf89c1dd340d84b0e Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 19 Feb 2026 13:45:58 +0800 Subject: [PATCH] Fix toast visibility and Create Look dialog error handling (#49) * Fix toast visibility z-index issue and Create Look dialog error handling - Moved `` outside of `SidebarProvider` in `Layout.tsx` and increased z-index to ensure toasts appear above dialog overlays. - Updated `CreateLookDialog.tsx` to use `toast.error()` for API errors instead of displaying them inline at the bottom of the dialog. * Fix Extractor error handling, toast visibility, and Create Look dialog errors - Updated `ExtractorDialog.tsx` to reset the stage to `'selection'` on refinement error, preventing infinite loading. - Updated `CreateLookDialog.tsx` to use `toast.error()` for API errors instead of inline text. - Moved `` in `Layout.tsx` outside of `SidebarProvider` to ensure toasts appear above dialog overlays. - Ensured `package.json` and `sonner.tsx` remain clean (reverted temporary changes). * fix sonner * fix lint --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: yiling ji --- src/ui/Layout.tsx | 50 ++++++++++++++------------ src/ui/components/CreateLookDialog.tsx | 17 ++++----- src/ui/components/ExtractorDialog.tsx | 1 + src/ui/components/ui/sonner.tsx | 29 +++++++-------- 4 files changed, 50 insertions(+), 47 deletions(-) diff --git a/src/ui/Layout.tsx b/src/ui/Layout.tsx index fa3168a..933b4fb 100644 --- a/src/ui/Layout.tsx +++ b/src/ui/Layout.tsx @@ -3,31 +3,35 @@ import { AppSidebar } from './components/AppSidebar' import { Icons } from './components/Icons' import { Separator } from './components/ui/separator' import { SidebarInset, SidebarProvider, SidebarTrigger } from './components/ui/sidebar' +import { Toaster } from './components/ui/sonner' export default function Layout() { return ( - - - - - - - - Forgery - - - - - - - - - - + <> + + + + + + + + Forgery + + + + + + + + + + + + > ) } diff --git a/src/ui/components/CreateLookDialog.tsx b/src/ui/components/CreateLookDialog.tsx index f19c00f..7ef8774 100644 --- a/src/ui/components/CreateLookDialog.tsx +++ b/src/ui/components/CreateLookDialog.tsx @@ -11,12 +11,12 @@ import { SaveOutfitDialog } from './SaveOutfitDialog' import { Badge } from './ui/badge' import { Button } from './ui/button' import { - Dialog, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogTitle, + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, } from './ui/dialog' import { Label } from './ui/label' import { ScrollArea, ScrollBar } from './ui/scroll-area' @@ -52,7 +52,6 @@ export const CreateLookDialog: React.FC = ({ const [selectedExpressionId, setSelectedExpressionId] = useState(null) const [userPrompt, setUserPrompt] = useState('') const [submitting, setSubmitting] = useState(false) - const [error, setError] = useState(null) const [loadOutfitOpen, setLoadOutfitOpen] = useState(false) const [saveOutfitOpen, setSaveOutfitOpen] = useState(false) @@ -143,7 +142,6 @@ export const CreateLookDialog: React.FC = ({ const handleCreate = async () => { if (selectedEquipments.length === 0) return setSubmitting(true) - setError(null) try { const res = await client.generations.$post({ @@ -167,7 +165,7 @@ export const CreateLookDialog: React.FC = ({ setUserPrompt('') } catch (e) { console.error(e) - setError(e instanceof Error ? e.message : 'Something went wrong') + toast.error(e instanceof Error ? e.message : 'Something went wrong') } finally { setSubmitting(false) } @@ -532,7 +530,6 @@ export const CreateLookDialog: React.FC = ({ - {error && {error}} = ({ console.error(e) const err = e instanceof Error ? e : new Error(String(e)) toast.error(err.message || 'Refinement failed') + setStage('selection') } } diff --git a/src/ui/components/ui/sonner.tsx b/src/ui/components/ui/sonner.tsx index 9f46e06..ef6164f 100644 --- a/src/ui/components/ui/sonner.tsx +++ b/src/ui/components/ui/sonner.tsx @@ -1,19 +1,19 @@ import { - CircleCheckIcon, - InfoIcon, - Loader2Icon, - OctagonXIcon, - TriangleAlertIcon, -} from "lucide-react" -import { useTheme } from "next-themes" -import { Toaster as Sonner, type ToasterProps } from "sonner" + CircleCheckIcon, + InfoIcon, + Loader2Icon, + OctagonXIcon, + TriangleAlertIcon, +} from 'lucide-react' +import { useTheme } from 'next-themes' +import { Toaster as Sonner, type ToasterProps } from 'sonner' const Toaster = ({ ...props }: ToasterProps) => { - const { theme = "system" } = useTheme() + const { theme = 'system' } = useTheme() return ( , @@ -24,10 +24,11 @@ const Toaster = ({ ...props }: ToasterProps) => { }} style={ { - "--normal-bg": "var(--popover)", - "--normal-text": "var(--popover-foreground)", - "--normal-border": "var(--border)", - "--border-radius": "var(--radius)", + '--normal-bg': 'white', + '--normal-text': 'var(--popover-foreground)', + '--normal-border': 'var(--border)', + '--border-radius': 'var(--radius)', + zIndex: 99, } as React.CSSProperties } {...props}