Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): move to React 18 and base for using shadcn/ui #4174

Merged
merged 30 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
918409c
chore: Add UI components Button, Toaster, and ThemeWrapper
sedghi May 22, 2024
2cc9158
chore: Update tailwindcss version to 3.2.4 and button default variant…
sedghi May 23, 2024
d2aace1
chore: Remove Toaster component and update imports in index files
sedghi May 23, 2024
dd472b2
chore: Update Button component imports and tailwind.css
sedghi May 24, 2024
9d8267f
chore: Update Button component imports and button variants in Button …
sedghi May 24, 2024
f2cf1a8
chore: Update Button component imports and button variants in Button …
sedghi May 24, 2024
9c87fa5
chore: Update React version to "^18.3.1" in package.json files
sedghi May 24, 2024
e690cd5
move away from deafult props
sedghi May 24, 2024
84eee12
feat: Add Popover and Combobox components
sedghi May 24, 2024
0edf1d6
chore: Update Dialog component imports and add untrack series confirm…
sedghi May 24, 2024
f76ede4
Merge branch 'master' of github.com:OHIF/Viewers into feat/workers-ui-ux
sedghi May 24, 2024
b8d9adf
fix icons, cypress
IbrahimCSAE May 25, 2024
78fa6c2
memory fix
IbrahimCSAE May 25, 2024
bbd7f48
undo
IbrahimCSAE May 25, 2024
1fbf5ce
undo
IbrahimCSAE May 26, 2024
17b780d
update react-resize-detector
IbrahimCSAE May 26, 2024
f1e706f
xlarge resource class
IbrahimCSAE May 27, 2024
fcd838f
Try large since xlarge is unavailable
IbrahimCSAE May 27, 2024
9ff4582
check for undefined
IbrahimCSAE May 27, 2024
315467f
date picker replacement
IbrahimCSAE May 27, 2024
077f380
fix small bug
IbrahimCSAE May 27, 2024
0b1867b
update
sedghi May 27, 2024
1783430
Merge branch 'feat/workers-ui-ux' of github.com:OHIF/Viewers into fea…
sedghi May 27, 2024
fabf768
chore: Remove unused imports and update calendar caption layout
sedghi May 27, 2024
bb7071b
chore: Update calendar caption layout and remove unused imports
sedghi May 27, 2024
7890561
chore: Update calendar caption layout and remove unused imports
sedghi May 27, 2024
29fa404
feat: Update defaultMonth in DatePickerWithRange component
sedghi May 27, 2024
64f3744
fix: Update DatePickerWithRange component to handle input changes
sedghi May 27, 2024
68e6655
update
sedghi May 27, 2024
00c73b6
chore: Update date range input selectors in Cypress tests
sedghi May 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
###
UNIT_TESTS:
<<: *defaults
resource_class: large
steps:
# Update yarn
- run: yarn -v
Expand Down Expand Up @@ -98,6 +99,7 @@ jobs:
###
BUILD:
<<: *defaults
resource_class: large
steps:
# Checkout code and ALL Git Tags
- checkout
Expand Down Expand Up @@ -146,6 +148,7 @@ jobs:
# just to make sure later on we can publish them
BUILD_PACKAGES_QUICK:
<<: *defaults
resource_class: large
steps:
- run: yarn -v
# Checkout code and ALL Git Tags
Expand Down Expand Up @@ -195,6 +198,7 @@ jobs:
###
NPM_PUBLISH:
<<: *defaults
resource_class: large
steps:
- run: yarn -v
# Checkout code and ALL Git Tags
Expand Down Expand Up @@ -264,6 +268,7 @@ jobs:

DOCKER_RELEASE_PUBLISH:
<<: *defaults
resource_class: large
steps:
- attach_workspace:
at: ~/repo
Expand Down Expand Up @@ -293,6 +298,7 @@ jobs:

DOCKER_BETA_PUBLISH:
<<: *defaults
resource_class: large
steps:
- attach_workspace:
at: ~/repo
Expand Down Expand Up @@ -397,6 +403,7 @@ jobs:
default: ''
description: Directory containing package.json
type: string
resource_class: large
steps:
- cypress/install:
cypress-cache-key: << parameters.cypress-cache-key >>
Expand Down
32 changes: 32 additions & 0 deletions .webpack/webpack.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,38 @@ module.exports = (env, argv, { SRC_DIR, ENTRY }) => {
module: {
noParse: [/(codec)/, /(dicomicc)/],
rules: [
{
test: /\.svg?$/,
oneOf: [
{
use: [
{
loader: '@svgr/webpack',
options: {
svgoConfig: {
plugins: [
{
name: 'preset-default',
params: {
overrides: {
removeViewBox: false
},
},
},
]
},
prettier: false,
svgo: true,
titleProp: true,
},
},
],
issuer: {
and: [/\.(ts|tsx|js|jsx|md|mdx)$/],
},
},
],
},
{
test: /\.js$/,
enforce: 'pre',
Expand Down
17 changes: 0 additions & 17 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,6 @@ module.exports = {
babelrcRoots: ['./platform/*', './extensions/*', './modes/*'],
presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'],
plugins: [
[
'inline-react-svg',
{
svgo: {
plugins: [
{
name: 'preset-default',
params: {
overrides: {
removeViewBox: false,
},
},
},
],
},
},
],
['@babel/plugin-proposal-class-properties', { loose: true }],
'@babel/plugin-transform-typescript',
['@babel/plugin-proposal-private-property-in-object', { loose: true }],
Expand Down
2 changes: 1 addition & 1 deletion extensions/cornerstone-dicom-rt/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
plugins: ['inline-react-svg', '@babel/plugin-proposal-class-properties'],
plugins: ['@babel/plugin-proposal-class-properties'],
env: {
test: {
presets: [
Expand Down
4 changes: 2 additions & 2 deletions extensions/cornerstone-dicom-rt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"@ohif/extension-default": "3.9.0-beta.21",
"@ohif/i18n": "3.9.0-beta.21",
"prop-types": "^15.6.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-i18next": "^10.11.0",
"react-router": "^6.3.0",
"react-router-dom": "^6.3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,6 @@ OHIFCornerstoneRTViewport.propTypes = {
viewportId: PropTypes.string.isRequired,
dataSource: PropTypes.object,
children: PropTypes.node,
customProps: PropTypes.object,
};

OHIFCornerstoneRTViewport.defaultProps = {
customProps: {},
};

function _getReferencedDisplaySetMetadata(referencedDisplaySet) {
Expand Down
2 changes: 1 addition & 1 deletion extensions/cornerstone-dicom-seg/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
plugins: ['inline-react-svg', '@babel/plugin-proposal-class-properties'],
plugins: ['@babel/plugin-proposal-class-properties'],
env: {
test: {
presets: [
Expand Down
4 changes: 2 additions & 2 deletions extensions/cornerstone-dicom-seg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"@ohif/extension-default": "3.9.0-beta.21",
"@ohif/i18n": "3.9.0-beta.21",
"prop-types": "^15.6.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-i18next": "^12.2.2",
"react-router": "^6.8.1",
"react-router-dom": "^6.8.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,6 @@ OHIFCornerstoneSEGViewport.propTypes = {
viewportId: PropTypes.string.isRequired,
dataSource: PropTypes.object,
children: PropTypes.node,
customProps: PropTypes.object,
};

OHIFCornerstoneSEGViewport.defaultProps = {
customProps: {},
};

function _getReferencedDisplaySetMetadata(referencedDisplaySet, segDisplaySet) {
Expand Down
2 changes: 1 addition & 1 deletion extensions/cornerstone-dicom-sr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"dicom-parser": "^1.8.9",
"hammerjs": "^2.0.8",
"prop-types": "^15.6.2",
"react": "^17.0.2"
"react": "^18.3.1"
},
"dependencies": {
"@babel/runtime": "^7.20.13",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,16 +367,11 @@ OHIFCornerstoneSRViewport.propTypes = {
dataSource: PropTypes.object,
children: PropTypes.node,
viewportLabel: PropTypes.string,
customProps: PropTypes.object,
viewportOptions: PropTypes.object,
servicesManager: PropTypes.object.isRequired,
extensionManager: PropTypes.instanceOf(ExtensionManager).isRequired,
};

OHIFCornerstoneSRViewport.defaultProps = {
customProps: {},
};

async function _getViewportReferencedDisplaySetData(
displaySet,
measurementSelected,
Expand Down
2 changes: 1 addition & 1 deletion extensions/cornerstone-dynamic-volume/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"dicom-parser": "^1.8.21",
"hammerjs": "^2.0.8",
"prop-types": "^15.6.2",
"react": "^17.0.2"
"react": "^18.3.1"
},
"dependencies": {
"@babel/runtime": "^7.20.13",
Expand Down
6 changes: 3 additions & 3 deletions extensions/cornerstone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
"dicom-parser": "^1.8.21",
"hammerjs": "^2.0.8",
"prop-types": "^15.6.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-resize-detector": "^6.7.6"
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-resize-detector": "^10.0.1"
},
"devDependencies": {
"lodash": "^4.17.21"
Expand Down
22 changes: 10 additions & 12 deletions extensions/cornerstone/src/Viewport/OHIFCornerstoneViewport.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useRef, useCallback, useState } from 'react';
import ReactResizeDetector from 'react-resize-detector';
import { useResizeDetector } from 'react-resize-detector';
import PropTypes from 'prop-types';
import * as cs3DTools from '@cornerstonejs/tools';
import {
Expand Down Expand Up @@ -109,7 +109,7 @@ const OHIFCornerstoneViewport = React.memo((props: withAppTypes) => {
onElementEnabled,
// eslint-disable-next-line react/prop-types
onElementDisabled,
isJumpToMeasurementDisabled,
isJumpToMeasurementDisabled = false,
// Note: you SHOULD NOT use the initialImageIdOrIndex for manipulation
// of the imageData in the OHIFCornerstoneViewport. This prop is used
// to set the initial state of the viewport's first image to render
Expand Down Expand Up @@ -140,7 +140,7 @@ const OHIFCornerstoneViewport = React.memo((props: withAppTypes) => {

const [scrollbarHeight, setScrollbarHeight] = useState('100px');
const [enabledVPElement, setEnabledVPElement] = useState(null);
const elementRef = useRef();
const elementRef = useRef() as React.MutableRefObject<HTMLDivElement>;
const [appConfig] = useAppConfig();

const {
Expand Down Expand Up @@ -417,19 +417,21 @@ const OHIFCornerstoneViewport = React.memo((props: withAppTypes) => {
});
}, [displaySets, viewportId, viewportActionCornersService, servicesManager, commandsManager]);

const { ref: resizeRef } = useResizeDetector({
onResize,
});
return (
<React.Fragment>
<div className="viewport-wrapper">
<ReactResizeDetector
onResize={onResize}
targetRef={elementRef.current}
/>
<div
className="cornerstone-viewport-element"
style={{ height: '100%', width: '100%' }}
onContextMenu={e => e.preventDefault()}
onMouseDown={e => e.preventDefault()}
ref={elementRef}
ref={el => {
resizeRef.current = el;
elementRef.current = el;
}}
></div>
<CornerstoneOverlays
viewportId={viewportId}
Expand Down Expand Up @@ -683,10 +685,6 @@ function _rehydrateSynchronizers(
// Component displayName
OHIFCornerstoneViewport.displayName = 'OHIFCornerstoneViewport';

OHIFCornerstoneViewport.defaultProps = {
isJumpToMeasurementDisabled: false,
};

OHIFCornerstoneViewport.propTypes = {
displaySets: PropTypes.array.isRequired,
dataSource: PropTypes.object.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,8 @@ function ViewportImageSliceLoadingIndicator({ viewportData, element }) {
}

ViewportImageSliceLoadingIndicator.propTypes = {
percentComplete: PropTypes.number,
error: PropTypes.object,
element: PropTypes.object,
};

ViewportImageSliceLoadingIndicator.defaultProps = {
percentComplete: 0,
error: null,
};

export default ViewportImageSliceLoadingIndicator;
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,6 @@ function ViewportOrientationMarkers({
return <div className="ViewportOrientationMarkers select-none">{markers}</div>;
}

ViewportOrientationMarkers.propTypes = {
percentComplete: PropTypes.number,
error: PropTypes.object,
};

ViewportOrientationMarkers.defaultProps = {
percentComplete: 0,
error: null,
};

/**
*
* Computes the orientation labels on a Cornerstone-enabled Viewport element
Expand Down
2 changes: 1 addition & 1 deletion extensions/cornerstone/src/initCineService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function _getVolumesFromViewport(viewport) {
}

function _getVolumeFromViewport(viewport) {
const volumes = _getVolumesFromViewport(viewport);
const volumes = _getVolumesFromViewport(viewport).filter(volume => volume);
const dynamicVolume = volumes.find(volume => volume.isDynamicVolume());

return dynamicVolume ?? volumes[0];
Expand Down
4 changes: 2 additions & 2 deletions extensions/default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"dcmjs": "^0.29.12",
"dicomweb-client": "^0.10.4",
"prop-types": "^15.6.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-i18next": "^12.2.2",
"react-window": "^1.8.9",
"webpack": "^5.50.0",
Expand Down
14 changes: 7 additions & 7 deletions extensions/default/src/Toolbar/LegacyLayoutSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import React, { useEffect, useState, useCallback } from 'react';
import PropTypes from 'prop-types';
import { LayoutSelector as OHIFLayoutSelector, ToolbarButton } from '@ohif/ui';

function LegacyLayoutSelectorWithServices({ servicesManager, ...props }: withAppTypes) {
function LegacyLayoutSelectorWithServices({
servicesManager,
rows = 3,
columns = 3,
onLayoutChange = () => {},
...props
}) {
const { toolbarService } = servicesManager.services;

const onSelection = useCallback(
Expand Down Expand Up @@ -78,10 +84,4 @@ LayoutSelector.propTypes = {
servicesManager: PropTypes.object.isRequired,
};

LayoutSelector.defaultProps = {
rows: 3,
columns: 3,
onLayoutChange: () => {},
};

export default LegacyLayoutSelectorWithServices;
11 changes: 3 additions & 8 deletions extensions/default/src/Toolbar/ToolbarLayoutSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ function ToolbarLayoutSelectorWithServices({
}

function LayoutSelector({
rows,
columns,
rows = 3,
columns = 4,
onLayoutChange = () => {},
className,
onSelection,
onSelectionPreset,
Expand Down Expand Up @@ -242,10 +243,4 @@ LayoutSelector.propTypes = {
servicesManager: PropTypes.object.isRequired,
};

LayoutSelector.defaultProps = {
columns: 4,
rows: 3,
onLayoutChange: () => {},
};

export default ToolbarLayoutSelectorWithServices;
Loading
Loading