diff --git a/frontend/src/components/AppShell.tsx b/frontend/src/components/AppShell.tsx index b01ab21c..f7602df8 100644 --- a/frontend/src/components/AppShell.tsx +++ b/frontend/src/components/AppShell.tsx @@ -10,6 +10,7 @@ import { useNotifications } from "@/hooks/useApi"; import { getVerbCategory } from "@/lib/verbTranslations"; import { NotificationCenter, NotificationPanel } from "@/components/NotificationCenter"; import { CalendarSidebar } from "@/components/calendar/CalendarSidebar"; +import { PushOnboardingPrompt } from "@/components/PushOnboardingPrompt"; import { useCalendarModals } from "@/hooks/useCalendarModals"; import { CalendarModals } from "@/components/layout/CalendarModals"; import { MobileLeftDrawer, MobileCalendarDrawer } from "@/components/layout/MobileDrawers"; @@ -478,7 +479,10 @@ export function AppShell({ children }: AppShellProps) { />
-
{children}
+
+ {!isMessageDialogPage ? : null} + {children} +
{ + if (typeof window === "undefined" || !userId) { + return false; + } + + return ( + window.localStorage.getItem(getDismissStorageKey(userId)) === "1" + ); + }, [userId]); + + const dismissed = sessionDismissed || persistedDismissed; + + const shouldShow = useMemo(() => { + if (!userId) return false; + if (dismissed || isLoading) return false; + if (!isSupported || isSubscribed) return false; + return permission === "default"; + }, [dismissed, isLoading, isSubscribed, isSupported, permission, userId]); + + const handleDismiss = useCallback(() => { + if (typeof window !== "undefined" && userId) { + window.localStorage.setItem(getDismissStorageKey(userId), "1"); + } + setSessionDismissed(true); + }, [userId]); + + const handleEnable = useCallback(async () => { + const success = await subscribe(); + if (success) { + setSessionDismissed(true); + } + }, [subscribe]); + + if (!shouldShow) { + return null; + } + + return ( +
+
+
+ +
+ +
+
+
+

Системные уведомления

+

+ Включить push-уведомления +

+
+ +
+ +

+ Приложение сможет присылать системные уведомления о новых сообщениях, + заявках и других событиях, даже когда вкладка закрыта. +

+ +
+ + + + Настройки уведомлений + +
+
+
+
+ ); +}