From b00f62ebeca98f7c14cb7b1b69e8f0a6855dcf20 Mon Sep 17 00:00:00 2001 From: zhom <2717306+zhom@users.noreply.github.com> Date: Tue, 3 Jun 2025 13:56:58 +0400 Subject: [PATCH] fix: improve toast and dialog interations --- src/app/page.tsx | 6 ++++++ src/components/settings-dialog.tsx | 4 ++-- src/components/ui/sonner.tsx | 7 +++++++ src/components/update-notification.tsx | 18 +++++++++--------- src/hooks/use-app-update-notifications.tsx | 4 ++++ src/hooks/use-update-notifications.tsx | 6 ++++-- src/lib/toast-utils.ts | 6 ++++++ src/styles/globals.css | 20 ++++++++++++++++++++ 8 files changed, 58 insertions(+), 13 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index d147770..d4f9fcc 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -48,6 +48,7 @@ export default function Home() { useState(null); const [currentProfileForVersionChange, setCurrentProfileForVersionChange] = useState(null); + const [hasCheckedStartupPrompt, setHasCheckedStartupPrompt] = useState(false); // Simple profiles loader without updates check (for use as callback) const loadProfiles = useCallback(async () => { @@ -110,6 +111,9 @@ export default function Home() { }, [loadProfilesWithUpdateCheck, checkForUpdates]); const checkStartupPrompt = async () => { + // Only check once during app startup to prevent reopening after dismissing notifications + if (hasCheckedStartupPrompt) return; + try { const shouldShow = await invoke( "should_show_settings_on_startup", @@ -117,8 +121,10 @@ export default function Home() { if (shouldShow) { setSettingsDialogOpen(true); } + setHasCheckedStartupPrompt(true); } catch (error) { console.error("Failed to check startup prompt:", error); + setHasCheckedStartupPrompt(true); } }; diff --git a/src/components/settings-dialog.tsx b/src/components/settings-dialog.tsx index f6ad183..680642e 100644 --- a/src/components/settings-dialog.tsx +++ b/src/components/settings-dialog.tsx @@ -139,7 +139,7 @@ export function SettingsDialog({ isOpen, onClose }: SettingsDialogProps) { Settings -
+
{/* Appearance Section */}
@@ -172,7 +172,7 @@ export function SettingsDialog({ isOpen, onClose }: SettingsDialogProps) { {/* Default Browser Section */}
-
+
{isDefaultBrowser ? "Active" : "Inactive"} diff --git a/src/components/ui/sonner.tsx b/src/components/ui/sonner.tsx index f96a98d..c018f0e 100644 --- a/src/components/ui/sonner.tsx +++ b/src/components/ui/sonner.tsx @@ -15,8 +15,15 @@ const Toaster = ({ ...props }: ToasterProps) => { "--normal-bg": "var(--popover)", "--normal-text": "var(--popover-foreground)", "--normal-border": "var(--border)", + zIndex: 99999, } as React.CSSProperties } + toastOptions={{ + style: { + zIndex: 99999, + pointerEvents: "auto", + }, + }} {...props} /> ); diff --git a/src/components/update-notification.tsx b/src/components/update-notification.tsx index e57b6dc..3235e2d 100644 --- a/src/components/update-notification.tsx +++ b/src/components/update-notification.tsx @@ -47,17 +47,17 @@ export function UpdateNotificationComponent({ }; return ( -
-
+
+
-
+
{browserDisplayName} Update Available - {notification.is_stable_update ? "Stable" : "Beta"} + {notification.is_stable_update ? "Stable" : "Nightly"}
@@ -71,20 +71,20 @@ export function UpdateNotificationComponent({ onClick={async () => { await onDismiss(notification.id); }} - className="h-6 w-6 p-0 shrink-0" + className="p-0 w-6 h-6 shrink-0" > - +
-
+