78 lines
2.1 KiB
TypeScript
78 lines
2.1 KiB
TypeScript
import {ListItemBuilder, StructureResolver} from 'sanity/structure'
|
||
import collections from './collectionStructure'
|
||
import colorThemes from './colorThemeStructure'
|
||
import about from './aboutStructure'
|
||
import home from './homeStructure'
|
||
import journal from './journalStructure'
|
||
import pages from './pageStructure'
|
||
import products from './productStructure'
|
||
import settings from './settingStructure'
|
||
import reviews from './reviewsStructure'
|
||
import staticStorePages from './staticPagesStructure'
|
||
|
||
/**
|
||
* Structure overrides
|
||
*
|
||
* Sanity Studio automatically lists document types out of the box.
|
||
* With this custom structure we achieve things like showing the `home`
|
||
* and `settings` document types as singletons, and grouping product details
|
||
* and variants for easy editorial access.
|
||
*
|
||
* You can customize this even further as your schema types progress.
|
||
* To learn more about structure builder, visit our docs:
|
||
* https://www.sanity.io/docs/overview-structure-builder
|
||
*/
|
||
|
||
// If you add document types to structure manually, you can add them to this function to prevent duplicates in the root pane
|
||
const hiddenDocTypes = (listItem: ListItemBuilder) => {
|
||
const id = listItem.getId()
|
||
|
||
if (!id) {
|
||
return false
|
||
}
|
||
|
||
return ![
|
||
'collection',
|
||
'colorTheme',
|
||
'home',
|
||
'aboutPage',
|
||
'journalIndex',
|
||
'media.tag',
|
||
'page',
|
||
'product',
|
||
'productVariant',
|
||
'productReview',
|
||
'settings',
|
||
'abiirFaqPage',
|
||
'abiirShippingPage',
|
||
'abiirContactPage',
|
||
'abiirTrackOrderPage',
|
||
'abiirSkincareQuizPage',
|
||
'abiirPressPage',
|
||
'abiirPrivacyPolicyPage',
|
||
'abiirTermsOfServicePage',
|
||
].includes(id)
|
||
}
|
||
|
||
export const structure: StructureResolver = (S, context) =>
|
||
S.list()
|
||
.title('Content')
|
||
.items([
|
||
home(S, context),
|
||
about(S, context),
|
||
staticStorePages(S, context),
|
||
journal(S, context),
|
||
pages(S, context),
|
||
S.divider(),
|
||
collections(S, context),
|
||
products(S, context),
|
||
S.divider(),
|
||
colorThemes(S, context),
|
||
S.divider(),
|
||
reviews(S, context),
|
||
S.divider(),
|
||
settings(S, context),
|
||
S.divider(),
|
||
...S.documentTypeListItems().filter(hiddenDocTypes),
|
||
])
|