diff --git a/app/api/v1/reports/route.ts b/app/api/v1/reports/route.ts index 1eda28d..6674100 100644 --- a/app/api/v1/reports/route.ts +++ b/app/api/v1/reports/route.ts @@ -27,8 +27,7 @@ export const GET = route(async (req) => { }); /** - * Authenticated: submit a report. Accepts multipart/form-data (fields plus up - * to 3 `photos` files) or plain JSON when there are no photos. + * Authenticated: submit a report as multipart/form-data with 1 to 3 `photos` files. */ export const POST = route(async (req) => { const session = await requireUser(); @@ -54,6 +53,7 @@ export const POST = route(async (req) => { if (!withinBounds(input.lng, input.lat)) { throw new HttpError(400, "The selected location is outside Sipocot"); } + if (files.length === 0) throw new HttpError(400, "Attach at least one photo of the problem"); const stored = await saveImages(files); try { diff --git a/app/globals.css b/app/globals.css index d0bc91d..3a9928e 100644 --- a/app/globals.css +++ b/app/globals.css @@ -96,3 +96,88 @@ body { border: 1px solid #e2e8f0; border-radius: 0.75rem; } + +/* Map pins. Motion goes on the inner svg and pseudo-elements only: MapLibre sets transform on the marker root. */ +@keyframes pin-drop { + 0% { opacity: 0; transform: translateY(-16px) scale(0.6); } + 60% { opacity: 1; transform: translateY(3px) scale(1.04); } + 100% { transform: none; } +} +@keyframes pin-pulse { + 0% { opacity: 0.7; transform: scale(0.4); } + 100% { opacity: 0; transform: scale(1.9); } +} +@keyframes card-in { + from { opacity: 0; transform: translate(-50%, 4px); } + to { opacity: 1; transform: translate(-50%, 0); } +} +/* Hover and press use the individual translate/rotate/scale properties, so they do not fight the drop and launch transform animations. */ +.pin-svg { + animation: pin-drop 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; + transition: translate 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), rotate 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), scale 0.15s ease-out, transform 0.2s ease-out; +} +.pin:hover .pin-svg { + translate: 0 -4px; + rotate: -7deg; +} +.pin:active .pin-svg { + scale: 0.88; +} +.pin[data-selected="1"] .pin-svg { + transform: scale(1.25); +} +.pin[data-selected="1"]::before { + content: ""; + position: absolute; + left: 0; + bottom: 0; + width: 34px; + height: 12px; + border-radius: 50%; + background: rgb(29 53 87 / 0.45); + z-index: -1; + animation: pin-pulse 1.6s ease-out infinite; +} +.pin-card { + animation: card-in 0.18s ease-out; +} +/* Click: the pin lifts off, a shock ring spreads, and the other pins fade while the map flies in. */ +@keyframes pin-launch { + 0% { transform: translateY(0) scale(1); } + 30% { transform: translateY(-10px) scale(1.2); } + 100% { transform: translateY(-140px) scale(0.35); opacity: 0; } +} +@keyframes pin-shock { + from { transform: scale(0.5); opacity: 1; } + to { transform: scale(7); opacity: 0; } +} +.pin.pin-launch .pin-svg { + animation: pin-launch 0.9s cubic-bezier(0.5, 0, 0.8, 0.4) forwards; +} +.pin.pin-launch::after { + content: ""; + position: absolute; + left: 0; + bottom: 0; + width: 34px; + height: 12px; + border: 2px solid rgb(29 53 87 / 0.7); + border-radius: 50%; + animation: pin-shock 0.9s ease-out forwards; +} +.pin.pin-launch .pin-card { + display: none !important; /* beats the inline display set on hover */ +} +.map-launching .pin:not(.pin-launch) { + opacity: 0.25; + transition: opacity 0.4s ease-out; +} +@media (prefers-reduced-motion: reduce) { + .pin-svg, + .pin-card, + .pin[data-selected="1"]::before, + .pin.pin-launch::after { + animation: none; + transition: none; + } +} diff --git a/app/reports/[id]/page.tsx b/app/reports/[id]/page.tsx index 033a1e1..dcbb2a9 100644 --- a/app/reports/[id]/page.tsx +++ b/app/reports/[id]/page.tsx @@ -2,6 +2,9 @@ import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import ProgressSteps from "@/components/ProgressSteps"; +import LocationCard from "@/components/LocationCard"; +import ShareReport from "@/components/ShareReport"; +import PhotoGallery from "@/components/PhotoGallery"; import StaticMap from "@/components/StaticMap"; import StatusBadge from "@/components/StatusBadge"; import TransitionControls from "@/components/TransitionControls"; @@ -72,22 +75,7 @@ export default async function ReportPage({ params }: Props) {

Details

{report.description}

- {report.media.length > 0 && ( - - )} + {report.media.length > 0 && }
@@ -114,6 +102,8 @@ export default async function ReportPage({ params }: Props) {