diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index 5e671055535..f2f8fbd45cb 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -22,11 +22,21 @@ jobs: - name: Checkout 📥 uses: actions/checkout@v3 + - name: Set backend branch + id: backend-branch + run: | + if [[ '${{ github.event.pull_request.base.ref }}' == 'staging' ]]; then + echo "branch=staging" >> $GITHUB_OUTPUT + else + echo "branch=develop" >> $GITHUB_OUTPUT + fi + - name: Checkout care 📥 uses: actions/checkout@v3 with: repository: coronasafe/care path: care + ref: ${{ steps.backend-branch.outputs.branch }} - name: Start care docker containers 🐳 run: | diff --git a/package-lock.json b/package-lock.json index 0c59edd073e..ba448d666e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,7 +44,6 @@ "react-pdf": "^9.0.0", "react-player": "^2.16.0", "react-redux": "^8.1.1", - "react-transition-group": "^4.4.5", "react-webcam": "^7.2.0", "redux": "^4.2.1", "redux-thunk": "^2.4.2", @@ -62,8 +61,6 @@ "@tailwindcss/container-queries": "^0.1.1", "@tailwindcss/forms": "^0.5.7", "@tailwindcss/typography": "^0.5.13", - "@types/cypress": "^1.1.3", - "@types/echarts": "^4.9.22", "@types/google.maps": "^3.55.8", "@types/lodash-es": "^4.17.12", "@types/qrcode.react": "^1.0.5", @@ -72,8 +69,6 @@ "@types/react-csv": "^1.1.10", "@types/react-dom": "^18.3.0", "@types/react-google-recaptcha": "^2.1.9", - "@types/react-qr-reader": "^2.1.7", - "@types/react-transition-group": "^4.4.10", "@typescript-eslint/eslint-plugin": "^7.18.0", "@vitejs/plugin-react-swc": "^3.6.0", "autoprefixer": "^10.4.19", @@ -6546,16 +6541,6 @@ "@types/node": "*" } }, - "node_modules/@types/cypress": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@types/cypress/-/cypress-1.1.3.tgz", - "integrity": "sha512-OXe0Gw8LeCflkG1oPgFpyrYWJmEKqYncBsD/J0r17r0ETx/TnIGDNLwXt/pFYSYuYTpzcq1q3g62M9DrfsBL4g==", - "deprecated": "This is a stub types definition for cypress (https://cypress.io). cypress provides its own type definitions, so you don't need @types/cypress installed!", - "dev": true, - "dependencies": { - "cypress": "*" - } - }, "node_modules/@types/debug": { "version": "4.1.12", "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", @@ -6582,15 +6567,6 @@ "integrity": "sha512-w5jZ0ee+HaPOaX25X2/2oGR/7rgAQSYII7X7pp0m9KgBfMP7uKfMfTvcpl5Dj+eDBbpxKGiqE+flqDr6XTd2RA==", "dev": true }, - "node_modules/@types/echarts": { - "version": "4.9.22", - "resolved": "https://registry.npmjs.org/@types/echarts/-/echarts-4.9.22.tgz", - "integrity": "sha512-7Fo6XdWpoi8jxkwP7BARUOM7riq8bMhmsCtSG8gzUcJmFhLo387tihoBYS/y5j7jl3PENT5RxeWZdN9RiwO7HQ==", - "dev": true, - "dependencies": { - "@types/zrender": "*" - } - }, "node_modules/@types/ejs": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/@types/ejs/-/ejs-3.1.5.tgz", @@ -6875,24 +6851,6 @@ "@types/react": "*" } }, - "node_modules/@types/react-qr-reader": { - "version": "2.1.7", - "resolved": "https://registry.npmjs.org/@types/react-qr-reader/-/react-qr-reader-2.1.7.tgz", - "integrity": "sha512-6K6DQeqP7c2oohcfvBpExlOawVsB2/C+7ZZL/fkCkNzYYAKDJnNHnuP3F5ChMl0mpoYEdqkqkllxqfM0VslEiw==", - "dev": true, - "dependencies": { - "@types/react": "*" - } - }, - "node_modules/@types/react-transition-group": { - "version": "4.4.10", - "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.10.tgz", - "integrity": "sha512-hT/+s0VQs2ojCX823m60m5f0sL5idt9SO6Tj6Dg+rdphGPIeJbJ6CxvBYkgkGKrYeDjvIpKTR38UzmtHJOGW3Q==", - "dev": true, - "dependencies": { - "@types/react": "*" - } - }, "node_modules/@types/resolve": { "version": "1.20.6", "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.6.tgz", @@ -6977,12 +6935,6 @@ "@types/node": "*" } }, - "node_modules/@types/zrender": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/@types/zrender/-/zrender-4.0.6.tgz", - "integrity": "sha512-1jZ9bJn2BsfmYFPBHtl5o3uV+ILejAtGrDcYSpT4qaVKEI/0YY+arw3XHU04Ebd8Nca3SQ7uNcLaqiL+tTFVMg==", - "dev": true - }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "7.18.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.18.0.tgz", @@ -10330,15 +10282,6 @@ "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==", "dev": true }, - "node_modules/dom-helpers": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz", - "integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==", - "dependencies": { - "@babel/runtime": "^7.8.7", - "csstype": "^3.0.2" - } - }, "node_modules/dotenv": { "version": "16.4.5", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", @@ -19805,21 +19748,6 @@ } } }, - "node_modules/react-transition-group": { - "version": "4.4.5", - "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz", - "integrity": "sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g==", - "dependencies": { - "@babel/runtime": "^7.5.5", - "dom-helpers": "^5.0.1", - "loose-envify": "^1.4.0", - "prop-types": "^15.6.2" - }, - "peerDependencies": { - "react": ">=16.6.0", - "react-dom": ">=16.6.0" - } - }, "node_modules/react-webcam": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/react-webcam/-/react-webcam-7.2.0.tgz", diff --git a/package.json b/package.json index e9f22f98b16..ccb91dfcbae 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,6 @@ "react-pdf": "^9.0.0", "react-player": "^2.16.0", "react-redux": "^8.1.1", - "react-transition-group": "^4.4.5", "react-webcam": "^7.2.0", "redux": "^4.2.1", "redux-thunk": "^2.4.2", @@ -98,8 +97,6 @@ "@tailwindcss/container-queries": "^0.1.1", "@tailwindcss/forms": "^0.5.7", "@tailwindcss/typography": "^0.5.13", - "@types/cypress": "^1.1.3", - "@types/echarts": "^4.9.22", "@types/google.maps": "^3.55.8", "@types/lodash-es": "^4.17.12", "@types/qrcode.react": "^1.0.5", @@ -108,8 +105,6 @@ "@types/react-csv": "^1.1.10", "@types/react-dom": "^18.3.0", "@types/react-google-recaptcha": "^2.1.9", - "@types/react-qr-reader": "^2.1.7", - "@types/react-transition-group": "^4.4.10", "@typescript-eslint/eslint-plugin": "^7.18.0", "@vitejs/plugin-react-swc": "^3.6.0", "autoprefixer": "^10.4.19", diff --git a/src/Components/Common/Transition.tsx b/src/Components/Common/Transition.tsx deleted file mode 100644 index 7f5830d47db..00000000000 --- a/src/Components/Common/Transition.tsx +++ /dev/null @@ -1,134 +0,0 @@ -import { CSSTransition as ReactCSSTransition } from "react-transition-group"; -import { createContext, useContext, useEffect, useRef } from "react"; - -type TransitionContextProps = { - parent: { - show: boolean; - isInitialRender: boolean; - appear?: boolean; - }; -}; - -const TransitionContext = createContext>({ - parent: { - show: false, - isInitialRender: true, - }, -}); - -function useIsInitialRender() { - const isInitialRender = useRef(true); - useEffect(() => { - isInitialRender.current = false; - }, []); - return isInitialRender.current; -} - -interface TransitionProps { - show?: boolean; - enter?: string; - enterFrom?: string; - enterTo?: string; - leave?: string; - leaveFrom?: string; - leaveTo?: string; - appear?: boolean; - children: React.ReactNode; -} - -function CSSTransition({ - show, - enter = "", - enterFrom = "", - enterTo = "", - leave = "", - leaveFrom = "", - leaveTo = "", - appear, - children, -}: TransitionProps) { - const enterClasses = enter.split(" ").filter((s) => s.length); - const enterFromClasses = enterFrom.split(" ").filter((s) => s.length); - const enterToClasses = enterTo.split(" ").filter((s) => s.length); - const leaveClasses = leave.split(" ").filter((s) => s.length); - const leaveFromClasses = leaveFrom.split(" ").filter((s) => s.length); - const leaveToClasses = leaveTo.split(" ").filter((s) => s.length); - - function addClasses(node: HTMLElement, classes: string[]): void { - if (classes.length) { - node.classList.add(...classes); - } - } - - function removeClasses(node: HTMLElement, classes: string[]): void { - if (classes.length) { - node.classList.remove(...classes); - } - } - - return ( - { - node.addEventListener("transitionend", done, false); - }} - onEnter={(node: any) => { - addClasses(node, [...enterClasses, ...enterFromClasses]); - }} - onEntering={(node: any) => { - removeClasses(node, enterFromClasses); - addClasses(node, enterToClasses); - }} - onEntered={(node: any) => { - removeClasses(node, [...enterToClasses, ...enterClasses]); - }} - onExit={(node: any) => { - addClasses(node, [...leaveClasses, ...leaveFromClasses]); - }} - onExiting={(node: any) => { - removeClasses(node, leaveFromClasses); - addClasses(node, leaveToClasses); - }} - onExited={(node: any) => { - removeClasses(node, [...leaveToClasses, ...leaveClasses]); - }} - > - {children} - - ); -} - -function Transition({ show, appear, ...rest }: TransitionProps) { - const { parent } = useContext(TransitionContext); - const isInitialRender = useIsInitialRender(); - const isChild = show === undefined; - - if (isChild) { - return ( - - ); - } - - return ( - - - - ); -} - -export default Transition; diff --git a/src/Components/Common/utils/Tooltip.tsx b/src/Components/Common/utils/Tooltip.tsx deleted file mode 100644 index 2257b9b28b6..00000000000 --- a/src/Components/Common/utils/Tooltip.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import { ReactNode, useState } from "react"; -import { classNames } from "../../../Utils/utils"; - -interface TooltipProps { - children: ReactNode; - text: ReactNode; - position?: "TOP" | "BOTTOM" | "LEFT" | "RIGHT" | "CUSTOM"; - className?: string; -} - -/** - * Deprecated. Use `tooltip` and `tooltip-text` with `tooltip-{left/right/top/bottom}` classes on elements. - * - * **Example:** - * ```html - * - * ``` - */ -export default function ToolTip(props: TooltipProps) { - const position = props.position || "TOP"; - - const [status, show] = useState(false); - - const style = classNames( - "absolute z-50 block w-[150px] rounded bg-black/50 px-2 py-1 text-center text-white backdrop-blur transition", - position === "TOP" && "bottom-[calc(100%+5px)] left-[calc(50%-75px)]", - position === "BOTTOM" && "left-[calc(50%-75px)] top-[calc(100%+5px)]", - position === "LEFT" && "right-[calc(100%+5px)] top-[calc(50%-75px)]", - position === "RIGHT" && "left-[calc(100%+5px)] top-[calc(50%-75px)]", - status === true - ? "visible -translate-y-1 opacity-100" - : "invisible translate-y-0 opacity-0", - props.className && props.className, - ); - - return ( -
show(true)} - onMouseLeave={() => show(false)} - > -
{props.text}
- {props.children} -
- ); -} diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index 4680c1ca2b5..10af5bec23a 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -740,12 +740,6 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { patient_no: state.form.patient_no || null, }; - request(id ? routes.updateConsultation : routes.createConsultation, { - pathParams: id ? { id } : undefined, - body: data, - controllerRef: submitController, - }); - const { data: obj } = await request( id ? routes.updateConsultation : routes.createConsultation, { diff --git a/src/Components/Facility/DuplicatePatientDialog.tsx b/src/Components/Facility/DuplicatePatientDialog.tsx index b948ad91fa3..b9d740f85e8 100644 --- a/src/Components/Facility/DuplicatePatientDialog.tsx +++ b/src/Components/Facility/DuplicatePatientDialog.tsx @@ -2,6 +2,7 @@ import { useState } from "react"; import { Cancel, Submit } from "../Common/components/ButtonV2"; import DialogModal from "../Common/Dialog"; import { DupPatientModel } from "./models"; +import { useTranslation } from "react-i18next"; interface Props { patientList: Array; @@ -12,6 +13,7 @@ interface Props { const tdClass = "border border-secondary-400 p-2 text-left"; const DuplicatePatientDialog = (props: Props) => { + const { t } = useTranslation(); const { patientList, handleOk, handleCancel } = props; const [action, setAction] = useState(""); @@ -79,10 +81,7 @@ const DuplicatePatientDialog = (props: Props) => { value="transfer" onChange={(e) => setAction(e.target.value)} /> -

- Admit the patient record to your facility by adding the date of - birth -

+

{t("duplicate_patient_record_confirmation")}

@@ -99,18 +98,11 @@ const DuplicatePatientDialog = (props: Props) => { value="close" onChange={(e) => setAction(e.target.value)} /> -

- I confirm that the suspect / patient I want to create is not on - the list. -

+

{t("duplicate_patient_record_rejection")}

-

- Please contact your district care coordinator, the shifting facility - or the patient themselves if you are not sure about the patient's - date of birth. -

+

{t("duplicate_patient_record_birth_unknown")}

diff --git a/src/Components/Facility/FacilityCard.tsx b/src/Components/Facility/FacilityCard.tsx index d6c2dce2b6c..858386b72e6 100644 --- a/src/Components/Facility/FacilityCard.tsx +++ b/src/Components/Facility/FacilityCard.tsx @@ -36,6 +36,7 @@ export const FacilityCard = (props: { facility: any; userType: any }) => { Notification.Success({ msg: "Facility Notified", }); + setNotifyMessage(""); setNotifyModalFor(undefined); } else { Notification.Error({ msg: "Something went wrong..." }); @@ -224,6 +225,7 @@ export const FacilityCard = (props: { facility: any; userType: any }) => { name="message" rows={5} className="pb-2 pt-4" + value={notifyMessage} onChange={(e) => setNotifyMessage(e.value)} placeholder="Type your message..." error={notifyError} diff --git a/src/Components/Facility/TransferPatientDialog.tsx b/src/Components/Facility/TransferPatientDialog.tsx index 0c4af6c5d0c..4facfc2b35e 100644 --- a/src/Components/Facility/TransferPatientDialog.tsx +++ b/src/Components/Facility/TransferPatientDialog.tsx @@ -163,8 +163,7 @@ const TransferPatientDialog = (props: Props) => {

- Note: Date of birth must match the patient to process the transfer - request. + {t("patient_transfer_birth_match_note")}

diff --git a/src/Components/Patient/DailyRounds.tsx b/src/Components/Patient/DailyRounds.tsx index 4ec6b879b23..8c09db3f8c2 100644 --- a/src/Components/Patient/DailyRounds.tsx +++ b/src/Components/Patient/DailyRounds.tsx @@ -141,7 +141,11 @@ export const DailyRounds = (props: any) => { const [showDiscontinuedPrescriptions, setShowDiscontinuedPrescriptions] = useState(false); const headerText = !id ? "Add Consultation Update" : "Info"; - const buttonText = !id ? "Save" : "Continue"; + const buttonText = !id + ? !["VENTILATOR", "DOCTORS_LOG"].includes(state.form.rounds_type) + ? t("save") + : t("save_and_continue") + : t("continue"); const formFields = [ "physical_examination_info", @@ -423,7 +427,7 @@ export const DailyRounds = (props: any) => { return ; } - const roundTypes = []; + const roundTypes: { id: string; text: string }[] = []; if ( ["Doctor", "Staff", "DistrictAdmin", "StateAdmin"].includes( @@ -594,11 +598,11 @@ export const DailyRounds = (props: any) => { [ "investigations", "icd11_diagnosis", - "additional_symptoms", "prescriptions", "prn_prescriptions", ].includes(f), - ) + ) && + roundTypes.some((t) => t.id === "DOCTORS_LOG") ) { rounds_type = "DOCTORS_LOG"; } diff --git a/src/Locale/en/Common.json b/src/Locale/en/Common.json index 79ffefd7906..25cbef69371 100644 --- a/src/Locale/en/Common.json +++ b/src/Locale/en/Common.json @@ -119,6 +119,8 @@ "latitude_invalid": "Latitude must be between -90 and 90", "longitude_invalid": "Longitude must be between -180 and 180", "save": "Save", + "continue" : "Continue", + "save_and_continue": "Save and Continue", "select": "Select", "lsg": "Lsg", "delete": "Delete", diff --git a/src/Locale/en/Facility.json b/src/Locale/en/Facility.json index 5bb0a269e87..e321fa02f43 100644 --- a/src/Locale/en/Facility.json +++ b/src/Locale/en/Facility.json @@ -54,5 +54,9 @@ "create_add_more": "Create & Add More", "discharged_patients": "Discharged Patients", "discharged_patients_empty": "No discharged patients present in this facility", - "update_facility_middleware_success": "Facility middleware updated successfully" + "update_facility_middleware_success": "Facility middleware updated successfully", + "duplicate_patient_record_confirmation": "Admit the patient record to your facility by adding the year of birth", + "duplicate_patient_record_rejection": "I confirm that the suspect / patient I want to create is not on the list.", + "duplicate_patient_record_birth_unknown": "Please contact your district care coordinator, the shifting facility or the patient themselves if you are not sure about the patient's year of birth.", + "patient_transfer_birth_match_note": "Note: Year of birth must match the patient to process the transfer request." }