@sanity/dashboard 6.0.6 → 6.0.7
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/dist/index.js +668 -524
- package/dist/index.js.map +1 -1
- package/package.json +5 -6
package/dist/index.js
CHANGED
|
@@ -1,609 +1,753 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createContext, useContext, useEffect, useState } from "react";
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { Box, Button, Card, Code, Container, Flex, Grid, Heading, Label, Spinner, Stack, Text, rem } from "@sanity/ui";
|
|
4
4
|
import { getTheme_v2 } from "@sanity/ui/theme";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { useClient, useListFormat, UserAvatar, useUserStore, definePlugin } from "sanity";
|
|
5
|
+
import { css, styled } from "styled-components";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
7
|
import { from } from "rxjs";
|
|
9
|
-
import {
|
|
8
|
+
import { UserAvatar, definePlugin, useClient, useListFormat, useUserStore } from "sanity";
|
|
9
|
+
import { map, switchMap } from "rxjs/operators";
|
|
10
10
|
import { RobotIcon } from "@sanity/icons/Robot";
|
|
11
11
|
import { createImageUrlBuilder } from "@sanity/image-url";
|
|
12
12
|
import { PlayIcon } from "@sanity/icons/Play";
|
|
13
|
-
const Root$3 =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
})
|
|
26
|
-
theme
|
|
27
|
-
}) => getTheme_v2(theme).media[0]);
|
|
13
|
+
const Root$3 = styled(Card).withConfig({
|
|
14
|
+
displayName: "Root",
|
|
15
|
+
componentId: "sc-41rfei-0"
|
|
16
|
+
})`display:flex;flex-direction:column;justify-content:stretch;height:100%;box-sizing:border-box;position:relative;`, Header = styled(Card).withConfig({
|
|
17
|
+
displayName: "Header",
|
|
18
|
+
componentId: "sc-41rfei-1"
|
|
19
|
+
})`position:sticky;top:0;z-index:2;border-top-left-radius:inherit;border-top-right-radius:inherit;`, Footer = styled(Card).withConfig({
|
|
20
|
+
displayName: "Footer",
|
|
21
|
+
componentId: "sc-41rfei-2"
|
|
22
|
+
})`position:sticky;overflow:hidden;bottom:0;z-index:2;border-bottom-right-radius:inherit;border-bottom-left-radius:inherit;margin-top:auto;`, Content = styled(Box).withConfig({
|
|
23
|
+
displayName: "Content",
|
|
24
|
+
componentId: "sc-41rfei-3"
|
|
25
|
+
})`position:relative;z-index:1;height:stretch;min-height:21.5em;@media (min-width:${({ theme }) => getTheme_v2(theme).media[0]}px){overflow-y:auto;outline:none;}`;
|
|
28
26
|
function DashboardWidgetContainer(props) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
27
|
+
let $ = c(11), { header, children, footer, ref } = props, t0;
|
|
28
|
+
$[0] === header ? t0 = $[1] : (t0 = header && /* @__PURE__ */ jsx(Header, {
|
|
29
|
+
borderBottom: !0,
|
|
30
|
+
paddingX: 3,
|
|
31
|
+
paddingY: 4,
|
|
32
|
+
children: /* @__PURE__ */ jsx(Heading, {
|
|
33
|
+
size: 1,
|
|
34
|
+
textOverflow: "ellipsis",
|
|
35
|
+
children: header
|
|
36
|
+
})
|
|
37
|
+
}), $[0] = header, $[1] = t0);
|
|
38
|
+
let t1;
|
|
39
|
+
$[2] === children ? t1 = $[3] : (t1 = children && /* @__PURE__ */ jsx(Content, { children }), $[2] = children, $[3] = t1);
|
|
40
|
+
let t2;
|
|
41
|
+
$[4] === footer ? t2 = $[5] : (t2 = footer && /* @__PURE__ */ jsx(Footer, {
|
|
42
|
+
borderTop: !0,
|
|
43
|
+
children: footer
|
|
44
|
+
}), $[4] = footer, $[5] = t2);
|
|
45
|
+
let t3;
|
|
46
|
+
return $[6] !== ref || $[7] !== t0 || $[8] !== t1 || $[9] !== t2 ? (t3 = /* @__PURE__ */ jsxs(Root$3, {
|
|
47
|
+
radius: 3,
|
|
48
|
+
display: "flex",
|
|
49
|
+
ref,
|
|
50
|
+
children: [
|
|
51
|
+
t0,
|
|
52
|
+
t1,
|
|
53
|
+
t2
|
|
54
|
+
]
|
|
55
|
+
}), $[6] = ref, $[7] = t0, $[8] = t1, $[9] = t2, $[10] = t3) : t3 = $[10], t3;
|
|
56
|
+
}
|
|
57
|
+
const DashboardContext = createContext({ widgets: [] });
|
|
51
58
|
function useDashboardConfig() {
|
|
52
|
-
|
|
59
|
+
return useContext(DashboardContext);
|
|
53
60
|
}
|
|
54
61
|
function WidgetContainer(props) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
let $ = c(9), config = useDashboardConfig(), t0;
|
|
63
|
+
$[0] !== config.layout || $[1] !== props.layout ? (t0 = {
|
|
64
|
+
...props.layout,
|
|
65
|
+
...config.layout
|
|
66
|
+
}, $[0] = config.layout, $[1] = props.layout, $[2] = t0) : t0 = $[2];
|
|
67
|
+
let layout = t0, Widget = props.component, t1;
|
|
68
|
+
$[3] === Widget ? t1 = $[4] : (t1 = /* @__PURE__ */ jsx(Widget, {}), $[3] = Widget, $[4] = t1);
|
|
69
|
+
let t2;
|
|
70
|
+
return $[5] !== layout.height || $[6] !== layout.width || $[7] !== t1 ? (t2 = /* @__PURE__ */ jsx(Card, {
|
|
71
|
+
shadow: 1,
|
|
72
|
+
"data-width": layout.width,
|
|
73
|
+
"data-height": layout.height,
|
|
74
|
+
children: t1
|
|
75
|
+
}), $[5] = layout.height, $[6] = layout.width, $[7] = t1, $[8] = t2) : t2 = $[8], t2;
|
|
66
76
|
}
|
|
67
77
|
function useVersionedClient() {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return $[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = {
|
|
71
|
-
apiVersion: "2024-08-01"
|
|
72
|
-
}, $[0] = t0) : t0 = $[0], useClient(t0);
|
|
78
|
+
let $ = c(1), t0;
|
|
79
|
+
return $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { apiVersion: "2024-08-01" }, $[0] = t0) : t0 = $[0], useClient(t0);
|
|
73
80
|
}
|
|
74
81
|
function isUrl(url) {
|
|
75
|
-
|
|
82
|
+
return url && /^https?:\/\//.test(url);
|
|
76
83
|
}
|
|
77
84
|
function getGraphQLUrl(projectId, dataset) {
|
|
78
|
-
|
|
85
|
+
return `https://${projectId}.api.sanity.io/v1/graphql/${dataset}/default`;
|
|
79
86
|
}
|
|
80
87
|
function getGroqUrl(projectId, dataset) {
|
|
81
|
-
|
|
88
|
+
return `https://${projectId}.api.sanity.io/v1/groq/${dataset}`;
|
|
82
89
|
}
|
|
83
90
|
function getManageUrl(projectId) {
|
|
84
|
-
|
|
91
|
+
return `https://manage.sanity.io/projects/${projectId}`;
|
|
85
92
|
}
|
|
86
93
|
const NO_EXPERIMENTAL = [], NO_DATA = [];
|
|
87
94
|
function ProjectInfo(props) {
|
|
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
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
95
|
+
let $ = c(37), { __experimental_before: t0, data: t1 } = props, __experimental_before = t0 === void 0 ? NO_EXPERIMENTAL : t0, data = t1 === void 0 ? NO_DATA : t1, [studioApps, setStudioApps] = useState(), [graphQLApi, setGraphQLApi] = useState(), versionedClient = useVersionedClient(), t2;
|
|
96
|
+
$[0] === versionedClient ? t2 = $[1] : (t2 = versionedClient.config(), $[0] = versionedClient, $[1] = t2);
|
|
97
|
+
let { projectId: t3, dataset: t4 } = t2, projectId = t3 === void 0 ? "unknown" : t3, dataset = t4 === void 0 ? "unknown" : t4, t5;
|
|
98
|
+
$[2] !== dataset || $[3] !== projectId || $[4] !== versionedClient.observable ? (t5 = () => {
|
|
99
|
+
let subscriptions = [];
|
|
100
|
+
return subscriptions.push(versionedClient.observable.request({
|
|
101
|
+
uri: "/user-applications",
|
|
102
|
+
tag: "dashboard.project-info"
|
|
103
|
+
}).subscribe({
|
|
104
|
+
next: (result) => setStudioApps(result.filter(_temp$2)),
|
|
105
|
+
error: (error) => {
|
|
106
|
+
console.error("Error while resolving user applications", error), setStudioApps({ error: "Something went wrong while resolving user applications. See console." });
|
|
107
|
+
}
|
|
108
|
+
})), subscriptions.push(versionedClient.observable.request({
|
|
109
|
+
method: "HEAD",
|
|
110
|
+
uri: `/graphql/${dataset}/default`,
|
|
111
|
+
tag: "dashboard.project-info.graphql-api"
|
|
112
|
+
}).subscribe({
|
|
113
|
+
next: () => setGraphQLApi(getGraphQLUrl(projectId, dataset)),
|
|
114
|
+
error: (error_0) => {
|
|
115
|
+
error_0.statusCode === 404 ? setGraphQLApi(void 0) : (console.error("Error while looking for graphQLApi", error_0), setGraphQLApi({ error: "Something went wrong while looking up graphQLApi. See console." }));
|
|
116
|
+
}
|
|
117
|
+
})), () => {
|
|
118
|
+
subscriptions.forEach(_temp2$1);
|
|
119
|
+
};
|
|
120
|
+
}, $[2] = dataset, $[3] = projectId, $[4] = versionedClient.observable, $[5] = t5) : t5 = $[5];
|
|
121
|
+
let t6;
|
|
122
|
+
$[6] !== dataset || $[7] !== projectId || $[8] !== versionedClient ? (t6 = [
|
|
123
|
+
dataset,
|
|
124
|
+
projectId,
|
|
125
|
+
versionedClient,
|
|
126
|
+
setGraphQLApi
|
|
127
|
+
], $[6] = dataset, $[7] = projectId, $[8] = versionedClient, $[9] = t6) : t6 = $[9], useEffect(t5, t6);
|
|
128
|
+
let result_0;
|
|
129
|
+
if ($[10] !== data || $[11] !== dataset || $[12] !== graphQLApi || $[13] !== projectId || $[14] !== studioApps) {
|
|
130
|
+
result_0 = [{
|
|
131
|
+
title: "Sanity project",
|
|
132
|
+
rows: [{
|
|
133
|
+
title: "Project ID",
|
|
134
|
+
value: projectId
|
|
135
|
+
}, {
|
|
136
|
+
title: "Dataset",
|
|
137
|
+
value: dataset
|
|
138
|
+
}]
|
|
139
|
+
}];
|
|
140
|
+
let apps = data.filter(_temp3);
|
|
141
|
+
(Array.isArray(studioApps) ? studioApps : []).forEach((app_0) => {
|
|
142
|
+
apps.push({
|
|
143
|
+
title: app_0.title || "Studio",
|
|
144
|
+
value: app_0.urlType === "internal" ? `https://${app_0.appHost}.sanity.studio` : app_0.appHost
|
|
145
|
+
});
|
|
146
|
+
}), apps.length > 0 && (result_0 = result_0.concat([{
|
|
147
|
+
title: "Apps",
|
|
148
|
+
rows: apps
|
|
149
|
+
}])), result_0 = result_0.concat([{
|
|
150
|
+
title: "APIs",
|
|
151
|
+
rows: [{
|
|
152
|
+
title: "GROQ",
|
|
153
|
+
value: getGroqUrl(projectId, dataset)
|
|
154
|
+
}, {
|
|
155
|
+
title: "GraphQL",
|
|
156
|
+
value: (typeof graphQLApi == "object" ? "Error" : graphQLApi) ?? "Not deployed"
|
|
157
|
+
}]
|
|
158
|
+
}], data.filter(_temp4));
|
|
159
|
+
let otherStuff = {};
|
|
160
|
+
data.forEach((item_1) => {
|
|
161
|
+
if (item_1.category && item_1.category !== "apps" && item_1.category !== "apis") {
|
|
162
|
+
let group = otherStuff[item_1.category] ?? [];
|
|
163
|
+
group.push(item_1), otherStuff[item_1.category] = group;
|
|
164
|
+
}
|
|
165
|
+
}), Object.keys(otherStuff).forEach((category) => {
|
|
166
|
+
result_0.push({
|
|
167
|
+
title: category,
|
|
168
|
+
rows: otherStuff[category]
|
|
169
|
+
});
|
|
170
|
+
}), $[10] = data, $[11] = dataset, $[12] = graphQLApi, $[13] = projectId, $[14] = studioApps, $[15] = result_0;
|
|
171
|
+
} else result_0 = $[15];
|
|
172
|
+
let assembleTableRows = result_0, t7;
|
|
173
|
+
$[16] === __experimental_before ? t7 = $[17] : (t7 = __experimental_before.map(_temp5), $[16] = __experimental_before, $[17] = t7);
|
|
174
|
+
let t8 = __experimental_before?.length > 0 ? 4 : 0, t9;
|
|
175
|
+
$[18] === Symbol.for("react.memo_cache_sentinel") ? (t9 = { width: "100%" }, $[18] = t9) : t9 = $[18];
|
|
176
|
+
let t10;
|
|
177
|
+
$[19] === projectId ? t10 = $[20] : (t10 = getManageUrl(projectId), $[19] = projectId, $[20] = t10);
|
|
178
|
+
let t11;
|
|
179
|
+
$[21] === t10 ? t11 = $[22] : (t11 = /* @__PURE__ */ jsx(Button, {
|
|
180
|
+
style: t9,
|
|
181
|
+
paddingX: 2,
|
|
182
|
+
paddingY: 4,
|
|
183
|
+
mode: "bleed",
|
|
184
|
+
tone: "primary",
|
|
185
|
+
text: "Manage project",
|
|
186
|
+
as: "a",
|
|
187
|
+
href: t10
|
|
188
|
+
}), $[21] = t10, $[22] = t11);
|
|
189
|
+
let t12;
|
|
190
|
+
$[23] === Symbol.for("react.memo_cache_sentinel") ? (t12 = /* @__PURE__ */ jsx(Box, {
|
|
191
|
+
paddingX: 3,
|
|
192
|
+
as: "header",
|
|
193
|
+
children: /* @__PURE__ */ jsx(Heading, {
|
|
194
|
+
size: 1,
|
|
195
|
+
as: "h2",
|
|
196
|
+
id: "project_info_table",
|
|
197
|
+
children: "Project info"
|
|
198
|
+
})
|
|
199
|
+
}), $[23] = t12) : t12 = $[23];
|
|
200
|
+
let t13;
|
|
201
|
+
$[24] === assembleTableRows ? t13 = $[25] : (t13 = assembleTableRows.map(_temp7), $[24] = assembleTableRows, $[25] = t13);
|
|
202
|
+
let t14;
|
|
203
|
+
$[26] === t13 ? t14 = $[27] : (t14 = /* @__PURE__ */ jsx(Card, {
|
|
204
|
+
paddingY: 4,
|
|
205
|
+
radius: 2,
|
|
206
|
+
"aria-label": "Project info",
|
|
207
|
+
children: /* @__PURE__ */ jsxs(Stack, {
|
|
208
|
+
gap: 4,
|
|
209
|
+
children: [t12, t13]
|
|
210
|
+
})
|
|
211
|
+
}), $[26] = t13, $[27] = t14);
|
|
212
|
+
let t15;
|
|
213
|
+
$[28] !== t11 || $[29] !== t14 ? (t15 = /* @__PURE__ */ jsx(DashboardWidgetContainer, {
|
|
214
|
+
footer: t11,
|
|
215
|
+
children: t14
|
|
216
|
+
}), $[28] = t11, $[29] = t14, $[30] = t15) : t15 = $[30];
|
|
217
|
+
let t16;
|
|
218
|
+
$[31] !== t15 || $[32] !== t8 ? (t16 = /* @__PURE__ */ jsx(Box, {
|
|
219
|
+
height: "fill",
|
|
220
|
+
marginTop: t8,
|
|
221
|
+
children: t15
|
|
222
|
+
}), $[31] = t15, $[32] = t8, $[33] = t16) : t16 = $[33];
|
|
223
|
+
let t17;
|
|
224
|
+
return $[34] !== t16 || $[35] !== t7 ? (t17 = /* @__PURE__ */ jsxs(Fragment, { children: [t7, t16] }), $[34] = t16, $[35] = t7, $[36] = t17) : t17 = $[36], t17;
|
|
203
225
|
}
|
|
204
226
|
function _temp7(item_2) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
227
|
+
return !item_2 || !item_2.rows ? null : /* @__PURE__ */ jsxs(Stack, {
|
|
228
|
+
gap: 3,
|
|
229
|
+
children: [/* @__PURE__ */ jsx(Card, {
|
|
230
|
+
borderBottom: !0,
|
|
231
|
+
padding: 3,
|
|
232
|
+
children: /* @__PURE__ */ jsx(Label, {
|
|
233
|
+
size: 0,
|
|
234
|
+
muted: !0,
|
|
235
|
+
children: item_2.title
|
|
236
|
+
})
|
|
237
|
+
}), /* @__PURE__ */ jsx(Stack, {
|
|
238
|
+
gap: 4,
|
|
239
|
+
paddingX: 3,
|
|
240
|
+
children: item_2.rows.map(_temp6)
|
|
241
|
+
})]
|
|
242
|
+
}, item_2.title);
|
|
209
243
|
}
|
|
210
244
|
function _temp6(row) {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
245
|
+
let rowValue = typeof row.value == "object" ? row.value.error : row.value;
|
|
246
|
+
return /* @__PURE__ */ jsxs(Grid, {
|
|
247
|
+
gridTemplateColumns: 2,
|
|
248
|
+
children: [
|
|
249
|
+
/* @__PURE__ */ jsx(Text, {
|
|
250
|
+
weight: "medium",
|
|
251
|
+
children: row.title
|
|
252
|
+
}),
|
|
253
|
+
typeof row.value == "object" && /* @__PURE__ */ jsx(Text, {
|
|
254
|
+
size: 1,
|
|
255
|
+
children: row.value?.error
|
|
256
|
+
}),
|
|
257
|
+
typeof row.value == "string" && /* @__PURE__ */ jsx(Fragment, { children: isUrl(row.value) ? /* @__PURE__ */ jsx(Text, {
|
|
258
|
+
size: 1,
|
|
259
|
+
style: { wordBreak: "break-word" },
|
|
260
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
261
|
+
href: row.value,
|
|
262
|
+
children: row.value
|
|
263
|
+
})
|
|
264
|
+
}) : /* @__PURE__ */ jsx(Code, {
|
|
265
|
+
size: 1,
|
|
266
|
+
style: { wordBreak: "break-word" },
|
|
267
|
+
children: row.value
|
|
268
|
+
}) })
|
|
269
|
+
]
|
|
270
|
+
}, `${rowValue ?? ""}-${row.title}`);
|
|
221
271
|
}
|
|
222
272
|
function _temp5(widgetConfig, idx) {
|
|
223
|
-
|
|
273
|
+
return /* @__PURE__ */ jsx(WidgetContainer, { ...widgetConfig }, idx);
|
|
224
274
|
}
|
|
225
275
|
function _temp4(item_0) {
|
|
226
|
-
|
|
276
|
+
return item_0.category === "apis";
|
|
227
277
|
}
|
|
228
278
|
function _temp3(item) {
|
|
229
|
-
|
|
279
|
+
return item.category === "apps";
|
|
230
280
|
}
|
|
231
281
|
function _temp2$1(s) {
|
|
232
|
-
|
|
282
|
+
return s.unsubscribe();
|
|
233
283
|
}
|
|
234
284
|
function _temp$2(app) {
|
|
235
|
-
|
|
285
|
+
return app.type === "studio";
|
|
236
286
|
}
|
|
237
287
|
function projectInfoWidget(config) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
componentId: "sc-63c5lb-0"
|
|
249
|
-
})(["height:", ";box-sizing:content-box;"], rem(33));
|
|
288
|
+
return {
|
|
289
|
+
name: "project-info",
|
|
290
|
+
component: ProjectInfo,
|
|
291
|
+
layout: config?.layout ?? { width: "medium" }
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
const Root$2 = styled(Flex).withConfig({
|
|
295
|
+
displayName: "Root",
|
|
296
|
+
componentId: "sc-sdrwc6-0"
|
|
297
|
+
})`height:${rem(33)};box-sizing:content-box;`;
|
|
250
298
|
function ProjectUser(t0) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
299
|
+
let $ = c(18), { user, isRobot, roles } = t0, t1;
|
|
300
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = { style: "narrow" }, $[0] = t1) : t1 = $[0];
|
|
301
|
+
let listFormat = useListFormat(t1), t2;
|
|
302
|
+
$[1] !== isRobot || $[2] !== user ? (t2 = /* @__PURE__ */ jsx(Box, {
|
|
303
|
+
flex: "none",
|
|
304
|
+
children: isRobot ? /* @__PURE__ */ jsx(Text, {
|
|
305
|
+
size: 2,
|
|
306
|
+
children: /* @__PURE__ */ jsx(RobotIcon, {})
|
|
307
|
+
}) : /* @__PURE__ */ jsx(UserAvatar, { user })
|
|
308
|
+
}), $[1] = isRobot, $[2] = user, $[3] = t2) : t2 = $[3];
|
|
309
|
+
let t3;
|
|
310
|
+
$[4] === Symbol.for("react.memo_cache_sentinel") ? (t3 = { color: "inherit" }, $[4] = t3) : t3 = $[4];
|
|
311
|
+
let t4;
|
|
312
|
+
$[5] === user.displayName ? t4 = $[6] : (t4 = /* @__PURE__ */ jsx(Text, {
|
|
313
|
+
size: 1,
|
|
314
|
+
style: t3,
|
|
315
|
+
textOverflow: "ellipsis",
|
|
316
|
+
weight: "medium",
|
|
317
|
+
children: user.displayName
|
|
318
|
+
}), $[5] = user.displayName, $[6] = t4);
|
|
319
|
+
let t5;
|
|
320
|
+
$[7] !== listFormat || $[8] !== roles ? (t5 = listFormat.format(roles), $[7] = listFormat, $[8] = roles, $[9] = t5) : t5 = $[9];
|
|
321
|
+
let t6;
|
|
322
|
+
$[10] === t5 ? t6 = $[11] : (t6 = /* @__PURE__ */ jsx(Text, {
|
|
323
|
+
muted: !0,
|
|
324
|
+
size: 1,
|
|
325
|
+
textOverflow: "ellipsis",
|
|
326
|
+
children: t5
|
|
327
|
+
}), $[10] = t5, $[11] = t6);
|
|
328
|
+
let t7;
|
|
329
|
+
$[12] !== t4 || $[13] !== t6 ? (t7 = /* @__PURE__ */ jsxs(Stack, {
|
|
330
|
+
flex: 1,
|
|
331
|
+
gap: 2,
|
|
332
|
+
children: [t4, t6]
|
|
333
|
+
}), $[12] = t4, $[13] = t6, $[14] = t7) : t7 = $[14];
|
|
334
|
+
let t8;
|
|
335
|
+
return $[15] !== t2 || $[16] !== t7 ? (t8 = /* @__PURE__ */ jsx(Root$2, {
|
|
336
|
+
align: "center",
|
|
337
|
+
children: /* @__PURE__ */ jsxs(Flex, {
|
|
338
|
+
align: "center",
|
|
339
|
+
flex: 1,
|
|
340
|
+
gap: 2,
|
|
341
|
+
children: [t2, t7]
|
|
342
|
+
})
|
|
343
|
+
}), $[15] = t2, $[16] = t7, $[17] = t8) : t8 = $[17], t8;
|
|
283
344
|
}
|
|
284
345
|
function getInviteUrl(projectId) {
|
|
285
|
-
|
|
346
|
+
return `https://manage.sanity.io/projects/${projectId}/members`;
|
|
286
347
|
}
|
|
287
348
|
function ProjectUsers() {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
+
let $ = c(28), [project, setProject] = useState(), [users, setUsers] = useState(), [error, setError] = useState(), userStore = useUserStore(), versionedClient = useVersionedClient(), t0;
|
|
350
|
+
$[0] !== userStore || $[1] !== versionedClient ? (t0 = () => {
|
|
351
|
+
let { projectId } = versionedClient.config(), subscription = versionedClient.observable.request({
|
|
352
|
+
uri: `/projects/${projectId}`,
|
|
353
|
+
tag: "dashboard.project-users"
|
|
354
|
+
}).pipe(switchMap((_project) => from(userStore.getUsers(_project.members.map(_temp$1))).pipe(map((_users) => ({
|
|
355
|
+
project: _project,
|
|
356
|
+
users: _users
|
|
357
|
+
}))))).subscribe({
|
|
358
|
+
next: (t1) => {
|
|
359
|
+
let { users: _users_0, project: _project_0 } = t1;
|
|
360
|
+
setProject(_project_0), setUsers((Array.isArray(_users_0) ? _users_0 : [_users_0]).sort((userA, userB) => sortUsersByRobotStatus(userA, userB, _project_0)));
|
|
361
|
+
},
|
|
362
|
+
error: (e) => setError(e)
|
|
363
|
+
});
|
|
364
|
+
return () => subscription.unsubscribe();
|
|
365
|
+
}, $[0] = userStore, $[1] = versionedClient, $[2] = t0) : t0 = $[2];
|
|
366
|
+
let fetchData = t0, t1, t2;
|
|
367
|
+
$[3] === fetchData ? (t1 = $[4], t2 = $[5]) : (t1 = () => fetchData(), t2 = [fetchData], $[3] = fetchData, $[4] = t1, $[5] = t2), useEffect(t1, t2);
|
|
368
|
+
let t3;
|
|
369
|
+
$[6] === fetchData ? t3 = $[7] : (t3 = () => fetchData(), $[6] = fetchData, $[7] = t3);
|
|
370
|
+
let handleRetryFetch = t3, isLoading = !users || !project;
|
|
371
|
+
if (error) {
|
|
372
|
+
let t4;
|
|
373
|
+
$[8] === Symbol.for("react.memo_cache_sentinel") ? (t4 = /* @__PURE__ */ jsx(Text, { children: "Something went wrong while fetching data." }), $[8] = t4) : t4 = $[8];
|
|
374
|
+
let t5;
|
|
375
|
+
return $[9] === handleRetryFetch ? t5 = $[10] : (t5 = /* @__PURE__ */ jsx(DashboardWidgetContainer, {
|
|
376
|
+
header: "Project users",
|
|
377
|
+
children: /* @__PURE__ */ jsx(Box, {
|
|
378
|
+
padding: 4,
|
|
379
|
+
children: /* @__PURE__ */ jsxs(Stack, {
|
|
380
|
+
gap: 3,
|
|
381
|
+
children: [t4, /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Button, {
|
|
382
|
+
mode: "ghost",
|
|
383
|
+
text: "Retry",
|
|
384
|
+
title: "Retry users fetch",
|
|
385
|
+
onClick: handleRetryFetch
|
|
386
|
+
}) })]
|
|
387
|
+
})
|
|
388
|
+
})
|
|
389
|
+
}), $[9] = handleRetryFetch, $[10] = t5), t5;
|
|
390
|
+
}
|
|
391
|
+
let t4;
|
|
392
|
+
$[11] === Symbol.for("react.memo_cache_sentinel") ? (t4 = { width: "100%" }, $[11] = t4) : t4 = $[11];
|
|
393
|
+
let t5;
|
|
394
|
+
$[12] !== isLoading || $[13] !== project ? (t5 = isLoading ? void 0 : getInviteUrl(project.id), $[12] = isLoading, $[13] = project, $[14] = t5) : t5 = $[14];
|
|
395
|
+
let t6;
|
|
396
|
+
$[15] !== isLoading || $[16] !== t5 ? (t6 = /* @__PURE__ */ jsx(Button, {
|
|
397
|
+
style: t4,
|
|
398
|
+
paddingX: 2,
|
|
399
|
+
paddingY: 4,
|
|
400
|
+
mode: "bleed",
|
|
401
|
+
tone: "primary",
|
|
402
|
+
text: "Manage members",
|
|
403
|
+
as: "a",
|
|
404
|
+
loading: isLoading,
|
|
405
|
+
href: t5
|
|
406
|
+
}), $[15] = isLoading, $[16] = t5, $[17] = t6) : t6 = $[17];
|
|
407
|
+
let t7;
|
|
408
|
+
$[18] === isLoading ? t7 = $[19] : (t7 = isLoading && /* @__PURE__ */ jsx(Box, {
|
|
409
|
+
paddingY: 5,
|
|
410
|
+
paddingX: 2,
|
|
411
|
+
children: /* @__PURE__ */ jsxs(Stack, {
|
|
412
|
+
gap: 4,
|
|
413
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
414
|
+
align: "center",
|
|
415
|
+
muted: !0,
|
|
416
|
+
size: 1,
|
|
417
|
+
children: /* @__PURE__ */ jsx(Spinner, {})
|
|
418
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
419
|
+
align: "center",
|
|
420
|
+
size: 1,
|
|
421
|
+
muted: !0,
|
|
422
|
+
children: "Loading items…"
|
|
423
|
+
})]
|
|
424
|
+
})
|
|
425
|
+
}), $[18] = isLoading, $[19] = t7);
|
|
426
|
+
let t8;
|
|
427
|
+
$[20] !== isLoading || $[21] !== project || $[22] !== users ? (t8 = !isLoading && /* @__PURE__ */ jsx(Stack, {
|
|
428
|
+
gap: 3,
|
|
429
|
+
padding: 3,
|
|
430
|
+
children: users?.map((user) => {
|
|
431
|
+
let membership = project.members.find((member) => member.id === user.id);
|
|
432
|
+
return /* @__PURE__ */ jsx(ProjectUser, {
|
|
433
|
+
user,
|
|
434
|
+
isRobot: membership?.isRobot ?? !1,
|
|
435
|
+
roles: membership?.roles.map(_temp2) || []
|
|
436
|
+
}, user.id);
|
|
437
|
+
})
|
|
438
|
+
}), $[20] = isLoading, $[21] = project, $[22] = users, $[23] = t8) : t8 = $[23];
|
|
439
|
+
let t9;
|
|
440
|
+
return $[24] !== t6 || $[25] !== t7 || $[26] !== t8 ? (t9 = /* @__PURE__ */ jsxs(DashboardWidgetContainer, {
|
|
441
|
+
header: "Project users",
|
|
442
|
+
footer: t6,
|
|
443
|
+
children: [t7, t8]
|
|
444
|
+
}), $[24] = t6, $[25] = t7, $[26] = t8, $[27] = t9) : t9 = $[27], t9;
|
|
349
445
|
}
|
|
350
446
|
function _temp2(role) {
|
|
351
|
-
|
|
447
|
+
return role.title;
|
|
352
448
|
}
|
|
353
449
|
function _temp$1(mem) {
|
|
354
|
-
|
|
450
|
+
return mem.id;
|
|
355
451
|
}
|
|
356
452
|
function sortUsersByRobotStatus(userA, userB, project) {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
} = project, membershipA = members.find((member) => member.id === userA?.id), membershipB = members.find((member) => member.id === userB?.id);
|
|
360
|
-
return membershipA?.isRobot === membershipB?.isRobot ? (membershipA?.createdAt || "") > (membershipB?.createdAt || "") ? 1 : -1 : membershipA?.isRobot ? 1 : -1;
|
|
453
|
+
let { members } = project, membershipA = members.find((member) => member.id === userA?.id), membershipB = members.find((member) => member.id === userB?.id);
|
|
454
|
+
return membershipA?.isRobot === membershipB?.isRobot ? (membershipA?.createdAt || "") > (membershipB?.createdAt || "") ? 1 : -1 : membershipA?.isRobot ? 1 : -1;
|
|
361
455
|
}
|
|
362
456
|
function projectUsersWidget(config) {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
457
|
+
return {
|
|
458
|
+
name: "project-users",
|
|
459
|
+
component: ProjectUsers,
|
|
460
|
+
layout: config?.layout
|
|
461
|
+
};
|
|
368
462
|
}
|
|
369
463
|
const tutorialsProjectConfig = {
|
|
370
|
-
|
|
371
|
-
|
|
464
|
+
projectId: "3do82whm",
|
|
465
|
+
dataset: "next"
|
|
372
466
|
};
|
|
373
467
|
function useDataAdapter() {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
})
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
})(
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
})
|
|
404
|
-
displayName: "Poster",
|
|
405
|
-
componentId: "sc-15gyucb-3"
|
|
406
|
-
})(["position:absolute;top:0;left:0;height:100%;width:100%;object-fit:cover;display:block;&:not([src]){display:none;}"]);
|
|
468
|
+
let $ = c(5), versionedClient = useVersionedClient(), t0;
|
|
469
|
+
$[0] === versionedClient ? t0 = $[1] : (t0 = (templateRepoId) => {
|
|
470
|
+
let uri = templateRepoId ? `/addons/dashboard?templateRepoId=${templateRepoId}` : "/addons/dashboard";
|
|
471
|
+
return versionedClient.observable.request({
|
|
472
|
+
uri,
|
|
473
|
+
tag: "dashboard.sanity-tutorials",
|
|
474
|
+
withCredentials: !1
|
|
475
|
+
});
|
|
476
|
+
}, $[0] = versionedClient, $[1] = t0);
|
|
477
|
+
let t1;
|
|
478
|
+
$[2] === Symbol.for("react.memo_cache_sentinel") ? (t1 = createImageUrlBuilder(tutorialsProjectConfig), $[2] = t1) : t1 = $[2];
|
|
479
|
+
let t2;
|
|
480
|
+
return $[3] === t0 ? t2 = $[4] : (t2 = {
|
|
481
|
+
getFeed: t0,
|
|
482
|
+
urlBuilder: t1
|
|
483
|
+
}, $[3] = t0, $[4] = t2), t2;
|
|
484
|
+
}
|
|
485
|
+
const PlayIconBox = styled(Box).withConfig({
|
|
486
|
+
displayName: "PlayIconBox",
|
|
487
|
+
componentId: "sc-ptigy3-0"
|
|
488
|
+
})`position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);&:before{content:'';position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:2.75em;height:2.75em;border-radius:50%;background:${({ theme }) => getTheme_v2(theme).color.bg};opacity:0.75;}`, Root$1 = styled(Flex).withConfig({
|
|
489
|
+
displayName: "Root",
|
|
490
|
+
componentId: "sc-ptigy3-1"
|
|
491
|
+
})`&:hover{${PlayIconBox}{&:before{opacity:1;}}}`, PosterCard = styled(Card).withConfig({
|
|
492
|
+
displayName: "PosterCard",
|
|
493
|
+
componentId: "sc-ptigy3-2"
|
|
494
|
+
})`width:100%;padding-bottom:calc(9 / 16 * 100%);position:relative;`, Poster = styled.img.withConfig({
|
|
495
|
+
displayName: "Poster",
|
|
496
|
+
componentId: "sc-ptigy3-3"
|
|
497
|
+
})`position:absolute;top:0;left:0;height:100%;width:100%;object-fit:cover;display:block;&:not([src]){display:none;}`;
|
|
407
498
|
function Tutorial(props) {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
499
|
+
let $ = c(24), { title, posterURL, showPlayIcon, href, presenterName, presenterSubtitle } = props, t0;
|
|
500
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { position: "relative" }, $[0] = t0) : t0 = $[0];
|
|
501
|
+
let t1;
|
|
502
|
+
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = { height: "100%" }, $[1] = t1) : t1 = $[1];
|
|
503
|
+
let t2;
|
|
504
|
+
$[2] !== posterURL || $[3] !== showPlayIcon ? (t2 = posterURL && /* @__PURE__ */ jsxs(PosterCard, {
|
|
505
|
+
marginBottom: 1,
|
|
506
|
+
children: [/* @__PURE__ */ jsx(Poster, { src: posterURL }), showPlayIcon && /* @__PURE__ */ jsx(PlayIconBox, {
|
|
507
|
+
display: "flex",
|
|
508
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
509
|
+
align: "center",
|
|
510
|
+
children: /* @__PURE__ */ jsx(PlayIcon, {})
|
|
511
|
+
})
|
|
512
|
+
})]
|
|
513
|
+
}), $[2] = posterURL, $[3] = showPlayIcon, $[4] = t2) : t2 = $[4];
|
|
514
|
+
let t3;
|
|
515
|
+
$[5] === title ? t3 = $[6] : (t3 = /* @__PURE__ */ jsx(Heading, {
|
|
516
|
+
as: "h3",
|
|
517
|
+
size: 1,
|
|
518
|
+
children: title
|
|
519
|
+
}), $[5] = title, $[6] = t3);
|
|
520
|
+
let t4;
|
|
521
|
+
$[7] === presenterName ? t4 = $[8] : (t4 = /* @__PURE__ */ jsx(Text, {
|
|
522
|
+
size: 1,
|
|
523
|
+
children: presenterName
|
|
524
|
+
}), $[7] = presenterName, $[8] = t4);
|
|
525
|
+
let t5;
|
|
526
|
+
$[9] === Symbol.for("react.memo_cache_sentinel") ? (t5 = { opacity: .7 }, $[9] = t5) : t5 = $[9];
|
|
527
|
+
let t6;
|
|
528
|
+
$[10] === presenterSubtitle ? t6 = $[11] : (t6 = /* @__PURE__ */ jsx(Text, {
|
|
529
|
+
size: 0,
|
|
530
|
+
style: t5,
|
|
531
|
+
children: presenterSubtitle
|
|
532
|
+
}), $[10] = presenterSubtitle, $[11] = t6);
|
|
533
|
+
let t7;
|
|
534
|
+
$[12] !== t4 || $[13] !== t6 ? (t7 = /* @__PURE__ */ jsx(Box, {
|
|
535
|
+
marginTop: 4,
|
|
536
|
+
children: /* @__PURE__ */ jsxs(Stack, {
|
|
537
|
+
gap: 2,
|
|
538
|
+
flex: 1,
|
|
539
|
+
children: [t4, t6]
|
|
540
|
+
})
|
|
541
|
+
}), $[12] = t4, $[13] = t6, $[14] = t7) : t7 = $[14];
|
|
542
|
+
let t8;
|
|
543
|
+
$[15] !== t3 || $[16] !== t7 ? (t8 = /* @__PURE__ */ jsxs(Flex, {
|
|
544
|
+
direction: "column",
|
|
545
|
+
justify: "space-between",
|
|
546
|
+
paddingY: 2,
|
|
547
|
+
flex: 1,
|
|
548
|
+
children: [t3, t7]
|
|
549
|
+
}), $[15] = t3, $[16] = t7, $[17] = t8) : t8 = $[17];
|
|
550
|
+
let t9;
|
|
551
|
+
$[18] !== t2 || $[19] !== t8 ? (t9 = /* @__PURE__ */ jsxs(Flex, {
|
|
552
|
+
direction: "column",
|
|
553
|
+
style: t1,
|
|
554
|
+
children: [t2, t8]
|
|
555
|
+
}), $[18] = t2, $[19] = t8, $[20] = t9) : t9 = $[20];
|
|
556
|
+
let t10;
|
|
557
|
+
return $[21] !== href || $[22] !== t9 ? (t10 = /* @__PURE__ */ jsx(Root$1, {
|
|
558
|
+
flex: 1,
|
|
559
|
+
children: /* @__PURE__ */ jsx(Card, {
|
|
560
|
+
sizing: "border",
|
|
561
|
+
flex: 1,
|
|
562
|
+
padding: 2,
|
|
563
|
+
radius: 2,
|
|
564
|
+
as: "a",
|
|
565
|
+
href,
|
|
566
|
+
target: "_blank",
|
|
567
|
+
rel: "noopener noreferrer",
|
|
568
|
+
style: t0,
|
|
569
|
+
children: t9
|
|
570
|
+
})
|
|
571
|
+
}), $[21] = href, $[22] = t9, $[23] = t10) : t10 = $[23], t10;
|
|
456
572
|
}
|
|
457
573
|
function createUrl(slug, type) {
|
|
458
|
-
|
|
574
|
+
return type === "tutorial" ? `https://www.sanity.io/docs/tutorials/${slug.current}` : type === "guide" ? `https://www.sanity.io/docs/guides/${slug.current}` : !1;
|
|
459
575
|
}
|
|
460
576
|
function SanityTutorials(props) {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
577
|
+
let $ = c(10), { templateRepoId } = props, t0;
|
|
578
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = [], $[0] = t0) : t0 = $[0];
|
|
579
|
+
let [feedItems, setFeedItems] = useState(t0), { getFeed, urlBuilder } = useDataAdapter(), t1, t2;
|
|
580
|
+
$[1] !== getFeed || $[2] !== templateRepoId ? (t1 = () => {
|
|
581
|
+
let subscription = getFeed(templateRepoId).subscribe((response) => {
|
|
582
|
+
setFeedItems(response.items);
|
|
583
|
+
});
|
|
584
|
+
return () => {
|
|
585
|
+
subscription.unsubscribe();
|
|
586
|
+
};
|
|
587
|
+
}, t2 = [
|
|
588
|
+
setFeedItems,
|
|
589
|
+
getFeed,
|
|
590
|
+
templateRepoId
|
|
591
|
+
], $[1] = getFeed, $[2] = templateRepoId, $[3] = t1, $[4] = t2) : (t1 = $[3], t2 = $[4]), useEffect(t1, t2);
|
|
592
|
+
let t3;
|
|
593
|
+
$[5] !== feedItems || $[6] !== urlBuilder ? (t3 = feedItems?.map((feedItem, index) => {
|
|
594
|
+
if (!feedItem.title || !feedItem.guideOrTutorial && !feedItem.externalLink) return null;
|
|
595
|
+
let presenter = feedItem.presenter || feedItem.guideOrTutorial?.presenter || {}, subtitle = feedItem.category, { guideOrTutorial: t4 } = feedItem, guideOrTutorial = t4 === void 0 ? {} : t4, href = (guideOrTutorial.slug ? createUrl(guideOrTutorial.slug, guideOrTutorial._type) : feedItem.externalLink) || feedItem.externalLink;
|
|
596
|
+
return /* @__PURE__ */ jsx(Flex, {
|
|
597
|
+
as: "li",
|
|
598
|
+
paddingRight: index < feedItems?.length - 1 ? 1 : 3,
|
|
599
|
+
paddingLeft: index === 0 ? 3 : 0,
|
|
600
|
+
align: "stretch",
|
|
601
|
+
style: {
|
|
602
|
+
minWidth: 272,
|
|
603
|
+
width: "30%"
|
|
604
|
+
},
|
|
605
|
+
children: /* @__PURE__ */ jsx(Tutorial, {
|
|
606
|
+
title: feedItem.title,
|
|
607
|
+
href: href ?? "",
|
|
608
|
+
presenterName: presenter.name,
|
|
609
|
+
presenterSubtitle: subtitle,
|
|
610
|
+
showPlayIcon: feedItem.hasVideo,
|
|
611
|
+
posterURL: feedItem.poster ? urlBuilder.image(feedItem.poster).height(360).url() : void 0
|
|
612
|
+
})
|
|
613
|
+
}, feedItem._id);
|
|
614
|
+
}), $[5] = feedItems, $[6] = urlBuilder, $[7] = t3) : t3 = $[7];
|
|
615
|
+
let t4;
|
|
616
|
+
return $[8] === t3 ? t4 = $[9] : (t4 = /* @__PURE__ */ jsx(DashboardWidgetContainer, {
|
|
617
|
+
header: "Learn about Sanity",
|
|
618
|
+
children: /* @__PURE__ */ jsx(Flex, {
|
|
619
|
+
as: "ul",
|
|
620
|
+
overflow: "auto",
|
|
621
|
+
align: "stretch",
|
|
622
|
+
paddingY: 2,
|
|
623
|
+
children: t3
|
|
624
|
+
})
|
|
625
|
+
}), $[8] = t3, $[9] = t4), t4;
|
|
493
626
|
}
|
|
494
627
|
function sanityTutorialsWidget(config) {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
}
|
|
501
|
-
};
|
|
628
|
+
return {
|
|
629
|
+
name: "sanity-tutorials",
|
|
630
|
+
component: SanityTutorials,
|
|
631
|
+
layout: config?.layout ?? { width: "full" }
|
|
632
|
+
};
|
|
502
633
|
}
|
|
503
634
|
function DashboardLayout(t0) {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
635
|
+
let $ = c(3), { children } = t0, t1;
|
|
636
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = {
|
|
637
|
+
height: "100%",
|
|
638
|
+
overflowY: "auto"
|
|
639
|
+
}, $[0] = t1) : t1 = $[0];
|
|
640
|
+
let t2;
|
|
641
|
+
return $[1] === children ? t2 = $[2] : (t2 = /* @__PURE__ */ jsx(Container, {
|
|
642
|
+
width: 4,
|
|
643
|
+
padding: 4,
|
|
644
|
+
sizing: "border",
|
|
645
|
+
style: t1,
|
|
646
|
+
children
|
|
647
|
+
}), $[1] = children, $[2] = t2), t2;
|
|
514
648
|
}
|
|
515
649
|
const media = {
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
}, Root = /* @__PURE__ */ styled(Grid).withConfig({
|
|
523
|
-
displayName: "Root",
|
|
524
|
-
componentId: "sc-1av8yx9-0"
|
|
525
|
-
})(["grid-template-columns:repeat(auto-fit,minmax(250px,1fr));& > div{overflow:hidden;}& > div[data-width='medium']{", "}& > div[data-width='large']{", " ", "}& > div[data-width='full']{", "}& > div[data-height='medium']{", "}& > div[data-height='large']{", " ", "}& > div[data-height='full']{", "}"], media.small`
|
|
650
|
+
small: (...args) => css`@media (min-width:${({ theme }) => getTheme_v2(theme).media[0]}px){${css(...args)}}`,
|
|
651
|
+
medium: (...args) => css`@media (min-width:${({ theme }) => getTheme_v2(theme).media[2]}px){${css(...args)}}`
|
|
652
|
+
}, Root = styled(Grid).withConfig({
|
|
653
|
+
displayName: "Root",
|
|
654
|
+
componentId: "sc-f3tzqz-0"
|
|
655
|
+
})`grid-template-columns:repeat(auto-fit,minmax(250px,1fr));& > div{overflow:hidden;}& > div[data-width='medium']{${media.small`
|
|
526
656
|
grid-column: span 2;
|
|
527
|
-
|
|
657
|
+
`}}& > div[data-width='large']{${media.small`
|
|
528
658
|
grid-column: span 2;
|
|
529
|
-
|
|
659
|
+
`} ${media.medium`
|
|
530
660
|
grid-column: span 3;
|
|
531
|
-
|
|
661
|
+
`}}& > div[data-width='full']{${media.small`
|
|
532
662
|
grid-column: 1 / -1;
|
|
533
|
-
|
|
663
|
+
`}}& > div[data-height='medium']{${media.small`
|
|
534
664
|
grid-row: span 2;
|
|
535
|
-
|
|
665
|
+
`}}& > div[data-height='large']{${media.small`
|
|
536
666
|
grid-row: span 2;
|
|
537
|
-
|
|
667
|
+
`} ${media.medium`
|
|
538
668
|
grid-row: span 3;
|
|
539
|
-
|
|
669
|
+
`}}& > div[data-height='full']{${media.medium`
|
|
540
670
|
grid-row: 1 / -1;
|
|
541
|
-
`
|
|
671
|
+
`}}`, NO_WIDGETS = [], NO_LAYOUT = {};
|
|
542
672
|
function WidgetGroup(props) {
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
673
|
+
let $ = c(9), { config: t0 } = props, { layout: t1, widgets: t2 } = t0, layout = t1 === void 0 ? NO_LAYOUT : t1, widgets = t2 === void 0 ? NO_WIDGETS : t2, t3 = layout.width || "auto", t4 = layout.height || "auto", t5;
|
|
674
|
+
$[0] === widgets.length ? t5 = $[1] : (t5 = widgets.length ? null : /* @__PURE__ */ jsx(Card, {
|
|
675
|
+
padding: 4,
|
|
676
|
+
shadow: 1,
|
|
677
|
+
tone: "primary",
|
|
678
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
679
|
+
align: "center",
|
|
680
|
+
children: "Add some widgets to populate this space."
|
|
681
|
+
})
|
|
682
|
+
}), $[0] = widgets.length, $[1] = t5);
|
|
683
|
+
let t6;
|
|
684
|
+
$[2] === widgets ? t6 = $[3] : (t6 = widgets.map(_temp), $[2] = widgets, $[3] = t6);
|
|
685
|
+
let t7;
|
|
686
|
+
return $[4] !== t3 || $[5] !== t4 || $[6] !== t5 || $[7] !== t6 ? (t7 = /* @__PURE__ */ jsxs(Root, {
|
|
687
|
+
autoFlow: "row dense",
|
|
688
|
+
"data-width": t3,
|
|
689
|
+
"data-height": t4,
|
|
690
|
+
gap: 4,
|
|
691
|
+
children: [t5, t6]
|
|
692
|
+
}), $[4] = t3, $[5] = t4, $[6] = t5, $[7] = t6, $[8] = t7) : t7 = $[8], t7;
|
|
558
693
|
}
|
|
559
694
|
function _temp(widgetConfig, index) {
|
|
560
|
-
|
|
561
|
-
widgetConfig.name,
|
|
562
|
-
" is missing widget component"
|
|
563
|
-
] }, index);
|
|
695
|
+
return widgetConfig.type === "__experimental_group" ? /* @__PURE__ */ jsx(WidgetGroup, { config: widgetConfig }, index) : widgetConfig.component ? /* @__PURE__ */ jsx(WidgetContainer, { ...widgetConfig }, index) : /* @__PURE__ */ jsxs(Box, { children: [widgetConfig.name, " is missing widget component"] }, index);
|
|
564
696
|
}
|
|
565
697
|
function Dashboard(t0) {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
698
|
+
let $ = c(5), { config } = t0;
|
|
699
|
+
if (!config) return null;
|
|
700
|
+
let t1;
|
|
701
|
+
$[0] === config ? t1 = $[1] : (t1 = /* @__PURE__ */ jsx(DashboardLayout, { children: /* @__PURE__ */ jsx(WidgetGroup, { config }) }), $[0] = config, $[1] = t1);
|
|
702
|
+
let t2;
|
|
703
|
+
return $[2] !== config || $[3] !== t1 ? (t2 = /* @__PURE__ */ jsx(DashboardContext.Provider, {
|
|
704
|
+
value: config,
|
|
705
|
+
children: t1
|
|
706
|
+
}), $[2] = config, $[3] = t1, $[4] = t2) : t2 = $[4], t2;
|
|
575
707
|
}
|
|
576
708
|
const strokeStyle = {
|
|
577
|
-
|
|
578
|
-
|
|
709
|
+
stroke: "currentColor",
|
|
710
|
+
strokeWidth: 1.2
|
|
579
711
|
}, DashboardIcon = () => {
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
712
|
+
let $ = c(1), t0;
|
|
713
|
+
return $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ jsxs("svg", {
|
|
714
|
+
"data-sanity-icon": !0,
|
|
715
|
+
viewBox: "0 0 25 25",
|
|
716
|
+
fill: "none",
|
|
717
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
718
|
+
preserveAspectRatio: "xMidYMid",
|
|
719
|
+
width: "1em",
|
|
720
|
+
height: "1em",
|
|
721
|
+
children: [
|
|
722
|
+
/* @__PURE__ */ jsx("path", {
|
|
723
|
+
d: "M19.5 19.5H5.5V5.5H19.5V19.5Z",
|
|
724
|
+
style: strokeStyle
|
|
725
|
+
}),
|
|
726
|
+
/* @__PURE__ */ jsx("path", {
|
|
727
|
+
d: "M5.5 12.5H19.5",
|
|
728
|
+
style: strokeStyle
|
|
729
|
+
}),
|
|
730
|
+
/* @__PURE__ */ jsx("path", {
|
|
731
|
+
d: "M14.5 19.5V12.5M10.5 12.5V5.5",
|
|
732
|
+
style: strokeStyle
|
|
733
|
+
})
|
|
734
|
+
]
|
|
735
|
+
}), $[0] = t0) : t0 = $[0], t0;
|
|
587
736
|
}, dashboardTool = definePlugin((config = {}) => {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
737
|
+
let pluginConfig = {
|
|
738
|
+
layout: config.defaultLayout ?? {},
|
|
739
|
+
widgets: config.widgets ?? []
|
|
740
|
+
};
|
|
741
|
+
return {
|
|
742
|
+
name: "dashboard",
|
|
743
|
+
tools: [{
|
|
744
|
+
title: config.title ?? "Dashboard",
|
|
745
|
+
name: config.name ?? "dashboard",
|
|
746
|
+
icon: config.icon ?? DashboardIcon,
|
|
747
|
+
component: () => /* @__PURE__ */ jsx(Dashboard, { config: pluginConfig })
|
|
748
|
+
}]
|
|
749
|
+
};
|
|
601
750
|
});
|
|
602
|
-
export {
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
projectInfoWidget,
|
|
606
|
-
projectUsersWidget,
|
|
607
|
-
sanityTutorialsWidget
|
|
608
|
-
};
|
|
609
|
-
//# sourceMappingURL=index.js.map
|
|
751
|
+
export { DashboardWidgetContainer, dashboardTool, projectInfoWidget, projectUsersWidget, sanityTutorialsWidget };
|
|
752
|
+
|
|
753
|
+
//# sourceMappingURL=index.js.map
|