From 68f4b1e909a3f05c064bcbe8a3fbc2919fcad367 Mon Sep 17 00:00:00 2001 From: codytseng Date: Sat, 12 Apr 2025 17:47:12 +0800 Subject: [PATCH] feat: show login modal when clicking notification without being logged in --- src/components/BottomNavigationBar/NotificationsButton.tsx | 4 +++- src/components/Sidebar/NotificationButton.tsx | 4 +++- src/providers/NotificationProvider.tsx | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/BottomNavigationBar/NotificationsButton.tsx b/src/components/BottomNavigationBar/NotificationsButton.tsx index 14c76f79..724d6752 100644 --- a/src/components/BottomNavigationBar/NotificationsButton.tsx +++ b/src/components/BottomNavigationBar/NotificationsButton.tsx @@ -1,16 +1,18 @@ import { usePrimaryPage } from '@/PageManager' +import { useNostr } from '@/providers/NostrProvider' import { useNotification } from '@/providers/NotificationProvider' import { Bell } from 'lucide-react' import BottomNavigationBarItem from './BottomNavigationBarItem' export default function NotificationsButton() { + const { checkLogin } = useNostr() const { navigate, current } = usePrimaryPage() const { hasNewNotification } = useNotification() return ( navigate('notifications')} + onClick={() => checkLogin(() => navigate('notifications'))} >
diff --git a/src/components/Sidebar/NotificationButton.tsx b/src/components/Sidebar/NotificationButton.tsx index 3f862d82..d0bae5bd 100644 --- a/src/components/Sidebar/NotificationButton.tsx +++ b/src/components/Sidebar/NotificationButton.tsx @@ -1,16 +1,18 @@ import { usePrimaryPage } from '@/PageManager' +import { useNostr } from '@/providers/NostrProvider' import { useNotification } from '@/providers/NotificationProvider' import { Bell } from 'lucide-react' import SidebarItem from './SidebarItem' export default function NotificationsButton() { + const { checkLogin } = useNostr() const { navigate, current } = usePrimaryPage() const { hasNewNotification } = useNotification() return ( navigate('notifications')} + onClick={() => checkLogin(() => navigate('notifications'))} active={current === 'notifications'} >
diff --git a/src/providers/NotificationProvider.tsx b/src/providers/NotificationProvider.tsx index 002eac4c..7dafdab1 100644 --- a/src/providers/NotificationProvider.tsx +++ b/src/providers/NotificationProvider.tsx @@ -114,7 +114,7 @@ export function NotificationProvider({ children }: { children: React.ReactNode } useEffect(() => { if (hasNewNotification) { - document.title = '📩 Jumble' + document.title = '📥 Jumble' } else { document.title = 'Jumble' }