1.6 KiB
1.6 KiB
Phase 3 — Opportunities Persistence & Workflow
Goals
- Persist opportunity search results in Convex.
- Enable lead management (status, notes, tags).
- Add filtering, pagination, and basic bulk actions.
Scope
- Write opportunities to Convex during search.
- Read opportunities from Convex in the UI.
- Implement lead status changes and notes/tags.
Detailed Tasks
-
Persist opportunities
- Update
/api/opportunitiesto callopportunities.upsertBatchafter scoring. - Dedupe by URL + projectId.
- Store analysisId + projectId on each opportunity.
- Update
-
Load opportunities from Convex
- Replace local state-only data with Convex query.
- Add pagination and “Load more” to avoid giant tables.
-
Filtering & sorting
- Filters: status, intent, platform, min relevance score.
- Sorting: relevance score, createdAt.
-
Lead workflow actions
- Status change: new → viewed/contacted/responded/converted/ignored.
- Add notes + tags; persist via mutation.
- Optional: quick bulk action for selected rows.
-
UI feedback
- Show counts by status.
- Empty states for no results or no saved opportunities.
Dependencies
- Requires Phase 1 schema and Phase 2 project + analysis persistence.
Acceptance Criteria
- Opportunities persist across refresh and sessions.
- Status/notes/tags are stored and reflected in UI.
- Filters and pagination are usable.
Risks
- Serper or direct Google scraping limits; need clear UX for failed searches.
Notes
- Keep raw search results transient; only store scored opportunities.