1
0
mirror of https://github.com/vercel/commerce.git synced 2025-09-19 14:20:15 +00:00
Files
.github
.vscode
app
components
helpers
lib
sanity
components
desk
blurb-structure.ts
category-structure.ts
home-structure.ts
index.ts
navigation-structure.ts
page-structure.ts
product-structure.ts
search-structure.ts
section-structure.ts
settings-structure.ts
usp-structure.ts
schemas
utils
constants.ts
languages.ts
localizedTypes.ts
queries.tsx
sanity.client.ts
sanity.image.ts
shopify
storm
constants.ts
constants.tsx
type-guards.ts
utils.ts
messages
public
.env.example
.eslintrc.js
.gitignore
.npmrc
.nvmrc
.prettierignore
README.md
components.json
i18n-config.ts
license.md
middleware.ts
next.config.js
package.json
playwright.config.ts
pnpm-lock.yaml
postcss.config.js
prettier.config.js
sanity.config.ts
tailwind.config.js
tsconfig.json
commerce/lib/sanity/desk/index.ts
2023-08-15 10:44:10 +02:00

76 lines
2.0 KiB
TypeScript
Raw 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.

/**
* Desk structure overrides
*/
import { ListItemBuilder, StructureResolver } from 'sanity/desk'
import blurbs from './blurb-structure'
import categories from './category-structure'
import home from './home-structure'
import navigation from './navigation-structure'
import pages from './page-structure'
import products from './product-structure'
import search from './search-structure'
import sections from './section-structure'
import settings from './settings-structure'
import usps from './usp-structure'
/**
* Desk structure overrides
*
* Sanity Studio automatically lists document types out of the box.
* With this custom desk 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 schemas progress.
* To learn more about structure builder, visit our docs:
* https://www.sanity.io/docs/overview-structure-builder
*/
// If you add document types to desk 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 ![
'category',
'home',
'media.tag',
'page',
'product',
'productVariant',
'settings',
'blurb',
'section',
'usp',
'navigation',
'footerMenu',
'utilityMenu',
'search'
].includes(id)
}
export const structure: StructureResolver = (S, context) =>
S.list()
.title('Content')
.items([
home(S, context),
pages(S, context),
S.divider(),
products(S, context),
categories(S, context),
S.divider(),
blurbs(S, context),
usps(S, context),
sections(S, context),
S.divider(),
settings(S, context),
search(S, context),
navigation(S, context),
S.divider(),
...S.documentTypeListItems().filter(hiddenDocTypes),
S.divider(),
])