feat(notifications): add notification system and wire order/dispute events

This commit is contained in:
zetaloop
2026-02-23 11:05:04 +08:00
parent 2222dccbb7
commit c986539954
7 changed files with 214 additions and 17 deletions
+22 -5
View File
@@ -17,7 +17,15 @@ import type { UserRole } from "@/lib/types"
import { useAuthStore } from "@/store/auth"
export default function SettingsPage() {
const { currentRole, verifiedRoles, switchRole, user, updateProfile } = useAuthStore()
const {
currentRole,
verifiedRoles,
switchRole,
user,
updateProfile,
notificationPrefs,
setNotificationPref,
} = useAuthStore()
const [nickname, setNickname] = useState(user?.nickname ?? "")
const [bio, setBio] = useState(user?.bio ?? "")
const [avatar, setAvatar] = useState(user?.avatar ?? "")
@@ -26,7 +34,7 @@ export default function SettingsPage() {
const isRoleVerified = (role: UserRole) => verifiedRoles.includes(role)
return (
<div className="max-w-2xl space-y-6">
<div className="max-w-2xl mx-auto space-y-6">
<h1 className="text-2xl font-bold"></h1>
<Card>
@@ -176,7 +184,10 @@ export default function SettingsPage() {
<p className="text-sm font-medium"></p>
<p className="text-xs text-muted-foreground"></p>
</div>
<Switch defaultChecked />
<Switch
checked={notificationPrefs.order}
onCheckedChange={(checked) => setNotificationPref("order", checked)}
/>
</div>
<Separator />
<div className="flex items-center justify-between">
@@ -184,7 +195,10 @@ export default function SettingsPage() {
<p className="text-sm font-medium"></p>
<p className="text-xs text-muted-foreground"></p>
</div>
<Switch defaultChecked />
<Switch
checked={notificationPrefs.community}
onCheckedChange={(checked) => setNotificationPref("community", checked)}
/>
</div>
<Separator />
<div className="flex items-center justify-between">
@@ -192,7 +206,10 @@ export default function SettingsPage() {
<p className="text-sm font-medium"></p>
<p className="text-xs text-muted-foreground"></p>
</div>
<Switch />
<Switch
checked={notificationPrefs.system}
onCheckedChange={(checked) => setNotificationPref("system", checked)}
/>
</div>
</CardContent>
</Card>