import { useState, useEffect, useCallback } from 'react'; import { motion } from 'framer-motion'; import { HiSearch } from 'react-icons/hi'; import { HiArrowPath } from 'react-icons/hi2'; import api from '../../../services/api'; import { formatDate, formatCurrency } from '../../../utils/helpers'; import toast from 'react-hot-toast'; const STATUSES = ['', 'submitted', 'under_review', 'approved', 'rejected', 'fulfilled']; const STATUS_STYLE = { submitted: { bg: '#eff6ff', color: '#2563EB', label: 'New' }, under_review: { bg: '#fffbeb', color: '#D97706', label: 'Reviewing' }, approved: { bg: '#ecfdf5', color: '#059669', label: 'Approved' }, rejected: { bg: '#fef2f2', color: '#EF4444', label: 'Rejected' }, fulfilled: { bg: '#f5f3ff', color: '#7C3AED', label: 'Fulfilled' }, }; const URGENCY_STYLE = { critical: '#EF4444', high: '#F59E0B', medium: '#3B82F6', low: '#10B981', }; const NEXT_STATUS = { submitted: 'under_review', under_review: 'approved', approved: 'fulfilled', }; function ReviewModal({ request, onClose, onUpdate }) { const [status, setStatus] = useState(request.status); const [notes, setNotes] = useState(request.reviewNotes || ''); const [saving, setSaving] = useState(false); const handle = async () => { setSaving(true); try { await api.put(`/help-requests/${request.id}/status`, { status, reviewNotes: notes }); toast.success('Request updated!'); onUpdate(); onClose(); } catch (e) { toast.error(e.message || 'Update failed.'); } finally { setSaving(false); } }; return (
e.stopPropagation()}>

๐Ÿ” Review: {request.title}

Submitted {formatDate(request.createdAt)} ยท Est. {formatCurrency(request.estimatedAmount || 0)}

{request.description}