feat(notification): add dashboard notification center

This commit is contained in:
mlogclub
2026-04-28 19:20:38 +08:00
parent f287727c59
commit 909854cd03
22 changed files with 1230 additions and 13 deletions
+16 -2
View File
@@ -5,6 +5,8 @@ import { useState } from "react"
import { useAuth } from "@/components/auth-provider"
import { ChangePasswordDialog } from "@/components/change-password-dialog"
import { useNotifications } from "@/components/notification-provider"
import { Badge } from "@/components/ui/badge"
import {
Avatar,
AvatarFallback,
@@ -42,7 +44,9 @@ export function NavUser({
}
}) {
const { signOut } = useAuth()
const { unreadCount } = useNotifications()
const { isMobile } = useSidebar()
const router = useRouter()
const [changePasswordOpen, setChangePasswordOpen] = useState(false)
const fallback = user.name.slice(0, 1).toUpperCase() || "U"
return (
@@ -99,9 +103,19 @@ export function NavUser({
<KeyRoundIcon />
</DropdownMenuItem>
<DropdownMenuItem>
<DropdownMenuItem
onClick={() => {
router.push("/dashboard/notifications")
}}
className="gap-2"
>
<BellIcon />
<span className="flex-1"></span>
{unreadCount > 0 ? (
<Badge className="h-5 min-w-5 px-1.5">
{unreadCount > 99 ? "99+" : unreadCount}
</Badge>
) : null}
</DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuSeparator />