Skip to content

feat(leads): group leads by campaign as lead lists with table UI - #30

Open
Rishavraaj wants to merge 1 commit into
mainfrom
feat/leads-grouped-by-campaign
Open

feat(leads): group leads by campaign as lead lists with table UI#30
Rishavraaj wants to merge 1 commit into
mainfrom
feat/leads-grouped-by-campaign

Conversation

@Rishavraaj

@Rishavraaj Rishavraaj commented Aug 7, 2026

Copy link
Copy Markdown
Member

Summary

  • Leads page now shows a list of campaigns (lead lists) instead of a flat table
  • Clicking a campaign opens all leads for that campaign
  • Backend groups leads by campaign with counts

Changes

libs/sales

  • leads.repository.ts: add findLists() — groups leads by campaignId using Prisma groupBy, joins campaign names, returns { campaignId, campaignName, leadCount }[]

apps/backend

  • leads.service.ts: expose findLists()
  • leads.controller.ts: add GET /leads/lists endpoint (declared before GET /leads/:id to avoid route conflict)

apps/web

  • lib/api/leads.ts: add LeadList type and leadsApi.lists()
  • query-options.ts: add getLeadLists() and getLeads(filters) query options
  • app/(app)/leads/page.tsx: replaced flat list with LeadLists (server-side prefetch)
  • app/(app)/leads/campaign/[campaignId]/page.tsx: new page — shows leads for a campaign
  • components/Leads/LeadLists.tsx: table of campaigns with lead counts, click to drill in
  • components/Leads/LeadsInList.tsx: table of leads for a campaign — name, email, company, title, status, created + convert/delete actions

Test plan

  • /leads shows a table of campaigns with lead counts
  • Clicking a row navigates to /leads/campaign/<id>
  • Campaign leads page shows correct leads for that campaign
  • Convert to Deal action works
  • Delete action removes lead and refreshes list
  • Empty states display correctly

🤖 Generated with Claude Code

- Backend: LeadsRepository.findLists() groups leads by campaign with counts
- Backend: GET /leads/lists endpoint
- Frontend: /leads shows LeadLists table (campaigns with lead counts, click to drill in)
- Frontend: /leads/campaign/[campaignId] shows LeadsInList table with
  name/email/company/title/status/created columns + convert/delete actions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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