fix: sync notification and shop dashboard state
This commit is contained in:
@@ -29,10 +29,11 @@ import {
|
||||
} from "@/components/ui/dropdown-menu"
|
||||
import { Input } from "@/components/ui/input"
|
||||
import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet"
|
||||
import { currentUser, mockNotifications, mockShops } from "@/lib/mock"
|
||||
import { currentUser, mockShops } from "@/lib/mock"
|
||||
import type { UserRole } from "@/lib/types"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { useAuthStore } from "@/store/auth"
|
||||
import { useNotificationStore } from "@/store/notifications"
|
||||
|
||||
const roleLabels: Record<UserRole, string> = {
|
||||
consumer: "消费者",
|
||||
@@ -72,7 +73,9 @@ export function Header() {
|
||||
setMobileOpen(false)
|
||||
}
|
||||
|
||||
const unreadCount = mockNotifications.filter((n) => !n.read).length
|
||||
const unreadCount = useNotificationStore(
|
||||
(state) => state.notifications.filter((notification) => !notification.read).length,
|
||||
)
|
||||
|
||||
const handleSearch = (e: React.FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault()
|
||||
|
||||
Reference in New Issue
Block a user