mirror of
https://github.com/wassname/talk.git
synced 2026-07-19 11:28:50 +08:00
Hide empty categories
This commit is contained in:
@@ -2,6 +2,7 @@ import React from 'react';
|
||||
import cn from 'classnames';
|
||||
import styles from './Menu.css';
|
||||
import {capitalize} from 'plugin-api/beta/client/utils';
|
||||
import {IfSlotIsNotEmpty} from 'plugin-api/beta/client/components';
|
||||
import Category from './Category';
|
||||
import {t} from 'plugin-api/beta/client/services';
|
||||
|
||||
@@ -16,11 +17,12 @@ class Menu extends React.Component {
|
||||
<div className={cn([styles.menu, 'talk-plugin-viewing-options-menu'])}>
|
||||
{
|
||||
Object.keys(this.categories).map((category) =>
|
||||
<Category
|
||||
key={category}
|
||||
slot={`viewingOptions${capitalize(category)}`}
|
||||
title={this.categories[category]}
|
||||
/>
|
||||
<IfSlotIsNotEmpty slot={`viewingOptions${capitalize(category)}`} key={category}>
|
||||
<Category
|
||||
slot={`viewingOptions${capitalize(category)}`}
|
||||
title={this.categories[category]}
|
||||
/>
|
||||
</IfSlotIsNotEmpty>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user