diff --git a/app/routes/profile._index.tsx b/app/routes/profile._index.tsx index 2c3550d..1216d85 100644 --- a/app/routes/profile._index.tsx +++ b/app/routes/profile._index.tsx @@ -20,6 +20,7 @@ import { import { Link, useNavigate } from "@remix-run/react"; import { useServiceGetProfile } from "~/utils/RequestHandler"; import { useServiceGetWallet } from "~/requestHandler/use-wallet-hooks"; +import { useBadgeCounts } from "~/hooks/useBadgeCounts"; import { Skeleton } from "~/components/ui/skeleton"; import { useState } from "react"; import { Button } from "~/components/ui/button"; @@ -35,6 +36,7 @@ interface MenuItemType { pageName: string; hasBorder?: boolean; image: React.ReactNode; + badge?: number | null; } // Guard: the account hub requires login (sub-pages are already protected via // validateTokens; this covers the /profile index itself). @@ -56,6 +58,7 @@ export default function Profile() { const [logoutModalOpen, setLogoutModalOpen] = useState(false); const { data: profileData } = useServiceGetProfile(); const { data: walletData } = useServiceGetWallet(); + const { data: badgeCounts } = useBadgeCounts(); const { data: followedSellers, isLoading: isFollowedSellersLoading } = useServiceGetFollowedSellers(); @@ -72,7 +75,7 @@ export default function Profile() { label: "سفارش‌ها", link: "/profile/orders", icon: , - badge: null as number | null, + badge: (badgeCounts?.order_updates || null) as number | null, }, { label: "نشان‌ها", @@ -124,6 +127,7 @@ export default function Profile() { link: "/profile/threads", pageName: "messages", image: , + badge: badgeCounts?.chat || null, }, { title: "کیف پول", @@ -371,7 +375,14 @@ const MenuItemContent = ({ item }: { item: MenuItemType }) => { {item.image}

{item.title}

- +
+ {item.badge ? ( + + {item.badge > 99 ? "99+" : item.badge} + + ) : null} + +
); };