Skip to content

Commit

Permalink
Record page
Browse files Browse the repository at this point in the history
  • Loading branch information
brandnholl committed Apr 11, 2024
1 parent dfeb140 commit f360b8e
Showing 1 changed file with 59 additions and 6 deletions.
65 changes: 59 additions & 6 deletions apps/web/app/(app)/[campusid]/[recordid]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { SinglePointMap } from "@/components/maps/single-point";
import { Badge } from "@/components/ui/badge";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { getRecord, getCoordinate } from "@/lib/record";

export default async function Campus({
Expand All @@ -15,13 +17,64 @@ export default async function Campus({

return (
<>
<div className="w-full h-[36rem]">
<SinglePointMap
latitude={location!.latitude!}
longitude={location!.longitude!}
zoom={15.5}
/>
<div className="flex h-screen items-center justify-center max-w-screen-xl mx-auto">
<div className="mt-16 sm:space-x-2 flex flex-col sm:flex-row">
<div className="max-sm:pb-1 sm:w-1/2">
<Card>
<CardHeader>
<CardTitle className="flex items-center justify-between">
Record Details<Badge>UC San Diego</Badge>
</CardTitle>
</CardHeader>
<CardContent className="mt-2 space-y-2">
<RecordLine label="Case Number" value={record.case_number} />
<RecordLine label="Incident Type" value={record.incident} />
<RecordLine label="Location" value={record.location} />
<RecordLine
label="Date Reported"
value={record.date_reported}
/>
<div className="flex flex-col justify-center">
<h2 className="font-semibold">Date/Time Occured</h2>
<p className="font-mono">
{record.date_occurred} {record.time_occurred}
</p>
</div>
<RecordLine label="Summary" value={record.summary} />
<RecordLine label="Disposition" value={record.disposition} />
</CardContent>
</Card>
</div>
{location?.longitude && location?.latitude ? (
<Card className="flex grow">
<SinglePointMap
latitude={location!.latitude!}
longitude={location!.longitude!}
zoom={15.5}
/>
</Card>
) : (
<Card className="flex flex-grow items-center justify-center">
<p className="text-lg font-semibold">
No coordinate data available.
</p>
</Card>
)}
</div>
</div>
</>
);
}

const RecordLine = ({
label,
value,
}: {
label: string;
value: string | null;
}) => (
<div className="flex flex-col justify-center">
<h2 className="font-semibold">{label}</h2>
<p className="font-mono">{value}</p>
</div>
);

0 comments on commit f360b8e

Please sign in to comment.