feat: add campaign configuration controls

This commit is contained in:
2026-06-04 14:45:47 +02:00
parent 07841aea0f
commit 585c4eeb2a
24 changed files with 2941 additions and 34 deletions

View File

@@ -1,9 +1,10 @@
---
id: TASK-5
title: Implement campaign configuration and scheduling controls
status: To Do
status: Done
assignee: []
created_date: '2026-06-03 19:12'
updated_date: '2026-06-04 12:44'
labels:
- mvp
- campaigns
@@ -13,7 +14,7 @@ dependencies:
references:
- PRD.md
priority: high
ordinal: 5000
ordinal: 21000
---
## Description
@@ -24,11 +25,11 @@ Build the campaign management UI and backend mutations for reusable local search
## Acceptance Criteria
<!-- AC:BEGIN -->
- [ ] #1 Campaign create/edit forms use React Hook Form, Zod, and shadcn form components
- [ ] #2 Campaigns support predefined categories plus Anderes with a required custom input
- [ ] #3 Campaigns store PLZ, radius, cadence, max new leads, max audits, active/paused state, and Germany-only context
- [ ] #4 Each campaign has a Jetzt ausführen action and shows last run, next run, and current run status
- [ ] #5 Form validation gives clear German error messages for invalid PLZ, radius, cadence, and limits
- [x] #1 Campaign create/edit forms use React Hook Form, Zod, and shadcn form components
- [x] #2 Campaigns support predefined categories plus Anderes with a required custom input
- [x] #3 Campaigns store PLZ, radius, cadence, max new leads, max audits, active/paused state, and Germany-only context
- [x] #4 Each campaign has a Jetzt ausführen action and shows last run, next run, and current run status
- [x] #5 Form validation gives clear German error messages for invalid PLZ, radius, cadence, and limits
<!-- AC:END -->
## Implementation Plan
@@ -40,3 +41,21 @@ Build the campaign management UI and backend mutations for reusable local search
4. Add run metadata fields for last run, next run, and current status.
5. Verify campaign forms and dashboard state transitions.
<!-- SECTION:PLAN:END -->
## Implementation Notes
<!-- SECTION:NOTES:BEGIN -->
Started subagent-driven, test-driven implementation with Codex Spark workers. Orchestrator will enforce red-green cycles, spec review, code quality review, and final verification before requesting manual confirmation.
Implemented TASK-5 subagent-driven and test-driven. Backend/domain slice passed spec and quality review after fix loops. Frontend slice passed spec review and quality re-review after accessibility/timer fixes. Verification: pnpm test passed 40/40; pnpm exec tsc -p tsconfig.json passed; pnpm lint passed with only existing generated Convex warnings; pnpm build passed with network allowed for next/font assets. Local route check: /dashboard/campaigns returns 307 to /login without session; /login returns 200. Browser visual flow still needs authenticated manual testing before closing task as Done.
Bugfix after manual testing: campaign create dialog crashed because SelectContent was placed inside FormControl, giving FormControl multiple children and triggering React.Children.only. Fixed category and recurrence Select composition so FormControl wraps only SelectTrigger while SelectContent remains inside Select as a sibling. Verification after fix: pnpm exec tsc -p tsconfig.json passed; pnpm lint passed with only existing generated warnings; pnpm test passed 40/40; pnpm build passed.
Bugfix after manual testing: campaign create dialog emitted controlled/uncontrolled input warning because campaignFormDefaults lacked name/customSearchTerm while RHF rendered controlled inputs. Added empty string defaults and defensive customSearchTerm value fallback. Verification after fix: pnpm exec tsc -p tsconfig.json passed; pnpm test passed 40/40; pnpm lint passed with only existing generated warnings; pnpm build passed.
<!-- SECTION:NOTES:END -->
## Final Summary
<!-- SECTION:FINAL_SUMMARY:BEGIN -->
TASK-5 shipped campaign configuration and scheduling controls: React Hook Form/Zod/shadcn create/edit forms, predefined categories plus Anderes custom niche, Convex campaign persistence with Germany-only context, run request/status metadata, pause/resume controls, German validation, and post-manual-test bugfixes for Select composition and controlled inputs.
<!-- SECTION:FINAL_SUMMARY:END -->