import {defineConfig} from 'sanity' import {structureTool} from 'sanity/structure' import {ClipboardIcon, HomeIcon, WrenchIcon} from '@sanity/icons' import {schemaTypes} from './schemaTypes' import {presentationTool} from 'sanity/presentation' import {linkField} from 'sanity-plugin-link-field' import {seoMetaFields} from 'sanity-plugin-seo' import {simplerColorInput} from 'sanity-plugin-simpler-color-input' import {createColorList} from './lib/colorUtils' import { sanityConnection } from '@repo/sanity-connection' import Logo from '@repo/ui/components/logo' export default defineConfig({ name: 'default', title: sanityConnection.pageTitle, projectId: sanityConnection.projectId, dataset: sanityConnection.dataset, icon: Logo, plugins: [ structureTool({ title: 'Content', structure: (S) => S.list() .title('Content') .items([ S.listItem() .title('Landing Page') .icon(HomeIcon) .child(S.document().schemaType('home').documentId('home').title('Home')), S.divider(), S.listItem() .title('Custom pages') .icon(ClipboardIcon) .child(S.documentTypeList('custom').title('Content')), S.divider(), S.listItem() .title('Settings') .icon(WrenchIcon) .child(S.document().schemaType('settings').documentId('settings').title('Settings')), ]), }), // @ts-ignore linkField({ linkableSchemaTypes: ['custom'], }), presentationTool({ previewUrl: { origin: sanityConnection.previewUrl ?? 'http://localhost:5173', preview: '/', previewMode: { enable: '/preview/enable', disable: '/preview/disable', }, }, }), seoMetaFields(), simplerColorInput({ defaultColorFormat: 'hex', defaultColorList: createColorList(), enableSearch: true, showColorValue: true, }), ], schema: { types: schemaTypes, }, })