mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(topbar): empty brackets would show for sub category if empty
This commit is contained in:
@@ -63,46 +63,49 @@ const TopBarDesktop = () => {
|
|||||||
|
|
||||||
const { plebbitSubs, interestsSubs, randomSubs, internationalSubs, projectsSubs } = categorizeSubplebbits(subplebbits);
|
const { plebbitSubs, interestsSubs, randomSubs, internationalSubs, projectsSubs } = categorizeSubplebbits(subplebbits);
|
||||||
|
|
||||||
const renderSubplebbits = (subplebbits: any) => {
|
const renderSubplebbits = (subplebbits: any) =>
|
||||||
return subplebbits.map((sub: any, index: any) => (
|
subplebbits.length > 0 && (
|
||||||
<span key={index}>
|
<>
|
||||||
{index === 0 ? null : ' '}
|
[
|
||||||
<Link to={`/p/${sub.address}${isInCatalogView ? '/catalog' : ''}`}>{sub.address.includes('.') ? sub.address : sub.address.slice(0, 10).concat('...')}</Link>
|
{subplebbits.map((sub: any, index: any) => (
|
||||||
{index !== subplebbits.length - 1 ? ' /' : null}
|
<span key={index}>
|
||||||
</span>
|
{index === 0 ? null : ' '}
|
||||||
));
|
<Link to={`/p/${sub.address}${isInCatalogView ? '/catalog' : ''}`}>{sub.address.includes('.') ? sub.address : sub.address.slice(0, 10).concat('...')}</Link>
|
||||||
};
|
{index !== subplebbits.length - 1 ? ' /' : null}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
]{' '}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.boardNavDesktop}>
|
<div className={styles.boardNavDesktop}>
|
||||||
<span className={styles.boardList}>
|
<span className={styles.boardList}>
|
||||||
[<Link to='/p/all'>all</Link> / <Link to='/p/subscriptions'>subscriptions</Link>]{' '}
|
[<Link to='/p/all'>all</Link> / <Link to='/p/subscriptions'>subscriptions</Link>] {renderSubplebbits(plebbitSubs)}
|
||||||
{subplebbits && (
|
{renderSubplebbits(projectsSubs)}
|
||||||
<>
|
{renderSubplebbits(interestsSubs)}
|
||||||
[{renderSubplebbits(plebbitSubs)}] [{renderSubplebbits(projectsSubs)}] [{renderSubplebbits(interestsSubs)}] [{renderSubplebbits(randomSubs)}] [
|
{renderSubplebbits(randomSubs)}
|
||||||
{renderSubplebbits(internationalSubs)}] [
|
{renderSubplebbits(internationalSubs)}[
|
||||||
<Link
|
<Link
|
||||||
to='boards/create'
|
to='boards/create'
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
alert('work in progress');
|
alert('work in progress');
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Create
|
Create
|
||||||
</Link>
|
</Link>
|
||||||
] [
|
] [
|
||||||
<Link
|
<Link
|
||||||
to='boards'
|
to='boards'
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
alert('work in progress');
|
alert('work in progress');
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Vote
|
Vote
|
||||||
</Link>
|
</Link>
|
||||||
]
|
]
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</span>
|
</span>
|
||||||
<span className={styles.navTopRight}>
|
<span className={styles.navTopRight}>
|
||||||
[<Link to={!location.pathname.endsWith('settings') ? location.pathname.replace(/\/$/, '') + '/settings' : location.pathname}>{t('settings')}</Link>] [
|
[<Link to={!location.pathname.endsWith('settings') ? location.pathname.replace(/\/$/, '') + '/settings' : location.pathname}>{t('settings')}</Link>] [
|
||||||
|
|||||||
Reference in New Issue
Block a user