Skip to content

Commit f5e3cc6

Browse files
feat: 86extdm6t (#89)
* feat: add conected to back * fix: add Appointment component * fix
1 parent f606cc1 commit f5e3cc6

4 files changed

Lines changed: 48 additions & 19 deletions

File tree

src/constants/api.constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ export const API_ENDPOINTS = {
22
patient: '/api/patients/',
33
metrics: '/api/metrics/',
44
metricsToday: '/api/metrics/today/',
5+
appointment: '/api/appointment/nextAppointment',
56
email: '/api/email',
67
}

src/constants/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
import { formatIsoDate } from '@/utils/datesUtils'
2+
13
export const DOT = '•'
24
export const METRIC_MAX_VALUE = '10'
35
export const SLIDER_MIN_VALUE = 1
46
export const SLIDER_MAX_VALUE = 10
57
export const BALANCE_VIDEO_TIME = 15
68
export const STRETCH_VIDEO_TIME = 10
9+
export const MOCK_DATA = {
10+
patientID: Number('1622017'),
11+
date: formatIsoDate(new Date(2026, 5, 23)),
12+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { useQuery } from '@tanstack/react-query'
2+
import { BottomSheetDialog } from '@/components/BottomSheetDialog/BottomSheetDialog'
3+
import { apiService } from '@/services/api/api.service'
4+
import { useState } from 'react'
5+
import type { Appointment } from '@/components/BottomSheetDialog/types'
6+
import { API_ENDPOINTS } from '@/constants/api.constants'
7+
import { MOCK_DATA } from '@/constants'
8+
9+
export const AppointmentBottomSheet = () => {
10+
const [selectedAppointment, setSelectedAppointment] = useState<boolean>(true)
11+
12+
const patientid = MOCK_DATA.patientID
13+
const date = MOCK_DATA.date
14+
15+
const { data: appointment } = useQuery({
16+
queryKey: ['nextAppointment', patientid, date],
17+
queryFn: async () => {
18+
const response = await apiService.get<Appointment>(API_ENDPOINTS.appointment, {
19+
params: {
20+
patientid,
21+
date,
22+
},
23+
})
24+
return response
25+
},
26+
})
27+
28+
const handleCloseBottomSheet = () => {
29+
setSelectedAppointment(false)
30+
}
31+
32+
return (
33+
<BottomSheetDialog
34+
appointment={appointment}
35+
isOpen={selectedAppointment && !!appointment}
36+
onClose={handleCloseBottomSheet}
37+
/>
38+
)
39+
}

src/pages/home/home.tsx

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import { useState } from 'react'
21
import { ProgressCard } from '@/pages/home/progress/ProgressCard'
3-
import { BottomSheetDialog } from '@/components/BottomSheetDialog/BottomSheetDialog'
4-
import type { Appointment } from '@/components/BottomSheetDialog/types'
52
import { DailyTips } from './dailyTips/DailyTips'
63
import { CheckIn } from './checkIn/CheckIn'
74
import { HomeButtomDesktop, HomeButtomMobile, HomeTopDesktop, HomeTopMobile } from './styles'
@@ -10,29 +7,15 @@ import { SGLTypography } from '@/components/UI/Typography/SGLTypography'
107
import { useTranslation } from 'react-i18next'
118
import { useIsMobile } from '@/hooks/useIsMobile'
129
import { Welcome } from './welcome/Welcome'
10+
import { AppointmentBottomSheet } from './AppointmentBottomSheet/AppointmentBottomSheet'
1311

1412
export const Home = () => {
15-
const [selectedAppointment, setSelectedAppointment] = useState<Appointment | undefined>({
16-
appointmentId: '1',
17-
patientId: 1622017,
18-
time: '10:12:50',
19-
date: '2026-05-15',
20-
chamber: 'appointment.chamber.hyperbaric',
21-
chairNumber: 9,
22-
treatmentNumber: 2,
23-
status: 'confirmed',
24-
})
25-
2613
const { t } = useTranslation()
2714
const isMobile = useIsMobile()
2815

2916
return (
3017
<>
31-
<BottomSheetDialog
32-
appointment={selectedAppointment}
33-
isOpen={!!selectedAppointment}
34-
onClose={() => setSelectedAppointment(undefined)}
35-
/>
18+
<AppointmentBottomSheet />
3619
<div style={isMobile ? HomeTopMobile : HomeTopDesktop}>
3720
<Welcome />
3821
<ProgressCard value={10} />

0 commit comments

Comments
 (0)