forked from SSWConsulting/SSW.Rules.Content
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.ts
152 lines (149 loc) · 4.53 KB
/
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import { TinaField, defineConfig } from "tinacms";
// Your hosting provider likely exposes this as an environment variable
const branch =
process.env.GITHUB_BRANCH ||
process.env.VERCEL_GIT_COMMIT_REF ||
process.env.HEAD ||
"main";
const ruleFields = [
{
type: 'boolean',
name: 'archived',
label: 'Archived',
},
{
type: 'string',
name: 'title',
label: 'Title',
isTitle: true,
required: true,
},
{
type: 'rich-text',
name: 'body',
label: 'Body',
isBody: true,
},
];
export default defineConfig({
branch,
// Get this from tina.io
clientId: process.env.NEXT_PUBLIC_TINA_CLIENT_ID,
// Get this from tina.io
token: process.env.TINA_TOKEN,
tinaioConfig: {
frontendUrlOverride: 'http://localhost:3002',
identityApiUrlOverride: 'https://bjeyn-identity.tinajs.dev',
contentApiUrlOverride: 'https://bjeyn-content.tinajs.dev'
},
build: {
outputFolder: "admin",
publicFolder: "public",
},
media: {
tina: {
mediaRoot: "",
publicFolder: "public",
},
},
// See docs on content modeling for more info on how to setup new content models: https://tina.io/docs/schema/
schema: {
collections: [
{
name: 'topic',
label: 'Topics',
path: 'content/topics',
format: 'json',
fields: [
{
type: 'string',
name: 'slug',
label: 'Slug',
required: true,
},
{
type: 'string',
name: 'title',
label: 'Title',
required: true,
isTitle: true,
},
{
type: "object",
list: true,
name: "topics",
label: "Topics",
ui: {
itemProps: (item) => {
return { label: item?.category };
},
},
fields: [
{
type: 'reference',
name: 'category',
label: 'Category',
collections: ['category'],
},
]
}
],
},
{
name: 'category',
label: 'Categories',
path: 'content/categories',
format: 'json',
fields: [
{
type: 'string',
name: 'slug',
label: 'Slug',
required: true,
},
{
type: 'string',
name: 'title',
label: 'Title',
isTitle: true,
required: true,
},
{
type: "object",
list: true,
name: "rules",
label: "Rules",
ui: {
itemProps: (item) => {
return { label: item?.rule };
},
},
fields: [
{
type: 'reference',
name: 'rule',
label: 'Rule',
collections: ['rule', 'rule_md'],
required: true,
}
]
}
],
},
{
name: 'rule',
label: 'Rules',
path: 'content/rules',
format: 'mdx',
fields: ruleFields as TinaField[],
},
{
name: 'rule_md',
label: 'Rules',
path: 'content/rules',
format: 'md',
fields: ruleFields as TinaField[],
},
],
},
});