Email preferences look like a settings screen and are really a data model question: what is the unit of consent, where does it live, and what happens to a message that was due while it was off.
Nakodo sends a brand a handful of emails about its outreach campaigns. Six of them can be turned off, and this is the whole of how that works.
The registry is a 49-line file with no logic in it
export const NOTIFICATION_EMAILS = [ "first_results" , "daily_digest" , "needs_you" , "after_intro" , "setup_reminder" , "plan_limit" , ] as const ; export type NotificationEmail = ( typeof NOTIFICATION_EMAILS ) [ number ] ;
Enter fullscreen mode
Exit fullscreen mode
Beside the list is the copy that the settings screen renders, one label and one sentence per kind. The sentence has a shape that turned out to be the most useful rule in the feature:
daily_digest : { label : "A day's news" , text : "One email a day while a campaign is running: who Nakodo wrote to, who wrote back, and anything waiting on you.…