-
Notifications
You must be signed in to change notification settings - Fork 423
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
feat/Added bed number in location card (#8131) #8677
feat/Added bed number in location card (#8131) #8677
Conversation
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
function BedsData(facilityId: string, locationId: string) { | ||
const { loading, data } = useQuery(routes.listFacilityBeds, { | ||
query: { | ||
facility: facilityId, | ||
location: locationId, | ||
}, | ||
}); | ||
|
||
return { | ||
loading, | ||
totalBeds: data?.results.length || 0, | ||
}; | ||
} |
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.
let's not create a function that wraps a hook
@@ -216,6 +242,7 @@ export default function LocationManagement({ facilityId }: Props) { | |||
const Location = ({ |
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.
Instead call that hook inside this component without wrapping
{(item) => { | ||
const { loading, totalBeds } = BedsData(facilityId, item.id); | ||
|
||
if (loading) { | ||
return <Loading />; | ||
} | ||
return ( | ||
<Location | ||
setShowDeletePopup={setShowDeletePopup} | ||
facilityId={facilityId} | ||
{...item} | ||
totalBeds={totalBeds} | ||
disabled={ | ||
["DistrictAdmin", "StateAdmin"].includes( | ||
authUser.user_type, | ||
) | ||
? false | ||
: true | ||
} | ||
/> | ||
); | ||
}} |
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.
That way these changes also can be reverted
Proposed Changes
@ohcnetwork/care-fe-code-reviewers
Merge Checklist