'use client' import { Button } from '@/components/ui/button'; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/components/ui/card" import { Switch } from "@/components/ui/switch" import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover" import { useEffect } from 'react'; import { getMessaging, onMessage } from 'firebase/messaging'; import firebaseApp from '@/lib/firebase'; import { Bell, BellRing } from 'lucide-react'; const notifications = [ { title: "Your call has been confirmed.", description: "1 hour ago", }, { title: "You have a new message!", description: "1 hour ago", }, { title: "Your subscription is expiring soon!", description: "2 hours ago", }, ] type CardProps = React.ComponentProps function Notification({ className, ...props }: CardProps) { // const { fcmToken, notificationPermissionStatus } = useFcmToken(); // eslint-disable-next-line react-hooks/rules-of-hooks useEffect(() => { if (typeof window !== 'undefined' && 'serviceWorker' in navigator) { const messaging = getMessaging(firebaseApp); const unsubscribe = onMessage(messaging, (payload) => { console.log('Foreground push notification received:', payload); // Handle the received push notification while the app is in the foreground // You can display a notification or update the UI based on the payload }); return () => { unsubscribe(); // Unsubscribe from the onMessage event }; } }, []); return ( Notifications You have 3 unread messages.

Push Notifications

Send notifications to device.

{/* { }} /> */}
{notifications.map((notification, index) => (

{notification.title}

{notification.description}

))}
); } export default Notification;