AbiirSkincare/Hydrogen/studio/structure/index.ts

78 lines
2.1 KiB
TypeScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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),
])