Skip to content

Commit

Permalink
Refactor ohri dashboard welcome component to support custom title
Browse files Browse the repository at this point in the history
  • Loading branch information
pirupius committed Sep 25, 2023
1 parent 8223d59 commit 49f45da
Show file tree
Hide file tree
Showing 4 changed files with 3,614 additions and 3,815 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,11 @@ import { capitalize } from 'lodash-es';
import { Link, BrowserRouter as Router } from 'react-router-dom';
import { LabresultsFormViewer } from '../lab-results-form-viewer';

interface CD4ResultsListProps {
patientUuid: string;
}

export const filterPatientsByName = (searchTerm: string, patients: Array<any>) => {
return patients.filter((patient) => patient.patientSearchName.toLowerCase().includes(searchTerm.toLowerCase()));
};

const CD4ResultsList: React.FC<CD4ResultsListProps> = ({ patientUuid }) => {
const CD4ResultsList = () => {
const { t } = useTranslation();
const [patients, setPatients] = useState([]);
const [patientToCd4Map, setPatientToCd4Map] = useState([]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useEffect, useState, useMemo, useCallback } from 'react';

import styles from './patient-list.scss';
import { useTranslation } from 'react-i18next';
import { age, navigate, openmrsFetch } from '@openmrs/esm-framework';
Expand All @@ -11,7 +10,6 @@ import {
fetchPatientList,
encounterRepresentation,
getObsFromEncounter,
fetchLastVisit,
} from '@ohri/openmrs-esm-ohri-commons-lib';
import {
ViralLoadResultDate_UUID,
Expand All @@ -22,11 +20,7 @@ import { Link, BrowserRouter as Router } from 'react-router-dom';
import { filterPatientsByName } from './cd4-results.component';
import { LabresultsFormViewer } from '../lab-results-form-viewer';

interface ViralLoadResultsListProps {
patientUuid: string;
}

const ViralLoadResultsList: React.FC<ViralLoadResultsListProps> = () => {
const ViralLoadResultsList = () => {
const { t } = useTranslation();
const [patients, setPatients] = useState([]);
const [patientToViralLoadMap, setPatientToViralLoadMap] = useState([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ import CD4ResultsList from './Tabs/cd4-results.component';
import ViralLoadResultsList from './Tabs/viral-load-results.component';
import { useTranslation } from 'react-i18next';

interface OverviewListProps {
patientUuid: string;
}

const LabResultsSummary: React.FC<OverviewListProps> = ({ patientUuid }) => {
const LabResultsSummary = () => {
const { t } = useTranslation();
return (
<Tabs type="container" className={styles.tabContainer}>
Expand All @@ -19,10 +15,10 @@ const LabResultsSummary: React.FC<OverviewListProps> = ({ patientUuid }) => {
</TabList>
<TabPanels>
<TabPanel>
<CD4ResultsList patientUuid={patientUuid} />
<CD4ResultsList />
</TabPanel>
<TabPanel>
<ViralLoadResultsList patientUuid={patientUuid} />
<ViralLoadResultsList />
</TabPanel>
</TabPanels>
</Tabs>
Expand Down
Loading

0 comments on commit 49f45da

Please sign in to comment.