Wire up notification preferences in settings UI

This commit is contained in:
fullsizemalt 2025-12-26 17:02:23 -08:00
parent 2f905d7173
commit a7ce4d17a1
2 changed files with 22 additions and 27 deletions

View file

@ -244,7 +244,7 @@ export default function SettingsPage() {
<Separator />
<NotificationsSection />
<NotificationsSection preferences={preferences} updatePreferences={updatePreferences} />
<Separator />
@ -307,7 +307,7 @@ export default function SettingsPage() {
</TabsContent>
<TabsContent value="notifications">
<NotificationsSection />
<NotificationsSection preferences={preferences} updatePreferences={updatePreferences} />
</TabsContent>
<TabsContent value="privacy">
@ -545,7 +545,7 @@ function DisplaySection({ preferences, updatePreferences }: any) {
}
// Notifications Section
function NotificationsSection() {
function NotificationsSection({ preferences, updatePreferences }: any) {
return (
<Card id="notifications">
<CardHeader>
@ -554,46 +554,33 @@ function NotificationsSection() {
Notifications
</CardTitle>
<CardDescription>
Choose what updates you receive
Choose what email notifications you receive
</CardDescription>
</CardHeader>
<CardContent className="space-y-6">
<SettingRow
label="Comment Replies"
description="Get notified when someone replies to your comment"
checked={true}
onChange={() => { }}
comingSoon
description="Get an email when someone replies to your review or comment"
checked={preferences.email_on_reply ?? true}
onChange={(checked: boolean) => updatePreferences({ email_on_reply: checked })}
/>
<Separator />
<SettingRow
label="New Show Added"
description="Get notified when a new show is added to the archive"
checked={true}
onChange={() => { }}
comingSoon
/>
<Separator />
<SettingRow
label="Chase Song Played"
description="Get notified when a song on your chase list gets played"
checked={true}
onChange={() => { }}
comingSoon
label="Chase Song Alerts"
description="Get an email when a song on your chase list gets played at a show"
checked={preferences.email_on_chase ?? true}
onChange={(checked: boolean) => updatePreferences({ email_on_chase: checked })}
/>
<Separator />
<SettingRow
label="Weekly Digest"
description="Receive a weekly email with site highlights"
checked={false}
onChange={() => { }}
comingSoon
description="Receive a weekly email with site highlights and new shows"
checked={preferences.email_digest ?? false}
onChange={(checked: boolean) => updatePreferences({ email_digest: checked })}
/>
</CardContent>
</Card>

View file

@ -7,6 +7,10 @@ interface Preferences {
wiki_mode: boolean
show_ratings: boolean
show_comments: boolean
theme: string
email_on_reply: boolean
email_on_chase: boolean
email_digest: boolean
}
interface PreferencesContextType {
@ -19,6 +23,10 @@ const defaultPreferences: Preferences = {
wiki_mode: false,
show_ratings: true,
show_comments: true,
theme: "system",
email_on_reply: true,
email_on_chase: true,
email_digest: false,
}
const PreferencesContext = createContext<PreferencesContextType>({