Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Amy Chen committed Aug 22, 2023
1 parent e0549a5 commit 818db28
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ describe("DetailPanel", () => {
it("DetailPanel component renders without crashing", () => {
const data = {
rowData: {
id: 1
}
}
const wrapper = shallow(<DetailPanel data={data}/>);
id: 1,
},
};
const wrapper = shallow(<DetailPanel data={data} />);
expect(wrapper).toBeDefined();
});
});
26 changes: 19 additions & 7 deletions patientsearch/src/js/components/patientList/DetailPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,31 @@ import Paper from "@material-ui/core/Paper";
import useStyles from "../../../styles/patientListStyle";
import { usePatientListContext } from "../../context/PatientListContextProvider";

export default function DetailPanel({data}) {
export default function DetailPanel({ data }) {
const classes = useStyles();
let {
selectedMenuItem,
getSelectedItemComponent,
handleMenuClose,
handleToggleDetailPanel,
shouldHideMoreMenu
shouldHideMoreMenu,
} = usePatientListContext();
if (!shouldHideMoreMenu) shouldHideMoreMenu = function() { return true};
if (!handleToggleDetailPanel) shouldHideMoreMenu = function() { return true};
if (!handleMenuClose) handleMenuClose = function() { return true};
if (!getSelectedItemComponent) getSelectedItemComponent = function() { return null};
if (!shouldHideMoreMenu)
shouldHideMoreMenu = function () {
return true;
};
if (!handleToggleDetailPanel)
shouldHideMoreMenu = function () {
return true;
};
if (!handleMenuClose)
handleMenuClose = function () {
return true;
};
if (!getSelectedItemComponent)
getSelectedItemComponent = function () {
return null;
};
if (shouldHideMoreMenu()) return false;
return (
<div className={classes.detailPanelWrapper}>
Expand All @@ -44,4 +56,4 @@ export default function DetailPanel({data}) {

DetailPanel.propTypes = {
data: PropTypes.object.isRequired,
};
};
5 changes: 4 additions & 1 deletion patientsearch/src/js/components/patientList/DropdownMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ export default function DropdownMenu() {
shouldHideMoreMenu,
shouldShowMenuItem,
} = usePatientListContext();
if (!shouldHideMoreMenu) shouldHideMoreMenu = function () { return true };
if (!shouldHideMoreMenu)
shouldHideMoreMenu = function () {
return true;
};
if (shouldHideMoreMenu()) return false;
return (
<Dropdown
Expand Down
2 changes: 1 addition & 1 deletion patientsearch/src/js/components/patientList/FilterRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const useStyles = makeStyles((theme) => ({
},
}));

export default function FilterRow(props) {
export default function FilterRow() {
let {
//methods
handleSearch,
Expand Down
24 changes: 15 additions & 9 deletions patientsearch/src/js/components/patientList/PatientListTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,21 @@ export default function PatientListTable() {
openLoadingModal,
} = usePatientListContext();

if (!handleErrorCallback) handleErrorCallback = function() {};
if (!handlePageUnload) handlePageUnload = function() {};
if (!getColumns) getColumns = function() {return []};
if (!getPatientList) getPatientList = function() { return []};
if (!getTableActions) getTableActions = function() {};
if (!getTableRowEvent) getTableRowEvent = function() {};
if (!getTableEditableOptions) getTableEditableOptions = function() {};
if (!getTableLocalizations) getTableLocalizations = function() {};
if (!getTableOptions) getTableOptions = function() {}
if (!handleErrorCallback) handleErrorCallback = function () {};
if (!handlePageUnload) handlePageUnload = function () {};
if (!getColumns)
getColumns = function () {
return [];
};
if (!getPatientList)
getPatientList = function () {
return [];
};
if (!getTableActions) getTableActions = function () {};
if (!getTableRowEvent) getTableRowEvent = function () {};
if (!getTableEditableOptions) getTableEditableOptions = function () {};
if (!getTableLocalizations) getTableLocalizations = function () {};
if (!getTableOptions) getTableOptions = function () {};

const renderPatientSearchRow = () => (
<table className={classes.filterTable}>
Expand Down
3 changes: 2 additions & 1 deletion patientsearch/src/js/context/PatientListContextProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ const PatientListContext = React.createContext({});
*/
let filterIntervalId = 0;
export default function PatientListContextProvider({ children }) {
const appSettings = useSettingContext().appSettings;
const settingsCxt = useSettingContext();
const appSettings = settingsCxt ? settingsCxt.appSettings : {};
const { user, userError } = useUserContext();
const { userName, roles } = user || {};
const appClients = getClientsByRequiredRoles(
Expand Down

0 comments on commit 818db28

Please sign in to comment.