'use client'; import { ef } from '@/lib/helpers/utfNumbers'; import { ArrowLeft, Trash } from 'iconsax-react'; import { useRouter } from 'next/navigation'; import React from 'react' import { useTranslation } from 'react-i18next'; import { useGetNotifications, useDeleteNotification } from './hooks/useNotificationData'; import type { Notification } from './types/Types'; type Props = object const formatDate = (dateString: string): string => { const date = new Date(dateString); return date.toLocaleDateString('fa-IR', { year: 'numeric', month: 'long', day: 'numeric' }); }; const formatTime = (dateString: string): string => { const date = new Date(dateString); return date.toLocaleTimeString('fa-IR', { hour: '2-digit', minute: '2-digit' }); }; export default function NotificationsIndex({ }: Props) { const { t } = useTranslation('notifications') const router = useRouter(); const { data, isLoading, isError } = useGetNotifications(); const { mutate: deleteNotification } = useDeleteNotification(); const notifications = React.useMemo(() => { return data?.data ?? []; }, [data?.data]); const handleDelete = (id: string) => { deleteNotification(id); }; if (isLoading) { return (

{t("Heading")}

{ router.back() }} />

در حال دریافت اعلان‌ها...

); } if (isError || !notifications.length) { return (

{t("Heading")}

{ router.back() }} />

اعلانی وجود ندارد

); } return (

{t("Heading")}

{ router.back() }} />
) }