feat: add hide property to collections (#3618) (#3643)

This commit is contained in:
Shashank Bairy R
2020-04-22 12:32:13 +00:00
committed by GitHub
parent f8603c5d92
commit 88b6c633af
4 changed files with 14 additions and 2 deletions

View File

@ -50,7 +50,12 @@ const ErrorCodeBlock = styled.pre`
`;
const getDefaultPath = collections => {
return `/collections/${collections.first().get('name')}`;
const first = collections.filter(collection => collection.get('hide') !== true).first();
if (first) {
return `/collections/${first.get('name')}`;
} else {
throw new Error('Could not find a non hidden collection');
}
};
const RouteInCollection = ({ collections, render, ...props }) => {

View File

@ -133,7 +133,12 @@ class Sidebar extends React.Component {
value={query}
/>
</SearchContainer>
<SidebarNavList>{collections.toList().map(this.renderLink)}</SidebarNavList>
<SidebarNavList>
{collections
.toList()
.filter(collection => collection.get('hide') !== true)
.map(this.renderLink)}
</SidebarNavList>
</SidebarContainer>
);
}

View File

@ -118,6 +118,7 @@ const getConfigSchema = () => ({
preview_path_date_field: { type: 'string' },
create: { type: 'boolean' },
publish: { type: 'boolean' },
hide: { type: 'boolean' },
editor: {
type: 'object',
properties: {