Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into issues/10524/min…
Browse files Browse the repository at this point in the history
…or-responsive
  • Loading branch information
modamaan committed Feb 28, 2025
2 parents bb52739 + 07387b9 commit 64633e8
Show file tree
Hide file tree
Showing 71 changed files with 2,698 additions and 1,203 deletions.
3 changes: 3 additions & 0 deletions .example.env
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@ REACT_ALLOWED_LOCALES="en,hi,ta,ml,mr,kn"

# ISO 3166-1 Alpha-2 code for the default country code (default: "IN")
REACT_DEFAULT_COUNTRY=

# Maps fallback URL template (default:"https://www.openstreetmap.org/?mlat={lat}&mlon={long}&zoom=15")
REACT_MAPS_FALLBACK_URL_TEMPLATE=
4 changes: 4 additions & 0 deletions care.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ const careConfig = {
defaultEncounterType: (env.REACT_DEFAULT_ENCOUNTER_TYPE ||
"hh") as EncounterClass,

mapFallbackUrlTemplate:
env.REACT_MAPS_FALLBACK_URL_TEMPLATE ||
"https://www.openstreetmap.org/?mlat={lat}&mlon={long}&zoom=15",

gmapsApiKey:
env.REACT_GMAPS_API_KEY || "AIzaSyDsBAc3y7deI5ZO3NtK5GuzKwtUzQNJNUk",

Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/patient_spec/patient_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ describe("Patient Management", () => {
];

beforeEach(() => {
cy.viewport(1920, 1080);
cy.loginByApi("doctor");
cy.visit("/");
});
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/patient_spec/patient_details.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const patientDetails = new PatientDetails();

describe("Patient Management", () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.loginByApi("devdoctor");
cy.visit("/");
});
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/patient_spec/patient_encounter.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const patientEncounter = new PatientEncounter();

describe("Patient Encounter Questionnaire", () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.loginByApi("devnurse");
cy.visit("/");
});
Expand Down
22 changes: 22 additions & 0 deletions cypress/e2e/users_spec/user_avatar.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { UserAvatar } from "@/pageObject/Users/UserAvatar";

describe("User Profile Avatar Modification", () => {
const userAvatar = new UserAvatar("teststaff4");
beforeEach(() => {
cy.loginByApi("teststaff4");
cy.visit("/");
});
it("should modify an avatar", () => {
userAvatar
.navigateToProfile()
.interceptUploadAvatarRequest()
.clickChangeAvatarButton()
.uploadAvatar()
.clickSaveAvatarButton()
.verifyUploadAvatarApiCall()
.interceptDeleteAvatarRequest()
.clickChangeAvatarButton()
.clickDeleteAvatarButton()
.verifyDeleteAvatarApiCall();
});
});
Binary file added cypress/fixtures/avatar.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions cypress/fixtures/users.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,9 @@
"devdoctor": {
"username": "developdoctor",
"password": "Test@123"
},
"teststaff4": {
"username": "teststaff4",
"password": "Test@123"
}
}
59 changes: 59 additions & 0 deletions cypress/pageObject/Users/UserAvatar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
export class UserAvatar {
username: string;
constructor(username: string) {
this.username = username;
}

navigateToProfile() {
cy.visit(`/users/${this.username}`);
return this;
}

interceptUploadAvatarRequest() {
cy.intercept("POST", `/api/v1/users/${this.username}/profile_picture/`).as(
"uploadAvatar",
);
return this;
}

clickChangeAvatarButton() {
cy.verifyAndClickElement('[data-cy="change-avatar"]', "Change Avatar");
return this;
}

uploadAvatar() {
cy.get('input[title="changeFile"]').selectFile(
"cypress/fixtures/avatar.jpg",
{ force: true },
);
return this;
}

clickSaveAvatarButton() {
cy.verifyAndClickElement('[data-cy="save-cover-image"]', "Save");
return this;
}

verifyUploadAvatarApiCall() {
cy.wait("@uploadAvatar").its("response.statusCode").should("eq", 200);
return this;
}

interceptDeleteAvatarRequest() {
cy.intercept(
"DELETE",
`/api/v1/users/${this.username}/profile_picture/`,
).as("deleteAvatar");
return this;
}

clickDeleteAvatarButton() {
cy.verifyAndClickElement('[data-cy="delete-avatar"]', "Delete");
return this;
}

verifyDeleteAvatarApiCall() {
cy.wait("@deleteAvatar").its("response.statusCode").should("eq", 204);
return this;
}
}
33 changes: 33 additions & 0 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@
"active": "Active",
"active_encounters": "Active Encounters",
"active_files": "Active Files",
"active_location_cannot_be_in_future": "Active location cannot be in the future",
"active_prescriptions": "Active Prescriptions",
"add": "Add",
"add_another_session": "Add another session",
Expand All @@ -304,6 +305,7 @@
"add_location_description": "Create a Location such as Rooms/Beds",
"add_new_beds": "Add New Bed(s)",
"add_new_facility": "Add New Facility",
"add_new_location": "Add New Location",
"add_new_patient": "Add New Patient",
"add_new_user": "Add New User",
"add_notes": "Add notes",
Expand Down Expand Up @@ -591,8 +593,17 @@
"clear_search": "Clear search",
"clear_selection": "Clear selection",
"clear_skill": "Clear Skill",
"click": "Click",
"click_add_department_team": "Click <strong>Add Department/Team</strong> to create a new department/team.",
"click_add_main_location": "Click <strong>Add Location</strong> to add a main location.",
"click_manage_create_users": "Click <strong>See Details</strong><CareIcon /> to create or manage users and departments/teams within the corresponding dept/team.",
"click_manage_create_users_mobile": "Click <CareIcon /> to create or manage users and departments/teams within the corresponding dept/team.",
"click_manage_sub_locations": "Click <strong>See Details</strong><ArrowIcon/> to manage sub-locations.",
"click_manage_sub_locations_mobile": "Click <PenLine/>to edit and <ArrowIcon/> to manage sub-locations.",
"click_on": "Click on",
"close": "Close",
"close_scanner": "Close Scanner",
"collapse_all": "Collapse All",
"collapse_sidebar": "Collapse Sidebar",
"combine_files_pdf": "Combine Files To PDF",
"comment_added_successfully": "Comment added successfully",
Expand Down Expand Up @@ -681,6 +692,7 @@
"create_department_team_description": "Create a new department/team in this facility.",
"create_encounter": "Create Encounter",
"create_facility": "Create Facility",
"create_location_association": "Create Location Association",
"create_new": "Create New",
"create_new_asset": "Create New Asset",
"create_new_encounter": "Create a new encounter to get started",
Expand Down Expand Up @@ -942,6 +954,7 @@
"encounter_manage_organization_description": "Add or remove organizations from this encouter",
"encounter_marked_as_complete": "Encounter Completed",
"encounter_notes__all_discussions": "All Discussions",
"encounter_notes__all_discussions_description": "View and manage encounternotes discussion threads",
"encounter_notes__be_first_to_send": "Be the first to send a message",
"encounter_notes__choose_template": "Choose a template or enter a custom title",
"encounter_notes__create_discussion": "Create a new discussion thread to organize your conversation topics.",
Expand Down Expand Up @@ -1001,6 +1014,7 @@
"end_time": "End Time",
"end_time_before_start_error": "End time cannot be before start time",
"end_time_future_error": "End time cannot be in the future",
"end_time_required": "End time is required",
"ended": "Ended",
"enter_contact_value": "Enter contact value",
"enter_department_team_description": "Enter department/team description (optional)",
Expand Down Expand Up @@ -1058,6 +1072,7 @@
"exception_created": "Exception created successfully",
"exception_deleted": "Exception deleted",
"exceptions": "Exceptions",
"expand_all": "Expand All",
"expand_sidebar": "Expand Sidebar",
"expected_burn_rate": "Expected Burn Rate",
"expiration_date": "Expiration Date",
Expand Down Expand Up @@ -1144,6 +1159,8 @@
"filter_by": "Filter By",
"filter_by_category": "Filter by category",
"filter_by_date": "Filter by Date",
"filter_by_department_or_team_name": "Filter by department or team name",
"filter_by_locations": "Filter by Locations",
"filters": "Filters",
"first_name": "First Name",
"food": "Food",
Expand Down Expand Up @@ -1206,6 +1223,7 @@
"hospital_identifier": "Hospital Identifier",
"hospitalisation_details": "Hospitalization Details",
"hospitalization_details": "Hospitalization Details",
"hover_focus_reveal": "Hover or focus to reveal",
"hubs": "Hub Facilities",
"i_declare": "I hereby declare that:",
"icd11_as_recommended": "As per ICD-11 recommended by WHO",
Expand Down Expand Up @@ -1343,6 +1361,8 @@
"local_ip_address_example": "e.g. 192.168.0.123",
"location": "Location",
"location_associated_successfully": "Location associated successfully",
"location_association_created_successfully": "Location association created successfully",
"location_association_updated_successfully": "Location association updated successfully",
"location_beds_empty": "No beds available in this location",
"location_created": "Location Created",
"location_description": "Location Description",
Expand Down Expand Up @@ -1395,6 +1415,7 @@
"manage_my_schedule": "Manage my schedule",
"manage_organizations": "Manage Organizations",
"manage_organizations_description": "Add or remove organizations from this questionnaire",
"manage_patient_location_and_transfers": "Manage patient location and transfers",
"manage_prescriptions": "Manage Prescriptions",
"manage_preset": "Manage preset {{ name }}",
"manage_tags": "Manage Tags",
Expand All @@ -1404,6 +1425,7 @@
"manufacture_date_cannot_be_in_future": "Manufacture date cannot be in future",
"manufactured": "Manufactured",
"manufacturer": "Manufacturer",
"map": "Map",
"map_acronym": "M.A.P.",
"mark_active": "Mark Active",
"mark_all_as_read": "Mark all as Read",
Expand Down Expand Up @@ -1498,6 +1520,7 @@
"next_sessions": "Next Sessions",
"next_week_short": "Next wk",
"no": "No",
"no_active_medication_recorded": "No Active Medication Recorded",
"no_address_provided": "No address provided",
"no_allergies_recorded": "No allergies recorded",
"no_appointments": "No appointments found",
Expand Down Expand Up @@ -1539,6 +1562,7 @@
"no_log_update_delta": "No changes since previous log update",
"no_log_updates": "No log updates found",
"no_medical_history_available": "No Medical History Available",
"no_medication_recorded": "No Medication Recorded",
"no_medications": "No Medications",
"no_medications_found_for_this_encounter": "No medications found for this encounter.",
"no_medications_to_administer": "No medications to administer",
Expand Down Expand Up @@ -1758,6 +1782,8 @@
"pincode_district_auto_fill_error": "Failed to auto-fill district information",
"pincode_must_be_6_digits": "Pincode must be a 6-digit number",
"pincode_state_auto_fill_error": "Failed to auto-fill state and district information",
"planned": "Planned",
"planned_reserved_cannot_be_in_past": "Planned/Reserved cannot be in the past",
"play": "Play",
"play_audio": "Play Audio",
"please_assign_bed_to_patient": "Please assign a bed to this patient",
Expand Down Expand Up @@ -1951,6 +1977,7 @@
"rescheduled": "Rescheduled",
"rescheduling": "Rescheduling...",
"resend_otp": "Resend OTP",
"reserved": "Reserved",
"reset": "Reset",
"reset_password": "Reset Password",
"reset_password_note_self": "Enter your current password, then create and confirm your new password",
Expand Down Expand Up @@ -2080,6 +2107,7 @@
"see_details": "See Details",
"see_note": "See Note",
"select": "Select",
"select_a_status": "Select a status",
"select_a_value_set": "Select a Value Set",
"select_additional_instructions": "Select additional instructions",
"select_admit_source": "Select Admit Source",
Expand Down Expand Up @@ -2186,10 +2214,13 @@
"show_all_notifications": "Show All",
"show_all_slots": "Show all slots",
"show_default_presets": "Show Default Presets",
"show_on_map": "Show on Map",
"show_patient_presets": "Show Patient Presets",
"show_unread_notifications": "Show Unread",
"showing_all_appointments": "Showing all appointments",
"showing_x_of_y": "Showing <strong>{{x}}</strong> of <strong>{{y}}</strong>",
"sidebar": "sidebar",
"sidebar_description": "sidebar provides navigation to different sections",
"sign_in": "Sign in",
"sign_out": "Sign out",
"site": "Site",
Expand Down Expand Up @@ -2227,6 +2258,7 @@
"start_time_before_authored_error": "Start time cannot be before the medication was prescribed",
"start_time_future_error": "Start time cannot be in the future",
"start_time_must_be_before_end_time": "Start time must be before end time",
"start_time_required": "Start time is required",
"start_typing_to_search": "Start typing to search...",
"state": "State",
"state_reason_for_archiving": "State reason for archiving <strong>{{name}}</strong> file?",
Expand Down Expand Up @@ -2287,6 +2319,7 @@
"titrate_dosage": "Titrate Dosage",
"to": "to",
"to_be_conducted": "To be conducted",
"to_edit": "to edit",
"to_proceed_with_registration": "To proceed with registration, please create a new patient.",
"to_view_available_slots_select_resource_and_date": "To view available slots, select a preferred resource and date.",
"today": "Today",
Expand Down
12 changes: 11 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,23 @@ import AuthUserProvider from "@/Providers/AuthUserProvider";
import HistoryAPIProvider from "@/Providers/HistoryAPIProvider";
import Routers from "@/Routers";
import { handleHttpError } from "@/Utils/request/errorHandler";
import { HTTPError } from "@/Utils/request/types";

import { PubSubProvider } from "./Utils/pubsubContext";

const queryClient = new QueryClient({
defaultOptions: {
queries: {
retry: 2,
retry: (failureCount, error) => {
// Only retry network errors or server errors (502, 503, 504) up to 3 times
if (
error.message === "Network Error" ||
(error instanceof HTTPError && [502, 503, 504].includes(error.status))
) {
return failureCount < 3;
}
return false;
},
refetchOnWindowFocus: false,
},
},
Expand Down
13 changes: 5 additions & 8 deletions src/Routers/AppRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,21 @@ export default function AppRouter() {
)}
<main
id="pages"
className="flex-1 overflow-y-auto bg-gray-100 focus:outline-none md:pb-2 md:pr-2"
className="flex flex-col flex-1 min-h-[calc(100svh-theme(spacing.4))] md:m-2 md:peer-data-[state=collapsed]:ml-0 border rounded-lg shadow bg-gray-50 focus:outline-none"
>
<div className="relative z-10 flex h-16 shrink-0 bg-white shadow md:hidden">
<div className="relative z-10 flex h-16 bg-white shadow shrink-0 md:hidden">
<div className="flex items-center">
{shouldShowSidebar && <SidebarTrigger />}
</div>
<a className="flex h-full w-full items-center px-4 md:hidden">
<a className="flex items-center w-full h-full px-4 md:hidden">
<img
className="h-8 w-auto"
className="w-auto h-8"
src={careConfig.mainLogo?.dark}
alt="care logo"
/>
</a>
</div>
<div
className="max-w-8xl mx-auto mt-4 min-h-[96vh] rounded-lg border bg-gray-50 p-3 shadow"
data-cui-page
>
<div className="p-3 mt-4" data-cui-page>
<ErrorBoundary fallback={<ErrorPage forError="PAGE_LOAD_ERROR" />}>
{pages}
</ErrorBoundary>
Expand Down
8 changes: 6 additions & 2 deletions src/Routers/routes/ConsultationRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ const consultationRoutes: AppRoutes = {
/>
),
"/facility/:facilityId/patient/:patientId/encounter/:encounterId/treatment_summary":
({ facilityId, encounterId }) => (
<TreatmentSummary facilityId={facilityId} encounterId={encounterId} />
({ facilityId, encounterId, patientId }) => (
<TreatmentSummary
facilityId={facilityId}
encounterId={encounterId}
patientId={patientId}
/>
),
"/facility/:facilityId/patient/:patientId/encounter/:encounterId/questionnaire":
({ facilityId, encounterId, patientId }) => (
Expand Down
Loading

0 comments on commit 64633e8

Please sign in to comment.