feat: Lost Cats Finder website with announcements, map view & image upload#8
feat: Lost Cats Finder website with announcements, map view & image upload#8devin-ai-integration[bot] wants to merge 3 commits into
Conversation
- Hero section with live stats (lost/found/reunited counts) - 6 sample cat announcements with Unsplash photos - Search by name, location, color, or breed - Filter tabs (All / Lost / Found / Reunited) - Post Announcement form modal with full validation - Detail modal with cat info and Contact Now button - Responsive design with Tailwind CSS - Built with React + TypeScript + Vite
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Add formatDate helper that safely parses date strings with timezone offset to prevent 'Invalid Date' display. Falls back to raw string if parsing fails, or 'Date not provided' if empty.
| </div> | ||
| </div> | ||
| <a | ||
| href={`tel:${selectedAnnouncement.contact}`} |
There was a problem hiding this comment.
🟡 tel: link used for contact field that also accepts email addresses
The contact form field placeholder says "Phone or email" (line 411), indicating users can enter either a phone number or an email address. However, the "Contact Now" button in the detail modal always wraps the contact value in a tel: protocol link (lost-cats/src/App.tsx:500). If a user enters an email address as contact info, clicking "Contact Now" will attempt to initiate a phone call to the email string (e.g. tel:user@example.com), which will either fail or produce unexpected behavior on the user's device.
Was this helpful? React with 👍 or 👎 to provide feedback.
- Interactive map view with Leaflet showing cat locations with color-coded markers (red=lost, blue=found, green=reunited) - Grid/Map view toggle - Drag & drop image upload with file picker and preview - URL input fallback for image - Added lat/lng coordinates to all sample data
|
|
||
| {/* Post Announcement Modal */} | ||
| {showForm && ( | ||
| <div className="fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center p-4 z-50" onClick={() => { setShowForm(false); setImagePreview(null) }}> |
There was a problem hiding this comment.
🟡 Image preview cleared on modal close but formData.image retained, causing ghost image on resubmit
When the form modal is closed (via backdrop click at line 513 or X button at line 520), setImagePreview(null) is called but formData.image is not cleared. If a user uploads a photo (which sets both imagePreview and formData.image to a data URL), then closes the modal, then reopens it:
- The upload zone checks
imagePreview(line 645) which isnull, so it shows the "Drag & drop a photo" placeholder — suggesting no image is attached. - The URL input checks
formData.image.startsWith('data:')(line 675), which istrue, so it displays an empty string — hiding the stale data URL. - If the user submits the form,
formData.imagestill contains the old data URL, so the announcement is created with an image the user thought was removed.
This creates a mismatch between what the UI shows (no image) and what gets submitted (the previously uploaded image).
| <div className="fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center p-4 z-50" onClick={() => { setShowForm(false); setImagePreview(null) }}> | |
| <div className="fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center p-4 z-50" onClick={() => { setShowForm(false); setImagePreview(null); setFormData(prev => ({ ...prev, image: '' })) }}> |
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Adds a standalone Lost Cats Finder web application under the
lost-cats/directory. This is a React + TypeScript + Vite frontend for posting and browsing lost/found cat announcements.Features:
Stack: React 18, TypeScript, Vite 6, Tailwind CSS 3, Lucide React, Leaflet + react-leaflet v4
Live preview: https://lost-cats-finder.surge.sh
Updates since last revision
Added interactive Map View — New Leaflet-based map (via
react-leaflet@4) showing all cat announcements as color-coded markers: red = lost, blue = found, green = reunited. Map popups display the cat's photo, status, breed, and a "View Details" button. Includes a legend bar and a Grid/Map toggle in the toolbar. Each sample announcement now haslat/lngcoordinates (NYC area).Added drag & drop Image Upload — The "Post Announcement" form now has a drag-and-drop zone with file picker support. Uploaded images are converted to data URLs via
FileReaderand shown as an inline preview. Users can still paste an image URL as a fallback. The URL input is hidden when a file has been uploaded (clears on form close/submit).Fixed "Invalid Date" bug (previous revision) —
formatDatehelper appendsT00:00:00to date strings before parsing.Review & Testing Checklist for Human
lost-cats/src/App.tsx— all application logic (~790 lines) lives in a single component. In particular:handleSubmitfunction now constructsCatAnnouncementobjects manually (instead of...formDataspread) becauselat/lngneedparseFloatconversion from string form state to number. Verify this doesn't silently drop any fields.40.7128, -74.006. This means new announcements will cluster near NYC regardless of the typed location text.raw.githubusercontent.com/pointhi/leaflet-color-markers. If this third-party repo is removed or restructured, the map markers will break with no fallback.react-leaflet@4compatibility — v4 was chosen because v5 requires React 19. If the project upgrades to React 19 later, this should be revisited.Notes
leaflet,react-leaflet@4,@types/leaflet. Thepackage-lock.jsondiff is large accordingly.App.tsxviaimport 'leaflet/dist/leaflet.css'.Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/5876b90f983f47958188a58c3eea8682