// ===== ROAD HAZARD REPORT ===== // Community reporting for road & sidewalk hazards, anchored by the // "Ibalik ang Sidewalk sa mga Tao" campaign (clear sidewalks for pedestrians). const hazard_types = [ { id: 'vendor', label: 'Illegal vendor on sidewalk', icon: 'πŸ›’', campaign: true }, { id: 'parking', label: 'Vehicle on sidewalk', icon: 'πŸš—', campaign: true }, { id: 'structure', label: 'Structure blocking sidewalk', icon: 'πŸ—οΈ', campaign: true }, { id: 'pothole', label: 'Pothole / road damage', icon: 'πŸ•³οΈ', campaign: false }, { id: 'flood', label: 'Flooding', icon: '🌊', campaign: false }, { id: 'debris', label: 'Debris / obstruction', icon: 'πŸͺ¨', campaign: false }, { id: 'light', label: 'Broken light / signal', icon: 'πŸ’‘', campaign: false }, { id: 'drain', label: 'Open manhole / drainage', icon: '⚠️', campaign: false }, { id: 'tree', label: 'Fallen tree / branch', icon: '🌳', campaign: false }, ]; const hazard_recent = [ { id: 1, type: 'Vehicle on sidewalk', icon: 'πŸš—', loc: 'Aurora Blvd, Cubao', time: '20 min ago', status: 'Forwarded to LGU', color: '#2556a8' }, { id: 2, type: 'Pothole', icon: 'πŸ•³οΈ', loc: 'Commonwealth Ave, QC', time: '1 hr ago', status: 'Under review', color: '#ffa502' }, { id: 3, type: 'Illegal vendor on sidewalk', icon: 'πŸ›’', loc: 'Divisoria, Manila', time: '3 hrs ago', status: 'Resolved', color: '#00c48c' }, ]; function RoadHazardScreen({ t, go, user }) { const now = new Date(); const isoDate = new Date(now.getTime() - now.getTimezoneOffset() * 60000).toISOString().slice(0, 10); const isoTime = new Date(now.getTime() - now.getTimezoneOffset() * 60000).toISOString().slice(11, 16); const [type, setType] = useState(''); const [photo, setPhoto] = useState(null); // {url} const [video, setVideo] = useState(null); // {name} const [loc, setLoc] = useState(''); const [date, setDate] = useState(isoDate); const [time, setTime] = useState(isoTime); const [desc, setDesc] = useState(''); const [submitted, setSubmitted] = useState(null); const photoRef = useRef(null); const videoRef = useRef(null); const ready = type && loc.trim() && (photo || video); const onPhoto = (e) => { const f = e.target.files && e.target.files[0]; if (f) setPhoto({ url: URL.createObjectURL(f), name: f.name }); }; const onVideo = (e) => { const f = e.target.files && e.target.files[0]; if (f) setVideo({ url: URL.createObjectURL(f), name: f.name }); }; const useGps = () => setLoc(`${(14.55 + Math.random() * 0.2).toFixed(4)}Β° N, ${(120.95 + Math.random() * 0.12).toFixed(4)}Β° E`); const submit = () => { if (!ready) return; setSubmitted({ ref: 'HZ-' + Math.floor(100000 + Math.random() * 900000), type: hazard_types.find(h => h.id === type)?.label }); }; const reset = () => { setSubmitted(null); setType(''); setPhoto(null); setVideo(null); setLoc(''); setDesc(''); setDate(isoDate); setTime(isoTime); }; const field = { width: '100%', border: `1.5px solid ${t.border}`, background: t.inputBg, color: t.text, borderRadius: 12, padding: '12px 13px', outline: 'none', fontWeight: 500, fontSize: 14 }; const lbl = { fontSize: 12, fontWeight: 700, color: t.text, display: 'block', marginBottom: 7 }; if (submitted) { return (
πŸ“

Hazard reported!

Your report of {submitted.type} has been forwarded to the concerned LGU. Ref {submitted.ref}.

go('Home')}>Done Report another
); } return (
{/* Campaign banner */}
πŸšΆβ€β™€οΈπŸšΆ
Ibalik ang Sidewalk sa mga Tao
Isang kampanya laban sa illegal vendors, nakaparadang sasakyan, at mga istrukturang sumasakop sa bangketa. Ayon sa batas, ang bangketa ay para lamang sa mga pedestrian β€” ligtas at malayang madaanan.
Spotted a hazard or a blocked sidewalk? Report it below β€” your photo, location, and details go straight to the responsible LGU.
{/* Media */}
{/* Photo */} {/* Video */}
{/* Hazard type */}
🚢 SIDEWALK CAMPAIGN
{hazard_types.filter(h => h.campaign).map(h => { const sel = type === h.id; return ( ); })}
OTHER ROAD HAZARDS
{hazard_types.filter(h => !h.campaign).map(h => { const sel = type === h.id; return ( ); })}
{/* Location + date/time */}
setLoc(e.target.value)} placeholder="Street, barangay, city" style={{ ...field, flex: 1 }} />
setDate(e.target.value)} style={field} />
setTime(e.target.value)} style={field} />