2020-05-26 00:46:04 +05:00
|
|
|
import React from 'react';
|
2020-05-16 04:09:46 +05:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
import classNames from 'classnames';
|
|
|
|
|
import { useTranslation, Trans } from 'react-i18next';
|
2022-12-26 21:10:50 +01:00
|
|
|
import { Icon, Loader } from 'semantic-ui-react';
|
2020-05-16 04:09:46 +05:00
|
|
|
|
|
|
|
|
import ProjectsContainer from '../../containers/ProjectsContainer';
|
2022-12-26 21:10:50 +01:00
|
|
|
import BoardContainer from '../../containers/BoardContainer';
|
2020-05-16 04:09:46 +05:00
|
|
|
|
2020-05-29 19:31:19 +05:00
|
|
|
import styles from './Static.module.scss';
|
2020-05-16 04:09:46 +05:00
|
|
|
|
2022-12-26 21:10:50 +01:00
|
|
|
function Static({ projectId, cardId, board }) {
|
2020-05-16 04:09:46 +05:00
|
|
|
const [t] = useTranslation();
|
|
|
|
|
|
|
|
|
|
if (projectId === undefined) {
|
|
|
|
|
return (
|
2022-12-26 21:10:50 +01:00
|
|
|
<div className={styles.wrapper}>
|
2020-05-16 04:09:46 +05:00
|
|
|
<ProjectsContainer />
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (cardId === null) {
|
|
|
|
|
return (
|
2022-12-26 21:10:50 +01:00
|
|
|
<div className={classNames(styles.wrapper, styles.wrapperFlex)}>
|
2020-05-16 04:09:46 +05:00
|
|
|
<div className={styles.message}>
|
|
|
|
|
<h1>
|
|
|
|
|
{t('common.cardNotFound', {
|
|
|
|
|
context: 'title',
|
|
|
|
|
})}
|
|
|
|
|
</h1>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-26 21:10:50 +01:00
|
|
|
if (board === null) {
|
2020-05-16 04:09:46 +05:00
|
|
|
return (
|
2022-12-26 21:10:50 +01:00
|
|
|
<div className={classNames(styles.wrapper, styles.wrapperFlex)}>
|
2020-05-16 04:09:46 +05:00
|
|
|
<div className={styles.message}>
|
|
|
|
|
<h1>
|
|
|
|
|
{t('common.boardNotFound', {
|
|
|
|
|
context: 'title',
|
|
|
|
|
})}
|
|
|
|
|
</h1>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (projectId === null) {
|
|
|
|
|
return (
|
2022-12-26 21:10:50 +01:00
|
|
|
<div className={classNames(styles.wrapper, styles.wrapperFlex)}>
|
2020-05-16 04:09:46 +05:00
|
|
|
<div className={styles.message}>
|
|
|
|
|
<h1>
|
|
|
|
|
{t('common.projectNotFound', {
|
|
|
|
|
context: 'title',
|
|
|
|
|
})}
|
|
|
|
|
</h1>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-26 21:10:50 +01:00
|
|
|
if (board === undefined) {
|
2020-05-16 04:09:46 +05:00
|
|
|
return (
|
2022-12-26 21:10:50 +01:00
|
|
|
<div className={classNames(styles.wrapper, styles.wrapperFlex, styles.wrapperProject)}>
|
2020-05-16 04:09:46 +05:00
|
|
|
<div className={styles.message}>
|
|
|
|
|
<Icon inverted name="hand point up outline" size="huge" className={styles.messageIcon} />
|
|
|
|
|
<h1 className={styles.messageTitle}>
|
|
|
|
|
{t('common.openBoard', {
|
|
|
|
|
context: 'title',
|
|
|
|
|
})}
|
|
|
|
|
</h1>
|
|
|
|
|
<div className={styles.messageContent}>
|
|
|
|
|
<Trans i18nKey="common.createNewOneOrSelectExistingOne" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-26 21:10:50 +01:00
|
|
|
if (board.isFetching) {
|
|
|
|
|
return (
|
|
|
|
|
<div className={classNames(styles.wrapper, styles.wrapperLoader, styles.wrapperProject)}>
|
|
|
|
|
<Loader active size="big" />
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-16 04:09:46 +05:00
|
|
|
return (
|
2022-12-26 21:10:50 +01:00
|
|
|
<div className={classNames(styles.wrapper, styles.wrapperFlex, styles.wrapperBoard)}>
|
|
|
|
|
<BoardContainer />
|
2020-05-16 04:09:46 +05:00
|
|
|
</div>
|
|
|
|
|
);
|
2022-02-09 00:56:01 +05:00
|
|
|
}
|
2020-05-16 04:09:46 +05:00
|
|
|
|
2020-05-29 19:31:19 +05:00
|
|
|
Static.propTypes = {
|
2020-05-16 04:09:46 +05:00
|
|
|
projectId: PropTypes.string,
|
2022-12-26 21:10:50 +01:00
|
|
|
cardId: PropTypes.string,
|
|
|
|
|
board: PropTypes.object, // eslint-disable-line react/forbid-prop-types
|
2020-05-16 04:09:46 +05:00
|
|
|
};
|
|
|
|
|
|
2020-05-29 19:31:19 +05:00
|
|
|
Static.defaultProps = {
|
2020-05-16 04:09:46 +05:00
|
|
|
projectId: undefined,
|
2022-12-26 21:10:50 +01:00
|
|
|
cardId: undefined,
|
|
|
|
|
board: undefined,
|
2020-05-16 04:09:46 +05:00
|
|
|
};
|
|
|
|
|
|
2020-05-29 19:31:19 +05:00
|
|
|
export default Static;
|