Closed readeral closed 5 years ago
structure.txt My structure.js file as a txt document
import React from 'react';
import S from '@sanity/desk-tool/structure-builder';
import {FaCogs} from 'react-icons/fa';
import {
MdMap,
MdReceipt,
MdHome,
MdVideoLibrary,
MdViewAgenda,
MdFormatListBulleted,
MdCollectionsBookmark,
MdInsertDriveFile,
MdCallToAction,
MdFormatAlignLeft
} from 'react-icons/md';
import s3upload from './plugins/s3-upload-widget';
const hiddenDocTypes = listItem =>
![
'config',
'main',
'LayoutHome',
'speaker',
'category',
'page',
'modals',
'form'
].includes(listItem.getId());
export default () => {
return S.list()
.title('Website Content and Settings')
.items([
S.listItem()
.title('Home and Menu')
.icon(MdHome)
.child(
S.editor()
.title('Home and Menu')
.id('global-main')
.schemaType('main')
.documentId('global-main')
),
S.listItem()
.title('Segments')
.icon(MdViewAgenda)
.child(
S.list()
.title('Segments')
.items([
S.listItem()
.title('Normal segments')
.icon(MdReceipt)
.child(
S.documentList()
.title('Segments')
.menuItems(S.documentTypeList('LayoutHome').getMenuItems())
.filter('_type in ["LayoutHome"]')
),
S.listItem()
.title('Map segments')
.icon(MdMap)
.child(
S.documentList()
.title('Segments')
.menuItems(S.documentTypeList('LayoutMap').getMenuItems())
.filter('_type in ["LayoutMap"]')
)
])
),
S.listItem()
.title('Pages')
.icon(MdInsertDriveFile)
.child(
S.documentList()
.title('Pages')
.menuItems(S.documentTypeList('page').getMenuItems())
.filter('_type in ["page"]')
),
S.listItem()
.title('Body content blocks')
.icon(MdCollectionsBookmark)
.child(
S.list()
.title('Body content blocks')
.items([
S.listItem()
.title('Forms')
.child(
S.documentList()
.title('Forms')
.menuItems(S.documentTypeList('form').getMenuItems())
.filter('_type in ["form"]')
),
S.listItem()
.title('Grid block')
.child(
S.documentList()
.title('Grid block')
.menuItems(S.documentTypeList('gridblock').getMenuItems())
.filter('_type in ["gridblock"]')
)
])
),
S.listItem()
.title('Categories and classes')
.icon(MdCollectionsBookmark)
.child(
S.list()
.title('Categories and classes')
.items([
S.listItem()
.title('Speakers')
.child(
S.documentList()
.title('Speakers')
.menuItems(S.documentTypeList('speaker').getMenuItems())
.filter('_type in ["speaker"]')
),
S.listItem()
.title('Series')
.child(
S.documentList()
.title('Series')
.menuItems(
S.documentTypeList('series')
.defaultOrdering([
{field: '_updatedAt', direction: 'desc'}
])
.getMenuItems()
)
.filter('_type in ["series"]')
)
])
),
S.listItem()
.title('Sermons')
.icon(MdVideoLibrary)
.child(
S.documentList()
.title('Sermons')
.menuItems(S.documentTypeList('sermons').getMenuItems())
.filter('_type in ["sermons"]')
),
S.divider(),
S.listItem()
.title('Config')
.icon(FaCogs)
.child(
S.editor()
.id('config')
.title('Config')
.schemaType('config')
.documentId('global-config')
)
]);
};
Thank you for the report! We will look into this!
Thanks for reporting! I'm a little surprised the document lists you've specified have ever been able to infer the type to create, given that they don't have a document type specified.
I'd recommend using S.documentTypeList('series')
instead of specifying the filter yourself. You could also use .schemaType('series')
to help the logic figure out which templates to use. I've created a PR to pick up the schema type based on more filters such as your _type in [candidates]
here, as well as allowing it to infer more than a single type.
Describe the bug
The 'create new' button no longer renders on the document pane. See discussion at https://sanity-io-land.slack.com/archives/C9Z7RC3V1/p1571990263175100
To Reproduce
Steps to reproduce the behavior:
Start with a studio on 0.142, upgrade to 0.144, button disappears. See video here: https://sanity-io-land.slack.com/files/UB985R00J/FPT2NMU4V/sanity.mp4
Expected behavior Expected to see the create new button.
Screenshots See video above
Which versions of Sanity are you using?
Run
sanity versions
in the terminal and copy-paste the result here. @sanity/cli 0.144.0 (up to date) @sanity/base 0.144.0 (up to date) @sanity/color-input 0.144.0 (up to date) @sanity/components 0.144.0 (up to date) @sanity/core 0.144.0 (up to date) @sanity/dashboard 0.144.0 (up to date) @sanity/default-layout 0.144.0 (up to date) @sanity/default-login 0.144.0 (up to date) @sanity/desk-tool 0.144.0 (up to date) @sanity/google-maps-input 0.144.0 (up to date) @sanity/vision 0.144.0 (up to date)What operating system are you using? Mac OS
Which versions of Node.js / npm are you running?
Run
npm -v && node -v
in the terminal and copy-paste the result here. 6.12.0 v8.11.1Additional context I do use the structure builder, and so it could be related to my structure builder code. I'll copy that in below.
Add any other context about the problem here.
Security issue?
Any security issues should be submitted directly to security@sanity.io. In order to determine whether you are dealing with a security issue, ask yourself these two questions: