diff --git a/app/(account)/notifications/page.tsx b/app/(account)/notifications/page.tsx index 5ca6754..4638645 100644 --- a/app/(account)/notifications/page.tsx +++ b/app/(account)/notifications/page.tsx @@ -2,14 +2,15 @@ import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" -import { Card, CardContent } from "@/components/ui/card" +import { EmptyState } from "@/components/ui/empty-state" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { requestWithAuth } from "@/lib/api/client" import { listNotifications, markAllNotificationsAsRead } from "@/lib/api/notifications" import { toApiError } from "@/lib/errors" import { notifyInfo } from "@/lib/toast" import type { Notification } from "@/lib/types" -import { Bell, CheckCheck, MessageSquare, ShoppingBag } from "lucide-react" +import { cn } from "@/lib/utils" +import { Bell, CheckCheck, Loader2, MessageSquare, ShoppingBag } from "lucide-react" import Link from "next/link" import { useCallback, useEffect, useMemo, useRef, useState } from "react" @@ -25,36 +26,69 @@ const typeLabels: Record = { system: "系统", } +const typeVariants: Record = { + order: "info", + community: "neutral", + system: "neutral", +} + function NotificationItem({ notification }: { notification: Notification }) { const Icon = typeIcons[notification.type] + const content = ( - - -
- +
+
+ +
+
+
+ + {notification.title} + + {!notification.read && ( + + )}
-
-
- {notification.title} - {!notification.read && } -
-

{notification.content}

-

- {new Date(notification.createdAt).toLocaleString("zh-CN")} -

-
- - {typeLabels[notification.type]} - - - +

{notification.content}

+

+ {new Date(notification.createdAt).toLocaleString("zh-CN")} +

+
+ + {typeLabels[notification.type]} + +
) + return notification.link ? ( - + {content} ) : ( - content +
{content}
) } @@ -148,75 +182,110 @@ export default function NotificationsPage() { (items: Notification[], emptyText: string) => { if (loading) { return ( - - - 加载中... - - + ) } if (loadingError) { return ( - - - {loadingError} - - + ) } if (items.length === 0) { return ( - - - {emptyText} - - + ) } - return items.map((notification) => ( - - )) + return ( +
+ {items.map((notification) => ( + + ))} +
+ ) }, [loading, loadingError], ) return (
-
-
-

通知中心

- {unreadCount > 0 && {unreadCount} 条未读} +
+
+

通知中心

+ {unreadCount > 0 && ( + + {unreadCount} + + )}
-
- - - 全部 - 订单 - 社区 - 系统 + + + + 全部 + + + 订单 + + + 社区 + + + 系统 + - + {renderTab(notifications, "暂无通知")} - + {renderTab(orderNotifs, "暂无订单通知")} - + {renderTab(communityNotifs, "暂无社区通知")} - + {renderTab(systemNotifs, "暂无系统通知")} diff --git a/app/(account)/verify/page.tsx b/app/(account)/verify/page.tsx index 4935592..bf0b2db 100644 --- a/app/(account)/verify/page.tsx +++ b/app/(account)/verify/page.tsx @@ -11,6 +11,7 @@ import { SelectTrigger, SelectValue, } from "@/components/ui/select" +import { StatusBadge } from "@/components/ui/status-badge" import { applyCurrentUserVerification, getCurrentUserForLogin, @@ -21,7 +22,7 @@ import { toApiError } from "@/lib/errors" import { notifyInfo, notifySuccess } from "@/lib/toast" import type { UserRole } from "@/lib/types" import { useAuthStore } from "@/store/auth" -import { CheckCircle, Clock, ShieldCheck, Upload } from "lucide-react" +import { CheckCircle, ShieldCheck, Upload } from "lucide-react" import { useEffect, useState } from "react" type MaterialKey = "idCardFront" | "idCardBack" | "gameScreenshot" @@ -38,7 +39,7 @@ function MaterialUpload({ onSelect: (file: File) => Promise }) { return ( -