fix: ui fixes

This commit is contained in:
gosangam
2026-06-11 00:32:04 +05:30
parent 4b159cb4d9
commit ead8ad02e8
16 changed files with 769 additions and 266 deletions
+14 -6
View File
@@ -505,18 +505,26 @@ export const notifications = {
markAllRead() {
return call<void>("/notifications/read", { method: "POST" });
},
/** Email-notification preferences (currently aggregated like emails). */
emailPrefs() {
return call<{ like_emails: boolean }>("/notifications/email-prefs");
/** The event × channel notification matrix (Settings → Notifications). */
prefs() {
return call<{ prefs: NotificationPrefs }>("/notifications/prefs");
},
setEmailPrefs(likeEmails: boolean) {
return call<{ like_emails: boolean }>("/notifications/email-prefs", {
/** Write one matrix cell; returns the full re-resolved matrix. */
setPref(event: PrefEvent, channel: PrefChannel, enabled: boolean) {
return call<{ prefs: NotificationPrefs }>("/notifications/prefs", {
method: "PUT",
body: JSON.stringify({ like_emails: likeEmails }),
body: JSON.stringify({ event, channel, enabled }),
});
},
};
// ─── Notification preferences ──────────────────────────────────────────
export type PrefEvent = "follows" | "post_interactions" | "sadhna_reminders";
export type PrefChannel = "in_app" | "email" | "push";
/** event → channel → enabled, as resolved by the BFF (defaults on). */
export type NotificationPrefs = Record<PrefEvent, Record<PrefChannel, boolean>>;
export const relationships = {
/** Send a follow REQUEST. The target must accept before it counts as a
* follow — the returned relationship reflects `follow_requested: true`