Skip to content

Commit

Permalink
PS-601 fix uploader multi target
Browse files Browse the repository at this point in the history
  • Loading branch information
4rthem committed Jan 2, 2024
1 parent 037251b commit 5be3b21
Show file tree
Hide file tree
Showing 19 changed files with 50 additions and 109 deletions.
1 change: 0 additions & 1 deletion expose/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"react-image-gallery": "^0.9.1",
"react-image-magnifiers": "^1.3.2",
"react-images": "^1.1.7",
"react-loader-spinner": "^3.1.4",
"sass": "^1.44.0",
"sass-loader": "^8.0.0",
"universal-cookie": "^4.0.2",
Expand Down
2 changes: 1 addition & 1 deletion expose/client/src/component/ConfigWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import config from '../config';
import FullPageLoader from './FullPageLoader';
import {FullPageLoader} from '@alchemy/phrasea-ui';
import apiClient from '../lib/api-client';
import Root from './Root.tsx';

Expand Down
6 changes: 4 additions & 2 deletions expose/client/src/component/EmbeddedAsset.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useEffect} from 'react';
import FullPageLoader from './FullPageLoader';
import {FullPageLoader} from '@alchemy/phrasea-ui';
import {Asset} from '../types';
import AssetProxy from './layouts/shared-components/AssetProxy';
import {loadAsset} from './api';
Expand Down Expand Up @@ -38,7 +38,9 @@ export default function EmbeddedAsset({id}: Props) {
}

if (!data) {
return <FullPageLoader />;
return <FullPageLoader
backdrop={false}
/>;
}

const {publication} = data;
Expand Down
17 changes: 0 additions & 17 deletions expose/client/src/component/FullPageLoader.jsx

This file was deleted.

6 changes: 4 additions & 2 deletions expose/client/src/component/index/PublicationIndex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import moment from 'moment';
import SortImg from '../../images/sort.svg?react';
import {Dropdown, DropdownButton} from 'react-bootstrap';
import {Logo} from '../Logo';
import FullPageLoader from '../FullPageLoader';
import {FullPageLoader} from '@alchemy/phrasea-ui';
import {getThumbPlaceholder} from '../layouts/shared-components/placeholders';
import apiClient from '../../lib/api-client';
import {useTranslation} from 'react-i18next';
Expand Down Expand Up @@ -113,7 +113,9 @@ export default function PublicationIndex({}: Props) {
</div>
))
) : (
<FullPageLoader />
<FullPageLoader
backdrop={false}
/>
)}
</div>
</div>
Expand Down
6 changes: 4 additions & 2 deletions expose/client/src/component/layouts/grid/GridLayout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import AssetProxy from '../shared-components/AssetProxy';
import PublicationHeader from '../shared-components/PublicationHeader';
import {Trans} from 'react-i18next';
import FullPageLoader from '../../FullPageLoader';
import {FullPageLoader} from '@alchemy/phrasea-ui';
import {logAssetView} from '../../../lib/log';
import {getThumbPlaceholder} from '../shared-components/placeholders';

Expand Down Expand Up @@ -117,7 +117,9 @@ class GridLayout extends React.Component {

renderGallery() {
if (!this.state.thumbsLoaded) {
return <FullPageLoader />;
return <FullPageLoader
backdrop={false}
/>;
}

const {downloadEnabled} = this.props.data;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {PropsWithChildren} from 'react';
import {Publication} from '../../types';
import {securityMethods} from './methods';
import FullPageLoader from '../FullPageLoader';
import {FullPageLoader} from '@alchemy/phrasea-ui';
import {logPublicationView} from '../../lib/log';
import {keycloakClient} from '../../lib/api-client';

Expand All @@ -28,7 +28,9 @@ export default function PublicationSecurityProxy({
};

if (!publication) {
return <FullPageLoader />;
return <FullPageLoader
backdrop={false}
/>;
}

const {
Expand Down
2 changes: 0 additions & 2 deletions expose/client/src/scss/FullPageLoader.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import "react-loader-spinner/dist/loader/css/react-spinner-loader.css";

html {
min-height: 100%;
}
Expand Down
31 changes: 18 additions & 13 deletions lib/js/phrasea-ui/src/components/FullPageLoader.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
import {CircularProgress} from "@mui/material";
import {Backdrop, CircularProgress} from "@mui/material";

type Props = {};
type Props = {
open?: boolean;
backdrop?: boolean;
};

export default function FullPageLoader({}: Props) {
return <div style={{
background: 'rgba(0,0,0,0.3)',
position: 'absolute',
height: '100vh',
width: '100vw',
display: 'flex',
alignItems: 'center',
justifyContent: 'center'
}}>
export default function FullPageLoader({
open = true,
backdrop = true,
}: Props) {
return <Backdrop
sx={{
color: '#fff',
zIndex: (theme) => theme.zIndex.drawer + 1
}}
open={open}
invisible={!backdrop}
>
<CircularProgress/>
</div>
</Backdrop>
}
22 changes: 3 additions & 19 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion uploader/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"react-dom": "^18.2.0",
"react-dropzone": "^14.2.1",
"react-i18next": "^11.15.1",
"react-loader-spinner": "^3.1.14",
"react-redux": "^9.0.4",
"react-toastify": "^9.1.3",
"redux": "^4.2.1",
Expand Down
17 changes: 0 additions & 17 deletions uploader/client/src/components/FullPageLoader.jsx

This file was deleted.

2 changes: 1 addition & 1 deletion uploader/client/src/components/page/FormEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {Button, Form} from 'react-bootstrap';
import FormPreview from '../FormPreview';
import Container from '../Container';
import {getFormSchema, getTargets} from '../../requests';
import FullPageLoader from '../FullPageLoader';
import {FullPageLoader} from '@alchemy/phrasea-ui';
import apiClient from '../../lib/apiClient';

export default class FormEditor extends Component {
Expand Down
9 changes: 6 additions & 3 deletions uploader/client/src/components/page/SelectTarget.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import '../../scss/Upload.scss';
import {getTargets} from '../../requests';
import Container from '../Container';
import {getPath, Link, useNavigate} from '@alchemy/navigation';
import FullPageLoader from '../FullPageLoader';
import {FullPageLoader} from '@alchemy/phrasea-ui';
import {Translation} from 'react-i18next';
import {routes} from '../../routes';


export default function SelectTarget() {
const [targets, setTargets] = useState();
const navigate = useNavigate();
Expand All @@ -21,8 +22,10 @@ export default function SelectTarget() {
}
}, [targets]);

if (!targets || targets?.length) {
return <FullPageLoader />;
if (!targets || targets?.length === 1) {
return <FullPageLoader
backdrop={false}
/>;
}

return (
Expand Down
2 changes: 1 addition & 1 deletion uploader/client/src/components/page/TargetDataEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, {Component} from 'react';
import {Button, Form} from 'react-bootstrap';
import Container from '../Container';
import {getTargetParams, getTargets} from '../../requests';
import FullPageLoader from '../FullPageLoader';
import {FullPageLoader} from '@alchemy/phrasea-ui';
import apiClient from '../../lib/apiClient';

export default class TargetDataEditor extends Component {
Expand Down
6 changes: 4 additions & 2 deletions uploader/client/src/components/page/Upload.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import config from '../../config';
import {getTarget} from '../../requests';
import UploadBatch from '../../uploadBatch';
import {retrieveImageFromClipboardAsBlob} from '../ImagePaste';
import FullPageLoader from '../FullPageLoader';
import {FullPageLoader} from '@alchemy/phrasea-ui';
import {withRouter} from '../withRouter';
import {routes} from '../../routes';

Expand Down Expand Up @@ -214,7 +214,9 @@ class Upload extends Component {
);
}
if (!target) {
return <FullPageLoader />;
return <FullPageLoader
backdrop={false}
/>;
}

return (
Expand Down
1 change: 0 additions & 1 deletion uploader/client/src/oauth.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, {PureComponent} from 'react';
import config from './config';
import {KeycloakClient} from '@alchemy/auth';
// import PropTypes from "prop-types";
import FullPageLoader from './components/FullPageLoader';

export const keycloakClient = new KeycloakClient({
clientId: config.clientId,
Expand Down
1 change: 0 additions & 1 deletion uploader/client/src/scss/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
@import "variables";
@import "bootstrap/scss/bootstrap";
@import "Menu";
@import "FullPageLoader";
@import "Target";

body {
Expand Down
21 changes: 0 additions & 21 deletions uploader/client/src/scss/FullPageLoader.scss

This file was deleted.

0 comments on commit 5be3b21

Please sign in to comment.