1+ import type { GuestWithStays } from "@shared" ;
12import { UserRound } from "lucide-react" ;
2- import type { GuestProfile } from "./guest-mocks " ;
3+ import { formatDate } from "../../utils/dates " ;
34
45type GuestProfileCardProps = {
5- guest : GuestProfile ;
6+ guest : GuestWithStays ;
67} ;
78
89function DetailRow ( { label, value } : { label : string ; value : string } ) {
@@ -15,6 +16,8 @@ function DetailRow({ label, value }: { label: string; value: string }) {
1516}
1617
1718export function GuestProfileCard ( { guest } : GuestProfileCardProps ) {
19+ const currentStay = ( guest . current_stays ?? [ ] ) [ 0 ] ;
20+
1821 return (
1922 < section className = "border border-black bg-white px-[1vw] py-[2vh]" >
2023 < div className = "mb-[2vh] flex items-start gap-[1.1vw]" >
@@ -23,28 +26,27 @@ export function GuestProfileCard({ guest }: GuestProfileCardProps) {
2326 </ div >
2427 < div >
2528 < p className = "text-[2vw] font-medium leading-tight text-black" >
26- { guest . preferredName }
29+ { guest . first_name } { guest . last_name }
2730 </ p >
28- < p className = "text-[1vw] text-black" > { guest . pronouns } </ p >
2931 </ div >
3032 </ div >
3133
32- < div className = "border-b border-[#d3d8df] pb-[1vh]" >
33- < DetailRow label = "Government Name" value = { guest . governmentName } />
34- < DetailRow label = "Date of Birth" value = { guest . dateOfBirth } />
35- </ div >
36-
3734 < div className = "pt-[1vh]" >
38- < DetailRow label = "Room" value = { guest . room } />
39- < DetailRow label = "Group Size" value = { String ( guest . groupSize ) } />
40- < DetailRow
41- label = "Arrival"
42- value = { `${ guest . arrivalTime } ${ guest . arrivalDate } ` }
43- />
44- < DetailRow
45- label = "Departure"
46- value = { `${ guest . departureTime } ${ guest . departureDate } ` }
47- />
35+ { currentStay ? (
36+ < >
37+ < DetailRow label = "Room" value = { String ( currentStay . room_number ) } />
38+ < DetailRow
39+ label = "Arrival"
40+ value = { formatDate ( currentStay . arrival_date ) }
41+ />
42+ < DetailRow
43+ label = "Departure"
44+ value = { formatDate ( currentStay . departure_date ) }
45+ />
46+ </ >
47+ ) : (
48+ < p className = "text-[1vw] text-[#b6bac3]" > No active stay.</ p >
49+ ) }
4850 </ div >
4951 </ section >
5052 ) ;
0 commit comments