|
|
@ -16,9 +16,7 @@ const Board = (props) => { |
|
|
|
const history = useHistory(); |
|
|
|
const { t } = useTranslation(); |
|
|
|
|
|
|
|
const boardContents = useMemo(() => { |
|
|
|
if (numberOfTopics > 0) { |
|
|
|
return ( |
|
|
|
const boardContents = useMemo(() => ( |
|
|
|
<> |
|
|
|
{hasSignedUp |
|
|
|
? ( |
|
|
@ -32,11 +30,11 @@ const Board = (props) => { |
|
|
|
/> |
|
|
|
) |
|
|
|
: null} |
|
|
|
<TopicList topicIds={_.rangeRight(0, numberOfTopics)} /> |
|
|
|
</> |
|
|
|
); |
|
|
|
} if (!hasSignedUp) { |
|
|
|
return ( |
|
|
|
{/* eslint-disable-next-line no-nested-ternary */} |
|
|
|
{numberOfTopics > 0 |
|
|
|
? (<TopicList topicIds={_.rangeRight(0, numberOfTopics)} />) |
|
|
|
: (!hasSignedUp |
|
|
|
? ( |
|
|
|
<div id="no-topic-message" className="vertical-center-in-parent"> |
|
|
|
<Header textAlign="center" as="h2"> |
|
|
|
{t('board.header.no.topics.message')} |
|
|
@ -45,19 +43,8 @@ const Board = (props) => { |
|
|
|
{t('board.sub.header.no.topics.guest')} |
|
|
|
</Header> |
|
|
|
</div> |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
return ( |
|
|
|
<> |
|
|
|
<Button |
|
|
|
content="New Topic" |
|
|
|
icon="plus" |
|
|
|
labelPosition="left" |
|
|
|
positive |
|
|
|
id="new-topic-button" |
|
|
|
onClick={() => history.push('/topics/new')} |
|
|
|
/> |
|
|
|
) |
|
|
|
: ( |
|
|
|
<div id="no-topic-message" className="vertical-center-in-parent"> |
|
|
|
<Header textAlign="center" as="h2"> |
|
|
|
{t('board.header.no.topics.message')} |
|
|
@ -66,10 +53,10 @@ const Board = (props) => { |
|
|
|
{t('board.sub.header.no.topics.user')} |
|
|
|
</Header> |
|
|
|
</div> |
|
|
|
</> |
|
|
|
))} |
|
|
|
|
|
|
|
); |
|
|
|
}, [numberOfTopics, hasSignedUp, t, history]); |
|
|
|
</> |
|
|
|
), [numberOfTopics, hasSignedUp, t, history]); |
|
|
|
|
|
|
|
return (boardContents); |
|
|
|
}; |
|
|
|