-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsanity.config.ts
64 lines (60 loc) · 2.26 KB
/
sanity.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import { visionTool } from '@sanity/vision'
import { BookCheckIcon } from 'lucide-react'
import { defineConfig } from 'sanity'
import { structureTool } from 'sanity/structure'
import { media as mediaTool } from 'sanity-plugin-media'
import { projectDetails } from './app/sanity/project-details.ts'
import { schemaTypes } from './app/sanity/schema/index.ts'
const singletonActions = new Set(['publish', 'discardChanges', 'restore'])
const singletonTypes = new Set(['curriculum'])
export default defineConfig({
...projectDetails(),
name: 'walz',
title: 'Walz',
basePath: `/studio`,
plugins: [
structureTool({
structure: S =>
S.list()
.title('Content')
.items([
S.documentTypeListItem('post').title('Posts'),
S.documentTypeListItem('event').title('Ereignisse'),
S.divider(),
S.documentTypeListItem('costs').title('Kosten'),
S.documentTypeListItem('person').title('Personen'),
S.documentTypeListItem('year').title('Jahrgang'),
S.documentTypeListItem('schoolYear').title('Schuljahr'),
S.documentTypeListItem('testimonial').title('Erfahrungsberichte'),
S.divider(),
S.documentTypeListItem('home-hero').title('Home Hero'),
S.divider(),
S.listItem()
.title('Curriculum')
.icon(BookCheckIcon)
.id('curriculum')
.child(
S.document().schemaType('curriculum').documentId('curriculum'),
),
S.documentTypeListItem('project').title('Projekte'),
]),
}),
visionTool(),
// @ts-ignore it says its sanity v3 but typing suggest otherwise 🤷
mediaTool(),
],
schema: {
types: schemaTypes,
// Filter out singleton types from the global “New document” menu options
templates: templates =>
templates.filter(({ schemaType }) => !singletonTypes.has(schemaType)),
},
document: {
// For singleton types, filter out actions that are not explicitly included
// in the `singletonActions` list defined above
actions: (input, context) =>
singletonTypes.has(context.schemaType)
? input.filter(({ action }) => action && singletonActions.has(action))
: input,
},
})