feat(notes): make incoming-note popup attention-grabbing

Task #409: incoming notes now mirror UpcomingMeetingAlert's attention model
so recipients can't miss them.

Changes:
- DB: add `notification_sound_note` (default "knock"), `notify_notes_enabled`,
  `vibration_enabled_note` to users schema; pushed via drizzle.
- API spec: add 3 new fields to AuthUser + UpdateNotificationPreferencesBody;
  regenerated codegen.
- Auth route: include new fields in buildAuthUser + PATCH allowlist.
- Socket hook: play notification sound + vibrate on `note_received`,
  gated by mute/notifyNotesEnabled/socket warmup, with playedNoteIdsRef
  dedupe (mirrors upcoming-meeting-alert playedRef).
- IncomingNotePopupContext: enqueue() now returns boolean acceptance so
  the socket hook can suppress sound on own-note/duplicate.
- Popup visual: z-[110], ring-4 amber, shadow-2xl, animate-in zoom,
  avatar animate-ping pulse.
- Settings UI: refactored to SLOT_KEYS map, added 3rd "Notes" slot tab
  (grid-cols-3) with enabled/vibration toggles + sound picker.
- Locales en/ar: added notifSettings.slot.note, notesEnabled, vibrationNote.

Pre-existing typecheck errors in executive-meetings.ts (font settings
scope) are unrelated to this task.
This commit is contained in:
riyadhafraa
2026-05-05 16:21:14 +00:00
parent 33038106b4
commit aaadd9b520
12 changed files with 260 additions and 60 deletions
@@ -113,10 +113,13 @@ export const NotificationSoundId = {
export interface UpdateNotificationPreferencesBody {
notificationSoundOrder?: NotificationSoundId;
notificationSoundMeeting?: NotificationSoundId;
notificationSoundNote?: NotificationSoundId;
notifyOrdersEnabled?: boolean;
notifyMeetingsEnabled?: boolean;
notifyNotesEnabled?: boolean;
vibrationEnabledOrder?: boolean;
vibrationEnabledMeeting?: boolean;
vibrationEnabledNote?: boolean;
notificationsMuted?: boolean;
}
@@ -154,10 +157,13 @@ export interface AuthUser {
isActive: boolean;
notificationSoundOrder: NotificationSoundId;
notificationSoundMeeting: NotificationSoundId;
notificationSoundNote: NotificationSoundId;
notifyOrdersEnabled: boolean;
notifyMeetingsEnabled: boolean;
notifyNotesEnabled: boolean;
vibrationEnabledOrder: boolean;
vibrationEnabledMeeting: boolean;
vibrationEnabledNote: boolean;
notificationsMuted: boolean;
roles: string[];
groups: GroupSummary[];
+15
View File
@@ -3209,14 +3209,20 @@ components:
$ref: "#/components/schemas/NotificationSoundId"
notificationSoundMeeting:
$ref: "#/components/schemas/NotificationSoundId"
notificationSoundNote:
$ref: "#/components/schemas/NotificationSoundId"
notifyOrdersEnabled:
type: boolean
notifyMeetingsEnabled:
type: boolean
notifyNotesEnabled:
type: boolean
vibrationEnabledOrder:
type: boolean
vibrationEnabledMeeting:
type: boolean
vibrationEnabledNote:
type: boolean
notificationsMuted:
type: boolean
@@ -3258,14 +3264,20 @@ components:
$ref: "#/components/schemas/NotificationSoundId"
notificationSoundMeeting:
$ref: "#/components/schemas/NotificationSoundId"
notificationSoundNote:
$ref: "#/components/schemas/NotificationSoundId"
notifyOrdersEnabled:
type: boolean
notifyMeetingsEnabled:
type: boolean
notifyNotesEnabled:
type: boolean
vibrationEnabledOrder:
type: boolean
vibrationEnabledMeeting:
type: boolean
vibrationEnabledNote:
type: boolean
notificationsMuted:
type: boolean
roles:
@@ -3287,10 +3299,13 @@ components:
- isActive
- notificationSoundOrder
- notificationSoundMeeting
- notificationSoundNote
- notifyOrdersEnabled
- notifyMeetingsEnabled
- notifyNotesEnabled
- vibrationEnabledOrder
- vibrationEnabledMeeting
- vibrationEnabledNote
- notificationsMuted
- roles
- groups
+77
View File
@@ -74,10 +74,22 @@ export const LoginResponse = zod.object({
"beep",
"soft",
]),
notificationSoundNote: zod.enum([
"ding",
"chime",
"bell",
"knock",
"pop",
"alert",
"beep",
"soft",
]),
notifyOrdersEnabled: zod.boolean(),
notifyMeetingsEnabled: zod.boolean(),
notifyNotesEnabled: zod.boolean(),
vibrationEnabledOrder: zod.boolean(),
vibrationEnabledMeeting: zod.boolean(),
vibrationEnabledNote: zod.boolean(),
notificationsMuted: zod.boolean(),
roles: zod.array(zod.string()),
groups: zod.array(
@@ -187,10 +199,22 @@ export const GetMeResponse = zod.object({
"beep",
"soft",
]),
notificationSoundNote: zod.enum([
"ding",
"chime",
"bell",
"knock",
"pop",
"alert",
"beep",
"soft",
]),
notifyOrdersEnabled: zod.boolean(),
notifyMeetingsEnabled: zod.boolean(),
notifyNotesEnabled: zod.boolean(),
vibrationEnabledOrder: zod.boolean(),
vibrationEnabledMeeting: zod.boolean(),
vibrationEnabledNote: zod.boolean(),
notificationsMuted: zod.boolean(),
roles: zod.array(zod.string()),
groups: zod.array(
@@ -249,10 +273,22 @@ export const UpdateLanguageResponse = zod.object({
"beep",
"soft",
]),
notificationSoundNote: zod.enum([
"ding",
"chime",
"bell",
"knock",
"pop",
"alert",
"beep",
"soft",
]),
notifyOrdersEnabled: zod.boolean(),
notifyMeetingsEnabled: zod.boolean(),
notifyNotesEnabled: zod.boolean(),
vibrationEnabledOrder: zod.boolean(),
vibrationEnabledMeeting: zod.boolean(),
vibrationEnabledNote: zod.boolean(),
notificationsMuted: zod.boolean(),
roles: zod.array(zod.string()),
groups: zod.array(
@@ -318,10 +354,22 @@ export const UpdateClockStyleResponse = zod.object({
"beep",
"soft",
]),
notificationSoundNote: zod.enum([
"ding",
"chime",
"bell",
"knock",
"pop",
"alert",
"beep",
"soft",
]),
notifyOrdersEnabled: zod.boolean(),
notifyMeetingsEnabled: zod.boolean(),
notifyNotesEnabled: zod.boolean(),
vibrationEnabledOrder: zod.boolean(),
vibrationEnabledMeeting: zod.boolean(),
vibrationEnabledNote: zod.boolean(),
notificationsMuted: zod.boolean(),
roles: zod.array(zod.string()),
groups: zod.array(
@@ -345,10 +393,15 @@ export const UpdateNotificationPreferencesBody = zod.object({
notificationSoundMeeting: zod
.enum(["ding", "chime", "bell", "knock", "pop", "alert", "beep", "soft"])
.optional(),
notificationSoundNote: zod
.enum(["ding", "chime", "bell", "knock", "pop", "alert", "beep", "soft"])
.optional(),
notifyOrdersEnabled: zod.boolean().optional(),
notifyMeetingsEnabled: zod.boolean().optional(),
notifyNotesEnabled: zod.boolean().optional(),
vibrationEnabledOrder: zod.boolean().optional(),
vibrationEnabledMeeting: zod.boolean().optional(),
vibrationEnabledNote: zod.boolean().optional(),
notificationsMuted: zod.boolean().optional(),
});
@@ -390,10 +443,22 @@ export const UpdateNotificationPreferencesResponse = zod.object({
"beep",
"soft",
]),
notificationSoundNote: zod.enum([
"ding",
"chime",
"bell",
"knock",
"pop",
"alert",
"beep",
"soft",
]),
notifyOrdersEnabled: zod.boolean(),
notifyMeetingsEnabled: zod.boolean(),
notifyNotesEnabled: zod.boolean(),
vibrationEnabledOrder: zod.boolean(),
vibrationEnabledMeeting: zod.boolean(),
vibrationEnabledNote: zod.boolean(),
notificationsMuted: zod.boolean(),
roles: zod.array(zod.string()),
groups: zod.array(
@@ -457,10 +522,22 @@ export const UpdateClockHour12Response = zod.object({
"beep",
"soft",
]),
notificationSoundNote: zod.enum([
"ding",
"chime",
"bell",
"knock",
"pop",
"alert",
"beep",
"soft",
]),
notifyOrdersEnabled: zod.boolean(),
notifyMeetingsEnabled: zod.boolean(),
notifyNotesEnabled: zod.boolean(),
vibrationEnabledOrder: zod.boolean(),
vibrationEnabledMeeting: zod.boolean(),
vibrationEnabledNote: zod.boolean(),
notificationsMuted: zod.boolean(),
roles: zod.array(zod.string()),
groups: zod.array(
+3
View File
@@ -16,10 +16,13 @@ export const usersTable = pgTable("users", {
isActive: boolean("is_active").notNull().default(true),
notificationSoundOrder: varchar("notification_sound_order", { length: 30 }).notNull().default("ding"),
notificationSoundMeeting: varchar("notification_sound_meeting", { length: 30 }).notNull().default("chime"),
notificationSoundNote: varchar("notification_sound_note", { length: 30 }).notNull().default("knock"),
notifyOrdersEnabled: boolean("notify_orders_enabled").notNull().default(true),
notifyMeetingsEnabled: boolean("notify_meetings_enabled").notNull().default(true),
notifyNotesEnabled: boolean("notify_notes_enabled").notNull().default(true),
vibrationEnabledOrder: boolean("vibration_enabled_order").notNull().default(true),
vibrationEnabledMeeting: boolean("vibration_enabled_meeting").notNull().default(true),
vibrationEnabledNote: boolean("vibration_enabled_note").notNull().default(true),
notificationsMuted: boolean("notifications_muted").notNull().default(false),
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow().$onUpdate(() => new Date()),