Skip to content

feat(territories): show attribution kind on /me/territories pages#207

Merged
mindsers merged 4 commits into
mainfrom
feat/me-territories-attribution-kind
Jun 7, 2026
Merged

feat(territories): show attribution kind on /me/territories pages#207
mindsers merged 4 commits into
mainfrom
feat/me-territories-attribution-kind

Conversation

@mindsers

@mindsers mindsers commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a badge surfacing the attribution kind (Campaign, Phones) on the publisher-facing /me/territories list cards and /me/territories/:id detail header.
  • Default door-to-door kind renders nothing, mirroring the no-watermark behaviour of the territory PDF.
  • Reuses the existing attributions_type_campaign / attributions_type_phone Paraglide keys, so no new translations are needed.

Test plan

  • Assign a Campaign attribution to a publisher and confirm the blue "Campagne de distribution" badge appears on /me/territories and /me/territories/:id.
  • Assign a Phones attribution and confirm the green "Téléphones" badge appears on both pages.
  • Assign a default (door-to-door) attribution and confirm no extra badge appears.
  • Verify the PDF watermark still matches the on-screen badge for each kind.

mindsers added 4 commits June 7, 2026 20:31
Publishers can already see the attribution kind (campaign, phones) as a
watermark on the territory PDF, but the /me/territories list and detail
pages didn't surface it. Add a badge for non-default kinds so publishers
know up front whether the territory is a distribution campaign or a
phones territory before they start working it.
…ritories

The attribution-kind badges previously used the success (green) and info
(blue) variants, which collide with the status badge palette sitting on
the same row. Replace with a neutral secondary fill plus a Phone or
Megaphone icon, so the kind reads as categorical (not as another
status), and so it disambiguates from the territory type label rendered
just below ("Téléphone" the territory kind vs "Téléphones" the
attribution kind).

Extract the lookup into AttributionKindBadge to remove duplication
between the list and the detail route, and to give one place to add a
tooltip later.
…oader shape

Apply PR review follow-ups:
- Rename local Props to AttributionKindBadgeProps to match the dominant
  *Props convention in the codebase.
- Make the Default branch explicit instead of falling through to the
  trailing return null. TerritoryAttributionKind is a Prisma const-object
  union (not a TS enum), so the trailing return null silently absorbs any
  future variant; an explicit Default branch makes the intent visible and
  leaves the fall-through reserved for the unreachable case.
- Assert attribution.type in the getUserTerritoriesWithDetails test so
  dropping the type field from the Prisma select would now break a test
  instead of silently hiding the badge in prod. Fix the mock value while
  there: Prisma surfaces schema enum names (PascalCase), not the @map-ed
  lowercase DB value.
Mention the new assignment-type indicator on the publisher-facing
territory list and detail pages, and note in the assignment-types
section that the kind is surfaced in three places (PDF watermark, list
card, detail header) so publishers always know how to approach the
territory. Default (door-to-door) intentionally shows no indicator
anywhere.
@mindsers mindsers merged commit 961fea0 into main Jun 7, 2026
6 checks passed
@mindsers mindsers deleted the feat/me-territories-attribution-kind branch June 7, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant