From 3b022fe93db406d1f334fbdfd7a4fd3939eb7fee Mon Sep 17 00:00:00 2001 From: itzaname Date: Sun, 8 Jun 2025 15:57:05 -0400 Subject: [PATCH] Add before/after image, cleanup submission references in mapfix --- web/src/app/mapfixes/[mapfixId]/page.tsx | 151 +++++++++++++++++++---- web/src/app/mapfixes/page.tsx | 22 ++-- 2 files changed, 138 insertions(+), 35 deletions(-) diff --git a/web/src/app/mapfixes/[mapfixId]/page.tsx b/web/src/app/mapfixes/[mapfixId]/page.tsx index 34bae7b..3c276f0 100644 --- a/web/src/app/mapfixes/[mapfixId]/page.tsx +++ b/web/src/app/mapfixes/[mapfixId]/page.tsx @@ -36,7 +36,7 @@ interface SnackbarState { severity: 'success' | 'error' | 'info' | 'warning'; } -export default function SubmissionDetailsPage() { +export default function MapfixDetailsPage() { const { mapfixId } = useParams<{ mapfixId: string }>(); const router = useRouter(); @@ -47,6 +47,7 @@ export default function SubmissionDetailsPage() { const [newComment, setNewComment] = useState(""); const [user, setUser] = useState(null); const [roles, setRoles] = useState(RolesConstants.Empty); + const [showBeforeImage, setShowBeforeImage] = useState(false); const [snackbar, setSnackbar] = useState({ open: false, message: null, @@ -78,7 +79,7 @@ export default function SubmissionDetailsPage() { const [mapfixData, auditData, rolesData, userData] = await Promise.all([ fetch(`/api/mapfixes/${mapfixId}`).then(res => { - if (!res.ok) throw new Error(`Failed to fetch submission: ${res.status}`); + if (!res.ok) throw new Error(`Failed to fetch mapfix: ${res.status}`); return res.json(); }), fetch(`/api/mapfixes/${mapfixId}/audit-events?Page=1&Limit=100`).then(res => { @@ -109,7 +110,7 @@ export default function SubmissionDetailsPage() { } } - // Fetch submission data and audit events + // Fetch mapfix data and audit events useEffect(() => { fetchData(); }, [mapfixId]); @@ -246,29 +247,131 @@ export default function SubmissionDetailsPage() { {/* Left Column - Image and Action Buttons */} - {mapfix.AssetID ? ( - - ) : ( - - No image available + + {/* Before/After Images Container */} + + {/* Before Image */} + + + + + {/* After Image */} + + + + + {showBeforeImage ? ( + <> + + BEFORE + + + ) : ( + <> + + AFTER + + + )} + + + + + Click to compare + + + + setShowBeforeImage(!showBeforeImage)} + /> - )} + + {/* Review Buttons */} - {/* Right Column - Submission Details and Comments */} + {/* Right Column - Mapfix Details and Comments */} - {mapfixes.Mapfixes.map((submission) => ( + {mapfixes.Mapfixes.map((mapfix) => ( ))}