chore(prettier): full repo linting and code reformatting once and for all (#3627)
This commit is contained in:
1 parent
01500a2d4c
commit
9045ddaedc
656 files changed
+21737
-20628
No files matched your search
@@ -1,10 +1,4 @@
|
||||
import React, {
|
||||
createContext,
|
||||
useCallback,
|
||||
useContext,
|
||||
useEffect,
|
||||
useReducer,
|
||||
} from 'react';
|
||||
import React, { createContext, useCallback, useContext, useEffect, useReducer } from 'react';
|
||||
import merge from 'lodash.merge';
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
@@ -81,8 +75,7 @@ const determineActiveViewportId = (state: DefaultState, newViewports: Map) => {
|
||||
|
||||
// for the new viewports, we should rank them by the displaySetInstanceUIDs
|
||||
// they are displaying and the orientation then we can find the active viewport
|
||||
const currentActiveDisplaySetInstanceUIDs =
|
||||
currentActiveViewport.displaySetInstanceUIDs;
|
||||
const currentActiveDisplaySetInstanceUIDs = currentActiveViewport.displaySetInstanceUIDs;
|
||||
|
||||
// This doesn't take into account where stack viewport is converting to volumeViewport
|
||||
// since in stack viewport we don't have a concept of "orientation" as a string
|
||||
@@ -93,10 +86,8 @@ const determineActiveViewportId = (state: DefaultState, newViewports: Map) => {
|
||||
|
||||
const sortedViewports = Array.from(newViewports.values()).sort((a, b) => {
|
||||
// Compare orientations
|
||||
const aOrientationMatch =
|
||||
a.viewportOptions.orientation === currentOrientation;
|
||||
const bOrientationMatch =
|
||||
b.viewportOptions.orientation === currentOrientation;
|
||||
const aOrientationMatch = a.viewportOptions.orientation === currentOrientation;
|
||||
const bOrientationMatch = b.viewportOptions.orientation === currentOrientation;
|
||||
if (aOrientationMatch !== bOrientationMatch) {
|
||||
return bOrientationMatch - aOrientationMatch;
|
||||
}
|
||||
@@ -217,11 +208,7 @@ export function ViewportGridProvider({ children, service }) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const viewport = findOrCreateViewport(
|
||||
position,
|
||||
positionId,
|
||||
options
|
||||
);
|
||||
const viewport = findOrCreateViewport(position, positionId, options);
|
||||
|
||||
if (!viewport) {
|
||||
continue;
|
||||
@@ -243,9 +230,7 @@ export function ViewportGridProvider({ children, service }) {
|
||||
|
||||
let xPos, yPos, w, h;
|
||||
if (layoutOptions && layoutOptions[position]) {
|
||||
({ x: xPos, y: yPos, width: w, height: h } = layoutOptions[
|
||||
position
|
||||
]);
|
||||
({ x: xPos, y: yPos, width: w, height: h } = layoutOptions[position]);
|
||||
} else {
|
||||
w = 1 / numCols;
|
||||
h = 1 / numRows;
|
||||
@@ -260,10 +245,7 @@ export function ViewportGridProvider({ children, service }) {
|
||||
y: yPos,
|
||||
});
|
||||
|
||||
viewport.viewportLabel = getViewportLabel(
|
||||
viewports,
|
||||
viewport.viewportId
|
||||
);
|
||||
viewport.viewportLabel = getViewportLabel(viewports, viewport.viewportId);
|
||||
|
||||
if (!viewport.viewportOptions.presentationIds) {
|
||||
viewport.viewportOptions.presentationIds = ViewportGridService.getPresentationIds(
|
||||
@@ -275,9 +257,7 @@ export function ViewportGridProvider({ children, service }) {
|
||||
}
|
||||
|
||||
activeViewportIdToSet =
|
||||
activeViewportIdToSet ??
|
||||
determineActiveViewportId(state, viewports) ??
|
||||
'default';
|
||||
activeViewportIdToSet ?? determineActiveViewportId(state, viewports) ?? 'default';
|
||||
|
||||
const ret = {
|
||||
...state,
|
||||
@@ -308,10 +288,7 @@ export function ViewportGridProvider({ children, service }) {
|
||||
}
|
||||
};
|
||||
|
||||
const [viewportGridState, dispatch] = useReducer(
|
||||
viewportGridReducer,
|
||||
DEFAULT_STATE
|
||||
);
|
||||
const [viewportGridState, dispatch] = useReducer(viewportGridReducer, DEFAULT_STATE);
|
||||
|
||||
const getState = useCallback(() => {
|
||||
return viewportGridState;
|
||||
@@ -411,10 +388,8 @@ export function ViewportGridProvider({ children, service }) {
|
||||
const api = {
|
||||
getState,
|
||||
setActiveViewportId: index => service.setActiveViewportId(index),
|
||||
setDisplaySetsForViewport: props =>
|
||||
service.setDisplaySetsForViewports([props]),
|
||||
setDisplaySetsForViewports: props =>
|
||||
service.setDisplaySetsForViewports(props),
|
||||
setDisplaySetsForViewport: props => service.setDisplaySetsForViewports([props]),
|
||||
setDisplaySetsForViewports: props => service.setDisplaySetsForViewports(props),
|
||||
setLayout: layout => service.setLayout(layout),
|
||||
reset: () => service.reset(),
|
||||
set: gridLayoutState => service.setState(gridLayoutState), // run it through the service itself since we want to publish events
|
||||
|
||||
Reference in new issue
Block a user