@sanity/dashboard 2.30.1 → 3.0.0-sanity-v3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -44
- package/lib/cjs/index.js +1002 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/esm/index.js +977 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/types/index.d.ts +42 -0
- package/lib/types/index.d.ts.map +1 -0
- package/package.json +53 -14
- package/src/components/DashboardLayout.tsx +10 -0
- package/src/components/DashboardWidgetContainer.tsx +69 -0
- package/src/components/NotFoundWidget.tsx +30 -0
- package/src/components/WidgetGroup.tsx +108 -0
- package/src/containers/Dashboard.tsx +19 -0
- package/src/containers/DashboardContext.tsx +8 -0
- package/src/containers/WidgetContainer.tsx +21 -0
- package/src/index.tsx +62 -0
- package/src/types.ts +21 -0
- package/src/versionedClient.ts +7 -0
- package/src/widgets/projectInfo/ProjectInfo.tsx +233 -0
- package/src/widgets/projectInfo/index.ts +10 -0
- package/src/widgets/projectUsers/ProjectUsers.tsx +171 -0
- package/src/widgets/projectUsers/index.ts +10 -0
- package/src/widgets/sanityTutorials/SanityTutorials.tsx +77 -0
- package/src/widgets/sanityTutorials/Tutorial.tsx +111 -0
- package/src/widgets/sanityTutorials/dataAdapter.ts +48 -0
- package/src/widgets/sanityTutorials/index.ts +10 -0
- package/.babelrc +0 -4
- package/lib/DashboardTool.js +0 -59
- package/lib/components/DashboardLayout.js +0 -35
- package/lib/components/NotFoundWidget.js +0 -51
- package/lib/components/WidgetGroup.js +0 -67
- package/lib/components/dashboardWidget.js +0 -51
- package/lib/containers/Dashboard.js +0 -32
- package/lib/containers/WidgetContainer.js +0 -56
- package/lib/dashboardConfig.js +0 -16
- package/lib/legacyParts.js +0 -55
- package/lib/versionedClient.js +0 -20
- package/lib/widget.css +0 -62
- package/lib/widgets/projectInfo/ProjectInfo.js +0 -265
- package/lib/widgets/projectInfo/index.js +0 -19
- package/lib/widgets/projectUsers/ProjectUsers.js +0 -188
- package/lib/widgets/projectUsers/index.js +0 -16
- package/lib/widgets/sanityTutorials/SanityTutorials.js +0 -115
- package/lib/widgets/sanityTutorials/Tutorial.js +0 -111
- package/lib/widgets/sanityTutorials/dataAdapter.js +0 -28
- package/lib/widgets/sanityTutorials/index.js +0 -19
- package/sanity.json +0 -59
- package/tsconfig.json +0 -17
package/lib/esm/index.js
ADDED
|
@@ -0,0 +1,977 @@
|
|
|
1
|
+
import {jsxs as $5lYf0$jsxs, jsx as $5lYf0$jsx, Fragment as $5lYf0$Fragment} from "react/jsx-runtime";
|
|
2
|
+
import {useMemo as $5lYf0$useMemo, createElement as $5lYf0$createElement, createContext as $5lYf0$createContext, useContext as $5lYf0$useContext, forwardRef as $5lYf0$forwardRef, useState as $5lYf0$useState, useEffect as $5lYf0$useEffect, useCallback as $5lYf0$useCallback} from "react";
|
|
3
|
+
import {createPlugin as $5lYf0$createPlugin, useClient as $5lYf0$useClient, useSource as $5lYf0$useSource} from "sanity";
|
|
4
|
+
import {Container as $5lYf0$Container, Grid as $5lYf0$Grid, Card as $5lYf0$Card, Text as $5lYf0$Text, Box as $5lYf0$Box, Heading as $5lYf0$Heading, Button as $5lYf0$Button, Stack as $5lYf0$Stack, Label as $5lYf0$Label, Code as $5lYf0$Code, Spinner as $5lYf0$Spinner, Flex as $5lYf0$Flex} from "@sanity/ui";
|
|
5
|
+
import $5lYf0$styledcomponents, {css as $5lYf0$css} from "styled-components";
|
|
6
|
+
import {switchMap as $5lYf0$switchMap, map as $5lYf0$map} from "rxjs/operators";
|
|
7
|
+
import {RobotIcon as $5lYf0$RobotIcon, PlayIcon as $5lYf0$PlayIcon} from "@sanity/icons";
|
|
8
|
+
import {DefaultPreview as $5lYf0$DefaultPreview} from "sanity/_unstable";
|
|
9
|
+
import $5lYf0$sanityimageurl from "@sanity/image-url";
|
|
10
|
+
|
|
11
|
+
function $parcel$export(e, n, v, s) {
|
|
12
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
function $bb6535128092451c$export$3469e8c87b54056a(props) {
|
|
22
|
+
return /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Container), {
|
|
23
|
+
width: 4,
|
|
24
|
+
padding: 4,
|
|
25
|
+
sizing: "border",
|
|
26
|
+
style: {
|
|
27
|
+
minHeight: "100%"
|
|
28
|
+
},
|
|
29
|
+
children: props.children
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
const $103cc300d7db8f8f$export$3d9a716c82234f3d = /*#__PURE__*/ (0, $5lYf0$createContext)({
|
|
42
|
+
widgets: []
|
|
43
|
+
});
|
|
44
|
+
function $103cc300d7db8f8f$export$f69a0df1904034e() {
|
|
45
|
+
return (0, $5lYf0$useContext)($103cc300d7db8f8f$export$3d9a716c82234f3d);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
function $ee786c256a0386f4$export$d320a48219c7c153(props) {
|
|
51
|
+
const config = (0, $103cc300d7db8f8f$export$f69a0df1904034e)();
|
|
52
|
+
const layout = (0, $5lYf0$useMemo)(()=>({
|
|
53
|
+
...props.layout || {},
|
|
54
|
+
...config.layout || {}
|
|
55
|
+
}), [
|
|
56
|
+
props.layout,
|
|
57
|
+
config.layout
|
|
58
|
+
]);
|
|
59
|
+
return /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Card), {
|
|
60
|
+
shadow: 1,
|
|
61
|
+
"data-width": layout.width,
|
|
62
|
+
"data-height": layout.height,
|
|
63
|
+
children: /*#__PURE__*/ (0, $5lYf0$createElement)(props.component, {})
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
const $a64f5fea4a0ce905$var$media = {
|
|
69
|
+
small: (...args)=>(0, $5lYf0$css)`
|
|
70
|
+
@media (min-width: ${({ theme: theme })=>theme.sanity.media[0]}px) {
|
|
71
|
+
${(0, $5lYf0$css)(...args)}
|
|
72
|
+
}
|
|
73
|
+
`,
|
|
74
|
+
medium: (...args)=>(0, $5lYf0$css)`
|
|
75
|
+
@media (min-width: ${({ theme: theme })=>theme.sanity.media[2]}px) {
|
|
76
|
+
${(0, $5lYf0$css)(...args)}
|
|
77
|
+
}
|
|
78
|
+
`
|
|
79
|
+
};
|
|
80
|
+
const $a64f5fea4a0ce905$var$Root = (0, $5lYf0$styledcomponents)((0, $5lYf0$Grid))`
|
|
81
|
+
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
82
|
+
|
|
83
|
+
& > div {
|
|
84
|
+
overflow: hidden;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
& > div[data-width='medium'] {
|
|
88
|
+
${$a64f5fea4a0ce905$var$media.small`
|
|
89
|
+
grid-column: span 2;
|
|
90
|
+
`}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
& > div[data-width='large'] {
|
|
94
|
+
${$a64f5fea4a0ce905$var$media.small`
|
|
95
|
+
grid-column: span 2;
|
|
96
|
+
`}
|
|
97
|
+
|
|
98
|
+
${$a64f5fea4a0ce905$var$media.medium`
|
|
99
|
+
grid-column: span 3;
|
|
100
|
+
`}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
& > div[data-width='full'] {
|
|
104
|
+
${$a64f5fea4a0ce905$var$media.small`
|
|
105
|
+
grid-column: 1 / -1;
|
|
106
|
+
`}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
& > div[data-height='medium'] {
|
|
110
|
+
${$a64f5fea4a0ce905$var$media.small`
|
|
111
|
+
grid-row: span 2;
|
|
112
|
+
`}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
& > div[data-height='large'] {
|
|
116
|
+
${$a64f5fea4a0ce905$var$media.small`
|
|
117
|
+
grid-row: span 2;
|
|
118
|
+
`}
|
|
119
|
+
|
|
120
|
+
${$a64f5fea4a0ce905$var$media.medium`
|
|
121
|
+
grid-row: span 3;
|
|
122
|
+
`}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
& > div[data-height='full'] {
|
|
126
|
+
${$a64f5fea4a0ce905$var$media.medium`
|
|
127
|
+
grid-row: 1 / -1;
|
|
128
|
+
`}
|
|
129
|
+
}
|
|
130
|
+
`;
|
|
131
|
+
const $a64f5fea4a0ce905$var$NO_WIDGETS = [];
|
|
132
|
+
const $a64f5fea4a0ce905$var$NO_LAYOUT = {};
|
|
133
|
+
function $a64f5fea4a0ce905$export$606a10b16bce9144(props) {
|
|
134
|
+
const { config: { layout: layout = $a64f5fea4a0ce905$var$NO_LAYOUT , widgets: widgets = $a64f5fea4a0ce905$var$NO_WIDGETS } , } = props;
|
|
135
|
+
return /*#__PURE__*/ (0, $5lYf0$jsxs)($a64f5fea4a0ce905$var$Root, {
|
|
136
|
+
autoFlow: "row dense",
|
|
137
|
+
"data-width": layout.width || "auto",
|
|
138
|
+
"data-height": layout.height || "auto",
|
|
139
|
+
gap: 4,
|
|
140
|
+
children: [
|
|
141
|
+
widgets.length ? null : /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Card), {
|
|
142
|
+
padding: 4,
|
|
143
|
+
shadow: 1,
|
|
144
|
+
tone: "primary",
|
|
145
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Text), {
|
|
146
|
+
align: "center",
|
|
147
|
+
children: "Add some widgets to populate this space."
|
|
148
|
+
})
|
|
149
|
+
}),
|
|
150
|
+
widgets.map((widgetConfig, index)=>{
|
|
151
|
+
if (widgetConfig.type === "__experimental_group") return /*#__PURE__*/ (0, $5lYf0$jsx)($a64f5fea4a0ce905$export$606a10b16bce9144, {
|
|
152
|
+
config: widgetConfig
|
|
153
|
+
}, index);
|
|
154
|
+
if (widgetConfig.component) return /*#__PURE__*/ (0, $5lYf0$jsx)((0, $ee786c256a0386f4$export$d320a48219c7c153), {
|
|
155
|
+
...widgetConfig
|
|
156
|
+
}, index);
|
|
157
|
+
return /*#__PURE__*/ (0, $5lYf0$jsxs)((0, $5lYf0$Box), {
|
|
158
|
+
children: [
|
|
159
|
+
widgetConfig.name,
|
|
160
|
+
" is missing widget component"
|
|
161
|
+
]
|
|
162
|
+
}, index);
|
|
163
|
+
})
|
|
164
|
+
]
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
function $086586914f992408$export$fe82a520fc33e5f4({ config: config }) {
|
|
171
|
+
if (!config) return null;
|
|
172
|
+
return /*#__PURE__*/ (0, $5lYf0$jsx)((0, $103cc300d7db8f8f$export$3d9a716c82234f3d).Provider, {
|
|
173
|
+
value: config,
|
|
174
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsx)((0, $bb6535128092451c$export$3469e8c87b54056a), {
|
|
175
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsx)((0, $a64f5fea4a0ce905$export$606a10b16bce9144), {
|
|
176
|
+
config: config
|
|
177
|
+
})
|
|
178
|
+
})
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
var $81c1b644006d48ec$exports = {};
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
var $1f0cda7387acedc8$exports = {};
|
|
188
|
+
|
|
189
|
+
$parcel$export($1f0cda7387acedc8$exports, "DashboardWidgetContainer", () => $1f0cda7387acedc8$export$67b2e85605d868b2);
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
const $1f0cda7387acedc8$var$Root = (0, $5lYf0$styledcomponents)((0, $5lYf0$Card))`
|
|
195
|
+
display: flex;
|
|
196
|
+
flex-direction: column;
|
|
197
|
+
justify-content: stretch;
|
|
198
|
+
height: 100%;
|
|
199
|
+
box-sizing: border-box;
|
|
200
|
+
position: relative;
|
|
201
|
+
`;
|
|
202
|
+
const $1f0cda7387acedc8$var$Header = (0, $5lYf0$styledcomponents)((0, $5lYf0$Card))`
|
|
203
|
+
position: sticky;
|
|
204
|
+
top: 0;
|
|
205
|
+
z-index: 2;
|
|
206
|
+
border-top-left-radius: inherit;
|
|
207
|
+
border-top-right-radius: inherit;
|
|
208
|
+
`;
|
|
209
|
+
const $1f0cda7387acedc8$var$Footer = (0, $5lYf0$styledcomponents)((0, $5lYf0$Card))`
|
|
210
|
+
position: sticky;
|
|
211
|
+
overflow: hidden;
|
|
212
|
+
bottom: 0;
|
|
213
|
+
z-index: 2;
|
|
214
|
+
border-bottom-right-radius: inherit;
|
|
215
|
+
border-bottom-left-radius: inherit;
|
|
216
|
+
margin-top: auto;
|
|
217
|
+
`;
|
|
218
|
+
const $1f0cda7387acedc8$var$Content = (0, $5lYf0$styledcomponents)((0, $5lYf0$Box))`
|
|
219
|
+
position: relative;
|
|
220
|
+
z-index: 1;
|
|
221
|
+
height: stretch;
|
|
222
|
+
min-height: 21.5em;
|
|
223
|
+
|
|
224
|
+
@media (min-width: ${({ theme: theme })=>theme.sanity.media[0]}px) {
|
|
225
|
+
overflow-y: auto;
|
|
226
|
+
outline: none;
|
|
227
|
+
}
|
|
228
|
+
`;
|
|
229
|
+
const $1f0cda7387acedc8$export$67b2e85605d868b2 = /*#__PURE__*/ (0, $5lYf0$forwardRef)(function DashboardWidgetContainer(props, ref) {
|
|
230
|
+
const { header: header , children: children , footer: footer } = props;
|
|
231
|
+
return /*#__PURE__*/ (0, $5lYf0$jsxs)($1f0cda7387acedc8$var$Root, {
|
|
232
|
+
radius: 3,
|
|
233
|
+
display: "flex",
|
|
234
|
+
ref: ref,
|
|
235
|
+
children: [
|
|
236
|
+
header && /*#__PURE__*/ (0, $5lYf0$jsx)($1f0cda7387acedc8$var$Header, {
|
|
237
|
+
borderBottom: true,
|
|
238
|
+
paddingX: 3,
|
|
239
|
+
paddingY: 4,
|
|
240
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Heading), {
|
|
241
|
+
size: 1,
|
|
242
|
+
textOverflow: "ellipsis",
|
|
243
|
+
children: header
|
|
244
|
+
})
|
|
245
|
+
}),
|
|
246
|
+
children && /*#__PURE__*/ (0, $5lYf0$jsx)($1f0cda7387acedc8$var$Content, {
|
|
247
|
+
children: children
|
|
248
|
+
}),
|
|
249
|
+
footer && /*#__PURE__*/ (0, $5lYf0$jsx)($1f0cda7387acedc8$var$Footer, {
|
|
250
|
+
borderTop: true,
|
|
251
|
+
children: footer
|
|
252
|
+
})
|
|
253
|
+
]
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
var $ac478372f28acbf6$exports = {};
|
|
259
|
+
|
|
260
|
+
$parcel$export($ac478372f28acbf6$exports, "projectInfoWidget", () => $ac478372f28acbf6$export$66362ea0e7ee12e);
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
function $3a278251aab3d81f$export$270fde7c7e72cf26() {
|
|
267
|
+
const client = (0, $5lYf0$useClient)();
|
|
268
|
+
return (0, $5lYf0$useMemo)(()=>client.withConfig({
|
|
269
|
+
apiVersion: "1"
|
|
270
|
+
}), [
|
|
271
|
+
client
|
|
272
|
+
]);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
function $72d86a2cfb80e9d7$var$isUrl(url) {
|
|
279
|
+
return url && /^https?:\/\//.test(`${url}`);
|
|
280
|
+
}
|
|
281
|
+
function $72d86a2cfb80e9d7$var$getGraphQlUrl(projectId, dataset) {
|
|
282
|
+
return `https://${projectId}.api.sanity.io/v1/graphql/${dataset}/default`;
|
|
283
|
+
}
|
|
284
|
+
function $72d86a2cfb80e9d7$var$getGroqUrl(projectId, dataset) {
|
|
285
|
+
return `https://${projectId}.api.sanity.io/v1/groq/${dataset}`;
|
|
286
|
+
}
|
|
287
|
+
function $72d86a2cfb80e9d7$var$getManageUrl(projectId) {
|
|
288
|
+
return `https://manage.sanity.io/projects/${projectId}`;
|
|
289
|
+
}
|
|
290
|
+
const $72d86a2cfb80e9d7$var$NO_EXPERIMENTAL = [];
|
|
291
|
+
const $72d86a2cfb80e9d7$var$NO_DATA = [];
|
|
292
|
+
function $72d86a2cfb80e9d7$export$a1c9a67310a2d004(props) {
|
|
293
|
+
const { __experimental_before: __experimental_before = $72d86a2cfb80e9d7$var$NO_EXPERIMENTAL , data: data = $72d86a2cfb80e9d7$var$NO_DATA } = props;
|
|
294
|
+
const [studioHost, setStudioHost] = (0, $5lYf0$useState)();
|
|
295
|
+
const [graphqlApi, setGraphQlApi] = (0, $5lYf0$useState)();
|
|
296
|
+
const versionedClient = (0, $3a278251aab3d81f$export$270fde7c7e72cf26)();
|
|
297
|
+
const { projectId: projectId = "unknown" , dataset: dataset = "unknown" } = versionedClient.config();
|
|
298
|
+
(0, $5lYf0$useEffect)(()=>{
|
|
299
|
+
const subscriptions = [];
|
|
300
|
+
subscriptions.push(versionedClient.observable.request({
|
|
301
|
+
uri: `/projects/${projectId}`
|
|
302
|
+
}).subscribe({
|
|
303
|
+
next: (result)=>{
|
|
304
|
+
const { studioHost: host } = result;
|
|
305
|
+
setStudioHost(host ? `https://${host}.sanity.studio` : undefined);
|
|
306
|
+
},
|
|
307
|
+
error: (error)=>{
|
|
308
|
+
console.error("Error while looking for studioHost", error);
|
|
309
|
+
setStudioHost({
|
|
310
|
+
error: "Something went wrong while looking up studioHost. See console."
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
}));
|
|
314
|
+
// ping assumed graphql endpoint
|
|
315
|
+
subscriptions.push(versionedClient.observable.request({
|
|
316
|
+
method: "HEAD",
|
|
317
|
+
uri: `/graphql/${dataset}/default`
|
|
318
|
+
}).subscribe({
|
|
319
|
+
next: ()=>setGraphQlApi($72d86a2cfb80e9d7$var$getGraphQlUrl(projectId, dataset)),
|
|
320
|
+
error: (error)=>{
|
|
321
|
+
if (error.statusCode === 404) setGraphQlApi(undefined);
|
|
322
|
+
else {
|
|
323
|
+
console.error("Error while looking for graphqlApi", error);
|
|
324
|
+
setGraphQlApi({
|
|
325
|
+
error: "Something went wrong while looking up graphqlApi. See console."
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}));
|
|
330
|
+
return ()=>{
|
|
331
|
+
subscriptions.forEach((s)=>s.unsubscribe());
|
|
332
|
+
};
|
|
333
|
+
}, [
|
|
334
|
+
dataset,
|
|
335
|
+
projectId,
|
|
336
|
+
versionedClient,
|
|
337
|
+
setGraphQlApi,
|
|
338
|
+
setStudioHost
|
|
339
|
+
]);
|
|
340
|
+
const assembleTableRows = (0, $5lYf0$useMemo)(()=>{
|
|
341
|
+
let result = [
|
|
342
|
+
{
|
|
343
|
+
title: "Sanity project",
|
|
344
|
+
rows: [
|
|
345
|
+
{
|
|
346
|
+
title: "Project ID",
|
|
347
|
+
value: projectId
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
title: "Dataset",
|
|
351
|
+
value: dataset
|
|
352
|
+
},
|
|
353
|
+
]
|
|
354
|
+
},
|
|
355
|
+
];
|
|
356
|
+
// Handle any apps
|
|
357
|
+
const apps = [
|
|
358
|
+
studioHost ? {
|
|
359
|
+
title: "Studio",
|
|
360
|
+
value: studioHost
|
|
361
|
+
} : null,
|
|
362
|
+
...data.filter((item)=>item.category === "apps"),
|
|
363
|
+
].filter((a)=>!!a);
|
|
364
|
+
if (apps.length > 0) result = result.concat([
|
|
365
|
+
{
|
|
366
|
+
title: "Apps",
|
|
367
|
+
rows: apps
|
|
368
|
+
}
|
|
369
|
+
]);
|
|
370
|
+
// Handle APIs
|
|
371
|
+
result = result.concat([
|
|
372
|
+
{
|
|
373
|
+
title: "APIs",
|
|
374
|
+
rows: [
|
|
375
|
+
{
|
|
376
|
+
title: "GROQ",
|
|
377
|
+
value: $72d86a2cfb80e9d7$var$getGroqUrl(projectId, dataset)
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
title: "GraphQL",
|
|
381
|
+
value: (typeof graphqlApi === "object" ? "Error" : graphqlApi) ?? "Not deployed"
|
|
382
|
+
},
|
|
383
|
+
]
|
|
384
|
+
},
|
|
385
|
+
], data.filter((item)=>item.category === "apis"));
|
|
386
|
+
// Handle whatever else there might be
|
|
387
|
+
const otherStuff = {};
|
|
388
|
+
data.forEach((item)=>{
|
|
389
|
+
if (item.category && item.category !== "apps" && item.category !== "apis") {
|
|
390
|
+
if (!otherStuff[item.category]) otherStuff[item.category] = [];
|
|
391
|
+
otherStuff[item.category].push(item);
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
Object.keys(otherStuff).forEach((category)=>{
|
|
395
|
+
result.push({
|
|
396
|
+
title: category,
|
|
397
|
+
rows: otherStuff[category]
|
|
398
|
+
});
|
|
399
|
+
});
|
|
400
|
+
return result;
|
|
401
|
+
}, [
|
|
402
|
+
graphqlApi,
|
|
403
|
+
studioHost,
|
|
404
|
+
projectId,
|
|
405
|
+
dataset,
|
|
406
|
+
data
|
|
407
|
+
]);
|
|
408
|
+
return /*#__PURE__*/ (0, $5lYf0$jsxs)((0, $5lYf0$Fragment), {
|
|
409
|
+
children: [
|
|
410
|
+
__experimental_before.map((widgetConfig, idx)=>/*#__PURE__*/ (0, $5lYf0$jsx)((0, $ee786c256a0386f4$export$d320a48219c7c153), {
|
|
411
|
+
...widgetConfig
|
|
412
|
+
}, idx)),
|
|
413
|
+
/*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Box), {
|
|
414
|
+
height: "fill",
|
|
415
|
+
marginTop: __experimental_before?.length > 0 ? 4 : 0,
|
|
416
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsx)((0, $1f0cda7387acedc8$export$67b2e85605d868b2), {
|
|
417
|
+
footer: /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Button), {
|
|
418
|
+
style: {
|
|
419
|
+
width: "100%"
|
|
420
|
+
},
|
|
421
|
+
paddingX: 2,
|
|
422
|
+
paddingY: 4,
|
|
423
|
+
mode: "bleed",
|
|
424
|
+
tone: "primary",
|
|
425
|
+
text: "Manage project",
|
|
426
|
+
as: "a",
|
|
427
|
+
href: $72d86a2cfb80e9d7$var$getManageUrl(projectId)
|
|
428
|
+
}),
|
|
429
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Card), {
|
|
430
|
+
paddingY: 4,
|
|
431
|
+
radius: 2,
|
|
432
|
+
role: "table",
|
|
433
|
+
"aria-label": "Project info",
|
|
434
|
+
"aria-describedby": "project_info_table",
|
|
435
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsxs)((0, $5lYf0$Stack), {
|
|
436
|
+
space: 4,
|
|
437
|
+
children: [
|
|
438
|
+
/*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Box), {
|
|
439
|
+
paddingX: 3,
|
|
440
|
+
as: "header",
|
|
441
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Heading), {
|
|
442
|
+
size: 1,
|
|
443
|
+
as: "h2",
|
|
444
|
+
id: "project_info_table",
|
|
445
|
+
children: "Project info"
|
|
446
|
+
})
|
|
447
|
+
}),
|
|
448
|
+
assembleTableRows.map((item)=>{
|
|
449
|
+
if (!item || !item.rows) return null;
|
|
450
|
+
return /*#__PURE__*/ (0, $5lYf0$jsxs)((0, $5lYf0$Stack), {
|
|
451
|
+
space: 3,
|
|
452
|
+
children: [
|
|
453
|
+
/*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Card), {
|
|
454
|
+
borderBottom: true,
|
|
455
|
+
padding: 3,
|
|
456
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Label), {
|
|
457
|
+
size: 0,
|
|
458
|
+
muted: true,
|
|
459
|
+
role: "columnheader",
|
|
460
|
+
children: item.title
|
|
461
|
+
})
|
|
462
|
+
}),
|
|
463
|
+
/*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Stack), {
|
|
464
|
+
space: 4,
|
|
465
|
+
paddingX: 3,
|
|
466
|
+
role: "rowgroup",
|
|
467
|
+
children: item.rows.map((row)=>{
|
|
468
|
+
return /*#__PURE__*/ (0, $5lYf0$jsxs)((0, $5lYf0$Grid), {
|
|
469
|
+
columns: 2,
|
|
470
|
+
role: "row",
|
|
471
|
+
children: [
|
|
472
|
+
/*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Text), {
|
|
473
|
+
weight: "medium",
|
|
474
|
+
role: "rowheader",
|
|
475
|
+
children: row.title
|
|
476
|
+
}),
|
|
477
|
+
typeof row.value === "object" && /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Text), {
|
|
478
|
+
size: 1,
|
|
479
|
+
children: row.value?.error
|
|
480
|
+
}),
|
|
481
|
+
typeof row.value === "string" && /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Fragment), {
|
|
482
|
+
children: $72d86a2cfb80e9d7$var$isUrl(row.value) ? /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Text), {
|
|
483
|
+
size: 1,
|
|
484
|
+
role: "cell",
|
|
485
|
+
style: {
|
|
486
|
+
wordBreak: "break-word"
|
|
487
|
+
},
|
|
488
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsx)("a", {
|
|
489
|
+
href: row.value,
|
|
490
|
+
children: row.value
|
|
491
|
+
})
|
|
492
|
+
}) : /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Code), {
|
|
493
|
+
size: 1,
|
|
494
|
+
role: "cell",
|
|
495
|
+
style: {
|
|
496
|
+
wordBreak: "break-word"
|
|
497
|
+
},
|
|
498
|
+
children: row.value
|
|
499
|
+
})
|
|
500
|
+
})
|
|
501
|
+
]
|
|
502
|
+
}, row.title);
|
|
503
|
+
})
|
|
504
|
+
})
|
|
505
|
+
]
|
|
506
|
+
}, item.title);
|
|
507
|
+
})
|
|
508
|
+
]
|
|
509
|
+
})
|
|
510
|
+
})
|
|
511
|
+
})
|
|
512
|
+
})
|
|
513
|
+
]
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
function $ac478372f28acbf6$export$66362ea0e7ee12e(config) {
|
|
519
|
+
return {
|
|
520
|
+
name: "project-info",
|
|
521
|
+
component: (0, $72d86a2cfb80e9d7$export$a1c9a67310a2d004),
|
|
522
|
+
layout: config?.layout ?? {
|
|
523
|
+
width: "medium"
|
|
524
|
+
}
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
var $0ef0fb9920ec1f58$exports = {};
|
|
530
|
+
|
|
531
|
+
$parcel$export($0ef0fb9920ec1f58$exports, "projectUsersWidget", () => $0ef0fb9920ec1f58$export$5c0e62d7539f632);
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
const $3a1cbcec6b01611f$var$AvatarWrapper = (0, $5lYf0$styledcomponents)((0, $5lYf0$Card))`
|
|
543
|
+
box-sizing: border-box;
|
|
544
|
+
border-radius: 50%;
|
|
545
|
+
border-color: transparent;
|
|
546
|
+
overflow: hidden;
|
|
547
|
+
width: 100%;
|
|
548
|
+
height: 100%;
|
|
549
|
+
|
|
550
|
+
& > img {
|
|
551
|
+
width: 100%;
|
|
552
|
+
height: auto;
|
|
553
|
+
}
|
|
554
|
+
`;
|
|
555
|
+
function $3a1cbcec6b01611f$var$getInviteUrl(projectId) {
|
|
556
|
+
return `https://manage.sanity.io/projects/${projectId}/team/invite`;
|
|
557
|
+
}
|
|
558
|
+
function $3a1cbcec6b01611f$export$2500e0068175e4b9() {
|
|
559
|
+
const [project, setProject] = (0, $5lYf0$useState)();
|
|
560
|
+
const [users, setUsers] = (0, $5lYf0$useState)();
|
|
561
|
+
const [error, setError] = (0, $5lYf0$useState)();
|
|
562
|
+
const versionedClient = (0, $3a278251aab3d81f$export$270fde7c7e72cf26)();
|
|
563
|
+
const { __internal: { userStore: userStore } , } = (0, $5lYf0$useSource)();
|
|
564
|
+
const fetchData = (0, $5lYf0$useCallback)(()=>{
|
|
565
|
+
const { projectId: projectId } = versionedClient.config();
|
|
566
|
+
const subscription = versionedClient.observable.request({
|
|
567
|
+
uri: `/projects/${projectId}`
|
|
568
|
+
}).pipe((0, $5lYf0$switchMap)((_project)=>userStore.observable.getUsers(_project.members.map((mem)=>mem.id)).pipe((0, $5lYf0$map)((_users)=>({
|
|
569
|
+
project: _project,
|
|
570
|
+
users: _users
|
|
571
|
+
}))))).subscribe({
|
|
572
|
+
next: ({ users: _users , project: _project })=>{
|
|
573
|
+
setProject(_project);
|
|
574
|
+
setUsers((Array.isArray(_users) ? _users : [
|
|
575
|
+
_users
|
|
576
|
+
]).sort((userA, userB)=>$3a1cbcec6b01611f$var$sortUsersByRobotStatus(userA, userB, _project)));
|
|
577
|
+
},
|
|
578
|
+
error: (e)=>setError(e)
|
|
579
|
+
});
|
|
580
|
+
return ()=>subscription.unsubscribe();
|
|
581
|
+
}, [
|
|
582
|
+
userStore,
|
|
583
|
+
versionedClient
|
|
584
|
+
]);
|
|
585
|
+
(0, $5lYf0$useEffect)(()=>fetchData(), [
|
|
586
|
+
fetchData
|
|
587
|
+
]);
|
|
588
|
+
const handleRetryFetch = (0, $5lYf0$useCallback)(()=>fetchData(), [
|
|
589
|
+
fetchData
|
|
590
|
+
]);
|
|
591
|
+
const isLoading = !users || !project;
|
|
592
|
+
if (error) return /*#__PURE__*/ (0, $5lYf0$jsx)((0, $1f0cda7387acedc8$export$67b2e85605d868b2), {
|
|
593
|
+
header: "Project users",
|
|
594
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Box), {
|
|
595
|
+
padding: 4,
|
|
596
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsxs)((0, $5lYf0$Text), {
|
|
597
|
+
children: [
|
|
598
|
+
"Something went wrong while fetching data. You could",
|
|
599
|
+
" ",
|
|
600
|
+
/*#__PURE__*/ (0, $5lYf0$jsx)("a", {
|
|
601
|
+
onClick: handleRetryFetch,
|
|
602
|
+
title: "Retry users fetch",
|
|
603
|
+
style: {
|
|
604
|
+
cursor: "pointer"
|
|
605
|
+
},
|
|
606
|
+
children: "retry"
|
|
607
|
+
}),
|
|
608
|
+
"..?"
|
|
609
|
+
]
|
|
610
|
+
})
|
|
611
|
+
})
|
|
612
|
+
});
|
|
613
|
+
return /*#__PURE__*/ (0, $5lYf0$jsxs)((0, $1f0cda7387acedc8$export$67b2e85605d868b2), {
|
|
614
|
+
header: "Project users",
|
|
615
|
+
footer: /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Button), {
|
|
616
|
+
style: {
|
|
617
|
+
width: "100%"
|
|
618
|
+
},
|
|
619
|
+
paddingX: 2,
|
|
620
|
+
paddingY: 4,
|
|
621
|
+
mode: "bleed",
|
|
622
|
+
tone: "primary",
|
|
623
|
+
text: "Invite members",
|
|
624
|
+
as: "a",
|
|
625
|
+
loading: isLoading,
|
|
626
|
+
href: isLoading ? undefined : $3a1cbcec6b01611f$var$getInviteUrl(project.id)
|
|
627
|
+
}),
|
|
628
|
+
children: [
|
|
629
|
+
isLoading && /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Box), {
|
|
630
|
+
paddingY: 5,
|
|
631
|
+
paddingX: 2,
|
|
632
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsxs)((0, $5lYf0$Stack), {
|
|
633
|
+
space: 4,
|
|
634
|
+
children: [
|
|
635
|
+
/*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Text), {
|
|
636
|
+
align: "center",
|
|
637
|
+
muted: true,
|
|
638
|
+
size: 1,
|
|
639
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Spinner), {})
|
|
640
|
+
}),
|
|
641
|
+
/*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Text), {
|
|
642
|
+
align: "center",
|
|
643
|
+
size: 1,
|
|
644
|
+
muted: true,
|
|
645
|
+
children: "Loading items..."
|
|
646
|
+
})
|
|
647
|
+
]
|
|
648
|
+
})
|
|
649
|
+
}),
|
|
650
|
+
!isLoading && /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Stack), {
|
|
651
|
+
space: 3,
|
|
652
|
+
padding: 3,
|
|
653
|
+
children: users?.map((user)=>{
|
|
654
|
+
const membership = project.members.find((member)=>member.id === user.id);
|
|
655
|
+
const media = membership?.isRobot ? /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Text), {
|
|
656
|
+
size: 3,
|
|
657
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$RobotIcon), {})
|
|
658
|
+
}) : /*#__PURE__*/ (0, $5lYf0$jsx)($3a1cbcec6b01611f$var$AvatarWrapper, {
|
|
659
|
+
tone: "transparent",
|
|
660
|
+
children: user?.imageUrl && /*#__PURE__*/ (0, $5lYf0$jsx)("img", {
|
|
661
|
+
src: user.imageUrl,
|
|
662
|
+
alt: user?.displayName
|
|
663
|
+
})
|
|
664
|
+
});
|
|
665
|
+
return /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Box), {
|
|
666
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$DefaultPreview), {
|
|
667
|
+
title: user.displayName,
|
|
668
|
+
subtitle: membership?.role,
|
|
669
|
+
media: media
|
|
670
|
+
})
|
|
671
|
+
}, user.id);
|
|
672
|
+
})
|
|
673
|
+
})
|
|
674
|
+
]
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
function $3a1cbcec6b01611f$var$sortUsersByRobotStatus(userA, userB, project) {
|
|
678
|
+
const { members: members } = project;
|
|
679
|
+
const membershipA = members.find((member)=>member.id === userA?.id);
|
|
680
|
+
const membershipB = members.find((member)=>member.id === userB?.id);
|
|
681
|
+
if (membershipA?.isRobot) return 1;
|
|
682
|
+
if (membershipB?.isRobot) return -1;
|
|
683
|
+
return 0;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
function $0ef0fb9920ec1f58$export$5c0e62d7539f632(config) {
|
|
688
|
+
return {
|
|
689
|
+
name: "project-info",
|
|
690
|
+
component: (0, $3a1cbcec6b01611f$export$2500e0068175e4b9),
|
|
691
|
+
layout: config?.layout
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
var $dfd7c10d2685c9b1$exports = {};
|
|
697
|
+
|
|
698
|
+
$parcel$export($dfd7c10d2685c9b1$exports, "sanityTutorialsWidget", () => $dfd7c10d2685c9b1$export$b3552e87a7c5c47b);
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
const $f83ecb81d484a8cf$var$PlayIconBox = (0, $5lYf0$styledcomponents)((0, $5lYf0$Box))`
|
|
708
|
+
position: absolute;
|
|
709
|
+
top: 50%;
|
|
710
|
+
left: 50%;
|
|
711
|
+
transform: translate(-50%, -50%);
|
|
712
|
+
|
|
713
|
+
&:before {
|
|
714
|
+
content: '';
|
|
715
|
+
position: absolute;
|
|
716
|
+
top: 50%;
|
|
717
|
+
left: 50%;
|
|
718
|
+
transform: translate(-50%, -50%);
|
|
719
|
+
width: 2.75em;
|
|
720
|
+
height: 2.75em;
|
|
721
|
+
border-radius: 50%;
|
|
722
|
+
background: ${({ theme: theme })=>theme.sanity.color.card.enabled.bg};
|
|
723
|
+
opacity: 0.75;
|
|
724
|
+
}
|
|
725
|
+
`;
|
|
726
|
+
const $f83ecb81d484a8cf$var$Root = (0, $5lYf0$styledcomponents)((0, $5lYf0$Flex))`
|
|
727
|
+
&:hover {
|
|
728
|
+
${$f83ecb81d484a8cf$var$PlayIconBox} {
|
|
729
|
+
&:before {
|
|
730
|
+
opacity: 1;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
`;
|
|
735
|
+
const $f83ecb81d484a8cf$var$PosterCard = (0, $5lYf0$styledcomponents)((0, $5lYf0$Card))`
|
|
736
|
+
width: 100%;
|
|
737
|
+
padding-bottom: calc(9 / 16 * 100%);
|
|
738
|
+
position: relative;
|
|
739
|
+
`;
|
|
740
|
+
const $f83ecb81d484a8cf$var$Poster = (0, $5lYf0$styledcomponents).img`
|
|
741
|
+
position: absolute;
|
|
742
|
+
top: 0;
|
|
743
|
+
left: 0;
|
|
744
|
+
height: 100%;
|
|
745
|
+
width: 100%;
|
|
746
|
+
object-fit: cover;
|
|
747
|
+
display: block;
|
|
748
|
+
|
|
749
|
+
&:not([src]) {
|
|
750
|
+
display: none;
|
|
751
|
+
}
|
|
752
|
+
`;
|
|
753
|
+
function $f83ecb81d484a8cf$export$825b76de5f2b0345(props) {
|
|
754
|
+
const { title: title , posterURL: posterURL , showPlayIcon: showPlayIcon , href: href , presenterName: presenterName , presenterSubtitle: presenterSubtitle } = props;
|
|
755
|
+
return /*#__PURE__*/ (0, $5lYf0$jsx)($f83ecb81d484a8cf$var$Root, {
|
|
756
|
+
flex: 1,
|
|
757
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Card), {
|
|
758
|
+
sizing: "border",
|
|
759
|
+
flex: 1,
|
|
760
|
+
padding: 2,
|
|
761
|
+
radius: 2,
|
|
762
|
+
as: "a",
|
|
763
|
+
href: href,
|
|
764
|
+
target: "_blank",
|
|
765
|
+
rel: "noopener noreferrer",
|
|
766
|
+
style: {
|
|
767
|
+
position: "relative"
|
|
768
|
+
},
|
|
769
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsxs)((0, $5lYf0$Flex), {
|
|
770
|
+
direction: "column",
|
|
771
|
+
style: {
|
|
772
|
+
height: "100%"
|
|
773
|
+
},
|
|
774
|
+
children: [
|
|
775
|
+
posterURL && /*#__PURE__*/ (0, $5lYf0$jsxs)($f83ecb81d484a8cf$var$PosterCard, {
|
|
776
|
+
marginBottom: 1,
|
|
777
|
+
children: [
|
|
778
|
+
/*#__PURE__*/ (0, $5lYf0$jsx)($f83ecb81d484a8cf$var$Poster, {
|
|
779
|
+
src: posterURL
|
|
780
|
+
}),
|
|
781
|
+
showPlayIcon && /*#__PURE__*/ (0, $5lYf0$jsx)($f83ecb81d484a8cf$var$PlayIconBox, {
|
|
782
|
+
display: "flex",
|
|
783
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Text), {
|
|
784
|
+
align: "center",
|
|
785
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$PlayIcon), {})
|
|
786
|
+
})
|
|
787
|
+
})
|
|
788
|
+
]
|
|
789
|
+
}),
|
|
790
|
+
/*#__PURE__*/ (0, $5lYf0$jsxs)((0, $5lYf0$Flex), {
|
|
791
|
+
direction: "column",
|
|
792
|
+
justify: "space-between",
|
|
793
|
+
paddingY: 2,
|
|
794
|
+
flex: 1,
|
|
795
|
+
children: [
|
|
796
|
+
/*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Heading), {
|
|
797
|
+
as: "h3",
|
|
798
|
+
size: 1,
|
|
799
|
+
children: title
|
|
800
|
+
}),
|
|
801
|
+
/*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Box), {
|
|
802
|
+
marginTop: 4,
|
|
803
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsxs)((0, $5lYf0$Stack), {
|
|
804
|
+
space: 2,
|
|
805
|
+
flex: 1,
|
|
806
|
+
children: [
|
|
807
|
+
/*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Text), {
|
|
808
|
+
size: 1,
|
|
809
|
+
children: presenterName
|
|
810
|
+
}),
|
|
811
|
+
/*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Text), {
|
|
812
|
+
size: 0,
|
|
813
|
+
style: {
|
|
814
|
+
opacity: 0.7
|
|
815
|
+
},
|
|
816
|
+
children: presenterSubtitle
|
|
817
|
+
})
|
|
818
|
+
]
|
|
819
|
+
})
|
|
820
|
+
})
|
|
821
|
+
]
|
|
822
|
+
})
|
|
823
|
+
]
|
|
824
|
+
})
|
|
825
|
+
})
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
const $041161d503c3990f$var$tutorialsProjectConfig = {
|
|
834
|
+
projectId: "3do82whm",
|
|
835
|
+
dataset: "next"
|
|
836
|
+
};
|
|
837
|
+
function $041161d503c3990f$export$144c6e577729d454() {
|
|
838
|
+
const versionedClient = (0, $3a278251aab3d81f$export$270fde7c7e72cf26)();
|
|
839
|
+
return (0, $5lYf0$useMemo)(()=>({
|
|
840
|
+
getFeed: (templateRepoId)=>{
|
|
841
|
+
const uri = templateRepoId ? `/addons/dashboard?templateRepoId=${templateRepoId}` : "/addons/dashboard";
|
|
842
|
+
return versionedClient.observable.request({
|
|
843
|
+
uri: uri,
|
|
844
|
+
withCredentials: false
|
|
845
|
+
});
|
|
846
|
+
},
|
|
847
|
+
urlBuilder: (0, $5lYf0$sanityimageurl)($041161d503c3990f$var$tutorialsProjectConfig)
|
|
848
|
+
}), [
|
|
849
|
+
versionedClient
|
|
850
|
+
]);
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
function $e6d104338a42de87$var$createUrl(slug, type) {
|
|
856
|
+
if (type === "tutorial") return `https://www.sanity.io/docs/tutorials/${slug.current}`;
|
|
857
|
+
else if (type === "guide") return `https://www.sanity.io/docs/guides/${slug.current}`;
|
|
858
|
+
return false;
|
|
859
|
+
}
|
|
860
|
+
function $e6d104338a42de87$export$5f156cc357b8467f(props) {
|
|
861
|
+
const { templateRepoId: templateRepoId } = props;
|
|
862
|
+
const [feedItems, setFeedItems] = (0, $5lYf0$useState)([]);
|
|
863
|
+
const { getFeed: getFeed , urlBuilder: urlBuilder } = (0, $041161d503c3990f$export$144c6e577729d454)();
|
|
864
|
+
(0, $5lYf0$useEffect)(()=>{
|
|
865
|
+
const subscription = getFeed(templateRepoId).subscribe((response)=>{
|
|
866
|
+
setFeedItems(response.items);
|
|
867
|
+
});
|
|
868
|
+
return ()=>{
|
|
869
|
+
subscription.unsubscribe();
|
|
870
|
+
};
|
|
871
|
+
}, [
|
|
872
|
+
setFeedItems,
|
|
873
|
+
getFeed,
|
|
874
|
+
templateRepoId
|
|
875
|
+
]);
|
|
876
|
+
const title = "Learn about Sanity";
|
|
877
|
+
return /*#__PURE__*/ (0, $5lYf0$jsx)((0, $1f0cda7387acedc8$export$67b2e85605d868b2), {
|
|
878
|
+
header: title,
|
|
879
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Flex), {
|
|
880
|
+
as: "ul",
|
|
881
|
+
overflow: "auto",
|
|
882
|
+
align: "stretch",
|
|
883
|
+
paddingY: 2,
|
|
884
|
+
children: feedItems?.map((feedItem, index)=>{
|
|
885
|
+
if (!feedItem.title || !feedItem.guideOrTutorial && !feedItem.externalLink) return null;
|
|
886
|
+
const presenter = feedItem.presenter || feedItem.guideOrTutorial?.presenter || {};
|
|
887
|
+
const subtitle = feedItem.category;
|
|
888
|
+
const { guideOrTutorial: guideOrTutorial = {} } = feedItem;
|
|
889
|
+
const href = (guideOrTutorial.slug ? $e6d104338a42de87$var$createUrl(guideOrTutorial.slug, guideOrTutorial._type) : feedItem.externalLink) || feedItem.externalLink;
|
|
890
|
+
return /*#__PURE__*/ (0, $5lYf0$jsx)((0, $5lYf0$Flex), {
|
|
891
|
+
as: "li",
|
|
892
|
+
paddingRight: index < feedItems?.length - 1 ? 1 : 3,
|
|
893
|
+
paddingLeft: index === 0 ? 3 : 0,
|
|
894
|
+
align: "stretch",
|
|
895
|
+
style: {
|
|
896
|
+
minWidth: 272,
|
|
897
|
+
width: "30%"
|
|
898
|
+
},
|
|
899
|
+
children: /*#__PURE__*/ (0, $5lYf0$jsx)((0, $f83ecb81d484a8cf$export$825b76de5f2b0345), {
|
|
900
|
+
title: feedItem.title,
|
|
901
|
+
href: href ?? "",
|
|
902
|
+
presenterName: presenter.name,
|
|
903
|
+
presenterSubtitle: subtitle,
|
|
904
|
+
showPlayIcon: feedItem.hasVideo,
|
|
905
|
+
posterURL: feedItem.poster ? urlBuilder.image(feedItem.poster).height(360).url() : undefined
|
|
906
|
+
})
|
|
907
|
+
}, feedItem._id);
|
|
908
|
+
})
|
|
909
|
+
})
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
function $dfd7c10d2685c9b1$export$b3552e87a7c5c47b(config) {
|
|
915
|
+
return {
|
|
916
|
+
name: "sanity-tutorials",
|
|
917
|
+
component: (0, $e6d104338a42de87$export$5f156cc357b8467f),
|
|
918
|
+
layout: config?.layout ?? {
|
|
919
|
+
width: "full"
|
|
920
|
+
}
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
|
|
925
|
+
const $090815f5086f7f29$var$strokeStyle = {
|
|
926
|
+
stroke: "currentColor",
|
|
927
|
+
strokeWidth: 1.2
|
|
928
|
+
};
|
|
929
|
+
const $090815f5086f7f29$var$DashboardIcon = ()=>/*#__PURE__*/ (0, $5lYf0$jsxs)("svg", {
|
|
930
|
+
"data-sanity-icon": true,
|
|
931
|
+
viewBox: "0 0 25 25",
|
|
932
|
+
fill: "none",
|
|
933
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
934
|
+
preserveAspectRatio: "xMidYMid",
|
|
935
|
+
width: "1em",
|
|
936
|
+
height: "1em",
|
|
937
|
+
children: [
|
|
938
|
+
/*#__PURE__*/ (0, $5lYf0$jsx)("path", {
|
|
939
|
+
d: "M19.5 19.5H5.5V5.5H19.5V19.5Z",
|
|
940
|
+
style: $090815f5086f7f29$var$strokeStyle
|
|
941
|
+
}),
|
|
942
|
+
/*#__PURE__*/ (0, $5lYf0$jsx)("path", {
|
|
943
|
+
d: "M5.5 12.5H19.5",
|
|
944
|
+
style: $090815f5086f7f29$var$strokeStyle
|
|
945
|
+
}),
|
|
946
|
+
/*#__PURE__*/ (0, $5lYf0$jsx)("path", {
|
|
947
|
+
d: "M14.5 19.5V12.5M10.5 12.5V5.5",
|
|
948
|
+
style: $090815f5086f7f29$var$strokeStyle
|
|
949
|
+
})
|
|
950
|
+
]
|
|
951
|
+
});
|
|
952
|
+
const $090815f5086f7f29$export$dd097bc0a3a5adbd = (0, $5lYf0$createPlugin)((config = {})=>{
|
|
953
|
+
const pluginConfig = {
|
|
954
|
+
layout: config.defaultLayout ?? {},
|
|
955
|
+
widgets: config.widgets ?? []
|
|
956
|
+
};
|
|
957
|
+
return {
|
|
958
|
+
name: "dashboard",
|
|
959
|
+
tools: (prev, context)=>{
|
|
960
|
+
return [
|
|
961
|
+
...prev,
|
|
962
|
+
{
|
|
963
|
+
title: "Dashboard",
|
|
964
|
+
name: "dashboard",
|
|
965
|
+
icon: $090815f5086f7f29$var$DashboardIcon,
|
|
966
|
+
component: ()=>/*#__PURE__*/ (0, $5lYf0$jsx)((0, $086586914f992408$export$fe82a520fc33e5f4), {
|
|
967
|
+
config: pluginConfig
|
|
968
|
+
})
|
|
969
|
+
},
|
|
970
|
+
];
|
|
971
|
+
}
|
|
972
|
+
};
|
|
973
|
+
});
|
|
974
|
+
|
|
975
|
+
|
|
976
|
+
export {$090815f5086f7f29$export$dd097bc0a3a5adbd as dashboardTool, $1f0cda7387acedc8$export$67b2e85605d868b2 as DashboardWidgetContainer, $ac478372f28acbf6$export$66362ea0e7ee12e as projectInfoWidget, $0ef0fb9920ec1f58$export$5c0e62d7539f632 as projectUsersWidget, $dfd7c10d2685c9b1$export$b3552e87a7c5c47b as sanityTutorialsWidget};
|
|
977
|
+
//# sourceMappingURL=index.js.map
|