From 80ed86191a913a13702c0193bf86b98180f04e26 Mon Sep 17 00:00:00 2001 From: Gideon Pinto Date: Wed, 3 Apr 2024 11:56:56 -0400 Subject: [PATCH] feat: Minor code cleanup (#1149) --- src/components/Pacs/components/PatientCard.tsx | 18 +++++++++--------- .../Pacs/components/SettingsComponents.tsx | 6 +++--- src/components/Pacs/components/StudyCard.tsx | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/components/Pacs/components/PatientCard.tsx b/src/components/Pacs/components/PatientCard.tsx index 5083fd45f..8740dc1fc 100644 --- a/src/components/Pacs/components/PatientCard.tsx +++ b/src/components/Pacs/components/PatientCard.tsx @@ -1,18 +1,18 @@ -import React, { useState, useContext } from "react"; -import { format, parse } from "date-fns"; -import { notification } from "antd"; import { - GridItem, Card, CardHeader, Grid, - Tooltip, + GridItem, Skeleton, + Tooltip, } from "@patternfly/react-core"; -import StudyCard from "./StudyCard"; -import { CardHeaderComponent } from "./SettingsComponents"; +import { notification } from "antd"; +import { format, parse } from "date-fns"; +import { useContext, useEffect, useState } from "react"; import { PacsQueryContext } from "../context"; import useSettings from "../useSettings"; +import { CardHeaderComponent } from "./SettingsComponents"; +import StudyCard from "./StudyCard"; function getPatientDetails(patientDetails: any) { return { @@ -35,7 +35,7 @@ const PatientCard = ({ queryResult }: { queryResult: any }) => { const { PatientID, PatientName, PatientBirthDate, PatientSex } = patientDetails; - React.useEffect(() => { + useEffect(() => { if (isError) { api.error({ message: error.message, @@ -93,7 +93,7 @@ const PatientCard = ({ queryResult }: { queryResult: any }) => { screenreaderText="Loading contents" /> - ) : !error && + ) : !isError && userPreferences && userPreferencesArray && userPreferencesArray.length > 0 ? ( diff --git a/src/components/Pacs/components/SettingsComponents.tsx b/src/components/Pacs/components/SettingsComponents.tsx index 521ef3657..23f8b394d 100644 --- a/src/components/Pacs/components/SettingsComponents.tsx +++ b/src/components/Pacs/components/SettingsComponents.tsx @@ -1,8 +1,8 @@ -import { useState } from "react"; -import axios from "axios"; +import { Button, Checkbox } from "@patternfly/react-core"; import { useQueryClient } from "@tanstack/react-query"; import { Popover } from "antd"; -import { Checkbox, Button } from "@patternfly/react-core"; +import axios from "axios"; +import { useState } from "react"; import ChrisApiClient from "../../../api/chrisapiclient"; import { useTypedSelector } from "../../../store/hooks"; import { NodeDetailsPanelIcon } from "../../Icons"; diff --git a/src/components/Pacs/components/StudyCard.tsx b/src/components/Pacs/components/StudyCard.tsx index b89931307..9039a4eb3 100644 --- a/src/components/Pacs/components/StudyCard.tsx +++ b/src/components/Pacs/components/StudyCard.tsx @@ -24,7 +24,7 @@ import { CardHeaderComponent } from "./SettingsComponents"; import useSettings from "../useSettings"; const StudyCardCopy = ({ study }: { study: any }) => { - const { data, isLoading, error } = useSettings(); + const { data, isLoading, isError } = useSettings(); const { state, dispatch } = useContext(PacsQueryContext); const [isStudyExpanded, setIsStudyExpanded] = useState(false); const { preview, pullStudy, studyPullTracker } = state; @@ -94,7 +94,7 @@ const StudyCardCopy = ({ study }: { study: any }) => { ) : ( <> - {!error && + {!isError && userPreferences && userPreferencesArray && userPreferencesArray.length > 0 ? (