-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstructure.ts
168 lines (166 loc) · 4.93 KB
/
structure.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
import { StructureBuilder } from "sanity/structure";
import {
FcSettings,
FcNews,
FcFilledFilter,
FcBusinesswoman,
FcGenealogy,
FcFlowChart,
FcComments,
FcInTransit,
FcTemplate,
FcReuse,
FcGallery,
FcIdea,
FcPositiveDynamic,
FcDocument,
} from "react-icons/fc";
import { IconType } from "react-icons";
import { BsFillPinAngleFill } from "react-icons/bs";
import { IoBuildOutline } from "react-icons/io5";
const singletonListItem = (
S: StructureBuilder,
typeName: string,
title: string,
icon: IconType
) =>
S.listItem()
.title(title || typeName)
.id(typeName)
.icon(icon)
.child(
S.document()
.schemaType(typeName)
.documentId(typeName)
.title(title || typeName)
);
export const structure = (S: StructureBuilder) =>
S.list()
.title("Kontent")
.items([
S.listItem()
.title("Ustawienia")
.icon(FcSettings)
.child(
S.list()
.title("Ustawienia")
.items([
singletonListItem(S, "firstSite", "Pierwsza strona", FcGallery),
singletonListItem(S, "mainTopic", "Temat główny", FcIdea),
singletonListItem(
S,
"visitCounter",
"Licznik odwiedzin",
FcPositiveDynamic
),
singletonListItem(
S,
"pinnedPost",
"Przypięta publikacja",
BsFillPinAngleFill
),
singletonListItem(
S,
"generalConfig",
"Konfiguracja",
IoBuildOutline
),
singletonListItem(S, "rules", "Regulamin", FcDocument),
])
),
S.listItem()
.title("Reklamy")
.icon(FcInTransit)
.child(
S.list()
.title("Ustawienia")
.items([
singletonListItem(S, "adds", "Reklamy na stronie", FcTemplate),
S.listItem()
.title("Archiwum reklamy boxowe")
.icon(FcReuse)
.child(
S.documentList()
.title("Reklamy boxowe")
.filter('_type == "boxAdd"')
),
S.listItem()
.title("Archiwum reklamy banerowych")
.icon(FcReuse)
.child(
S.documentList()
.title("Reklamy baneorwe")
.filter('_type == "bannerAdd"')
),
])
),
S.divider(),
S.listItem()
.title("Wszystkie publikacje")
.icon(FcNews)
.child(
S.documentList()
.title("Wszystkie publikacje")
.filter('_type == "post"')
),
S.listItem()
.title("Filtrowane publikacje")
.icon(FcFilledFilter)
.child(
S.list()
.title("Filtry")
.items([
S.listItem()
.title("Kategorie")
.icon(FcFlowChart)
.child(
S.documentTypeList("category")
.title("Publikacje według kategorii")
.child((categoryId) =>
S.documentList()
.title("Publikacje")
.filter(
'_type == "post" && $categoryId in categories[]._ref'
)
.params({ categoryId })
)
),
S.listItem()
.title("Autorzy")
.icon(FcBusinesswoman)
.child(
S.documentTypeList("author")
.title("Publikacje według autorów")
.child((authorId) =>
S.documentList()
.title("Publikacje")
.filter('_type == "post" && $authorId == author._ref')
.params({ authorId })
)
),
])
),
S.divider(),
S.listItem()
.title("Autorzy")
.icon(FcBusinesswoman)
.child(S.documentList().title("Autorzy").filter('_type == "author"')),
S.divider(),
S.listItem()
.title("Kategorie")
.icon(FcFlowChart)
.child(
S.documentList().title("Kategorie").filter('_type == "category"')
),
S.listItem()
.icon(FcGenealogy)
.title("Zakładki")
.child(S.documentList().title("Zakładki").filter('_type == "tab"')),
S.divider(),
S.listItem()
.title("Komenatrze")
.icon(FcComments)
.child(
S.documentList().title("Komenatrze").filter('_type == "comment"')
),
]);