diff --git a/artifacts/api-server/src/routes/auth.ts b/artifacts/api-server/src/routes/auth.ts index 989b4b89..5775cc86 100644 --- a/artifacts/api-server/src/routes/auth.ts +++ b/artifacts/api-server/src/routes/auth.ts @@ -64,10 +64,13 @@ function buildAuthUser( isActive: user.isActive, notificationSoundOrder: user.notificationSoundOrder, notificationSoundMeeting: user.notificationSoundMeeting, + notificationSoundNote: user.notificationSoundNote, notifyOrdersEnabled: user.notifyOrdersEnabled, notifyMeetingsEnabled: user.notifyMeetingsEnabled, + notifyNotesEnabled: user.notifyNotesEnabled, vibrationEnabledOrder: user.vibrationEnabledOrder, vibrationEnabledMeeting: user.vibrationEnabledMeeting, + vibrationEnabledNote: user.vibrationEnabledNote, notificationsMuted: user.notificationsMuted, roles, groups, @@ -435,10 +438,13 @@ router.patch("/auth/me/notification-preferences", requireAuth, async (req, res): for (const k of [ "notificationSoundOrder", "notificationSoundMeeting", + "notificationSoundNote", "notifyOrdersEnabled", "notifyMeetingsEnabled", + "notifyNotesEnabled", "vibrationEnabledOrder", "vibrationEnabledMeeting", + "vibrationEnabledNote", "notificationsMuted", ] as const) { if (parsed.data[k] !== undefined) updates[k] = parsed.data[k]; diff --git a/artifacts/tx-os/src/components/notes/incoming-note-popup.tsx b/artifacts/tx-os/src/components/notes/incoming-note-popup.tsx index d5f1af73..716b1b98 100644 --- a/artifacts/tx-os/src/components/notes/incoming-note-popup.tsx +++ b/artifacts/tx-os/src/components/notes/incoming-note-popup.tsx @@ -69,21 +69,27 @@ export function IncomingNotePopup() { - {current.sender?.avatarUrl ? ( - + {heading} diff --git a/artifacts/tx-os/src/components/notification-settings.tsx b/artifacts/tx-os/src/components/notification-settings.tsx index 01838339..f8d54727 100644 --- a/artifacts/tx-os/src/components/notification-settings.tsx +++ b/artifacts/tx-os/src/components/notification-settings.tsx @@ -20,10 +20,13 @@ import { useAuth } from "@/contexts/AuthContext"; type PrefsPatch = { notificationSoundOrder?: NotificationSoundId; notificationSoundMeeting?: NotificationSoundId; + notificationSoundNote?: NotificationSoundId; notifyOrdersEnabled?: boolean; notifyMeetingsEnabled?: boolean; + notifyNotesEnabled?: boolean; vibrationEnabledOrder?: boolean; vibrationEnabledMeeting?: boolean; + vibrationEnabledNote?: boolean; notificationsMuted?: boolean; }; @@ -69,7 +72,51 @@ export function useUpdatePrefs() { }; } -type Slot = "order" | "meeting"; +type Slot = "order" | "meeting" | "note"; + +const SLOT_KEYS: Record< + Slot, + { + enabledKey: keyof Pick< + AuthUser, + "notifyOrdersEnabled" | "notifyMeetingsEnabled" | "notifyNotesEnabled" + >; + soundKey: keyof Pick< + AuthUser, + | "notificationSoundOrder" + | "notificationSoundMeeting" + | "notificationSoundNote" + >; + vibrateKey: keyof Pick< + AuthUser, + "vibrationEnabledOrder" | "vibrationEnabledMeeting" | "vibrationEnabledNote" + >; + enabledLabel: string; + vibrateLabel: string; + } +> = { + order: { + enabledKey: "notifyOrdersEnabled", + soundKey: "notificationSoundOrder", + vibrateKey: "vibrationEnabledOrder", + enabledLabel: "notifSettings.ordersEnabled", + vibrateLabel: "notifSettings.vibrationOrder", + }, + meeting: { + enabledKey: "notifyMeetingsEnabled", + soundKey: "notificationSoundMeeting", + vibrateKey: "vibrationEnabledMeeting", + enabledLabel: "notifSettings.meetingsEnabled", + vibrateLabel: "notifSettings.vibrationMeeting", + }, + note: { + enabledKey: "notifyNotesEnabled", + soundKey: "notificationSoundNote", + vibrateKey: "vibrationEnabledNote", + enabledLabel: "notifSettings.notesEnabled", + vibrateLabel: "notifSettings.vibrationNote", + }, +}; function SoundList({ current, @@ -201,6 +248,7 @@ export function NotificationSettingsPicker() { if (!user) return null; const muted = user.notificationsMuted; + const cfg = SLOT_KEYS[slot]; return ( @@ -232,10 +280,10 @@ export function NotificationSettingsPicker() {
- {(["order", "meeting"] as const).map((s) => { + {(["order", "meeting", "note"] as const).map((s) => { const isActive = s === slot; return (