-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 86extdm6t #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: 86extdm6t #89
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,7 +1,6 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useState } from 'react' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useQuery } from '@tanstack/react-query' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { ProgressCard } from '@/pages/home/progress/ProgressCard' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { BottomSheetDialog } from '@/components/BottomSheetDialog/BottomSheetDialog' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { Appointment } from '@/components/BottomSheetDialog/types' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { DailyTips } from './dailyTips/DailyTips' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { CheckIn } from './checkIn/CheckIn' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { HomeButtomDesktop, HomeButtomMobile, HomeTopDesktop, HomeTopMobile } from './styles' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -10,17 +9,27 @@ import { SGLTypography } from '@/components/UI/Typography/SGLTypography' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useTranslation } from 'react-i18next' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useIsMobile } from '@/hooks/useIsMobile' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { Welcome } from './welcome/Welcome' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { apiService } from '@/services/api/api.service' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useState } from 'react' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { Appointment } from '@/components/BottomSheetDialog/types' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const Home = () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const [selectedAppointment, setSelectedAppointment] = useState<Appointment | undefined>({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| appointmentId: '1', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| patientId: 1622017, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| time: '10:12:50', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| date: '2026-05-15', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| chamber: 'appointment.chamber.hyperbaric', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| chairNumber: 9, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| treatmentNumber: 2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| status: 'confirmed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const [selectedAppointment, setSelectedAppointment] = useState<boolean>(true) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const patientID = '1622017' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const date = '07-06-2026' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+19
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Description: Find how user/patient ID is accessed elsewhere in the codebase
# Search for user context, auth context, or patient context patterns
rg -n -C3 --type=tsx --type=ts 'useUser|useAuth|usePatient|user.*context|patient.*context' -i
# Search for existing patterns of getting current user/patient ID
rg -n -C3 --type=tsx --type=ts 'currentUser|userId|patientId|patient.*id' -i | head -50Repository: ColmanDevClubORG/Sagol360Management Length of output: 135 🏁 Script executed: # Read the home.tsx file to understand the context
cat -n src/pages/home/home.tsx | head -40Repository: ColmanDevClubORG/Sagol360Management Length of output: 1789 🏁 Script executed: # Search for user/auth context patterns with corrected rg syntax
rg -n -C3 'useUser|useAuth|usePatient|useContext.*user|useContext.*auth' -t ts -t tsx
# Also search for how patientId/userId is typically accessed
rg -n -C3 'patient.*id|user.*id|currentUser' -t ts -t tsx | head -50Repository: ColmanDevClubORG/Sagol360Management Length of output: 135 🏁 Script executed: # Check if there are any imports or hooks related to authentication in the codebase
fd -e ts -e tsx | xargs grep -l 'useAuth\|useUser\|user.*context' | head -20Repository: ColmanDevClubORG/Sagol360Management Length of output: 149 🏁 Script executed: # Read the useAuth hook to understand how to access user context
cat -n src/hooks/useAuth.tsRepository: ColmanDevClubORG/Sagol360Management Length of output: 258 🏁 Script executed: # Check ProtectedRoute to understand auth patterns
cat -n src/components/ProtectedRoute/ProtectedRoute.tsxRepository: ColmanDevClubORG/Sagol360Management Length of output: 380 🏁 Script executed: # Search for other uses of patientID in the codebase to understand patterns
rg -n 'patientID|patientId' --max-count=20Repository: ColmanDevClubORG/Sagol360Management Length of output: 1163 🏁 Script executed: # Look for user/session/auth context setup (try without type filters)
rg -n 'createContext|useContext|useState.*user|useState.*auth' | head -30Repository: ColmanDevClubORG/Sagol360Management Length of output: 61 Hardcoded test data must be replaced with dynamic user context and date logic. These hardcoded values will cause all users to see the same appointment data (patient Before merging:
🤖 Prompt for AI Agents
Comment on lines
+19
to
+20
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a comment for MOCK DATA |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { data: appointment } = useQuery({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| queryKey: ['nextAppointment', patientID, date], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| queryFn: async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const response = await apiService.get<Appointment>('/api/appointment/nextAppointment', { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the URL path should be a constant |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| params: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| patientID, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| date, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return response | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+22
to
33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add error and loading state handling for better user experience. The query result is destructured to only Consider destructuring and handling these states: 💡 Suggested enhancement- const { data: appointment } = useQuery({
+ const { data: appointment, isLoading, isError, error } = useQuery({
queryKey: ['nextAppointment', patientID, date],
queryFn: async () => {
const response = await apiService.get<Appointment>('/api/appointment/nextAppointment', {
params: {
patientID,
date,
},
})
return response
},
})
+
+ if (isLoading) {
+ return <div>Loading appointment...</div> // Or a proper loading skeleton
+ }
+
+ if (isError) {
+ console.error('Failed to fetch appointment:', error)
+ // Show error UI or toast notification
+ }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Comment on lines
+22
to
33
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. manage the appointment logic inside the component. This component should tell us what we will see in the HomePage with minimal logic as possible |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { t } = useTranslation() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -29,9 +38,9 @@ export const Home = () => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <BottomSheetDialog | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| appointment={selectedAppointment} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isOpen={!!selectedAppointment} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClose={() => setSelectedAppointment(undefined)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| appointment={appointment} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isOpen={selectedAppointment && !!appointment} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClose={() => setSelectedAppointment(false)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. define a function outside the return and call it.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. consider to implement it inside the component and allow override or add extra logic to the onClose. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
40
to
44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No mechanism to reopen the dialog after closing. Once the user closes the dialog, 🔧 Recommended solutionAdd a clickable UI element (e.g., an appointment card or "View Appointment" button) that calls <AppointmentCard
appointment={appointment}
onClick={() => setSelectedAppointment(true)}
/>or {appointment && (
<button onClick={() => setSelectedAppointment(true)}>
View Next Appointment
</button>
)}🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div style={isMobile ? HomeTopMobile : HomeTopDesktop}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Welcome /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dialog auto-opens on mount due to initial
truestate.Initializing
selectedAppointmenttotruecauses the dialog to attempt opening immediately when the component mounts, creating an auto-popup experience. Users typically expect dialogs to open in response to a deliberate action (e.g., clicking a button), not automatically on page load.🔧 Recommended fix
Then add a UI element (e.g., a button or card click handler) that calls
setSelectedAppointment(true)when the user wants to view their appointment.📝 Committable suggestion
🤖 Prompt for AI Agents