Skip to content

Commit

Permalink
Merge branch 'develop' into displaying-camera-feed-without-preset-in-…
Browse files Browse the repository at this point in the history
…consultation-page#8901
  • Loading branch information
Mahendar0701 committed Oct 24, 2024
2 parents 158b07e + c62b36d commit e1ac77c
Show file tree
Hide file tree
Showing 26 changed files with 323 additions and 176 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ build
.dockerignore
Dockerfile
.git
apps
4 changes: 3 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ REACT_CARE_API_URL=https://careapi.ohc.network
# Dev envs
ESLINT_NO_DEV_ERRORS=true
CARE_CDN_URL="https://egov-s3-facility-10bedicu.s3.amazonaws.com https://egov-s3-patient-data-10bedicu.s3.amazonaws.com http://localhost:4566"
REACT_ALLOWED_LOCALES="en,hi,ta,ml,mr,kn"
REACT_ALLOWED_LOCALES="en,hi,ta,ml,mr,kn"

REACT_ENABLED_APPS="ohcnetwork/care_livekit_fe@main"
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ WORKDIR /app

ENV NODE_OPTIONS="--max-old-space-size=4096"

RUN if [ "$(uname -m)" = "aarch64" ] || [ "$(uname -m)" = "arm64" ]; then apt-get update && apt-get install -y python3-dev make g++; fi
RUN apt-get update && apt-get install -y git

RUN if [ "$(uname -m)" = "aarch64" ] || [ "$(uname -m)" = "arm64" ]; then apt-get install -y python3-dev make g++; fi


COPY package.json package-lock.json ./

RUN npm install

COPY . .

RUN npm run setup

RUN npm run build


Expand Down
8 changes: 0 additions & 8 deletions cypress/e2e/patient_spec/PatientRegistration.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,6 @@ describe("Patient Creation with consultation", () => {
.contains("member id")
.scrollIntoView();
cy.wait(2000);
patientInsurance.verifyPatientPolicyDetails(
patientOneFirstSubscriberId,
patientOneFirstPolicyId,
patientOneFirstInsurerId,
patientOneFirstInsurerName,
isHCXEnabled,
);

patientInsurance.clickPatientInsuranceViewDetail();
cy.wait(3000);
patientInsurance.verifyPatientPolicyDetails(
Expand Down
7 changes: 2 additions & 5 deletions cypress/e2e/users_spec/UsersCreation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,10 @@ describe("User Creation", () => {
);
userCreationPage.typeIntoElementByIdPostClear("lastName", "Cypress");
userCreationPage.selectDropdownOption("gender", "Male");
userCreationPage.typeIntoElementByIdPostClear(
"phoneNumber",
"+91" + phone_number,
);
userCreationPage.typeIntoElementByIdPostClear("phoneNumber", phone_number);
userCreationPage.typeIntoElementByIdPostClear(
"altPhoneNumber",
"+91" + emergency_phone_number,
emergency_phone_number,
);
userCreationPage.typeIntoElementByIdPostClear("email", "test@test.com");
userCreationPage.typeIntoElementByIdPostClear("weekly_working_hours", "14");
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/users_spec/UsersProfile.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe("Manage User Profile", () => {
const date_of_birth = "01011999";
const gender = "Male";
const email = "test@example.com";
const phone = "+918899887788";
const phone = "8899887788";
const workinghours = "8";
const qualification = "MBBS";
const doctorYoE = "10";
Expand Down
2 changes: 1 addition & 1 deletion cypress/pageobject/Facility/FacilityLocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class FacilityLocation {
}

clickNotification() {
cy.get(".pnotify").click();
cy.get(".pnotify-container").click();
}

enterBedName(name: string) {
Expand Down
45 changes: 32 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions scripts/setup-care-apps.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { execSync } = require("child_process");
const { execSync, spawnSync } = require("child_process");
// eslint-disable-next-line @typescript-eslint/no-var-requires
const fs = require("fs");
// eslint-disable-next-line @typescript-eslint/no-var-requires
Expand Down Expand Up @@ -33,12 +33,12 @@ const installApp = (app) => {
const appDir = path.join(appsDir, app.package.split("/")[1]);

console.log(`Cloning ${app.package}...`);
execSync(
`npx -y gitget ${app.package}${app.branch ? `#${app.branch}` : ""} apps/${app.package.split("/")[1]} `,
{
stdio: "inherit",
},
);

const cloneUrl = `https://github.com/${app.package.replace("github:", "")}.git`;
const branchOption = app.branch ? ["--branch", app.branch] : [];

spawnSync("git", ["clone", ...branchOption, cloneUrl, appDir]);

// Create a care-package.lock file
fs.writeFileSync(
path.join(appDir, "care-package.lock"),
Expand Down
5 changes: 5 additions & 0 deletions src/Locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@
"abha_address_validation_length_error": "Should be atleast 4 character long",
"abha_address_validation_start_error": "Shouldn't start with a number or dot (.)",
"abha_details": "ABHA Details",
"abha_disabled_due_to_no_health_facility": "ABHA Number generation and linking is disabled for this facility, Please link a health facility to enable this feature.",
"abha_link_options__create_with_aadhaar__description": "Create New ABHA Number Using Aadhaar Number",
"abha_link_options__create_with_aadhaar__title": "Create with Aadhaar",
"abha_link_options__create_with_driving_license__description": "Create New ABHA Number Using Driving License",
Expand Down Expand Up @@ -379,6 +380,7 @@
"checking_eligibility": "Checking Eligibility",
"checking_for_update": "Checking for update",
"checking_policy_eligibility": "Checking Policy Eligibility",
"choose_date_time": "Choose Date and Time",
"choose_file": "Upload From Device",
"choose_location": "Choose Location",
"claim__add_item": "Add Item",
Expand Down Expand Up @@ -668,6 +670,7 @@
"full_name": "Full Name",
"full_screen": "Full Screen",
"gender": "Gender",
"generate_link_abha": "Generate/Link ABHA Number",
"generate_report": "Generate Report",
"generated_summary_caution": "This is a computer generated summary using the information captured in the CARE system.",
"generating": "Generating",
Expand Down Expand Up @@ -871,6 +874,7 @@
"no_tests_taken": "No tests taken",
"no_treating_physicians_available": "This facility does not have any home facility doctors. Please contact your admin.",
"no_users_found": "No Users Found",
"no_vitals_present": "No Vitals Monitor present in this location or facility",
"none": "None",
"normal": "Normal",
"not_eligible": "Not Eligible",
Expand Down Expand Up @@ -1242,6 +1246,7 @@
"virtual_nursing_assistant": "Virtual Nursing Assistant",
"vitals": "Vitals",
"vitals_monitor": "Vitals Monitor",
"vitals_present": "Vitals Monitor present",
"ward": "Ward",
"warranty_amc_expiry": "Warranty / AMC Expiry",
"what_facility_assign_the_patient_to": "What facility would you like to assign the patient to",
Expand Down
41 changes: 41 additions & 0 deletions src/Utils/request/useMutation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import request from "@/Utils/request/request";
import {
MutationRoute,
RequestOptions,
RequestResult,
} from "@/Utils/request/types";
import { mergeRequestOptions } from "@/Utils/request/utils";
import React from "react";

export default function useMutation<TData, TBody>(
route: MutationRoute<TData, TBody>,
options: RequestOptions<TData>,
) {
const [response, setResponse] = React.useState<RequestResult<TData>>();
const [isProcessing, setIsProcessing] = React.useState(false);

const controllerRef = React.useRef<AbortController>();

const runQuery = React.useCallback(
async (overrides?: RequestOptions<TData>) => {
controllerRef.current?.abort();

const controller = new AbortController();
controllerRef.current = controller;

const resolvedOptions =
options && overrides
? mergeRequestOptions(options, overrides)
: (overrides ?? options);

setIsProcessing(true);
const response = await request(route, { ...resolvedOptions, controller });
setResponse(response);
setIsProcessing(false);
return response;
},
[route, JSON.stringify(options)],
);

return { ...response, isProcessing, mutate: runQuery };
}
15 changes: 9 additions & 6 deletions src/components/Common/AvatarEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const VideoConstraints = {
},
} as const;

const isImageFile = (file?: File) => file?.type.split("/")[0] === "image";

type IVideoConstraint =
(typeof VideoConstraints)[keyof typeof VideoConstraints];

Expand Down Expand Up @@ -87,19 +89,20 @@ const AvatarEditModal = ({
};

useEffect(() => {
if (selectedFile) {
const objectUrl = URL.createObjectURL(selectedFile);
setPreview(objectUrl);
return () => URL.revokeObjectURL(objectUrl);
if (!isImageFile(selectedFile)) {
return;
}
const objectUrl = URL.createObjectURL(selectedFile!);
setPreview(objectUrl);
return () => URL.revokeObjectURL(objectUrl);
}, [selectedFile]);

const onSelectFile: ChangeEventHandler<HTMLInputElement> = (e) => {
if (!e.target.files || e.target.files.length === 0) {
setSelectedFile(undefined);
return;
}
if (e.target.files[0]?.type.split("/")[0] !== "image") {
if (!isImageFile(e.target.files[0])) {
Warn({ msg: "Please upload an image file!" });
return;
}
Expand Down Expand Up @@ -134,7 +137,7 @@ const AvatarEditModal = ({
dragProps.setDragOver(false);
setIsDragging(false);
const droppedFile = e?.dataTransfer?.files[0];
if (droppedFile.type.split("/")[0] !== "image")
if (!isImageFile(droppedFile))
return dragProps.setFileDropError("Please drop an image file to upload!");
setSelectedFile(droppedFile);
};
Expand Down
8 changes: 8 additions & 0 deletions src/components/Common/LocationSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ interface LocationSelectProps {
selected: string | string[] | null;
setSelected: (selected: string | string[] | null) => void;
errorClassName?: string;
bedIsOccupied?: boolean;
disableOnOneOrFewer?: boolean;
}

export const LocationSelect = (props: LocationSelectProps) => {
Expand All @@ -23,6 +25,8 @@ export const LocationSelect = (props: LocationSelectProps) => {
{
query: {
limit: 14,
bed_is_occupied:
props.bedIsOccupied === undefined ? undefined : !props.bedIsOccupied,
},
pathParams: {
facility_external_id: props.facilityId,
Expand All @@ -31,6 +35,10 @@ export const LocationSelect = (props: LocationSelectProps) => {
},
);

if (props.disableOnOneOrFewer && data && data.count <= 1) {
props = { ...props, disabled: true };
}

return props.multiple ? (
<AutocompleteMultiSelectFormField
name={props.name}
Expand Down
Loading

0 comments on commit e1ac77c

Please sign in to comment.