- Report button added to PromptModal component
- Located in PromptMetadataSection alongside share link button
- Red accent color (Flag icon) to indicate reporting action
- Disabled state when onReportClick not provided
- ReportDialog component with 6 reason options:
- Low quality or poor result
- Content doesn't match description
- Contains plagiarized content
- Harmful or inappropriate content
- Copyright violation
- Other reason
- Radio-style selection with visual feedback
- Required field validation
- Three-stage dialog flow:
- Form stage: reason selector + optional description
- Submitting stage: loading animation with status message
- Success stage: confirmation with check mark
- Auto-closes after 2 seconds on success
- Smooth animations between stages
- New admin page at
/admin/reports - Reports queue with filtering and sorting
- Review actions panel:
- Admin notes textarea
- Mark Resolved button
- Dismiss Report button
- Take Action on Prompt button (placeholder)
- Status indicators: pending, investigating, resolved, dismissed
src/lib/reports/reportClient.ts- API client for report submissionssrc/components/prompts/ReportDialog.tsx- Report submission dialog componentsrc/pages/admin/Reports.tsx- Admin review dashboardsrc/lib/reports/reportClient.test.ts- Client tests
server/src/models/Report.ts- MongoDB report schemaserver/src/controllers/controllers.ts- Added SubmitPromptReport and GetPromptReportsserver/src/routes/promptRoutes.ts- Added report endpoints
src/pages/browse/PromptModal.tsx- Integrated ReportDialog and added report button
type ReportReason =
| "quality-issue"
| "misleading-content"
| "plagiarism"
| "harmful-content"
| "copyright"
| "other"POST /api/prompts/reports- Submit a reportGET /api/prompts/reports?promptId={id}- Fetch reports (admin only)
- promptId: string
- reporterAddress: string (normalized to lowercase)
- reason: enum
- description: optional (max 500 chars)
- status: pending | investigating | resolved | dismissed
- adminNotes: optional
- timestamps: createdAt, updatedAt, resolvedAt
- User opens prompt modal
- Clicks "Report prompt" button (red flag icon)
- Dialog opens with reason selector
- User selects reason and optionally adds details
- Submits report
- Loading animation shown
- Success confirmation displayed
- Dialog auto-closes
- Navigate to
/admin/reports - View pending reports in queue
- Click report to select for review
- View reason, description, and reporter info
- Add admin notes
- Mark as Resolved or Dismiss
- Optionally take action on prompt
Report schema includes:
- Full audit trail with timestamps
- Status tracking for workflow
- Admin notes field
- Indexes on promptId and status for efficient queries
- Reporter address normalized to lowercase
- Admin token required for report retrieval
- No sensitive data exposed in responses
- Description limited to 500 characters