-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsanity.config.js
More file actions
58 lines (51 loc) · 1.74 KB
/
sanity.config.js
File metadata and controls
58 lines (51 loc) · 1.74 KB
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
'use client'
/**
* This configuration is used to for the Sanity Studio that’s mounted on the `/app/admin/[[...tool]]/page.jsx` route
*/
import { visionTool } from '@sanity/vision'
import { defineConfig } from 'sanity'
import { structureTool } from 'sanity/structure'
import { codeInput } from '@sanity/code-input'
import { table } from '@sanity/table'
// Go to https://www.sanity.io/docs/api-versioning to learn how API versioning works
import { apiVersion, dataset, projectId } from './src/sanity/env'
import { schemaTypes } from './src/sanity/schemaTypes'
import { structure } from './src/sanity/structure'
import {
ConvertToActiveProjectAction,
AcceptApplicationAction,
RejectApplicationAction
} from './src/sanity/lib/documentActions'
export default defineConfig({
basePath: '/admin',
projectId,
dataset,
// Add and edit the content schema in the './sanity/schemaTypes' folder
schema: {
types: schemaTypes,
},
plugins: [
structureTool({ structure }),
// Vision is for querying with GROQ from inside the Studio
// https://www.sanity.io/docs/the-vision-plugin
visionTool({ defaultApiVersion: apiVersion }),
codeInput(),
table(),
],
// Add custom document actions
document: {
actions: (prev, context) => {
const customActions = []
// Add convert action for project proposals
if (context.schemaType === 'projectProposal') {
customActions.push(ConvertToActiveProjectAction)
}
// Add accept/reject actions for project applications
if (context.schemaType === 'projectApplication') {
customActions.push(AcceptApplicationAction)
customActions.push(RejectApplicationAction)
}
return [...prev, ...customActions]
}
}
})