improvement: show quick add dropdown conditionally (#1679)
This commit is contained in:
committed by
Shawn Erquhart
parent
8c2217720f
commit
17530eb42a
@ -127,6 +127,10 @@ export default class Header extends React.Component {
|
||||
displayUrl,
|
||||
} = this.props;
|
||||
|
||||
const createableCollections = collections
|
||||
.filter(collection => collection.get('create'))
|
||||
.toList();
|
||||
|
||||
return (
|
||||
<AppHeaderContainer>
|
||||
<AppHeader>
|
||||
@ -152,23 +156,22 @@ export default class Header extends React.Component {
|
||||
</AppHeaderButton>
|
||||
</nav>
|
||||
<AppHeaderActions>
|
||||
<Dropdown
|
||||
renderButton={() => <AppHeaderQuickNewButton>Quick add</AppHeaderQuickNewButton>}
|
||||
dropdownTopOverlap="30px"
|
||||
dropdownWidth="160px"
|
||||
dropdownPosition="left"
|
||||
>
|
||||
{collections
|
||||
.filter(collection => collection.get('create'))
|
||||
.toList()
|
||||
.map(collection => (
|
||||
{createableCollections.size > 0 && (
|
||||
<Dropdown
|
||||
renderButton={() => <AppHeaderQuickNewButton>Quick add</AppHeaderQuickNewButton>}
|
||||
dropdownTopOverlap="30px"
|
||||
dropdownWidth="160px"
|
||||
dropdownPosition="left"
|
||||
>
|
||||
{createableCollections.map(collection => (
|
||||
<DropdownItem
|
||||
key={collection.get('name')}
|
||||
label={collection.get('label_singular') || collection.get('label')}
|
||||
onClick={() => this.handleCreatePostClick(collection.get('name'))}
|
||||
/>
|
||||
))}
|
||||
</Dropdown>
|
||||
</Dropdown>
|
||||
)}
|
||||
<SettingsDropdown
|
||||
displayUrl={displayUrl}
|
||||
imageUrl={user.get('avatar_url')}
|
||||
|
Reference in New Issue
Block a user