chore: Upgrade to webpack 5, fix conflicting issues with react-router under docusaurus with yarn workspaces

This commit is contained in:
Erik Ziegler committed 2021-07-08 15:23:09 +02:00
1 parent de412f2eef
commit 825e13bcf3
20 files changed
+825 -1992

No files matched your search

+6 -8
View File
@@ -2,19 +2,16 @@ import React from 'react';
import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next';
import classNames from 'classnames';
// TODO: This may fail if package is split from PWA build
import { useNavigate } from 'react-router-dom';
import { NavBar, Svg, Icon, IconButton, Dropdown } from '@ohif/ui';
function Header({ children, menuOptions, isReturnEnabled, isSticky, WhiteLabeling }) {
function Header({ children, menuOptions, isReturnEnabled, onClickReturnButton, isSticky, WhiteLabeling }) {
const { t } = useTranslation('Header');
const navigate = useNavigate();
// TODO: this should be passed in as a prop instead and the react-router-dom
// dependency should be dropped
const onReturnHandler = () => {
if (isReturnEnabled) {
navigate('/');
const onClickReturn = () => {
if (isReturnEnabled && onClickReturnButton) {
onClickReturnButton()
}
};
@@ -30,7 +27,7 @@ function Header({ children, menuOptions, isReturnEnabled, isSticky, WhiteLabelin
// Either injected service? Or context (like react router's `useLocation`?) */}
<div
className={classNames("inline-flex items-center mr-3", isReturnEnabled && 'cursor-pointer')}
onClick={onReturnHandler}
onClick={onClickReturn}
>
{isReturnEnabled && <Icon name="chevron-left" className="w-8 text-primary-active" />}
<div className="ml-4">{WhiteLabeling ? CustomLogo(React) : <Svg name="logo-ohif" />}</div>
@@ -78,6 +75,7 @@ Header.propTypes = {
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
isReturnEnabled: PropTypes.bool,
isSticky: PropTypes.bool,
onClickReturnButton: PropTypes.func,
WhiteLabeling: PropTypes.element,
};
@@ -24,6 +24,7 @@ const Thumbnail = ({
// this will still allow for "drag", even if there is no drop target for the
// specified item.
const [collectedProps, drag, dragPreview] = useDrag({
type: "displayset",
item: { ...dragData },
canDrag: function(monitor) {
return Object.keys(dragData).length !== 0;
@@ -18,6 +18,7 @@ const ThumbnailNoImage = ({
isActive,
}) => {
const [collectedProps, drag, dragPreview] = useDrag({
type: "displayset",
item: { ...dragData },
canDrag: function(monitor) {
return Object.keys(dragData).length !== 0;
@@ -1,7 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import { DndProvider } from 'react-dnd';
import HTML5Backend from 'react-dnd-html5-backend';
import { HTML5Backend } from 'react-dnd-html5-backend';
// import TouchBackend from 'react-dnd-touch-backend';
// TODO: this is false when it should not be :thinking: