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