import React from 'react'; import classnames from 'classnames'; import listComponentGenerator from './listComponentGenerator'; import './ViewportOverlay.css'; import { formatDICOMDate, formatDICOMTime, formatNumberPrecision, formatPN } from './utils'; interface OverlayItem { id: string; title: string; value?: (props: any) => string; condition?: (props: any) => boolean; contents?: (props: any) => { className: string; value: any }; generator?: (props: any) => any; } /** * * @param {*} config is a configuration object that defines four lists of elements, * one topLeft, topRight, bottomLeft, bottomRight contents. * @param {*} extensionManager is used to load the image data. * @returns */ export const generateFromConfig = ({ topLeft = [], topRight = [], bottomLeft = [], bottomRight = [], itemGenerator = () => {}, }: { topLeft?: OverlayItem[]; topRight?: OverlayItem[]; bottomLeft?: OverlayItem[]; bottomRight?: OverlayItem[]; itemGenerator?: (props: any) => any; }) => { return (props: any) => { const topLeftClass = 'top-viewport left-viewport text-primary-light'; const topRightClass = 'top-viewport right-viewport-scrollbar text-primary-light'; const bottomRightClass = 'bottom-viewport right-viewport-scrollbar text-primary-light'; const bottomLeftClass = 'bottom-viewport left-viewport text-primary-light'; const overlay = 'absolute pointer-events-none microscopy-viewport-overlay'; return ( <> {topLeft && topLeft.length > 0 && (