Skip to content

Commit

Permalink
Merge pull request #302 from informatici/eslint-fix
Browse files Browse the repository at this point in the history
Eslint fix
  • Loading branch information
axelpezzo authored May 26, 2022
2 parents ea72fa9 + d00f469 commit 0af16ff
Show file tree
Hide file tree
Showing 38 changed files with 204 additions and 235 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,3 @@ jobs:
spec: cypress/integration/**/*
env: host=localhost,port=3000
wait-on: "http://localhost:3000"

deploy:
needs: e2e
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: fregante/setup-git-user@v1
- name: Installing...
run: npm i
- name: Building
env:
CI: false
run: npm run clear && npm run build:gh-pages
- run: git add --force build
- run: git commit -m 'new build'
- run: git remote add intesys-oh https://github.com/intesys/openhospital-ui.git
- run: echo "HASH_COMMIT=$(git subtree split --prefix build develop)" >> $GITHUB_ENV
- run: git push intesys-oh $HASH_COMMIT:gh-pages --force
26 changes: 26 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Deploy

on:
workflow_run:
workflows: ["CI"]
types:
- completed

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: fregante/setup-git-user@v1
- name: Installing...
run: npm i
- name: Building
env:
CI: false
run: npm run clear && npm run build:gh-pages
- run: git add --force build
- run: git commit -m 'new build'
- run: git remote add intesys-oh https://github.com/intesys/openhospital-ui.git
- run: echo "HASH_COMMIT=$(git subtree split --prefix build develop)" >> $GITHUB_ENV
- run: git push intesys-oh $HASH_COMMIT:gh-pages --force
10 changes: 6 additions & 4 deletions src/components/accessories/admission/PatientAdmission.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ const PatientAdmission: FC = () => {
const [shouldResetForm, setShouldResetForm] = useState(false);
const [creationMode, setCreationMode] = useState(true);
const [showForm, setShowForm] = useState(false);
const [admissionToEdit, setAdmissionToEdit] =
useState<AdmissionDTO | undefined>();
const [admissionToEdit, setAdmissionToEdit] = useState<
AdmissionDTO | undefined
>();
const [shouldUpdateTable, setShouldUpdateTable] = useState(false);
const [activityTransitionState, setActivityTransitionState] =
useState<AdmissionTransitionState>("IDLE");
Expand Down Expand Up @@ -125,7 +126,7 @@ const PatientAdmission: FC = () => {
) {
setShowForm(true);
} else setShowForm(false);
}, [currentAdmissionStatus, creationMode]);
}, [currentAdmissionStatus, currentAdmission, creationMode]);

useEffect(() => {
if (activityTransitionState === "TO_RESET") {
Expand All @@ -138,7 +139,7 @@ const PatientAdmission: FC = () => {
setShouldUpdateTable(true);
setShouldResetForm(true);
}
}, [dispatch, activityTransitionState]);
}, [dispatch, patient, activityTransitionState]);

const resetFormCallback = () => {
setCreationMode(true);
Expand Down Expand Up @@ -171,6 +172,7 @@ const PatientAdmission: FC = () => {
<AdmissionForm
fields={fields}
onSubmit={onSubmit}
creationMode={creationMode}
submitButtonLabel={
admissionToEdit ? t("common.update") : t("common.save")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
DiseaseTypeDTO,
WardDTO,
} from "../../../../generated";
import { renderDate } from "../../../../libraries/formatUtils/dataFormatting";
import {
formatAllFieldValues,
getFromFields,
Expand All @@ -36,6 +37,7 @@ import { AdmissionProps } from "./types";
const AdmissionForm: FC<AdmissionProps> = ({
fields,
onSubmit,
creationMode,
submitButtonLabel,
resetButtonLabel,
isLoading,
Expand Down Expand Up @@ -224,6 +226,7 @@ const AdmissionForm: FC<AdmissionProps> = ({
const handleResetConfirmation = () => {
setOpenResetConfirmation(false);
formik.resetForm();
resetFormCallback();
};

useEffect(() => {
Expand Down Expand Up @@ -265,6 +268,13 @@ const AdmissionForm: FC<AdmissionProps> = ({
return (
<>
<div className="patientAdmissionForm">
<h5 className="formInsertMode">
{creationMode
? t("admission.newadmission")
: t("admission.editadmission") +
": " +
renderDate(formik.values.admDate)}
</h5>
<form
className="patientAdmissionForm__form"
onSubmit={formik.handleSubmit}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
align-items: center;
width: 100%;

.formInsertMode{
margin: 0px 0px 20px;
}

.patientAdmissionForm__item {
margin: 7px 0px;
padding: 0px 15px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { TFields } from "../../../../libraries/formDataHandling/types";
interface IAdmissionProps {
fields: TFields<AdmissionFormFieldName>;
onSubmit: (adm: AdmissionDTO) => void;
creationMode: boolean;
submitButtonLabel: string;
resetButtonLabel: string;
isLoading: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import { IState } from "../../../../types";
import { AdmissionDTO } from "../../../../generated";
import { getAdmissionsByPatientId } from "../../../../state/admissions/actions";
import { renderDate } from "../../../../libraries/formatUtils/dataFormatting";
import { isEmpty } from "lodash";
import moment from "moment";

interface IOwnProps {
shouldUpdateTable: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/components/accessories/customDialog/CustomDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const CustomDialog: FC<ICustomDialog> = ({
open,
onClose,
}) => {
const [scroll, setScroll] = React.useState<DialogProps["scroll"]>("paper");
const [scroll] = React.useState<DialogProps["scroll"]>("paper");

return (
<Dialog
Expand Down
1 change: 0 additions & 1 deletion src/components/accessories/dateField/DateField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
import DateFnsUtils from "@date-io/date-fns";
import { IProps } from "./types";
import "./styles.scss";
import TextField from "@material-ui/core/TextField";
import { FIELD_VALIDATION } from "../../../types";
const DateField: FunctionComponent<IProps> = ({
fieldName,
Expand Down
9 changes: 3 additions & 6 deletions src/components/accessories/discharge/PatientDischarge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const PatientDischarge: FC = () => {
const dispatch = useDispatch();
const infoBoxRef = useRef<HTMLDivElement>(null);
const [shouldResetForm, setShouldResetForm] = useState(false);
const [shouldUpdateTable, setShouldUpdateTable] = useState(false);
const [, setShouldUpdateTable] = useState(false);
const [activityTransitionState, setActivityTransitionState] =
useState<AdmissionTransitionState>("IDLE");

Expand All @@ -41,9 +41,6 @@ const PatientDischarge: FC = () => {
const patient = useSelector(
(state: IState) => state.patients.selectedPatient.data
);
const username = useSelector(
(state: IState) => state.main.authentication.data?.displayName
);

const dischargeStatus = useSelector<IState>(
(state) => state.admissions.dischargePatient.status
Expand Down Expand Up @@ -77,7 +74,7 @@ const PatientDischarge: FC = () => {
setActivityTransitionState("FAIL");
scrollToElement(infoBoxRef.current);
}
}, [dischargeStatus]);
}, [dischargeStatus, currentAdmissionStatus]);

useEffect(() => {
dispatch(dischargePatientReset());
Expand All @@ -90,7 +87,7 @@ const PatientDischarge: FC = () => {
dispatch(dischargePatientReset());
setShouldResetForm(true);
}
}, [dispatch, activityTransitionState]);
}, [dispatch, patient, activityTransitionState]);

const resetFormCallback = () => {
setShouldResetForm(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { FormikProvider, useFormik } from "formik";
import { isEmpty } from "lodash";
import { useFormik } from "formik";
import get from "lodash.get";
import has from "lodash.has";
import moment from "moment";
Expand All @@ -17,7 +16,6 @@ import {
differenceInDays,
formatAllFieldValues,
getFromFields,
parseDate,
} from "../../../../libraries/formDataHandling/functions";
import { getDischargeTypes } from "../../../../state/dischargeTypes/actions";
import { getDiseasesIpdOut } from "../../../../state/diseases/actions";
Expand Down Expand Up @@ -155,7 +153,7 @@ const DischargeForm: FC<DischargeProps> = ({
).toString();
setFieldValue("bedDays", days);
},
[setFieldValue]
[setFieldValue, admission]
);

const isValid = (fieldName: string): boolean => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/accessories/footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { FunctionComponent } from "react";
import { Link } from "react-router-dom";
import isfLogo from "../../../assets/isf-logo.png";
import "./styles.scss";

Expand All @@ -22,6 +21,7 @@ const Footer: FunctionComponent = () => {
<a
href={"https://www.informaticisenzafrontiere.org/"}
title="Informatici Senza Frontiere"
rel="noopener noreferrer"
target="_blank"
>
<img src={isfLogo} alt="Informatici Senza Frontiere" />
Expand Down
2 changes: 1 addition & 1 deletion src/components/accessories/imageResize/ImageResize.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useRef, useState } from "react";
import React, { useCallback, useState } from "react";
import ImageCrop, { Crop } from "react-image-crop";
import { useTranslation } from "react-i18next";
import CheckIcon from "@material-ui/icons/Check";
Expand Down
8 changes: 4 additions & 4 deletions src/components/accessories/patientExams/ExamForm/ExamForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@ const ExamForm: FC<ExamProps> = ({
setRowsData((rowObjs: string[]) => {
if (!rowObjs.includes(value)) {
rowObjs.push(value);
} else rowObjs = rowObjs.filter((e) => e != value);
} else rowObjs = rowObjs.filter((e) => e !== value);
return rowObjs;
});
},
[handleBlur]
[]
);

const [openResetConfirmation, setOpenResetConfirmation] = useState(false);
Expand Down Expand Up @@ -224,11 +224,11 @@ const ExamForm: FC<ExamProps> = ({
return (
<>
<div className="patientExamForm">
<h3 className="formInsertMode">
<h5 className="formInsertMode">
{creationMode
? t("lab.newlab")
: t("lab.editlab") + ": " + renderDate(formik.values.examDate)}
</h3>
</h5>
<form className="patientExamForm__form" onSubmit={formik.handleSubmit}>
<div className="row start-sm center-xs">
<div className="patientExamForm__item">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ const PatientExamsTable: FunctionComponent<IOwnProps> = ({
const labData = useSelector<IState, LaboratoryDTO[] | undefined>(
(state) => state.laboratories.labsByPatientId.data
);
const onDelete = (row: LaboratoryDTO) => {
handleDelete(row.code);
};

const onEdit = (row: any) => {
handleEdit(labData?.find((item) => item.code === row.code));
Expand Down
4 changes: 0 additions & 4 deletions src/components/accessories/patientOPD/patientOPD.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ const PatientOPD: FunctionComponent = () => {
(state: IState) => state.main.authentication.data?.displayName
);

const diseasesData = useSelector(
(state: IState) => state.diseases.diseasesOpd.data
);

useEffect(() => {
if (activityTransitionState === "TO_RESET") {
setShouldUpdateTable(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ const PatientOPDForm: FunctionComponent<TProps> = ({
return (
<>
<div className="patientOpdForm">
<h3 className="formInsertMode">
<h5 className="formInsertMode">
{creationMode
? t("opd.newopd")
: t("opd.editopd") + ": " + renderDate(formik.values.visitDate)}
</h3>
</h5>
<form className="patientOpdForm__form" onSubmit={formik.handleSubmit}>
<div className="row start-sm center-xs">
<div className="patientOpdForm__item">
Expand All @@ -200,13 +200,13 @@ const PatientOPDForm: FunctionComponent<TProps> = ({
value="R"
control={<Radio />}
label={t("opd.reattendance")}
checked={formik.values["newPatient"] == "R"}
checked={formik.values["newPatient"] === "R"}
/>
<FormControlLabel
value="N"
control={<Radio />}
label={t("opd.newadmittance")}
checked={formik.values["newPatient"] == "N"}
checked={formik.values["newPatient"] === "N"}
/>
</RadioGroup>
</FormControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import {
} from "../../../state/operations/actions";
import PatientOperationTable from "./operationTable/OperationRowTable";
import { getCurrentAdmissionByPatientId } from "../../../state/admissions/actions";
import { updateOperationRowFields } from "../../../libraries/formDataHandling/functions";
import { initialFields } from "./consts";
import { isEmpty } from "lodash";
import { opRowFields } from "./opRowFields";

Expand Down Expand Up @@ -64,10 +62,6 @@ const PatientOperation: FC<IOwnProps> = ({ opd, visit, onSuccess }) => {
(state: IState) => state.patients.selectedPatient.data
);

const operations = useSelector(
(state: IState) => state.operations.operationList.data
);

const username = useSelector(
(state: IState) => state.main.authentication.data?.displayName
);
Expand Down Expand Up @@ -115,7 +109,7 @@ const PatientOperation: FC<IOwnProps> = ({ opd, visit, onSuccess }) => {
dispatch(updateOperationRowReset());
setShouldResetForm(true);
}
}, [dispatch, activityTransitionState]);
}, [dispatch, onSuccess, activityTransitionState]);

const resetFormCallback = () => {
setShouldResetForm(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import has from "lodash.has";
import moment from "moment";
import React, { FC, useCallback, useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { useDispatch, useSelector } from "react-redux";
import { useSelector } from "react-redux";
import { number, object, string } from "yup";
import warningIcon from "../../../../assets/warning-icon.png";
import { OperationDTO } from "../../../../generated";
Expand Down Expand Up @@ -130,13 +130,13 @@ const OperationRowForm: FC<OperationRowProps> = ({
return (
<>
<div className="patientOperationForm">
<h3 className="formInsertMode">
<h5 className="formInsertMode">
{creationMode
? t("operation.newoperation")
: t("operation.editoperation") +
": " +
renderDate(formik.values.opDate)}
</h3>
</h5>
<form
className="patientOperationForm__form"
onSubmit={formik.handleSubmit}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,6 @@ const PatientTherapyTable: FunctionComponent<IOwnProps> = ({
(state) => state.therapies.therapiesByPatientId.status
);

const errorMessage = useSelector<IState>(
(state) =>
state.therapies.therapiesByPatientId.error?.message ||
t("common.somethingwrong")
) as string;

const onDelete = (row: TherapyRowDTO) => {
handleDelete(row.therapyID);
};
Expand Down
Loading

0 comments on commit 0af16ff

Please sign in to comment.