mirror of https://gitlab.com/ecentrics/concordia
Ezerous
4 years ago
10 changed files with 132 additions and 126 deletions
@ -1,4 +0,0 @@ |
|||
#topic-list{ |
|||
height: auto; |
|||
clear: both; |
|||
} |
@ -1,67 +0,0 @@ |
|||
import React, { useMemo } from 'react'; |
|||
import { Button, Header } from 'semantic-ui-react'; |
|||
import { useSelector } from 'react-redux'; |
|||
import { useHistory } from 'react-router'; |
|||
import { useTranslation } from 'react-i18next'; |
|||
import PropTypes from 'prop-types'; |
|||
import PaginatedTopicList from '../../../components/Pagination/PaginatedTopicList'; |
|||
import './styles.css'; |
|||
|
|||
const Board = (props) => { |
|||
const { numberOfTopics } = props; |
|||
const hasSignedUp = useSelector((state) => state.user.hasSignedUp); |
|||
const history = useHistory(); |
|||
const { t } = useTranslation(); |
|||
|
|||
const boardContents = useMemo(() => ( |
|||
<> |
|||
{hasSignedUp |
|||
? ( |
|||
<Button |
|||
id="new-topic-button" |
|||
className="primary-button" |
|||
content="New Topic" |
|||
icon="plus" |
|||
labelPosition="left" |
|||
positive |
|||
onClick={() => history.push('/topics/new')} |
|||
/> |
|||
) |
|||
: null} |
|||
{/* eslint-disable-next-line no-nested-ternary */} |
|||
{numberOfTopics > 0 |
|||
// eslint-disable-next-line react/jsx-no-undef |
|||
? (<PaginatedTopicList />) |
|||
: (!hasSignedUp |
|||
? ( |
|||
<div id="no-topic-message" className="vertical-center-in-parent unselectable"> |
|||
<Header textAlign="center" as="h2"> |
|||
{t('board.header.no.topics.message')} |
|||
</Header> |
|||
<Header textAlign="center" as="h3"> |
|||
{t('board.sub.header.no.topics.guest')} |
|||
</Header> |
|||
</div> |
|||
) |
|||
: ( |
|||
<div id="no-topic-message" className="vertical-center-in-parent unselectable"> |
|||
<Header textAlign="center" as="h2"> |
|||
{t('board.header.no.topics.message')} |
|||
</Header> |
|||
<Header textAlign="center" as="h3"> |
|||
{t('board.sub.header.no.topics.user')} |
|||
</Header> |
|||
</div> |
|||
))} |
|||
|
|||
</> |
|||
), [numberOfTopics, hasSignedUp, t, history]); |
|||
|
|||
return (boardContents); |
|||
}; |
|||
|
|||
Board.propTypes = { |
|||
numberOfTopics: PropTypes.number.isRequired, |
|||
}; |
|||
|
|||
export default Board; |
@ -1,15 +0,0 @@ |
|||
#no-topic-message { |
|||
padding-top: 22rem; |
|||
clear: both; |
|||
} |
|||
|
|||
#no-topic-message > .header { |
|||
color: white; |
|||
} |
|||
|
|||
#new-topic-button{ |
|||
float:right; |
|||
margin-top: 1px; |
|||
margin-bottom: 2em; |
|||
margin-right: 0; |
|||
} |
@ -1,3 +1,19 @@ |
|||
#home-container { |
|||
height: 100%; |
|||
} |
|||
} |
|||
|
|||
#no-topic-message { |
|||
padding-top: 22rem; |
|||
clear: both; |
|||
} |
|||
|
|||
#no-topic-message > .header { |
|||
color: white; |
|||
} |
|||
|
|||
#new-topic-button{ |
|||
float:right; |
|||
margin-top: 1px; |
|||
margin-bottom: 2em; |
|||
margin-right: 0; |
|||
} |
|||
|
Loading…
Reference in new issue