import {defineConfig, isDev}from 'sanity'
import {deskTool} from 'sanity/desk'
import {visionTool} from '@sanity/vision'
import deskStructure from './src/structure/deskStructure'
import schemas from './schemas/schema'
import {dashboardTool} from '@sanity/dashboard'
import { netlifyWidget } from 'sanity-plugin-dashboard-widget-netlify'
export default defineConfig({
name: 'default',
title: 'Bex Day Shop',
projectId: '#####################',
dataset: 'production',
plugins: [
dashboardTool({
widgets: [
netlifyWidget({
title: 'My Netlify deploys',
description:
"NOTE: Because these sites are static builds, they need to be re-deployed to see the changes when documents are published.",
sites: [
{
title: 'Bex Day Shop Studio',
apiId: '#####################',
buildHookId: '#####################',
name:'bex-day-shop-studio',
url: '<https://studioshop.bexday.com>',
},
{
title: 'Bex Day Shop',
apiId: "#####################",
buildHookId: "#####################",
name: 'bex-day-shop',
url: '<https://shop.bexday.com>',
}
],
}),
],
}),
deskTool({
structure: deskStructure,
}),
visionTool()
],
tools: (prev) => {
// :point_down: Uses environment variables set by Vite in development mode
if (isDev) {
return prev
}
return prev.filter((tool) => tool.name !== 'vision')
},
schema: {
types: schemas,
},
document: {
newDocumentOptions: (prev, {creationContext}) => {
if (creationContext.type === 'global') {
return prev.filter((templateItem) => templateItem.templateId != 'siteSettings','home')
}
return prev
},
actions: (prev, {schema}) => {
if (schema === 'siteSettings','home') {
return prev.filter(({action}) => !['unpublish', 'delete', 'duplicate'].includes(action))
}
return prev
},
},
})