fix(DicomUpload): Switch to use ui-next components and colors (#5576)
* Replaced legacy Button * Updated Dialog width * Restore text and spacing fixes * Updated drop zone styling * Migrated to ui-next colors
This commit is contained in:
parent
4dc8debb02
commit
62d6bf437b
@ -1,23 +0,0 @@
|
|||||||
.dicom-upload-drop-area-border-dash {
|
|
||||||
background-image: repeating-linear-gradient(
|
|
||||||
to right,
|
|
||||||
#7bb2ce 0%,
|
|
||||||
#7bb2ce 50%,
|
|
||||||
transparent 50%,
|
|
||||||
transparent 100%
|
|
||||||
),
|
|
||||||
repeating-linear-gradient(to right, #7bb2ce 0%, #7bb2ce 50%, transparent 50%, transparent 100%),
|
|
||||||
repeating-linear-gradient(to bottom, #7bb2ce 0%, #7bb2ce 50%, transparent 50%, transparent 100%),
|
|
||||||
repeating-linear-gradient(to bottom, #7bb2ce 0%, #7bb2ce 50%, transparent 50%, transparent 100%);
|
|
||||||
background-position:
|
|
||||||
left top,
|
|
||||||
left bottom,
|
|
||||||
left top,
|
|
||||||
right top;
|
|
||||||
background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
|
|
||||||
background-size:
|
|
||||||
20px 3px,
|
|
||||||
20px 3px,
|
|
||||||
3px 20px,
|
|
||||||
3px 20px;
|
|
||||||
}
|
|
||||||
@ -5,8 +5,8 @@ import PropTypes from 'prop-types';
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import DicomFileUploader from '../../utils/DicomFileUploader';
|
import DicomFileUploader from '../../utils/DicomFileUploader';
|
||||||
import DicomUploadProgress from './DicomUploadProgress';
|
import DicomUploadProgress from './DicomUploadProgress';
|
||||||
import { Button, ButtonEnums } from '@ohif/ui';
|
import { Button } from '@ohif/ui-next';
|
||||||
import './DicomUpload.css';
|
// Removed dashed border CSS; using simple 1px solid border with muted foreground color
|
||||||
|
|
||||||
type DicomUploadProps = {
|
type DicomUploadProps = {
|
||||||
dataSource;
|
dataSource;
|
||||||
@ -15,7 +15,8 @@ type DicomUploadProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function DicomUpload({ dataSource, onComplete, onStarted }: DicomUploadProps): ReactElement {
|
function DicomUpload({ dataSource, onComplete, onStarted }: DicomUploadProps): ReactElement {
|
||||||
const baseClassNames = 'min-h-[480px] flex flex-col bg-black select-none';
|
const baseClassNames =
|
||||||
|
'min-h-[375px] flex flex-col bg-black select-none rounded-lg overflow-hidden';
|
||||||
const [dicomFileUploaderArr, setDicomFileUploaderArr] = useState([]);
|
const [dicomFileUploaderArr, setDicomFileUploaderArr] = useState([]);
|
||||||
|
|
||||||
const onDrop = useCallback(async acceptedFiles => {
|
const onDrop = useCallback(async acceptedFiles => {
|
||||||
@ -34,9 +35,10 @@ function DicomUpload({ dataSource, onComplete, onStarted }: DicomUploadProps): R
|
|||||||
{({ getRootProps }) => (
|
{({ getRootProps }) => (
|
||||||
<div
|
<div
|
||||||
{...getRootProps()}
|
{...getRootProps()}
|
||||||
className="dicom-upload-drop-area-border-dash m-5 flex h-full flex-col items-center justify-center"
|
className="m-5 flex h-full flex-col items-center justify-center rounded-2xl border"
|
||||||
|
style={{ borderColor: 'hsl(var(--muted-foreground) / 0.25)' }}
|
||||||
>
|
>
|
||||||
<div className="flex gap-3">
|
<div className="flex gap-2">
|
||||||
<Dropzone
|
<Dropzone
|
||||||
onDrop={onDrop}
|
onDrop={onDrop}
|
||||||
noDrag
|
noDrag
|
||||||
@ -44,11 +46,16 @@ function DicomUpload({ dataSource, onComplete, onStarted }: DicomUploadProps): R
|
|||||||
{({ getRootProps, getInputProps }) => (
|
{({ getRootProps, getInputProps }) => (
|
||||||
<div {...getRootProps()}>
|
<div {...getRootProps()}>
|
||||||
<Button
|
<Button
|
||||||
|
variant="default"
|
||||||
|
size="lg"
|
||||||
disabled={false}
|
disabled={false}
|
||||||
onClick={() => {}}
|
onClick={() => {}}
|
||||||
>
|
>
|
||||||
{'Add files'}
|
{'Add files'}
|
||||||
<input {...getInputProps()} />
|
<input
|
||||||
|
{...getInputProps()}
|
||||||
|
style={{ display: 'none' }}
|
||||||
|
/>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@ -60,7 +67,8 @@ function DicomUpload({ dataSource, onComplete, onStarted }: DicomUploadProps): R
|
|||||||
{({ getRootProps, getInputProps }) => (
|
{({ getRootProps, getInputProps }) => (
|
||||||
<div {...getRootProps()}>
|
<div {...getRootProps()}>
|
||||||
<Button
|
<Button
|
||||||
type={ButtonEnums.type.secondary}
|
variant="secondary"
|
||||||
|
size="lg"
|
||||||
disabled={false}
|
disabled={false}
|
||||||
onClick={() => {}}
|
onClick={() => {}}
|
||||||
>
|
>
|
||||||
@ -69,14 +77,15 @@ function DicomUpload({ dataSource, onComplete, onStarted }: DicomUploadProps): R
|
|||||||
{...getInputProps()}
|
{...getInputProps()}
|
||||||
webkitdirectory="true"
|
webkitdirectory="true"
|
||||||
mozdirectory="true"
|
mozdirectory="true"
|
||||||
|
style={{ display: 'none' }}
|
||||||
/>
|
/>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Dropzone>
|
</Dropzone>
|
||||||
</div>
|
</div>
|
||||||
<div className="pt-5">or drag images or folders here</div>
|
<div className="text-foreground pt-6 text-base">or drag images or folders here</div>
|
||||||
<div className="text-aqua-pale pt-3 text-lg">(DICOM files supported)</div>
|
<div className="text-muted-foreground pt-1 text-base">(DICOM files supported)</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Dropzone>
|
</Dropzone>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import React, { useCallback, useEffect, useRef, useState, ReactElement } from 'react';
|
import React, { useCallback, useEffect, useRef, useState, ReactElement } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { useSystem } from '@ohif/core';
|
import { useSystem } from '@ohif/core';
|
||||||
import { Button } from '@ohif/ui';
|
import { Button } from '@ohif/ui-next';
|
||||||
import { Icons } from '@ohif/ui-next';
|
import { Icons } from '@ohif/ui-next';
|
||||||
import DicomFileUploader, {
|
import DicomFileUploader, {
|
||||||
EVENTS,
|
EVENTS,
|
||||||
@ -276,7 +276,7 @@ function DicomUploadProgress({
|
|||||||
|
|
||||||
const getNumCompletedAndTimeRemainingComponent = (): ReactElement => {
|
const getNumCompletedAndTimeRemainingComponent = (): ReactElement => {
|
||||||
return (
|
return (
|
||||||
<div className="bg-primary-dark flex h-14 items-center px-1 pb-4 text-lg text-white">
|
<div className="bg-muted flex h-14 items-center px-1 pb-4 text-lg text-white">
|
||||||
{numFilesCompleted === dicomFileUploaderArr.length ? (
|
{numFilesCompleted === dicomFileUploaderArr.length ? (
|
||||||
<>
|
<>
|
||||||
<span className={NO_WRAP_ELLIPSIS_CLASS_NAMES}>{`${dicomFileUploaderArr.length} ${
|
<span className={NO_WRAP_ELLIPSIS_CLASS_NAMES}>{`${dicomFileUploaderArr.length} ${
|
||||||
@ -308,7 +308,7 @@ function DicomUploadProgress({
|
|||||||
|
|
||||||
<span
|
<span
|
||||||
className={
|
className={
|
||||||
'text-primary hover:text-primary-lightactive:text-aqua-pale ml-auto cursor-pointer whitespace-nowrap'
|
'text-primary hover:text-highlight active:text-muted-foreground ml-auto cursor-pointer whitespace-nowrap'
|
||||||
}
|
}
|
||||||
onClick={cancelAllUploads}
|
onClick={cancelAllUploads}
|
||||||
>
|
>
|
||||||
@ -337,11 +337,11 @@ function DicomUploadProgress({
|
|||||||
|
|
||||||
const getPercentCompleteComponent = (): ReactElement => {
|
const getPercentCompleteComponent = (): ReactElement => {
|
||||||
return (
|
return (
|
||||||
<div className="ohif-scrollbar border-secondary-light overflow-y-scroll border-b px-2">
|
<div className="ohif-scrollbar border-input overflow-y-scroll border-b px-2">
|
||||||
<div className="min-h-14 flex w-full items-center p-2.5">
|
<div className="min-h-14 flex w-full items-center p-2.5">
|
||||||
{numFilesCompleted === dicomFileUploaderArr.length ? (
|
{numFilesCompleted === dicomFileUploaderArr.length ? (
|
||||||
<>
|
<>
|
||||||
<div className="text-primary-light text-xl">
|
<div className="text-highlight text-xl">
|
||||||
{numFails > 0
|
{numFails > 0
|
||||||
? `Completed with ${numFails} ${numFails > 1 ? 'errors' : 'error'}!`
|
? `Completed with ${numFails} ${numFails > 1 ? 'errors' : 'error'}!`
|
||||||
: 'Completed!'}
|
: 'Completed!'}
|
||||||
@ -359,7 +359,7 @@ function DicomUploadProgress({
|
|||||||
></ProgressLoadingBar>
|
></ProgressLoadingBar>
|
||||||
</div>
|
</div>
|
||||||
<div className="ml-1 flex w-24 items-center">
|
<div className="ml-1 flex w-24 items-center">
|
||||||
<div className="w-10 text-right text-foreground">{`${getPercentCompleteRounded()}%`}</div>
|
<div className="text-foreground w-10 text-right">{`${getPercentCompleteRounded()}%`}</div>
|
||||||
{getShowFailedOnlyIconComponent()}
|
{getShowFailedOnlyIconComponent()}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -56,7 +56,7 @@ const DicomUploadProgressItem = memo(
|
|||||||
return (
|
return (
|
||||||
<Icons.ByName
|
<Icons.ByName
|
||||||
name="status-tracked"
|
name="status-tracked"
|
||||||
className="text-primary-light"
|
className="text-highlight"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
case UploadStatus.InProgress:
|
case UploadStatus.InProgress:
|
||||||
@ -71,7 +71,7 @@ const DicomUploadProgressItem = memo(
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-14 border-secondary-light flex w-full items-center overflow-hidden border-b p-2.5 text-lg">
|
<div className="min-h-14 border-input flex w-full items-center overflow-hidden border-b p-2.5 text-lg">
|
||||||
<div className="self-top flex w-0 shrink grow flex-col gap-1">
|
<div className="self-top flex w-0 shrink grow flex-col gap-1">
|
||||||
<div className="flex gap-4">
|
<div className="flex gap-4">
|
||||||
<div className="flex w-6 shrink-0 items-center justify-center">{getStatusIcon()}</div>
|
<div className="flex w-6 shrink-0 items-center justify-center">{getStatusIcon()}</div>
|
||||||
|
|||||||
@ -1,6 +1,12 @@
|
|||||||
import { CinePlayer } from '@ohif/ui-next';
|
import { CinePlayer } from '@ohif/ui-next';
|
||||||
import DicomUpload from '../components/DicomUpload/DicomUpload';
|
import DicomUpload from '../components/DicomUpload/DicomUpload';
|
||||||
|
|
||||||
|
// Provide a wider default container for the DICOM Upload modal, without
|
||||||
|
// affecting other dialogs. We attach a static property that WorkList reads.
|
||||||
|
const DicomUploadWithSize = Object.assign(DicomUpload, {
|
||||||
|
containerClassName: 'max-w-3xl',
|
||||||
|
});
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
cinePlayer: CinePlayer,
|
cinePlayer: CinePlayer,
|
||||||
autoCineModalities: ['OT', 'US'],
|
autoCineModalities: ['OT', 'US'],
|
||||||
@ -11,6 +17,6 @@ export default {
|
|||||||
onBeforeDicomStore: ({ dicomDict, measurementData, naturalizedReport }) => {
|
onBeforeDicomStore: ({ dicomDict, measurementData, naturalizedReport }) => {
|
||||||
return dicomDict;
|
return dicomDict;
|
||||||
},
|
},
|
||||||
dicomUploadComponent: DicomUpload,
|
dicomUploadComponent: DicomUploadWithSize,
|
||||||
codingValues: {},
|
codingValues: {},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -524,6 +524,7 @@ function WorkList({
|
|||||||
DicomUploadComponent && dataSource.getConfig()?.dicomUploadEnabled
|
DicomUploadComponent && dataSource.getConfig()?.dicomUploadEnabled
|
||||||
? {
|
? {
|
||||||
title: 'Upload files',
|
title: 'Upload files',
|
||||||
|
containerClassName: DicomUploadComponent?.containerClassName,
|
||||||
closeButton: true,
|
closeButton: true,
|
||||||
shouldCloseOnEsc: false,
|
shouldCloseOnEsc: false,
|
||||||
shouldCloseOnOverlayClick: false,
|
shouldCloseOnOverlayClick: false,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user