diff --git a/web/src/app/_components/review/ReviewItem.tsx b/web/src/app/_components/review/ReviewItem.tsx index 1b531e7..1ce1940 100644 --- a/web/src/app/_components/review/ReviewItem.tsx +++ b/web/src/app/_components/review/ReviewItem.tsx @@ -49,6 +49,7 @@ export function ReviewItem({ { +export const ReviewItemHeader = ({ displayName, assetId, statusId, creator, submitterId }: ReviewItemHeaderProps) => { const isProcessing = StatusMatches(statusId, [Status.Validating, Status.Uploading, Status.Submitting]); const pulse = keyframes` 0%, 100% { opacity: 0.2; transform: scale(0.8); } @@ -57,9 +58,30 @@ export const ReviewItemHeader = ({ displayName, statusId, creator, submitterId } return ( <> - + {assetId != null ? ( + + + + {displayName} by {creator} + + + + + ) : ( + {displayName} by {creator} - + + )} {isProcessing && ( ([]); useTitle(map ? `${map.DisplayName}` : 'Loading Map...'); @@ -87,6 +90,33 @@ export default function MapDetails() { getRoles() }, [mapId]); + useEffect(() => { + if (!map) return; + const targetAssetId = map.ID; + async function fetchMapfixes() { + try { + const limit = 100; + let page = 1; + let allMapfixes: MapfixInfo[] = []; + let total = 0; + do { + const res = await fetch(`/api/mapfixes?Page=${page}&Limit=${limit}&TargetAssetID=${targetAssetId}`); + if (!res.ok) break; + const data = await res.json(); + if (page === 1) total = data.Total; + allMapfixes = allMapfixes.concat(data.Mapfixes); + page++; + } while (allMapfixes.length < total); + // Filter out rejected, uploading, uploaded (StatusID > 7) + const active = allMapfixes.filter((fix: MapfixInfo) => fix.StatusID <= MapfixStatus.Validated); + setMapfixes(active); + } catch { + setMapfixes([]); + } + } + fetchMapfixes(); + }, [map]); + const formatDate = (timestamp: number) => { return new Date(timestamp * 1000).toLocaleDateString('en-US', { year: 'numeric', @@ -361,13 +391,46 @@ export default function MapDetails() { handleCopyId(mapId as string)} - sx={{ ml: 1 }} + sx={{ ml: 1, p: 0 }} > + + {/* Active Mapfix in Map Details */} + {mapfixes.length > 0 && (() => { + const active = mapfixes.find(fix => fix.StatusID <= MapfixStatus.Validated); + const latest = mapfixes.reduce((a, b) => (a.CreatedAt > b.CreatedAt ? a : b)); + const showFix = active || latest; + return ( + + + Active Mapfix + + + + {showFix.Description} + + + + + ); + })()}