The "Report a Scam" feature allows users to submit scam reports directly from the scam alerts page. Reports are stored locally in the browser and can be managed by the user.
A 3-step wizard modal for submitting scam reports:
- Interactive Leaflet map centered on Sri Lanka
- Click anywhere on the map to place a red marker
- Shows selected coordinates in lat/lng format
- Visual confirmation with marker popup
- Scam Type Dropdown: Select from all existing scam types in the database
- Description Textarea: Write detailed description (required, 500 char limit with counter)
- Severity Selector (Optional): Choose from Critical, High, Medium, or Low with color-coded buttons
- Anonymous Checkbox: Option to report anonymously (identity not shared)
- Preview all entered information before submission
- Emergency contacts section with:
- 👮 Tourist Police: 1912 (24/7, English-speaking)
- 🚔 Emergency: 119
- Privacy note about immediate help availability
- Submit button with loading state
- "Report a Scam" Button: Green gradient button in hero section
- "My Reports" Button: Shows count of submitted reports (only visible when reports exist)
- Collapsible section showing user's submitted reports
- Grid layout with report cards displaying:
- Severity badge (color-coded)
- Pending status indicator
- Scam type title
- Description (truncated to 3 lines)
- Location coordinates
- Relative time (e.g., "2h ago", "3d ago")
- Delete button for removing reports
- Smooth slide-down animation when opened
- Auto-shows after new report submission
interface ScamReport {
id: string // Unique timestamp-based ID
location: {
lat: number
lng: number
}
scamType: string // ID of scam type from database
description: string // User's detailed description
severity: string // 'critical' | 'high' | 'medium' | 'low'
anonymous: boolean // Whether report is anonymous
status: 'pending' // Status of report
timestamp: string // ISO 8601 timestamp
}scamReportsin localStorage- Persists across browser sessions
- JSON serialized array of reports
- Click "Report a Scam" button in hero section
- Modal opens with Step 1 (Location)
- Click on map to place marker at scam location
- Click "Next" to proceed to Step 2 (Details)
- Select scam type from dropdown
- Write description of what happened
- Optionally select severity level
- Check "Report anonymously" if desired
- Click "Next" to proceed to Step 3 (Review)
- Review all information
- See emergency contact info (Tourist Police 1912, Emergency 119)
- Click "Submit Report"
- Success message shows briefly
- Modal auto-closes after 2 seconds
- "My Reports" section opens automatically
- Click "My Reports" button (shows count badge)
- Section expands with grid of submitted reports
- Each card shows summary of report
- Click delete button to remove a report (with confirmation)
- Click close button (×) to hide section
- Open "My Reports" section
- Find report to delete
- Click delete button (🗑️)
- Confirm deletion in browser prompt
- Report removed from display and localStorage
- Props:
show: boolean- Controls modal visibilityscamTypes: ScamType[]- Array of all available scam types
- Emits:
close- Fired when modal should closesubmit: [report: ScamReport]- Fired on successful submission
- Features:
- Leaflet map integration for location selection
- 3-step wizard with progress indicator
- Form validation (required fields, character limits)
- Emergency contact display
- LocalStorage integration
- Responsive design with mobile optimization
const showReportModal = ref(false) // Modal visibility
const showMyReports = ref(false) // Reports section visibility
const userReports = ref<ScamReport[]>([]) // Array of user's reportshandleReportSubmit(report)- Reloads reports from localStorage after submissiondeleteReport(reportId)- Removes report with confirmationgetScamTitle(scamId)- Gets scam type title from IDformatReportTime(timestamp)- Formats timestamp to relative time
- Modal overlay with blur backdrop
- Color-coded severity badges (red/orange/yellow/green)
- Smooth animations (slide-down, fade-in)
- Responsive grid layouts
- Mobile-optimized with stacked layouts on small screens
- Progressive Disclosure: 3-step wizard prevents overwhelming users
- Visual Feedback: Map markers, success messages, loading states
- Safety First: Emergency contacts prominently displayed
- Privacy Option: Anonymous reporting encourages participation
- Confirmation: Review step lets users verify before submitting
- Persistence: Reports saved locally across sessions
- Management: Easy deletion of submitted reports
- Responsive: Works on mobile, tablet, and desktop
- Server-side storage with API integration
- Report moderation and approval workflow
- Public display of verified reports on map
- Report statistics and analytics
- Email notifications for report status updates
- Photo upload capability
- Report editing functionality
- Export reports as PDF
- Modal opens when clicking "Report a Scam"
- Map allows placing markers
- Form validation works (required fields)
- All steps can be completed
- Report saves to localStorage
- Report appears in "My Reports" section
- Delete functionality works with confirmation
- Modal closes on success
- Emergency contacts are visible
- Responsive on mobile devices
- No console errors
- TypeScript types are correct