Feature: Membership Quests System + Email Consent Quest #474
Labels
No labels
accessibility
api
auth.js
backend
copy
database
defect
dependencies
design
discussion
documentation
duplicate
enhancement
epic
feature
front-end
good first issue
help wanted
invalid
next.js
noscript
on hold
operations
optimization
postgresql
prisma
prototype
question
react
spike
stale
story
tailwind
vulnerability
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
SSE/WebsiteTheSSEquel#474
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The existing Profile Quest (lines 1164–1242 in
ProfileContent.tsx) is fully hardcoded — the quest card, the field checklist, the completion logic, and the CTA button are all one-off JSX baked into the profile page. There is no way to add a second quest without copy-pasting the whole block and manually wiring up new logic.We need:
What Exists Today
File:
next/app/(main)/profile/[id]/ProfileContent.tsxThe completion check (
fieldComplete), progress bar, checklist, and "Complete Quest" button are all inline JSX — lines 941–1242. There is no DB backing; it reads directly from the user's profile fields.Proposed Solution
Step 1 — Extract a reusable
<QuestCard />componentPull the existing quest card out of
ProfileContent.tsxinto its own component so both quests share the same visual shell (gradient card, Target icon, progress bar, checklist, CTA button).New file:
next/components/quests/QuestCard.tsxThe component accepts:
title— quest namedescription— one-liner shown under the titleitems— array of{ label, complete, icon }(already computed by caller)ctaLabel— button textonCta— button click handlerThis keeps quest-specific logic (what counts as complete, what the CTA does) in each quest's own component while sharing the shell.
Step 2 — Keep Profile Quest as-is, just using the new shell
Refactor the existing profile quest to use
<QuestCard />. Behavior does not change — it still reads profile fields, still opens edit mode on "Complete Quest".Step 3 — Add Quest #2: Email Consent
New file:
next/components/quests/EmailConsentQuest.tsxThis quest shows below the Profile Quest on the member's own profile page. It:
EmailPreferencesrecord in the DBPrisma model addition:
New API routes:
GET/api/email-preferencesPUT/api/email-preferencesCompletion state:
EmailPreferencesrow exists for this user → quest is complete. Shown as incomplete until first save.Step 4 — Render both quests on the profile page
In
ProfileContent.tsx, replace the inline quest block with:Adding a future quest: create a new
XyzQuestCard.tsxusing<QuestCard />, add its API route, drop it into the list above. Nothing else changes.Scope
In scope:
<QuestCard />shared shell componentEmailPreferencesPrisma model + migrationGET /PUT /api/email-preferencesAPI routesEmailConsentQuestCardcomponent with four checkboxes and saveOut of scope:
Acceptance Criteria
EmailPreferencesand returned byGET /api/email-preferencesQuestCard-based component + adding it to the profile page list/api/email-preferencesreturn 401Additional Context
EmailPreferencesto filter recipientsnext/app/(main)/profile/[id]/ProfileContent.tsxlines 244–253 and 1164–1242next/lib/email/index.ts