Skip to content

Commit

Permalink
feat: Add a loading spinner to Dcm Display
Browse files Browse the repository at this point in the history
  • Loading branch information
PintoGideon committed Nov 1, 2024
1 parent 807990a commit 33edd28
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/Preview/displays/DcmDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import axios, { type AxiosProgressEvent } from "axios";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { type IFileBlob, getFileExtension } from "../../../api/model";
import { notification } from "../../Antd";
import { SpinContainer } from "../../Common";
import useSize from "../../FeedTree/useSize";
import type { ActionState } from "../FileDetailView";
import { useDicomCache } from "./DicomCacheContext";
import {
events,
type IStackViewport,
Expand All @@ -19,7 +21,6 @@ import {
stopClip,
stupidlyGetFileResourceUrl,
} from "./dicomUtils/utils";
import { useDicomCache } from "./DicomCacheContext";

export type DcmImageProps = {
selectedFile: IFileBlob;
Expand Down Expand Up @@ -487,6 +488,8 @@ const DcmDisplay = (props: DcmImageProps) => {
}
}, [actionState]);

const showProgress = downloadProgress > 0 && downloadProgress < 100;

return (
<>
<div
Expand Down Expand Up @@ -524,10 +527,10 @@ const DcmDisplay = (props: DcmImageProps) => {
</div>
)}
</div>

{downloadProgress > 0 && downloadProgress < 100 && (
<Progress percent={downloadProgress} />
{isLoading && !showProgress && (
<SpinContainer title="Loading Dicom Image..." />
)}
{showProgress && <Progress percent={downloadProgress} />}

{/* DICOM Image Display */}
<div
Expand Down

0 comments on commit 33edd28

Please sign in to comment.