Browse Source

feat: show login modal when clicking notification without being logged in

imwald
codytseng 11 months ago
parent
commit
68f4b1e909
  1. 4
      src/components/BottomNavigationBar/NotificationsButton.tsx
  2. 4
      src/components/Sidebar/NotificationButton.tsx
  3. 2
      src/providers/NotificationProvider.tsx

4
src/components/BottomNavigationBar/NotificationsButton.tsx

@ -1,16 +1,18 @@ @@ -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 (
<BottomNavigationBarItem
active={current === 'notifications'}
onClick={() => navigate('notifications')}
onClick={() => checkLogin(() => navigate('notifications'))}
>
<div className="relative">
<Bell />

4
src/components/Sidebar/NotificationButton.tsx

@ -1,16 +1,18 @@ @@ -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 (
<SidebarItem
title="Notifications"
onClick={() => navigate('notifications')}
onClick={() => checkLogin(() => navigate('notifications'))}
active={current === 'notifications'}
>
<div className="relative">

2
src/providers/NotificationProvider.tsx

@ -114,7 +114,7 @@ export function NotificationProvider({ children }: { children: React.ReactNode } @@ -114,7 +114,7 @@ export function NotificationProvider({ children }: { children: React.ReactNode }
useEffect(() => {
if (hasNewNotification) {
document.title = '📩 Jumble'
document.title = '📥 Jumble'
} else {
document.title = 'Jumble'
}

Loading…
Cancel
Save