tinacms 1.5.12 → 1.5.14
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/client.es.js +12 -4
- package/dist/client.js +9 -9
- package/dist/dev-tools.es.js +211 -245
- package/dist/dev-tools.js +221 -262
- package/dist/edit-state.es.js +37 -23
- package/dist/edit-state.js +39 -39
- package/dist/index.es.js +1960 -1538
- package/dist/index.js +1989 -1614
- package/dist/internalClient/index.d.ts +1 -0
- package/dist/react.es.js +32 -8
- package/dist/react.js +35 -21
- package/dist/rich-text/index.es.js +43 -104
- package/dist/rich-text/index.js +50 -117
- package/dist/rich-text/prism.d.ts +2 -0
- package/dist/rich-text/prism.es.js +13 -69
- package/dist/rich-text/prism.js +11 -74
- package/dist/utils/index.d.ts +2 -2
- package/package.json +8 -7
package/dist/index.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { EventBus, Modal, ModalPopup, ModalHeader, ModalBody, ModalActions, Button, LoadingDots, useLocalStorage, TinaCMS, BranchSwitcherPlugin, BranchDataProvider, TinaProvider, TinaMediaStore, DummyMediaStore, useCMS, Nav, BranchBanner, LocalWarning, BillingWarning, CreateBranchModel, Select, Message, OverflowMenu, CursorPaginator, Input, PopupModal, BaseTextField, Form, wrapFieldsWithMeta, FormStatus, FormBuilder, useBranchData, formatBranchName } from "@tinacms/toolkit";
|
|
3
3
|
export * from "@tinacms/toolkit";
|
|
4
|
-
|
|
4
|
+
import { MdxFieldPluginExtendible } from "@tinacms/toolkit";
|
|
5
5
|
import { getIntrospectionQuery, buildClientSchema, print, parse, buildSchema } from "graphql";
|
|
6
6
|
import gql$1 from "graphql-tag";
|
|
7
7
|
import { TinaSchema, addNamespaceToSchema, parseURL, resolveForm, normalizePath, validateSchema } from "@tinacms/schema-tools";
|
|
8
|
-
|
|
8
|
+
import { NAMER, resolveField } from "@tinacms/schema-tools";
|
|
9
9
|
import React, { useState, useCallback, useEffect, Fragment, useMemo } from "react";
|
|
10
10
|
import * as yup from "yup";
|
|
11
11
|
import { setEditing, useEditState } from "@tinacms/sharedctx";
|
|
@@ -16,7 +16,11 @@ import { useWindowWidth } from "@react-hook/window-size";
|
|
|
16
16
|
function popupWindow(url, title, window2, w, h) {
|
|
17
17
|
const y = window2.top.outerHeight / 2 + window2.top.screenY - h / 2;
|
|
18
18
|
const x = window2.top.outerWidth / 2 + window2.top.screenX - w / 2;
|
|
19
|
-
return window2.open(
|
|
19
|
+
return window2.open(
|
|
20
|
+
url,
|
|
21
|
+
title,
|
|
22
|
+
"toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=" + w + ", height=" + h + ", top=" + y + ", left=" + x
|
|
23
|
+
);
|
|
20
24
|
}
|
|
21
25
|
const TINA_LOGIN_EVENT = "tinaCloudLogin";
|
|
22
26
|
const AUTH_TOKEN_KEY = "tinacms-auth";
|
|
@@ -36,7 +40,13 @@ const authenticate = (clientId, frontendUrl) => {
|
|
|
36
40
|
}
|
|
37
41
|
});
|
|
38
42
|
const origin = `${window.location.protocol}//${window.location.host}`;
|
|
39
|
-
authTab = popupWindow(
|
|
43
|
+
authTab = popupWindow(
|
|
44
|
+
`${frontendUrl}/signin?clientId=${clientId}&origin=${origin}`,
|
|
45
|
+
"_blank",
|
|
46
|
+
window,
|
|
47
|
+
1e3,
|
|
48
|
+
700
|
|
49
|
+
);
|
|
40
50
|
});
|
|
41
51
|
};
|
|
42
52
|
class StringBuilder {
|
|
@@ -72,7 +82,10 @@ const extractText = (data, acc, indexableNodeTypes) => {
|
|
|
72
82
|
}
|
|
73
83
|
}
|
|
74
84
|
}
|
|
75
|
-
(_b = (_a = data.children) == null ? void 0 : _a.forEach) == null ? void 0 : _b.call(
|
|
85
|
+
(_b = (_a = data.children) == null ? void 0 : _a.forEach) == null ? void 0 : _b.call(
|
|
86
|
+
_a,
|
|
87
|
+
(child) => extractText(child, acc, indexableNodeTypes)
|
|
88
|
+
);
|
|
76
89
|
}
|
|
77
90
|
};
|
|
78
91
|
const relativePath = (path, collection) => {
|
|
@@ -106,16 +119,35 @@ const processDocumentForIndexing = (data, path, collection, textIndexLength, fie
|
|
|
106
119
|
if (data[f.name]) {
|
|
107
120
|
if (f.type === "object") {
|
|
108
121
|
if (isList) {
|
|
109
|
-
data[f.name] = data[f.name].map(
|
|
122
|
+
data[f.name] = data[f.name].map(
|
|
123
|
+
(obj) => processDocumentForIndexing(
|
|
124
|
+
obj,
|
|
125
|
+
path,
|
|
126
|
+
collection,
|
|
127
|
+
textIndexLength,
|
|
128
|
+
f
|
|
129
|
+
)
|
|
130
|
+
);
|
|
110
131
|
} else {
|
|
111
|
-
data[f.name] = processDocumentForIndexing(
|
|
132
|
+
data[f.name] = processDocumentForIndexing(
|
|
133
|
+
data[f.name],
|
|
134
|
+
path,
|
|
135
|
+
collection,
|
|
136
|
+
textIndexLength,
|
|
137
|
+
f
|
|
138
|
+
);
|
|
112
139
|
}
|
|
113
140
|
} else if (f.type === "string") {
|
|
114
141
|
const fieldTextIndexLength = f.maxSearchIndexFieldLength || textIndexLength;
|
|
115
142
|
if (isList) {
|
|
116
|
-
data[f.name] = data[f.name].map(
|
|
143
|
+
data[f.name] = data[f.name].map(
|
|
144
|
+
(value) => processTextFieldValue(value, fieldTextIndexLength)
|
|
145
|
+
);
|
|
117
146
|
} else {
|
|
118
|
-
data[f.name] = processTextFieldValue(
|
|
147
|
+
data[f.name] = processTextFieldValue(
|
|
148
|
+
data[f.name],
|
|
149
|
+
fieldTextIndexLength
|
|
150
|
+
);
|
|
119
151
|
}
|
|
120
152
|
} else if (f.type === "rich-text") {
|
|
121
153
|
const fieldTextIndexLength = f.maxSearchIndexFieldLength || textIndexLength;
|
|
@@ -205,14 +237,14 @@ const IndexStatusResponse = z.object({
|
|
|
205
237
|
timestamp: z.number().optional()
|
|
206
238
|
});
|
|
207
239
|
function asyncPoll(fn, pollInterval = 5 * 1e3, pollTimeout = 30 * 1e3) {
|
|
208
|
-
const endTime = new Date().getTime() + pollTimeout;
|
|
240
|
+
const endTime = (/* @__PURE__ */ new Date()).getTime() + pollTimeout;
|
|
209
241
|
let stop = false;
|
|
210
242
|
const cancel = () => {
|
|
211
243
|
stop = true;
|
|
212
244
|
};
|
|
213
245
|
const checkCondition = (resolve, reject) => {
|
|
214
246
|
Promise.resolve(fn()).then((result) => {
|
|
215
|
-
const now = new Date().getTime();
|
|
247
|
+
const now = (/* @__PURE__ */ new Date()).getTime();
|
|
216
248
|
if (stop) {
|
|
217
249
|
reject(new Error("AsyncPoller: cancelled"));
|
|
218
250
|
} else if (result.done) {
|
|
@@ -273,11 +305,14 @@ mutation addPendingDocumentMutation(
|
|
|
273
305
|
return this.gqlSchema;
|
|
274
306
|
};
|
|
275
307
|
this.getOptimizedQuery = async (documentNode) => {
|
|
276
|
-
const data = await this.request(
|
|
308
|
+
const data = await this.request(
|
|
309
|
+
`query GetOptimizedQuery($queryString: String!) {
|
|
277
310
|
getOptimizedQuery(queryString: $queryString)
|
|
278
|
-
}`,
|
|
279
|
-
|
|
280
|
-
|
|
311
|
+
}`,
|
|
312
|
+
{
|
|
313
|
+
variables: { queryString: print(documentNode) }
|
|
314
|
+
}
|
|
315
|
+
);
|
|
281
316
|
return parse(data.getOptimizedQuery);
|
|
282
317
|
};
|
|
283
318
|
this.tinaGraphQLVersion = options.tinaGraphQLVersion;
|
|
@@ -305,9 +340,12 @@ mutation addPendingDocumentMutation(
|
|
|
305
340
|
this.options.customContentApiUrl = options.schema.config.contentApiUrlOverride;
|
|
306
341
|
}
|
|
307
342
|
this.setBranch(options.branch);
|
|
308
|
-
this.events.subscribe(
|
|
309
|
-
|
|
310
|
-
|
|
343
|
+
this.events.subscribe(
|
|
344
|
+
"branch:change",
|
|
345
|
+
({ branchName }) => {
|
|
346
|
+
this.setBranch(branchName);
|
|
347
|
+
}
|
|
348
|
+
);
|
|
311
349
|
this.clientId = options.clientId;
|
|
312
350
|
switch (tokenStorage) {
|
|
313
351
|
case "LOCAL_STORAGE":
|
|
@@ -345,7 +383,9 @@ mutation addPendingDocumentMutation(
|
|
|
345
383
|
break;
|
|
346
384
|
case "CUSTOM":
|
|
347
385
|
if (!options.getTokenFn) {
|
|
348
|
-
throw new Error(
|
|
386
|
+
throw new Error(
|
|
387
|
+
"When CUSTOM token storage is selected, a getTokenFn must be provided"
|
|
388
|
+
);
|
|
349
389
|
}
|
|
350
390
|
this.getToken = options.getTokenFn;
|
|
351
391
|
break;
|
|
@@ -357,6 +397,9 @@ mutation addPendingDocumentMutation(
|
|
|
357
397
|
get isLocalMode() {
|
|
358
398
|
return false;
|
|
359
399
|
}
|
|
400
|
+
get isCustomContentApi() {
|
|
401
|
+
return !!this.options.customContentApiUrl;
|
|
402
|
+
}
|
|
360
403
|
setBranch(branchName) {
|
|
361
404
|
var _a, _b, _c, _d;
|
|
362
405
|
const encodedBranch = encodeURIComponent(branchName);
|
|
@@ -403,8 +446,10 @@ mutation addPendingDocumentMutation(
|
|
|
403
446
|
}
|
|
404
447
|
const json = await res.json();
|
|
405
448
|
if (json.errors) {
|
|
406
|
-
throw new Error(
|
|
407
|
-
|
|
449
|
+
throw new Error(
|
|
450
|
+
`Unable to fetch, errors:
|
|
451
|
+
${json.errors.map((error) => error.message).join("\n")}`
|
|
452
|
+
);
|
|
408
453
|
}
|
|
409
454
|
return json.data;
|
|
410
455
|
}
|
|
@@ -414,20 +459,26 @@ mutation addPendingDocumentMutation(
|
|
|
414
459
|
async checkSyncStatus({
|
|
415
460
|
assetsSyncing
|
|
416
461
|
}) {
|
|
417
|
-
const res = await this.fetchWithToken(
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
462
|
+
const res = await this.fetchWithToken(
|
|
463
|
+
`${this.assetsApiUrl}/v1/${this.clientId}/syncStatus`,
|
|
464
|
+
{
|
|
465
|
+
method: "POST",
|
|
466
|
+
headers: {
|
|
467
|
+
"Content-Type": "application/json"
|
|
468
|
+
},
|
|
469
|
+
body: JSON.stringify({ assetsSyncing })
|
|
470
|
+
}
|
|
471
|
+
);
|
|
424
472
|
const jsonRes = await res.json();
|
|
425
473
|
return jsonRes;
|
|
426
474
|
}
|
|
427
475
|
async getProject() {
|
|
428
|
-
const res = await this.fetchWithToken(
|
|
429
|
-
|
|
430
|
-
|
|
476
|
+
const res = await this.fetchWithToken(
|
|
477
|
+
`${this.identityApiUrl}/v2/apps/${this.clientId}`,
|
|
478
|
+
{
|
|
479
|
+
method: "GET"
|
|
480
|
+
}
|
|
481
|
+
);
|
|
431
482
|
const val = await res.json();
|
|
432
483
|
return val;
|
|
433
484
|
}
|
|
@@ -450,7 +501,9 @@ mutation addPendingDocumentMutation(
|
|
|
450
501
|
}
|
|
451
502
|
});
|
|
452
503
|
if (!res.ok) {
|
|
453
|
-
throw new Error(
|
|
504
|
+
throw new Error(
|
|
505
|
+
`There was an error creating a new branch. ${res.statusText}`
|
|
506
|
+
);
|
|
454
507
|
}
|
|
455
508
|
const values = await res.json();
|
|
456
509
|
return values;
|
|
@@ -465,15 +518,20 @@ mutation addPendingDocumentMutation(
|
|
|
465
518
|
events: []
|
|
466
519
|
};
|
|
467
520
|
} else {
|
|
468
|
-
return (await this.fetchWithToken(
|
|
521
|
+
return (await this.fetchWithToken(
|
|
522
|
+
`${this.contentApiBase}/events/${this.clientId}/${this.branch}?limit=${limit || 1}${cursor ? `&cursor=${cursor}` : ""}`,
|
|
523
|
+
{ method: "GET" }
|
|
524
|
+
)).json();
|
|
469
525
|
}
|
|
470
526
|
}
|
|
471
527
|
parseJwt(token) {
|
|
472
528
|
const base64Url = token.split(".")[1];
|
|
473
529
|
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
474
|
-
const jsonPayload = decodeURIComponent(
|
|
475
|
-
|
|
476
|
-
|
|
530
|
+
const jsonPayload = decodeURIComponent(
|
|
531
|
+
atob(base64).split("").map(function(c) {
|
|
532
|
+
return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
|
|
533
|
+
}).join("")
|
|
534
|
+
);
|
|
477
535
|
return JSON.parse(jsonPayload);
|
|
478
536
|
}
|
|
479
537
|
async getRefreshedToken(tokens) {
|
|
@@ -523,6 +581,15 @@ mutation addPendingDocumentMutation(
|
|
|
523
581
|
this.setToken(token);
|
|
524
582
|
return token;
|
|
525
583
|
}
|
|
584
|
+
/**
|
|
585
|
+
* Wraps the normal fetch function with same API but adds the authorization header token.
|
|
586
|
+
*
|
|
587
|
+
* @example
|
|
588
|
+
* const test = await tinaCloudClient.fetchWithToken(`/mycustomAPI/thing/one`) // the token will be passed in the authorization header
|
|
589
|
+
*
|
|
590
|
+
* @param input fetch function input
|
|
591
|
+
* @param init fetch function init
|
|
592
|
+
*/
|
|
526
593
|
async fetchWithToken(input, init) {
|
|
527
594
|
const headers = (init == null ? void 0 : init.headers) || {};
|
|
528
595
|
const token = await this.getToken();
|
|
@@ -581,29 +648,39 @@ mutation addPendingDocumentMutation(
|
|
|
581
648
|
waitForIndexStatus({ ref }) {
|
|
582
649
|
let unknownCount = 0;
|
|
583
650
|
try {
|
|
584
|
-
const [prom, cancel] = asyncPoll(
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
651
|
+
const [prom, cancel] = asyncPoll(
|
|
652
|
+
async () => {
|
|
653
|
+
try {
|
|
654
|
+
const result = await this.getIndexStatus({ ref });
|
|
655
|
+
if (!(result.status === "inprogress" || result.status === "unknown")) {
|
|
656
|
+
return Promise.resolve({
|
|
657
|
+
done: true,
|
|
658
|
+
data: result
|
|
659
|
+
});
|
|
660
|
+
} else {
|
|
661
|
+
if (result.status === "unknown") {
|
|
662
|
+
unknownCount++;
|
|
663
|
+
if (unknownCount > 5) {
|
|
664
|
+
throw new Error(
|
|
665
|
+
"AsyncPoller: status unknown for too long, please check indexing progress the Tina Cloud dashboard"
|
|
666
|
+
);
|
|
667
|
+
}
|
|
597
668
|
}
|
|
669
|
+
return Promise.resolve({
|
|
670
|
+
done: false
|
|
671
|
+
});
|
|
598
672
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
});
|
|
673
|
+
} catch (err) {
|
|
674
|
+
return Promise.reject(err);
|
|
602
675
|
}
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
676
|
+
},
|
|
677
|
+
// interval is 5s
|
|
678
|
+
5e3,
|
|
679
|
+
// interval
|
|
680
|
+
// timeout is 15 min
|
|
681
|
+
9e5
|
|
682
|
+
// timeout
|
|
683
|
+
);
|
|
607
684
|
return [prom, cancel];
|
|
608
685
|
} catch (error) {
|
|
609
686
|
if (error.message === "AsyncPoller: reached timeout") {
|
|
@@ -693,6 +770,7 @@ class LocalClient extends Client {
|
|
|
693
770
|
get isLocalMode() {
|
|
694
771
|
return true;
|
|
695
772
|
}
|
|
773
|
+
// These functions allow the local client to have a login state so that we can correctly call the "OnLogin" callback. This is important for things like preview mode
|
|
696
774
|
async logout() {
|
|
697
775
|
localStorage.removeItem(LOCAL_CLIENT_KEY);
|
|
698
776
|
}
|
|
@@ -712,25 +790,33 @@ class TinaCMSSearchClient {
|
|
|
712
790
|
const q = queryToSearchIndexQuery(query);
|
|
713
791
|
const opt = optionsToSearchIndexOptions(options);
|
|
714
792
|
const optionsParam = opt["PAGE"] ? `&options=${JSON.stringify(opt)}` : "";
|
|
715
|
-
const res = await this.client.fetchWithToken(
|
|
793
|
+
const res = await this.client.fetchWithToken(
|
|
794
|
+
`${this.client.contentApiBase}/searchIndex/${this.client.clientId}/${this.client.getBranch()}?q=${JSON.stringify(q)}${optionsParam}`
|
|
795
|
+
);
|
|
716
796
|
return parseSearchIndexResponse(await res.json(), options);
|
|
717
797
|
}
|
|
718
798
|
async del(ids) {
|
|
719
|
-
const res = await this.client.fetchWithToken(
|
|
720
|
-
|
|
721
|
-
|
|
799
|
+
const res = await this.client.fetchWithToken(
|
|
800
|
+
`${this.client.contentApiBase}/searchIndex/${this.client.clientId}/${this.client.getBranch()}?ids=${ids.join(",")}`,
|
|
801
|
+
{
|
|
802
|
+
method: "DELETE"
|
|
803
|
+
}
|
|
804
|
+
);
|
|
722
805
|
if (res.status !== 200) {
|
|
723
806
|
throw new Error("Failed to update search index");
|
|
724
807
|
}
|
|
725
808
|
}
|
|
726
809
|
async put(docs) {
|
|
727
|
-
const res = await this.client.fetchWithToken(
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
810
|
+
const res = await this.client.fetchWithToken(
|
|
811
|
+
`${this.client.contentApiBase}/searchIndex/${this.client.clientId}/${this.client.getBranch()}`,
|
|
812
|
+
{
|
|
813
|
+
method: "POST",
|
|
814
|
+
body: JSON.stringify({ docs }),
|
|
815
|
+
headers: {
|
|
816
|
+
"Content-Type": "application/json"
|
|
817
|
+
}
|
|
732
818
|
}
|
|
733
|
-
|
|
819
|
+
);
|
|
734
820
|
if (res.status !== 200) {
|
|
735
821
|
throw new Error("Failed to update search index");
|
|
736
822
|
}
|
|
@@ -747,7 +833,9 @@ class LocalSearchClient {
|
|
|
747
833
|
const q = queryToSearchIndexQuery(query);
|
|
748
834
|
const opt = optionsToSearchIndexOptions(options);
|
|
749
835
|
const optionsParam = opt["PAGE"] ? `&options=${JSON.stringify(opt)}` : "";
|
|
750
|
-
const res = await this.client.fetchWithToken(
|
|
836
|
+
const res = await this.client.fetchWithToken(
|
|
837
|
+
`http://localhost:4001/searchIndex?q=${JSON.stringify(q)}${optionsParam}`
|
|
838
|
+
);
|
|
751
839
|
return parseSearchIndexResponse(await res.json(), options);
|
|
752
840
|
}
|
|
753
841
|
del(ids) {
|
|
@@ -761,17 +849,9 @@ class LocalSearchClient {
|
|
|
761
849
|
}
|
|
762
850
|
}
|
|
763
851
|
function ModalBuilder(modalProps) {
|
|
764
|
-
return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(ModalPopup, null, /* @__PURE__ */ React.createElement(ModalHeader, null, modalProps.title), /* @__PURE__ */ React.createElement(ModalBody, {
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
key: action.name,
|
|
768
|
-
...action
|
|
769
|
-
})))));
|
|
770
|
-
}
|
|
771
|
-
const ErrorLabel = ({ style = {}, ...props }) => /* @__PURE__ */ React.createElement("p", {
|
|
772
|
-
style: { ...style, color: "var(--tina-color-error)" },
|
|
773
|
-
...props
|
|
774
|
-
});
|
|
852
|
+
return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(ModalPopup, null, /* @__PURE__ */ React.createElement(ModalHeader, null, modalProps.title), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement("p", null, modalProps.message), modalProps.error && /* @__PURE__ */ React.createElement(ErrorLabel, null, modalProps.error)), /* @__PURE__ */ React.createElement(ModalActions, null, modalProps.actions.map((action) => /* @__PURE__ */ React.createElement(AsyncButton, { key: action.name, ...action })))));
|
|
853
|
+
}
|
|
854
|
+
const ErrorLabel = ({ style = {}, ...props }) => /* @__PURE__ */ React.createElement("p", { style: { ...style, color: "var(--tina-color-error)" }, ...props });
|
|
775
855
|
const AsyncButton = ({ name, primary, action }) => {
|
|
776
856
|
const [submitting, setSubmitting] = useState(false);
|
|
777
857
|
const onClick = useCallback(async () => {
|
|
@@ -784,13 +864,18 @@ const AsyncButton = ({ name, primary, action }) => {
|
|
|
784
864
|
throw e;
|
|
785
865
|
}
|
|
786
866
|
}, [action, setSubmitting]);
|
|
787
|
-
return /* @__PURE__ */ React.createElement(
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
867
|
+
return /* @__PURE__ */ React.createElement(
|
|
868
|
+
Button,
|
|
869
|
+
{
|
|
870
|
+
"data-test": name.replace(/\s/g, "-").toLowerCase(),
|
|
871
|
+
variant: primary ? "primary" : "secondary",
|
|
872
|
+
onClick,
|
|
873
|
+
busy: submitting,
|
|
874
|
+
disabled: submitting
|
|
875
|
+
},
|
|
876
|
+
submitting && /* @__PURE__ */ React.createElement(LoadingDots, null),
|
|
877
|
+
!submitting && name
|
|
878
|
+
);
|
|
794
879
|
};
|
|
795
880
|
const TINA_AUTH_CONFIG = "tina_auth_config";
|
|
796
881
|
const useTinaAuthRedirect = () => {
|
|
@@ -871,16 +956,27 @@ class TinaAdminApi {
|
|
|
871
956
|
return this.schema.getCollections();
|
|
872
957
|
}
|
|
873
958
|
async renameDocument({ collection, relativePath: relativePath2, newRelativePath }) {
|
|
874
|
-
await this.api.request(
|
|
959
|
+
await this.api.request(
|
|
960
|
+
`#graphql
|
|
875
961
|
mutation RenameDocument($collection: String!, $relativePath: String! $newRelativePath: String!) {
|
|
876
962
|
updateDocument(collection: $collection, relativePath: $relativePath, params: {relativePath: $newRelativePath}){
|
|
877
963
|
__typename
|
|
878
964
|
}
|
|
879
965
|
}
|
|
880
|
-
`,
|
|
966
|
+
`,
|
|
967
|
+
{ variables: { collection, relativePath: relativePath2, newRelativePath } }
|
|
968
|
+
);
|
|
881
969
|
if (this.searchClient) {
|
|
882
|
-
const { document: doc } = await this.fetchDocument(
|
|
883
|
-
|
|
970
|
+
const { document: doc } = await this.fetchDocument(
|
|
971
|
+
collection.name,
|
|
972
|
+
newRelativePath
|
|
973
|
+
);
|
|
974
|
+
const processed = processDocumentForIndexing(
|
|
975
|
+
doc["_values"],
|
|
976
|
+
`${collection.path}/${newRelativePath}`,
|
|
977
|
+
collection,
|
|
978
|
+
this.maxSearchIndexFieldLength
|
|
979
|
+
);
|
|
884
980
|
await this.searchClient.put([processed]);
|
|
885
981
|
await this.searchClient.del([`${collection.name}:${relativePath2}`]);
|
|
886
982
|
}
|
|
@@ -890,12 +986,15 @@ class TinaAdminApi {
|
|
|
890
986
|
relativePath: relativePath2
|
|
891
987
|
}) {
|
|
892
988
|
var _a;
|
|
893
|
-
await this.api.request(
|
|
989
|
+
await this.api.request(
|
|
990
|
+
`#graphql
|
|
894
991
|
mutation DeleteDocument($collection: String!, $relativePath: String! ){
|
|
895
992
|
deleteDocument(collection: $collection, relativePath: $relativePath){
|
|
896
993
|
__typename
|
|
897
994
|
}
|
|
898
|
-
}`,
|
|
995
|
+
}`,
|
|
996
|
+
{ variables: { collection, relativePath: relativePath2 } }
|
|
997
|
+
);
|
|
899
998
|
await ((_a = this.searchClient) == null ? void 0 : _a.del([`${collection}:${relativePath2}`]));
|
|
900
999
|
}
|
|
901
1000
|
async fetchCollection(collectionName, includeDocuments, folder = "", after, sortKey, order, filterArgs) {
|
|
@@ -934,7 +1033,8 @@ class TinaAdminApi {
|
|
|
934
1033
|
}
|
|
935
1034
|
if (includeDocuments === true) {
|
|
936
1035
|
const sort = sortKey || this.schema.getIsTitleFieldName(collectionName);
|
|
937
|
-
const response = order === "asc" ? await this.api.request(
|
|
1036
|
+
const response = order === "asc" ? await this.api.request(
|
|
1037
|
+
`#graphql
|
|
938
1038
|
query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String, $filter: DocumentFilter, $folder: String){
|
|
939
1039
|
collection(collection: $collection){
|
|
940
1040
|
name
|
|
@@ -972,17 +1072,20 @@ class TinaAdminApi {
|
|
|
972
1072
|
}
|
|
973
1073
|
}
|
|
974
1074
|
}
|
|
975
|
-
}`,
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
1075
|
+
}`,
|
|
1076
|
+
{
|
|
1077
|
+
variables: {
|
|
1078
|
+
collection: collectionName,
|
|
1079
|
+
includeDocuments,
|
|
1080
|
+
folder,
|
|
1081
|
+
sort,
|
|
1082
|
+
limit: 50,
|
|
1083
|
+
after,
|
|
1084
|
+
filter
|
|
1085
|
+
}
|
|
984
1086
|
}
|
|
985
|
-
|
|
1087
|
+
) : await this.api.request(
|
|
1088
|
+
`#graphql
|
|
986
1089
|
query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String, $filter: DocumentFilter, $folder: String) {
|
|
987
1090
|
collection(collection: $collection){
|
|
988
1091
|
name
|
|
@@ -1020,24 +1123,28 @@ class TinaAdminApi {
|
|
|
1020
1123
|
}
|
|
1021
1124
|
}
|
|
1022
1125
|
}
|
|
1023
|
-
}`,
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1126
|
+
}`,
|
|
1127
|
+
{
|
|
1128
|
+
variables: {
|
|
1129
|
+
collection: collectionName,
|
|
1130
|
+
includeDocuments,
|
|
1131
|
+
folder,
|
|
1132
|
+
sort,
|
|
1133
|
+
limit: 50,
|
|
1134
|
+
after,
|
|
1135
|
+
filter
|
|
1136
|
+
}
|
|
1032
1137
|
}
|
|
1033
|
-
|
|
1138
|
+
);
|
|
1034
1139
|
return response.collection;
|
|
1035
1140
|
} else {
|
|
1036
1141
|
try {
|
|
1037
1142
|
const collection = this.schema.getCollection(collectionName);
|
|
1038
1143
|
return collection;
|
|
1039
1144
|
} catch (e) {
|
|
1040
|
-
console.error(
|
|
1145
|
+
console.error(
|
|
1146
|
+
`[TinaAdminAPI] Unable to fetchCollection(): ${e.message}`
|
|
1147
|
+
);
|
|
1041
1148
|
return void 0;
|
|
1042
1149
|
}
|
|
1043
1150
|
}
|
|
@@ -1079,45 +1186,67 @@ class TinaAdminApi {
|
|
|
1079
1186
|
return response;
|
|
1080
1187
|
}
|
|
1081
1188
|
async createDocument(collection, relativePath2, params) {
|
|
1082
|
-
const response = await this.api.request(
|
|
1189
|
+
const response = await this.api.request(
|
|
1190
|
+
`#graphql
|
|
1083
1191
|
mutation($collection: String!, $relativePath: String!, $params: DocumentMutation!) {
|
|
1084
1192
|
createDocument(
|
|
1085
1193
|
collection: $collection,
|
|
1086
1194
|
relativePath: $relativePath,
|
|
1087
1195
|
params: $params
|
|
1088
1196
|
){__typename}
|
|
1089
|
-
}`,
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1197
|
+
}`,
|
|
1198
|
+
{
|
|
1199
|
+
variables: {
|
|
1200
|
+
collection: collection.name,
|
|
1201
|
+
relativePath: relativePath2,
|
|
1202
|
+
params
|
|
1203
|
+
}
|
|
1094
1204
|
}
|
|
1095
|
-
|
|
1205
|
+
);
|
|
1096
1206
|
if (this.searchClient) {
|
|
1097
|
-
const { document: doc } = await this.fetchDocument(
|
|
1098
|
-
|
|
1207
|
+
const { document: doc } = await this.fetchDocument(
|
|
1208
|
+
collection.name,
|
|
1209
|
+
relativePath2
|
|
1210
|
+
);
|
|
1211
|
+
const processed = processDocumentForIndexing(
|
|
1212
|
+
doc["_values"],
|
|
1213
|
+
`${collection.path}/${relativePath2}`,
|
|
1214
|
+
collection,
|
|
1215
|
+
this.maxSearchIndexFieldLength
|
|
1216
|
+
);
|
|
1099
1217
|
await this.searchClient.put([processed]);
|
|
1100
1218
|
}
|
|
1101
1219
|
return response;
|
|
1102
1220
|
}
|
|
1103
1221
|
async updateDocument(collection, relativePath2, params) {
|
|
1104
|
-
const response = await this.api.request(
|
|
1222
|
+
const response = await this.api.request(
|
|
1223
|
+
`#graphql
|
|
1105
1224
|
mutation($collection: String!, $relativePath: String!, $params: DocumentUpdateMutation!) {
|
|
1106
1225
|
updateDocument(
|
|
1107
1226
|
collection: $collection,
|
|
1108
1227
|
relativePath: $relativePath,
|
|
1109
1228
|
params: $params
|
|
1110
1229
|
){__typename}
|
|
1111
|
-
}`,
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1230
|
+
}`,
|
|
1231
|
+
{
|
|
1232
|
+
variables: {
|
|
1233
|
+
collection: collection.name,
|
|
1234
|
+
relativePath: relativePath2,
|
|
1235
|
+
params
|
|
1236
|
+
}
|
|
1116
1237
|
}
|
|
1117
|
-
|
|
1238
|
+
);
|
|
1118
1239
|
if (this.searchClient) {
|
|
1119
|
-
const { document: doc } = await this.fetchDocument(
|
|
1120
|
-
|
|
1240
|
+
const { document: doc } = await this.fetchDocument(
|
|
1241
|
+
collection.name,
|
|
1242
|
+
relativePath2
|
|
1243
|
+
);
|
|
1244
|
+
const processed = processDocumentForIndexing(
|
|
1245
|
+
doc["_values"],
|
|
1246
|
+
`${collection.path}/${relativePath2}`,
|
|
1247
|
+
collection,
|
|
1248
|
+
this.maxSearchIndexFieldLength
|
|
1249
|
+
);
|
|
1121
1250
|
await this.searchClient.put([processed]);
|
|
1122
1251
|
}
|
|
1123
1252
|
return response;
|
|
@@ -1163,45 +1292,54 @@ const AuthWallInner = ({
|
|
|
1163
1292
|
setActiveModal(null);
|
|
1164
1293
|
}
|
|
1165
1294
|
}) : [];
|
|
1166
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, activeModal === "authenticate" && /* @__PURE__ */ React.createElement(
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
name: isTinaCloud ? "Continue to Tina Cloud" : "Enter Edit Mode",
|
|
1182
|
-
action: async () => {
|
|
1183
|
-
const token = await client.authenticate();
|
|
1184
|
-
if (typeof (client == null ? void 0 : client.onLogin) === "function") {
|
|
1185
|
-
await (client == null ? void 0 : client.onLogin({ token }));
|
|
1186
|
-
}
|
|
1187
|
-
onAuthSuccess();
|
|
1295
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, activeModal === "authenticate" && /* @__PURE__ */ React.createElement(
|
|
1296
|
+
ModalBuilder,
|
|
1297
|
+
{
|
|
1298
|
+
title: isTinaCloud ? "Tina Cloud Authorization" : "Enter into edit mode",
|
|
1299
|
+
message: isTinaCloud ? "To save edits, Tina Cloud authorization is required. On save, changes will get commited using your account." : "To save edits, enter into edit mode. On save, changes will saved to the local filesystem.",
|
|
1300
|
+
close,
|
|
1301
|
+
actions: [
|
|
1302
|
+
...otherModalActions,
|
|
1303
|
+
{
|
|
1304
|
+
action: async () => {
|
|
1305
|
+
setEditing(false);
|
|
1306
|
+
window.location.reload();
|
|
1307
|
+
},
|
|
1308
|
+
name: "Close",
|
|
1309
|
+
primary: false
|
|
1188
1310
|
},
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1311
|
+
{
|
|
1312
|
+
name: isTinaCloud ? "Continue to Tina Cloud" : "Enter Edit Mode",
|
|
1313
|
+
action: async () => {
|
|
1314
|
+
const token = await client.authenticate();
|
|
1315
|
+
if (typeof (client == null ? void 0 : client.onLogin) === "function") {
|
|
1316
|
+
await (client == null ? void 0 : client.onLogin({ token }));
|
|
1317
|
+
}
|
|
1318
|
+
onAuthSuccess();
|
|
1319
|
+
},
|
|
1320
|
+
primary: true
|
|
1321
|
+
}
|
|
1322
|
+
]
|
|
1323
|
+
}
|
|
1324
|
+
), showChildren ? children : loginScreen ? loginScreen : null);
|
|
1193
1325
|
};
|
|
1194
1326
|
const TinaCloudProvider = (props) => {
|
|
1195
1327
|
var _a, _b, _c, _d, _e;
|
|
1196
1328
|
const baseBranch = props.branch || "main";
|
|
1197
|
-
const [currentBranch, setCurrentBranch] = useLocalStorage(
|
|
1329
|
+
const [currentBranch, setCurrentBranch] = useLocalStorage(
|
|
1330
|
+
"tinacms-current-branch",
|
|
1331
|
+
baseBranch
|
|
1332
|
+
);
|
|
1198
1333
|
useTinaAuthRedirect();
|
|
1199
|
-
const cms = React.useMemo(
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1334
|
+
const cms = React.useMemo(
|
|
1335
|
+
() => props.cms || new TinaCMS({
|
|
1336
|
+
enabled: true,
|
|
1337
|
+
sidebar: true,
|
|
1338
|
+
isLocalClient: props.isLocalClient,
|
|
1339
|
+
clientId: props.clientId
|
|
1340
|
+
}),
|
|
1341
|
+
[props.cms]
|
|
1342
|
+
);
|
|
1205
1343
|
if (!cms.api.tina) {
|
|
1206
1344
|
cms.registerApi("tina", createClient({ ...props, branch: currentBranch }));
|
|
1207
1345
|
} else {
|
|
@@ -1232,7 +1370,12 @@ const TinaCloudProvider = (props) => {
|
|
|
1232
1370
|
const hasTinaMedia = Boolean((_b2 = (_a2 = props.schema.config) == null ? void 0 : _a2.media) == null ? void 0 : _b2.tina);
|
|
1233
1371
|
if (hasTinaMedia) {
|
|
1234
1372
|
cms.media.store = new TinaMediaStore(cms);
|
|
1235
|
-
} else if (
|
|
1373
|
+
} else if (
|
|
1374
|
+
/*
|
|
1375
|
+
Has tina custom media (set up in the schema or define schema)
|
|
1376
|
+
*/
|
|
1377
|
+
((_d2 = (_c2 = props.schema.config) == null ? void 0 : _c2.media) == null ? void 0 : _d2.loadCustomStore) || props.mediaStore
|
|
1378
|
+
) {
|
|
1236
1379
|
const mediaStoreFromProps = ((_f = (_e2 = props.schema.config) == null ? void 0 : _e2.media) == null ? void 0 : _f.loadCustomStore) || props.mediaStore;
|
|
1237
1380
|
if ((_g = mediaStoreFromProps.prototype) == null ? void 0 : _g.persist) {
|
|
1238
1381
|
cms.media.store = new mediaStoreFromProps(cms.api.tina);
|
|
@@ -1259,7 +1402,9 @@ const TinaCloudProvider = (props) => {
|
|
|
1259
1402
|
return newBranch;
|
|
1260
1403
|
};
|
|
1261
1404
|
setupMedia();
|
|
1262
|
-
const [branchingEnabled, setBranchingEnabled] = React.useState(
|
|
1405
|
+
const [branchingEnabled, setBranchingEnabled] = React.useState(
|
|
1406
|
+
() => cms.flags.get("branch-switcher")
|
|
1407
|
+
);
|
|
1263
1408
|
React.useEffect(() => {
|
|
1264
1409
|
cms.events.subscribe("flag:set", ({ key, value }) => {
|
|
1265
1410
|
if (key === "branch-switcher") {
|
|
@@ -1309,20 +1454,19 @@ const TinaCloudProvider = (props) => {
|
|
|
1309
1454
|
});
|
|
1310
1455
|
return unsubscribe;
|
|
1311
1456
|
}, [isTinaCloud, cms]);
|
|
1312
|
-
return /* @__PURE__ */ React.createElement(
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
...props,
|
|
1321
|
-
|
|
1322
|
-
})));
|
|
1457
|
+
return /* @__PURE__ */ React.createElement(
|
|
1458
|
+
BranchDataProvider,
|
|
1459
|
+
{
|
|
1460
|
+
currentBranch,
|
|
1461
|
+
setCurrentBranch: (b) => {
|
|
1462
|
+
setCurrentBranch(b);
|
|
1463
|
+
}
|
|
1464
|
+
},
|
|
1465
|
+
/* @__PURE__ */ React.createElement(TinaProvider, { cms }, /* @__PURE__ */ React.createElement(AuthWallInner, { ...props, cms }))
|
|
1466
|
+
);
|
|
1323
1467
|
};
|
|
1324
1468
|
const TinaCloudAuthWall = TinaCloudProvider;
|
|
1325
|
-
|
|
1469
|
+
const styles = `.tina-tailwind {
|
|
1326
1470
|
line-height: 1.5;
|
|
1327
1471
|
-webkit-text-size-adjust: 100%;
|
|
1328
1472
|
-moz-tab-size: 4;
|
|
@@ -2871,7 +3015,9 @@ class ContentCreatorPlugin {
|
|
|
2871
3015
|
}
|
|
2872
3016
|
async onSubmit({ collection, template, relativePath: relativePath2 }, cms) {
|
|
2873
3017
|
try {
|
|
2874
|
-
const selectedCollection = this.collections.find(
|
|
3018
|
+
const selectedCollection = this.collections.find(
|
|
3019
|
+
(collectionItem) => collectionItem.slug === collection
|
|
3020
|
+
);
|
|
2875
3021
|
const collectionFormat = selectedCollection.format;
|
|
2876
3022
|
const extensionLength = -1 * (collectionFormat.length + 1);
|
|
2877
3023
|
let relativePathWithExt = relativePath2;
|
|
@@ -2912,7 +3058,8 @@ const useDocumentCreatorPlugin = (args) => {
|
|
|
2912
3058
|
React.useEffect(() => {
|
|
2913
3059
|
const run = async () => {
|
|
2914
3060
|
var _a;
|
|
2915
|
-
const res = await cms.api.tina.request(
|
|
3061
|
+
const res = await cms.api.tina.request(
|
|
3062
|
+
(gql2) => gql2`
|
|
2916
3063
|
{
|
|
2917
3064
|
collections {
|
|
2918
3065
|
label
|
|
@@ -2921,7 +3068,9 @@ const useDocumentCreatorPlugin = (args) => {
|
|
|
2921
3068
|
templates
|
|
2922
3069
|
}
|
|
2923
3070
|
}
|
|
2924
|
-
`,
|
|
3071
|
+
`,
|
|
3072
|
+
{ variables: {} }
|
|
3073
|
+
);
|
|
2925
3074
|
const allCollectionOptions = [];
|
|
2926
3075
|
res.collections.forEach((collection) => {
|
|
2927
3076
|
const value = collection.slug;
|
|
@@ -2945,68 +3094,72 @@ const useDocumentCreatorPlugin = (args) => {
|
|
|
2945
3094
|
{ value: "", label: "Choose Template" }
|
|
2946
3095
|
];
|
|
2947
3096
|
if (values.collection) {
|
|
2948
|
-
const filteredCollection = res.collections.find(
|
|
3097
|
+
const filteredCollection = res.collections.find(
|
|
3098
|
+
(c) => c.slug === values.collection
|
|
3099
|
+
);
|
|
2949
3100
|
(_a = filteredCollection == null ? void 0 : filteredCollection.templates) == null ? void 0 : _a.forEach((template) => {
|
|
2950
3101
|
templateOptions.push({ value: template.name, label: template.label });
|
|
2951
3102
|
});
|
|
2952
3103
|
}
|
|
2953
|
-
setPlugin(
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
initialValues: values,
|
|
2961
|
-
fields: [
|
|
2962
|
-
{
|
|
2963
|
-
component: "select",
|
|
2964
|
-
name: "collection",
|
|
2965
|
-
label: "Collection",
|
|
2966
|
-
description: "Select the collection.",
|
|
2967
|
-
options: collectionOptions,
|
|
2968
|
-
validate: async (value, allValues, meta) => {
|
|
2969
|
-
if (!value) {
|
|
2970
|
-
return true;
|
|
2971
|
-
}
|
|
2972
|
-
}
|
|
3104
|
+
setPlugin(
|
|
3105
|
+
new ContentCreatorPlugin({
|
|
3106
|
+
label: "Add Document",
|
|
3107
|
+
onNewDocument: args && args.onNewDocument,
|
|
3108
|
+
collections: res.collections,
|
|
3109
|
+
onChange: async ({ values: values2 }) => {
|
|
3110
|
+
setValues(values2);
|
|
2973
3111
|
},
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
3112
|
+
initialValues: values,
|
|
3113
|
+
fields: [
|
|
3114
|
+
{
|
|
3115
|
+
component: "select",
|
|
3116
|
+
name: "collection",
|
|
3117
|
+
label: "Collection",
|
|
3118
|
+
description: "Select the collection.",
|
|
3119
|
+
options: collectionOptions,
|
|
3120
|
+
validate: async (value, allValues, meta) => {
|
|
3121
|
+
if (!value) {
|
|
3122
|
+
return true;
|
|
2984
3123
|
}
|
|
2985
|
-
return true;
|
|
2986
3124
|
}
|
|
2987
|
-
}
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
3125
|
+
},
|
|
3126
|
+
{
|
|
3127
|
+
component: "select",
|
|
3128
|
+
name: "template",
|
|
3129
|
+
label: "Template",
|
|
3130
|
+
description: "Select the template.",
|
|
3131
|
+
options: templateOptions,
|
|
3132
|
+
validate: async (value, allValues, meta) => {
|
|
3133
|
+
if (!value && templateOptions.length > 1) {
|
|
3134
|
+
if (meta.dirty) {
|
|
3135
|
+
return "Required";
|
|
3136
|
+
}
|
|
3137
|
+
return true;
|
|
2999
3138
|
}
|
|
3000
|
-
return true;
|
|
3001
3139
|
}
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3140
|
+
},
|
|
3141
|
+
{
|
|
3142
|
+
component: "text",
|
|
3143
|
+
name: "relativePath",
|
|
3144
|
+
label: "Name",
|
|
3145
|
+
description: `A unique name for the content. Example: "newPost" or "blog_022021`,
|
|
3146
|
+
placeholder: "newPost",
|
|
3147
|
+
validate: (value, allValues, meta) => {
|
|
3148
|
+
if (!value) {
|
|
3149
|
+
if (meta.dirty) {
|
|
3150
|
+
return "Required";
|
|
3151
|
+
}
|
|
3152
|
+
return true;
|
|
3153
|
+
}
|
|
3154
|
+
const isValid = /^[_a-zA-Z0-9][\-_a-zA-Z0-9]*$/.test(value);
|
|
3155
|
+
if (value && !isValid) {
|
|
3156
|
+
return "Must begin with a-z, A-Z, 0-9, or _ and contain only a-z, A-Z, 0-9, - or _";
|
|
3157
|
+
}
|
|
3005
3158
|
}
|
|
3006
3159
|
}
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3160
|
+
]
|
|
3161
|
+
})
|
|
3162
|
+
);
|
|
3010
3163
|
};
|
|
3011
3164
|
run();
|
|
3012
3165
|
}, [cms]);
|
|
@@ -3045,41 +3198,72 @@ class ErrorBoundary extends React.Component {
|
|
|
3045
3198
|
static getDerivedStateFromError(error) {
|
|
3046
3199
|
return { hasError: true, message: error.message };
|
|
3047
3200
|
}
|
|
3201
|
+
/**
|
|
3202
|
+
* Ideally we can track the last valid state and provide a button to go back, which
|
|
3203
|
+
* would just reset the form to that state. This isn't ideal for many cases though,
|
|
3204
|
+
* in general you'd probably want to push through the invalid state until you arrive at
|
|
3205
|
+
* a new state which you are happy with. So we should offer the opportunity to try rendering
|
|
3206
|
+
* again in the new, hopefully valid, state.
|
|
3207
|
+
*/
|
|
3048
3208
|
render() {
|
|
3049
3209
|
if (this.state.hasError && !this.state.pageRefresh) {
|
|
3050
|
-
return /* @__PURE__ */ React.createElement(
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3210
|
+
return /* @__PURE__ */ React.createElement(
|
|
3211
|
+
"div",
|
|
3212
|
+
{
|
|
3213
|
+
style: {
|
|
3214
|
+
background: "#efefef",
|
|
3215
|
+
height: "100vh",
|
|
3216
|
+
display: "flex",
|
|
3217
|
+
alignItems: "center",
|
|
3218
|
+
justifyContent: "center"
|
|
3219
|
+
}
|
|
3220
|
+
},
|
|
3221
|
+
/* @__PURE__ */ React.createElement("style", null, " body { margin: 0; } "),
|
|
3222
|
+
/* @__PURE__ */ React.createElement(
|
|
3223
|
+
"div",
|
|
3224
|
+
{
|
|
3225
|
+
style: {
|
|
3226
|
+
background: "#fff",
|
|
3227
|
+
maxWidth: "400px",
|
|
3228
|
+
padding: "20px",
|
|
3229
|
+
fontFamily: "'Inter', sans-serif",
|
|
3230
|
+
borderRadius: "5px",
|
|
3231
|
+
boxShadow: "0 6px 24px rgb(0 37 91 / 5%), 0 2px 4px rgb(0 37 91 / 3%)"
|
|
3232
|
+
}
|
|
3233
|
+
},
|
|
3234
|
+
/* @__PURE__ */ React.createElement("h3", { style: { color: "#eb6337" } }, "TinaCMS Render Error"),
|
|
3235
|
+
/* @__PURE__ */ React.createElement("p", null, "Tina caught an error while updating the page:"),
|
|
3236
|
+
/* @__PURE__ */ React.createElement("pre", { style: { marginTop: "1rem", overflowX: "auto" } }, this.state.message),
|
|
3237
|
+
/* @__PURE__ */ React.createElement("br", null),
|
|
3238
|
+
/* @__PURE__ */ React.createElement("p", null, `If you've just updated the form, undo your most recent changes and click "refresh". If after a few refreshes, you're still encountering this error. There is a bigger issue with the site. Please reach out to your site admin.`),
|
|
3239
|
+
/* @__PURE__ */ React.createElement("p", null, "See our", " ", /* @__PURE__ */ React.createElement(
|
|
3240
|
+
"a",
|
|
3241
|
+
{
|
|
3242
|
+
className: "text-gray-600",
|
|
3243
|
+
style: { textDecoration: "underline" },
|
|
3244
|
+
href: "https://tina.io/docs/errors/faq/",
|
|
3245
|
+
target: "_blank"
|
|
3246
|
+
},
|
|
3247
|
+
" ",
|
|
3248
|
+
"Error FAQ",
|
|
3249
|
+
" "
|
|
3250
|
+
), " ", "for more information."),
|
|
3251
|
+
/* @__PURE__ */ React.createElement(
|
|
3252
|
+
"button",
|
|
3253
|
+
{
|
|
3254
|
+
style: errorButtonStyles,
|
|
3255
|
+
onClick: () => {
|
|
3256
|
+
this.setState({ pageRefresh: true });
|
|
3257
|
+
setTimeout(
|
|
3258
|
+
() => this.setState({ hasError: false, pageRefresh: false }),
|
|
3259
|
+
3e3
|
|
3260
|
+
);
|
|
3261
|
+
}
|
|
3262
|
+
},
|
|
3263
|
+
"Refresh"
|
|
3264
|
+
)
|
|
3265
|
+
)
|
|
3266
|
+
);
|
|
3083
3267
|
}
|
|
3084
3268
|
if (this.state.pageRefresh) {
|
|
3085
3269
|
return /* @__PURE__ */ React.createElement(Loader, null, "Let's try that again.");
|
|
@@ -3096,130 +3280,157 @@ const TinaCMSProvider2 = ({
|
|
|
3096
3280
|
}) => {
|
|
3097
3281
|
var _a, _b, _c, _d, _e;
|
|
3098
3282
|
if (props == null ? void 0 : props.apiURL) {
|
|
3099
|
-
console.warn(
|
|
3283
|
+
console.warn(
|
|
3284
|
+
"The apiURL prop is deprecated. Please see https://tina.io/blog/tina-v-0.68.14 for information on how to upgrade to the new API"
|
|
3285
|
+
);
|
|
3100
3286
|
}
|
|
3101
3287
|
const apiURL = ((_a = props == null ? void 0 : props.client) == null ? void 0 : _a.apiUrl) || (props == null ? void 0 : props.apiURL);
|
|
3102
3288
|
const isLocalOverride = (_d = (_c = (_b = schema == null ? void 0 : schema.config) == null ? void 0 : _b.admin) == null ? void 0 : _c.auth) == null ? void 0 : _d.useLocalAuth;
|
|
3103
3289
|
const { branch, clientId, isLocalClient } = apiURL ? parseURL(apiURL) : {
|
|
3104
3290
|
branch: props.branch,
|
|
3105
3291
|
clientId: props.clientId,
|
|
3292
|
+
// @ts-expect-error this is for backwards compatibility
|
|
3106
3293
|
isLocalClient: props == null ? void 0 : props.isLocalClient
|
|
3107
3294
|
};
|
|
3108
|
-
if (
|
|
3109
|
-
|
|
3295
|
+
if (
|
|
3296
|
+
// Check if local client is defined
|
|
3297
|
+
typeof isLocalClient === "undefined" || // If in not in localMode check if clientId and branch are defined
|
|
3298
|
+
!isLocalClient && (!branch || !clientId) && // if they pass a custom apiURL, we don't need to throw an error
|
|
3299
|
+
!schema.config.contentApiUrlOverride
|
|
3300
|
+
) {
|
|
3301
|
+
throw new Error(
|
|
3302
|
+
"Invalid setup. See https://tina.io/docs/tina-cloud/connecting-site/ for more information."
|
|
3303
|
+
);
|
|
3110
3304
|
}
|
|
3111
3305
|
if (!schema) {
|
|
3112
|
-
throw new Error(
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3306
|
+
throw new Error(
|
|
3307
|
+
"`schema` is required to be passed as a property to `TinaProvider`. You can learn more about this change here: https://github.com/tinacms/tinacms/pull/2823"
|
|
3308
|
+
);
|
|
3309
|
+
}
|
|
3310
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
3311
|
+
TinaCloudProvider,
|
|
3312
|
+
{
|
|
3313
|
+
branch,
|
|
3314
|
+
clientId: clientId || ((_e = schema == null ? void 0 : schema.config) == null ? void 0 : _e.clientId),
|
|
3315
|
+
tinaioConfig: props.tinaioConfig,
|
|
3316
|
+
isLocalClient: isLocalOverride || isLocalClient,
|
|
3317
|
+
cmsCallback: props.cmsCallback,
|
|
3318
|
+
mediaStore: props.mediaStore,
|
|
3319
|
+
apiUrl: apiURL,
|
|
3320
|
+
schema: { ...schema, config: { ...schema.config, ...props } },
|
|
3321
|
+
tinaGraphQLVersion: props.tinaGraphQLVersion
|
|
3322
|
+
},
|
|
3323
|
+
/* @__PURE__ */ React.createElement("style", null, styles),
|
|
3324
|
+
/* @__PURE__ */ React.createElement(ErrorBoundary, null, props.children)
|
|
3325
|
+
));
|
|
3125
3326
|
};
|
|
3126
3327
|
const Loader = (props) => {
|
|
3127
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
background: "#f6f6f9",
|
|
3142
|
-
boxShadow: "0px 2px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.1)",
|
|
3143
|
-
borderRadius: "5px",
|
|
3144
|
-
padding: "40px 32px",
|
|
3145
|
-
width: "460px",
|
|
3146
|
-
maxWidth: "90%",
|
|
3147
|
-
display: "flex",
|
|
3148
|
-
alignItems: "center",
|
|
3149
|
-
justifyContent: "center",
|
|
3150
|
-
flexDirection: "column"
|
|
3151
|
-
}
|
|
3152
|
-
}, /* @__PURE__ */ React.createElement("svg", {
|
|
3153
|
-
style: {
|
|
3154
|
-
width: "64px",
|
|
3155
|
-
color: "#2296fe",
|
|
3156
|
-
marginTop: "-8px",
|
|
3157
|
-
marginBottom: "16px"
|
|
3328
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
3329
|
+
"div",
|
|
3330
|
+
{
|
|
3331
|
+
style: {
|
|
3332
|
+
position: "fixed",
|
|
3333
|
+
background: "rgba(0, 0, 0, 0.5)",
|
|
3334
|
+
inset: 0,
|
|
3335
|
+
zIndex: 200,
|
|
3336
|
+
opacity: "0.8",
|
|
3337
|
+
display: "flex",
|
|
3338
|
+
alignItems: "center",
|
|
3339
|
+
justifyContent: "center",
|
|
3340
|
+
padding: "40px"
|
|
3341
|
+
}
|
|
3158
3342
|
},
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3343
|
+
/* @__PURE__ */ React.createElement(
|
|
3344
|
+
"div",
|
|
3345
|
+
{
|
|
3346
|
+
style: {
|
|
3347
|
+
background: "#f6f6f9",
|
|
3348
|
+
boxShadow: "0px 2px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.1)",
|
|
3349
|
+
borderRadius: "5px",
|
|
3350
|
+
padding: "40px 32px",
|
|
3351
|
+
width: "460px",
|
|
3352
|
+
maxWidth: "90%",
|
|
3353
|
+
display: "flex",
|
|
3354
|
+
alignItems: "center",
|
|
3355
|
+
justifyContent: "center",
|
|
3356
|
+
flexDirection: "column"
|
|
3357
|
+
}
|
|
3358
|
+
},
|
|
3359
|
+
/* @__PURE__ */ React.createElement(
|
|
3360
|
+
"svg",
|
|
3361
|
+
{
|
|
3362
|
+
style: {
|
|
3363
|
+
width: "64px",
|
|
3364
|
+
color: "#2296fe",
|
|
3365
|
+
marginTop: "-8px",
|
|
3366
|
+
marginBottom: "16px"
|
|
3367
|
+
},
|
|
3368
|
+
version: "1.1",
|
|
3369
|
+
id: "L5",
|
|
3370
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3371
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
3372
|
+
x: "0px",
|
|
3373
|
+
y: "0px",
|
|
3374
|
+
viewBox: "0 0 100 64",
|
|
3375
|
+
enableBackground: "new 0 0 0 0",
|
|
3376
|
+
xmlSpace: "preserve"
|
|
3377
|
+
},
|
|
3378
|
+
/* @__PURE__ */ React.createElement("circle", { fill: "currentColor", stroke: "none", cx: 6, cy: 32, r: 6 }, /* @__PURE__ */ React.createElement(
|
|
3379
|
+
"animateTransform",
|
|
3380
|
+
{
|
|
3381
|
+
attributeName: "transform",
|
|
3382
|
+
dur: "1s",
|
|
3383
|
+
type: "translate",
|
|
3384
|
+
values: "0 15 ; 0 -15; 0 15",
|
|
3385
|
+
calcMode: "spline",
|
|
3386
|
+
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
3387
|
+
repeatCount: "indefinite",
|
|
3388
|
+
begin: "0.1"
|
|
3389
|
+
}
|
|
3390
|
+
)),
|
|
3391
|
+
/* @__PURE__ */ React.createElement("circle", { fill: "currentColor", stroke: "none", cx: 30, cy: 32, r: 6 }, /* @__PURE__ */ React.createElement(
|
|
3392
|
+
"animateTransform",
|
|
3393
|
+
{
|
|
3394
|
+
attributeName: "transform",
|
|
3395
|
+
dur: "1s",
|
|
3396
|
+
type: "translate",
|
|
3397
|
+
values: "0 15 ; 0 -10; 0 15",
|
|
3398
|
+
calcMode: "spline",
|
|
3399
|
+
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
3400
|
+
repeatCount: "indefinite",
|
|
3401
|
+
begin: "0.2"
|
|
3402
|
+
}
|
|
3403
|
+
)),
|
|
3404
|
+
/* @__PURE__ */ React.createElement("circle", { fill: "currentColor", stroke: "none", cx: 54, cy: 32, r: 6 }, /* @__PURE__ */ React.createElement(
|
|
3405
|
+
"animateTransform",
|
|
3406
|
+
{
|
|
3407
|
+
attributeName: "transform",
|
|
3408
|
+
dur: "1s",
|
|
3409
|
+
type: "translate",
|
|
3410
|
+
values: "0 15 ; 0 -5; 0 15",
|
|
3411
|
+
calcMode: "spline",
|
|
3412
|
+
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
3413
|
+
repeatCount: "indefinite",
|
|
3414
|
+
begin: "0.3"
|
|
3415
|
+
}
|
|
3416
|
+
))
|
|
3417
|
+
),
|
|
3418
|
+
/* @__PURE__ */ React.createElement(
|
|
3419
|
+
"p",
|
|
3420
|
+
{
|
|
3421
|
+
style: {
|
|
3422
|
+
fontSize: "18px",
|
|
3423
|
+
color: "#252336",
|
|
3424
|
+
textAlign: "center",
|
|
3425
|
+
lineHeight: "1.3",
|
|
3426
|
+
fontFamily: "'Inter', sans-serif",
|
|
3427
|
+
fontWeight: "normal"
|
|
3428
|
+
}
|
|
3429
|
+
},
|
|
3430
|
+
"Please wait, Tina is loading data..."
|
|
3431
|
+
)
|
|
3432
|
+
)
|
|
3433
|
+
), props.children);
|
|
3223
3434
|
};
|
|
3224
3435
|
const getStaticPropsForTina = async ({
|
|
3225
3436
|
query,
|
|
@@ -3227,17 +3438,21 @@ const getStaticPropsForTina = async ({
|
|
|
3227
3438
|
}) => {
|
|
3228
3439
|
try {
|
|
3229
3440
|
const data = await staticRequest({ query, variables });
|
|
3230
|
-
return JSON.parse(
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3441
|
+
return JSON.parse(
|
|
3442
|
+
JSON.stringify({
|
|
3443
|
+
data,
|
|
3444
|
+
query,
|
|
3445
|
+
variables
|
|
3446
|
+
})
|
|
3447
|
+
);
|
|
3235
3448
|
} catch (e) {
|
|
3236
|
-
return JSON.parse(
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3449
|
+
return JSON.parse(
|
|
3450
|
+
JSON.stringify({
|
|
3451
|
+
data: {},
|
|
3452
|
+
query,
|
|
3453
|
+
variables
|
|
3454
|
+
})
|
|
3455
|
+
);
|
|
3241
3456
|
}
|
|
3242
3457
|
};
|
|
3243
3458
|
function is_server() {
|
|
@@ -3267,20 +3482,24 @@ function gql(strings, ...args) {
|
|
|
3267
3482
|
return str;
|
|
3268
3483
|
}
|
|
3269
3484
|
const Layout = ({ children }) => {
|
|
3270
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("style", null, styles), /* @__PURE__ */ React.createElement(
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3485
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("style", null, styles), /* @__PURE__ */ React.createElement(
|
|
3486
|
+
"div",
|
|
3487
|
+
{
|
|
3488
|
+
className: "tina-tailwind",
|
|
3489
|
+
style: {
|
|
3490
|
+
position: "fixed",
|
|
3491
|
+
top: 0,
|
|
3492
|
+
left: 0,
|
|
3493
|
+
width: "100%",
|
|
3494
|
+
height: "100%",
|
|
3495
|
+
overflow: "auto",
|
|
3496
|
+
background: "#F6F6F9",
|
|
3497
|
+
fontFamily: "'Inter', sans-serif",
|
|
3498
|
+
zIndex: 9999
|
|
3499
|
+
}
|
|
3500
|
+
},
|
|
3501
|
+
children
|
|
3502
|
+
));
|
|
3284
3503
|
};
|
|
3285
3504
|
var DefaultContext = {
|
|
3286
3505
|
color: void 0,
|
|
@@ -3426,134 +3645,157 @@ const Sidebar = ({ cms }) => {
|
|
|
3426
3645
|
const navBreakpoint = 1e3;
|
|
3427
3646
|
const windowWidth = useWindowWidth();
|
|
3428
3647
|
const renderDesktopNav = windowWidth > navBreakpoint;
|
|
3429
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, renderDesktopNav && /* @__PURE__ */ React.createElement(
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
collectionsInfo,
|
|
3468
|
-
screens,
|
|
3469
|
-
cloudConfigs,
|
|
3470
|
-
contentCreators: [],
|
|
3471
|
-
RenderNavSite: ({ view }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
3472
|
-
label: view.name,
|
|
3473
|
-
to: `/screens/${slugify(view.name)}`,
|
|
3474
|
-
Icon: view.Icon ? view.Icon : ImFilesEmpty,
|
|
3475
|
-
onClick: () => {
|
|
3476
|
-
setMenuIsOpen(false);
|
|
3477
|
-
}
|
|
3478
|
-
}),
|
|
3479
|
-
RenderNavCloud: ({ config }) => /* @__PURE__ */ React.createElement(SidebarCloudLink, {
|
|
3480
|
-
config
|
|
3481
|
-
}),
|
|
3482
|
-
RenderNavCollection: ({ collection }) => /* @__PURE__ */ React.createElement(SidebarLink, {
|
|
3483
|
-
label: collection.label ? collection.label : collection.name,
|
|
3484
|
-
to: `/collections/${collection.name}/~`,
|
|
3485
|
-
Icon: ImFilesEmpty,
|
|
3486
|
-
onClick: () => {
|
|
3487
|
-
setMenuIsOpen(false);
|
|
3488
|
-
}
|
|
3489
|
-
})
|
|
3490
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
3491
|
-
className: "absolute top-8 right-0 transform translate-x-full overflow-hidden"
|
|
3492
|
-
}, /* @__PURE__ */ React.createElement(Button, {
|
|
3493
|
-
rounded: "right",
|
|
3494
|
-
variant: "secondary",
|
|
3495
|
-
onClick: () => {
|
|
3496
|
-
setMenuIsOpen(false);
|
|
3648
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, renderDesktopNav && /* @__PURE__ */ React.createElement(
|
|
3649
|
+
Nav,
|
|
3650
|
+
{
|
|
3651
|
+
isLocalMode,
|
|
3652
|
+
sidebarWidth: 360,
|
|
3653
|
+
showCollections: true,
|
|
3654
|
+
collectionsInfo,
|
|
3655
|
+
screens,
|
|
3656
|
+
cloudConfigs,
|
|
3657
|
+
contentCreators: [],
|
|
3658
|
+
RenderNavSite: ({ view }) => /* @__PURE__ */ React.createElement(
|
|
3659
|
+
SidebarLink,
|
|
3660
|
+
{
|
|
3661
|
+
label: view.name,
|
|
3662
|
+
to: `/screens/${slugify(view.name)}`,
|
|
3663
|
+
Icon: view.Icon ? view.Icon : ImFilesEmpty
|
|
3664
|
+
}
|
|
3665
|
+
),
|
|
3666
|
+
RenderNavCloud: ({ config }) => /* @__PURE__ */ React.createElement(SidebarCloudLink, { config }),
|
|
3667
|
+
RenderNavCollection: ({ collection }) => /* @__PURE__ */ React.createElement(
|
|
3668
|
+
SidebarLink,
|
|
3669
|
+
{
|
|
3670
|
+
label: collection.label ? collection.label : collection.name,
|
|
3671
|
+
to: `/collections/${collection.name}/~`,
|
|
3672
|
+
Icon: ImFilesEmpty
|
|
3673
|
+
}
|
|
3674
|
+
)
|
|
3675
|
+
}
|
|
3676
|
+
), !renderDesktopNav && /* @__PURE__ */ React.createElement(Transition, { show: menuIsOpen }, /* @__PURE__ */ React.createElement(
|
|
3677
|
+
Transition.Child,
|
|
3678
|
+
{
|
|
3679
|
+
as: React.Fragment,
|
|
3680
|
+
enter: "transform transition-all ease-out duration-300",
|
|
3681
|
+
enterFrom: "opacity-0 -translate-x-full",
|
|
3682
|
+
enterTo: "opacity-100 translate-x-0",
|
|
3683
|
+
leave: "transform transition-all ease-in duration-200",
|
|
3684
|
+
leaveFrom: "opacity-100 translate-x-0",
|
|
3685
|
+
leaveTo: "opacity-0 -translate-x-full"
|
|
3497
3686
|
},
|
|
3498
|
-
className:
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3687
|
+
/* @__PURE__ */ React.createElement("div", { className: "fixed left-0 top-0 z-overlay h-full transform" }, /* @__PURE__ */ React.createElement(
|
|
3688
|
+
Nav,
|
|
3689
|
+
{
|
|
3690
|
+
isLocalMode,
|
|
3691
|
+
className: "rounded-r-md",
|
|
3692
|
+
sidebarWidth: 360,
|
|
3693
|
+
showCollections: true,
|
|
3694
|
+
collectionsInfo,
|
|
3695
|
+
screens,
|
|
3696
|
+
cloudConfigs,
|
|
3697
|
+
contentCreators: [],
|
|
3698
|
+
RenderNavSite: ({ view }) => /* @__PURE__ */ React.createElement(
|
|
3699
|
+
SidebarLink,
|
|
3700
|
+
{
|
|
3701
|
+
label: view.name,
|
|
3702
|
+
to: `/screens/${slugify(view.name)}`,
|
|
3703
|
+
Icon: view.Icon ? view.Icon : ImFilesEmpty,
|
|
3704
|
+
onClick: () => {
|
|
3705
|
+
setMenuIsOpen(false);
|
|
3706
|
+
}
|
|
3707
|
+
}
|
|
3708
|
+
),
|
|
3709
|
+
RenderNavCloud: ({ config }) => /* @__PURE__ */ React.createElement(SidebarCloudLink, { config }),
|
|
3710
|
+
RenderNavCollection: ({ collection }) => /* @__PURE__ */ React.createElement(
|
|
3711
|
+
SidebarLink,
|
|
3712
|
+
{
|
|
3713
|
+
label: collection.label ? collection.label : collection.name,
|
|
3714
|
+
to: `/collections/${collection.name}/~`,
|
|
3715
|
+
Icon: ImFilesEmpty,
|
|
3716
|
+
onClick: () => {
|
|
3717
|
+
setMenuIsOpen(false);
|
|
3718
|
+
}
|
|
3719
|
+
}
|
|
3720
|
+
)
|
|
3721
|
+
},
|
|
3722
|
+
/* @__PURE__ */ React.createElement("div", { className: "absolute top-8 right-0 transform translate-x-full overflow-hidden" }, /* @__PURE__ */ React.createElement(
|
|
3723
|
+
Button,
|
|
3724
|
+
{
|
|
3725
|
+
rounded: "right",
|
|
3726
|
+
variant: "secondary",
|
|
3727
|
+
onClick: () => {
|
|
3728
|
+
setMenuIsOpen(false);
|
|
3729
|
+
},
|
|
3730
|
+
className: `transition-opacity duration-150 ease-out`
|
|
3731
|
+
},
|
|
3732
|
+
/* @__PURE__ */ React.createElement(IoMdClose, { className: "h-6 w-auto" })
|
|
3733
|
+
))
|
|
3734
|
+
))
|
|
3735
|
+
), /* @__PURE__ */ React.createElement(
|
|
3736
|
+
Transition.Child,
|
|
3737
|
+
{
|
|
3738
|
+
as: React.Fragment,
|
|
3739
|
+
enter: "ease-out duration-300",
|
|
3740
|
+
enterFrom: "opacity-0",
|
|
3741
|
+
enterTo: "opacity-80",
|
|
3742
|
+
entered: "opacity-80",
|
|
3743
|
+
leave: "ease-in duration-200",
|
|
3744
|
+
leaveFrom: "opacity-80",
|
|
3745
|
+
leaveTo: "opacity-0"
|
|
3513
3746
|
},
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3747
|
+
/* @__PURE__ */ React.createElement(
|
|
3748
|
+
"div",
|
|
3749
|
+
{
|
|
3750
|
+
onClick: () => {
|
|
3751
|
+
setMenuIsOpen(false);
|
|
3752
|
+
},
|
|
3753
|
+
className: "fixed z-menu inset-0 bg-gradient-to-br from-gray-800 via-gray-900 to-black"
|
|
3754
|
+
}
|
|
3755
|
+
)
|
|
3756
|
+
)), !renderDesktopNav && /* @__PURE__ */ React.createElement(
|
|
3757
|
+
Button,
|
|
3758
|
+
{
|
|
3759
|
+
rounded: "right",
|
|
3760
|
+
variant: "secondary",
|
|
3761
|
+
onClick: () => {
|
|
3762
|
+
setMenuIsOpen(true);
|
|
3763
|
+
},
|
|
3764
|
+
className: `pointer-events-auto -ml-px absolute left-0 z-50 ${isLocalMode ? `top-10` : `top-4`}`
|
|
3520
3765
|
},
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
className: "h-7 w-auto"
|
|
3524
|
-
})));
|
|
3766
|
+
/* @__PURE__ */ React.createElement(BiMenu, { className: "h-7 w-auto" })
|
|
3767
|
+
));
|
|
3525
3768
|
};
|
|
3526
3769
|
const SidebarLink = (props) => {
|
|
3527
3770
|
const { to, label, Icon } = props;
|
|
3528
|
-
return /* @__PURE__ */ React.createElement(
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3771
|
+
return /* @__PURE__ */ React.createElement(
|
|
3772
|
+
NavLink,
|
|
3773
|
+
{
|
|
3774
|
+
className: ({ isActive }) => {
|
|
3775
|
+
return `text-base tracking-wide ${isActive ? "text-blue-600" : "text-gray-500"} hover:text-blue-600 flex items-center opacity-90 hover:opacity-100`;
|
|
3776
|
+
},
|
|
3777
|
+
onClick: props.onClick ? props.onClick : () => {
|
|
3778
|
+
},
|
|
3779
|
+
to
|
|
3533
3780
|
},
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3781
|
+
/* @__PURE__ */ React.createElement(Icon, { className: "mr-2 h-6 opacity-80 w-auto" }),
|
|
3782
|
+
" ",
|
|
3783
|
+
label
|
|
3784
|
+
);
|
|
3538
3785
|
};
|
|
3539
3786
|
const SidebarCloudLink = ({ config }) => {
|
|
3540
3787
|
if (config.text) {
|
|
3541
|
-
return /* @__PURE__ */ React.createElement("span", {
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
}, /* @__PURE__ */ React.createElement(config.Icon, {
|
|
3552
|
-
className: "mr-2 h-6 opacity-80 w-auto"
|
|
3553
|
-
}), /* @__PURE__ */ React.createElement("a", {
|
|
3554
|
-
target: "_blank",
|
|
3555
|
-
href: config.link.href
|
|
3556
|
-
}, config.link.text));
|
|
3788
|
+
return /* @__PURE__ */ React.createElement("span", { className: "text-base tracking-wide text-gray-500 flex items-center opacity-90" }, config.text, " ", /* @__PURE__ */ React.createElement(
|
|
3789
|
+
"a",
|
|
3790
|
+
{
|
|
3791
|
+
target: "_blank",
|
|
3792
|
+
className: "ml-1 text-blue-600 hover:opacity-60",
|
|
3793
|
+
href: config.link.href
|
|
3794
|
+
},
|
|
3795
|
+
config.link.text
|
|
3796
|
+
));
|
|
3797
|
+
}
|
|
3798
|
+
return /* @__PURE__ */ React.createElement("span", { className: "text-base tracking-wide text-gray-500 hover:text-blue-600 flex items-center opacity-90 hover:opacity-100" }, /* @__PURE__ */ React.createElement(config.Icon, { className: "mr-2 h-6 opacity-80 w-auto" }), /* @__PURE__ */ React.createElement("a", { target: "_blank", href: config.link.href }, config.link.text));
|
|
3557
3799
|
};
|
|
3558
3800
|
const GetCMS = ({ children }) => {
|
|
3559
3801
|
try {
|
|
@@ -3570,54 +3812,45 @@ const AuthTemplate = ({
|
|
|
3570
3812
|
message,
|
|
3571
3813
|
children
|
|
3572
3814
|
}) => {
|
|
3573
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3585
|
-
className: "w-10 h-auto"
|
|
3586
|
-
}, /* @__PURE__ */ React.createElement("path", {
|
|
3587
|
-
d: "M18.6466 14.5553C19.9018 13.5141 20.458 7.36086 21.0014 5.14903C21.5447 2.9372 23.7919 3.04938 23.7919 3.04938C23.7919 3.04938 23.2085 4.06764 23.4464 4.82751C23.6844 5.58738 25.3145 6.26662 25.3145 6.26662L24.9629 7.19622C24.9629 7.19622 24.2288 7.10204 23.7919 7.9785C23.355 8.85496 24.3392 17.4442 24.3392 17.4442C24.3392 17.4442 21.4469 22.7275 21.4469 24.9206C21.4469 27.1136 22.4819 28.9515 22.4819 28.9515H21.0296C21.0296 28.9515 18.899 26.4086 18.462 25.1378C18.0251 23.8669 18.1998 22.596 18.1998 22.596C18.1998 22.596 15.8839 22.4646 13.8303 22.596C11.7767 22.7275 10.4072 24.498 10.16 25.4884C9.91287 26.4787 9.81048 28.9515 9.81048 28.9515H8.66211C7.96315 26.7882 7.40803 26.0129 7.70918 24.9206C8.54334 21.8949 8.37949 20.1788 8.18635 19.4145C7.99321 18.6501 6.68552 17.983 6.68552 17.983C7.32609 16.6741 7.97996 16.0452 10.7926 15.9796C13.6052 15.914 17.3915 15.5965 18.6466 14.5553Z"
|
|
3588
|
-
}), /* @__PURE__ */ React.createElement("path", {
|
|
3589
|
-
d: "M11.1268 24.7939C11.1268 24.7939 11.4236 27.5481 13.0001 28.9516H14.3511C13.0001 27.4166 12.8527 23.4155 12.8527 23.4155C12.1656 23.6399 11.3045 24.3846 11.1268 24.7939Z"
|
|
3590
|
-
})), /* @__PURE__ */ React.createElement("span", null, "Tina"))), message && /* @__PURE__ */ React.createElement("div", {
|
|
3591
|
-
className: "px-5 pt-4"
|
|
3592
|
-
}, /* @__PURE__ */ React.createElement("p", {
|
|
3593
|
-
className: "text-base font-sans leading-normal"
|
|
3594
|
-
}, message)), /* @__PURE__ */ React.createElement("div", {
|
|
3595
|
-
className: "px-5 py-4 flex gap-4 w-full justify-between"
|
|
3596
|
-
}, children)));
|
|
3815
|
+
return /* @__PURE__ */ React.createElement("div", { className: "h-screen w-full bg-gradient-to-b from-blue-900 to-gray-900 flex items-center justify-center px-4 py-6" }, /* @__PURE__ */ React.createElement("div", { className: "bg-white rounded-lg overflow-hidden shadow-lg w-full max-w-lg" }, /* @__PURE__ */ React.createElement("div", { className: "px-5 py-4 border-b border-gray-150" }, /* @__PURE__ */ React.createElement("h2", { className: "text-2xl font-sans tracking-wide text-gray-700 flex items-center gap-0.5" }, /* @__PURE__ */ React.createElement(
|
|
3816
|
+
"svg",
|
|
3817
|
+
{
|
|
3818
|
+
viewBox: "0 0 32 32",
|
|
3819
|
+
fill: "#EC4815",
|
|
3820
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3821
|
+
className: "w-10 h-auto"
|
|
3822
|
+
},
|
|
3823
|
+
/* @__PURE__ */ React.createElement("path", { d: "M18.6466 14.5553C19.9018 13.5141 20.458 7.36086 21.0014 5.14903C21.5447 2.9372 23.7919 3.04938 23.7919 3.04938C23.7919 3.04938 23.2085 4.06764 23.4464 4.82751C23.6844 5.58738 25.3145 6.26662 25.3145 6.26662L24.9629 7.19622C24.9629 7.19622 24.2288 7.10204 23.7919 7.9785C23.355 8.85496 24.3392 17.4442 24.3392 17.4442C24.3392 17.4442 21.4469 22.7275 21.4469 24.9206C21.4469 27.1136 22.4819 28.9515 22.4819 28.9515H21.0296C21.0296 28.9515 18.899 26.4086 18.462 25.1378C18.0251 23.8669 18.1998 22.596 18.1998 22.596C18.1998 22.596 15.8839 22.4646 13.8303 22.596C11.7767 22.7275 10.4072 24.498 10.16 25.4884C9.91287 26.4787 9.81048 28.9515 9.81048 28.9515H8.66211C7.96315 26.7882 7.40803 26.0129 7.70918 24.9206C8.54334 21.8949 8.37949 20.1788 8.18635 19.4145C7.99321 18.6501 6.68552 17.983 6.68552 17.983C7.32609 16.6741 7.97996 16.0452 10.7926 15.9796C13.6052 15.914 17.3915 15.5965 18.6466 14.5553Z" }),
|
|
3824
|
+
/* @__PURE__ */ React.createElement("path", { d: "M11.1268 24.7939C11.1268 24.7939 11.4236 27.5481 13.0001 28.9516H14.3511C13.0001 27.4166 12.8527 23.4155 12.8527 23.4155C12.1656 23.6399 11.3045 24.3846 11.1268 24.7939Z" })
|
|
3825
|
+
), /* @__PURE__ */ React.createElement("span", null, "Tina"))), message && /* @__PURE__ */ React.createElement("div", { className: "px-5 pt-4" }, /* @__PURE__ */ React.createElement("p", { className: "text-base font-sans leading-normal" }, message)), /* @__PURE__ */ React.createElement("div", { className: "px-5 py-4 flex gap-4 w-full justify-between" }, children)));
|
|
3597
3826
|
};
|
|
3598
3827
|
const LoginPage = () => {
|
|
3599
3828
|
const { setEdit } = useEditState();
|
|
3600
3829
|
const login = () => setEdit(true);
|
|
3601
|
-
return /* @__PURE__ */ React.createElement(AuthTemplate, null, /* @__PURE__ */ React.createElement("div", {
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3830
|
+
return /* @__PURE__ */ React.createElement(AuthTemplate, null, /* @__PURE__ */ React.createElement("div", { className: "flex w-full flex-1 gap-4 items-center justify-end" }, /* @__PURE__ */ React.createElement(
|
|
3831
|
+
Button,
|
|
3832
|
+
{
|
|
3833
|
+
onClick: () => {
|
|
3834
|
+
window.location.href = "/";
|
|
3835
|
+
},
|
|
3836
|
+
variant: "white",
|
|
3837
|
+
size: "custom",
|
|
3838
|
+
className: "text-base h-12 px-6 flex-shrink-0 flex-grow-0"
|
|
3839
|
+
},
|
|
3840
|
+
/* @__PURE__ */ React.createElement(MdOutlineArrowBack, { className: "w-6 h-auto mr-1.5 opacity-80" }),
|
|
3841
|
+
" Back To Site"
|
|
3842
|
+
), /* @__PURE__ */ React.createElement(
|
|
3843
|
+
Button,
|
|
3844
|
+
{
|
|
3845
|
+
onClick: () => login(),
|
|
3846
|
+
variant: "primary",
|
|
3847
|
+
size: "custom",
|
|
3848
|
+
className: "text-base h-12 px-6 flex-1",
|
|
3849
|
+
type: "submit"
|
|
3606
3850
|
},
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
}, /* @__PURE__ */ React.createElement(MdOutlineArrowBack, {
|
|
3611
|
-
className: "w-6 h-auto mr-1.5 opacity-80"
|
|
3612
|
-
}), " Back To Site"), /* @__PURE__ */ React.createElement(Button, {
|
|
3613
|
-
onClick: () => login(),
|
|
3614
|
-
variant: "primary",
|
|
3615
|
-
size: "custom",
|
|
3616
|
-
className: "text-base h-12 px-6 flex-1",
|
|
3617
|
-
type: "submit"
|
|
3618
|
-
}, /* @__PURE__ */ React.createElement(BiLogIn, {
|
|
3619
|
-
className: "w-6 h-auto mr-2 opacity-80"
|
|
3620
|
-
}), " Edit With Tina")));
|
|
3851
|
+
/* @__PURE__ */ React.createElement(BiLogIn, { className: "w-6 h-auto mr-2 opacity-80" }),
|
|
3852
|
+
" Edit With Tina"
|
|
3853
|
+
)));
|
|
3621
3854
|
};
|
|
3622
3855
|
const LogoutRedirect = () => {
|
|
3623
3856
|
const cms = useCMS();
|
|
@@ -3646,26 +3879,30 @@ const logout = () => {
|
|
|
3646
3879
|
window.location.href = "/";
|
|
3647
3880
|
};
|
|
3648
3881
|
const LogoutPage = () => {
|
|
3649
|
-
return /* @__PURE__ */ React.createElement(AuthTemplate, null, /* @__PURE__ */ React.createElement("div", {
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3882
|
+
return /* @__PURE__ */ React.createElement(AuthTemplate, null, /* @__PURE__ */ React.createElement("div", { className: "flex w-full flex-1 gap-4 items-center justify-end" }, /* @__PURE__ */ React.createElement(
|
|
3883
|
+
Button,
|
|
3884
|
+
{
|
|
3885
|
+
onClick: () => {
|
|
3886
|
+
window.location.href = "/";
|
|
3887
|
+
},
|
|
3888
|
+
variant: "white",
|
|
3889
|
+
size: "custom",
|
|
3890
|
+
className: "text-base h-12 px-6 flex-shrink-0 flex-grow-0"
|
|
3891
|
+
},
|
|
3892
|
+
/* @__PURE__ */ React.createElement(MdOutlineArrowBack, { className: "w-6 h-auto mr-1.5 opacity-80" }),
|
|
3893
|
+
" Back To Site"
|
|
3894
|
+
), /* @__PURE__ */ React.createElement(
|
|
3895
|
+
Button,
|
|
3896
|
+
{
|
|
3897
|
+
onClick: () => logout(),
|
|
3898
|
+
type: "submit",
|
|
3899
|
+
variant: "primary",
|
|
3900
|
+
size: "custom",
|
|
3901
|
+
className: "text-base h-12 px-6 flex-1"
|
|
3654
3902
|
},
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
}, /* @__PURE__ */ React.createElement(MdOutlineArrowBack, {
|
|
3659
|
-
className: "w-6 h-auto mr-1.5 opacity-80"
|
|
3660
|
-
}), " Back To Site"), /* @__PURE__ */ React.createElement(Button, {
|
|
3661
|
-
onClick: () => logout(),
|
|
3662
|
-
type: "submit",
|
|
3663
|
-
variant: "primary",
|
|
3664
|
-
size: "custom",
|
|
3665
|
-
className: "text-base h-12 px-6 flex-1"
|
|
3666
|
-
}, /* @__PURE__ */ React.createElement(BiLogOut, {
|
|
3667
|
-
className: "w-6 h-auto mr-1.5 opacity-80"
|
|
3668
|
-
}), " Log Out of Tina")));
|
|
3903
|
+
/* @__PURE__ */ React.createElement(BiLogOut, { className: "w-6 h-auto mr-1.5 opacity-80" }),
|
|
3904
|
+
" Log Out of Tina"
|
|
3905
|
+
)));
|
|
3669
3906
|
};
|
|
3670
3907
|
const PageWrapper = ({
|
|
3671
3908
|
children
|
|
@@ -3673,7 +3910,9 @@ const PageWrapper = ({
|
|
|
3673
3910
|
var _a, _b;
|
|
3674
3911
|
const cms = useCMS();
|
|
3675
3912
|
const isLocalMode = (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode;
|
|
3676
|
-
const [branchingEnabled, setBranchingEnabled] = React.useState(
|
|
3913
|
+
const [branchingEnabled, setBranchingEnabled] = React.useState(
|
|
3914
|
+
() => cms.flags.get("branch-switcher")
|
|
3915
|
+
);
|
|
3677
3916
|
React.useEffect(() => {
|
|
3678
3917
|
cms.events.subscribe("flag:set", ({ key, value }) => {
|
|
3679
3918
|
if (key === "branch-switcher") {
|
|
@@ -3681,164 +3920,143 @@ const PageWrapper = ({
|
|
|
3681
3920
|
}
|
|
3682
3921
|
});
|
|
3683
3922
|
}, [cms.events]);
|
|
3684
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
3685
|
-
className: "relative left-0 w-full h-full bg-gradient-to-b from-gray-50/50 to-gray-50 shadow-2xl overflow-y-auto transition-opacity duration-300 ease-out flex flex-col opacity-100"
|
|
3686
|
-
}, branchingEnabled && !isLocalMode && /* @__PURE__ */ React.createElement(BranchBanner, null), children);
|
|
3923
|
+
return /* @__PURE__ */ React.createElement("div", { className: "relative left-0 w-full h-full bg-gradient-to-b from-gray-50/50 to-gray-50 shadow-2xl overflow-y-auto transition-opacity duration-300 ease-out flex flex-col opacity-100" }, branchingEnabled && !isLocalMode && /* @__PURE__ */ React.createElement(BranchBanner, null), children);
|
|
3687
3924
|
};
|
|
3688
3925
|
const PageHeader = ({
|
|
3689
3926
|
isLocalMode,
|
|
3690
3927
|
children
|
|
3691
3928
|
}) => {
|
|
3692
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, isLocalMode && /* @__PURE__ */ React.createElement(LocalWarning, null), !isLocalMode && /* @__PURE__ */ React.createElement(BillingWarning, null), /* @__PURE__ */ React.createElement("div", {
|
|
3693
|
-
className: "pt-12 px-12"
|
|
3694
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
3695
|
-
className: "w-full mx-auto max-w-screen-xl"
|
|
3696
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
3697
|
-
className: "w-full flex justify-between items-end"
|
|
3698
|
-
}, children))));
|
|
3929
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, isLocalMode && /* @__PURE__ */ React.createElement(LocalWarning, null), !isLocalMode && /* @__PURE__ */ React.createElement(BillingWarning, null), /* @__PURE__ */ React.createElement("div", { className: "pt-12 px-12" }, /* @__PURE__ */ React.createElement("div", { className: "w-full mx-auto max-w-screen-xl" }, /* @__PURE__ */ React.createElement("div", { className: "w-full flex justify-between items-end" }, children))));
|
|
3699
3930
|
};
|
|
3700
3931
|
const PageBody = ({
|
|
3701
3932
|
children
|
|
3702
|
-
}) => /* @__PURE__ */ React.createElement("div", {
|
|
3703
|
-
className: "py-8 px-12"
|
|
3704
|
-
}, children);
|
|
3933
|
+
}) => /* @__PURE__ */ React.createElement("div", { className: "py-8 px-12" }, children);
|
|
3705
3934
|
const PageBodyNarrow = ({
|
|
3706
3935
|
children
|
|
3707
|
-
}) => /* @__PURE__ */ React.createElement("div", {
|
|
3708
|
-
className: "py-10 px-12"
|
|
3709
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
3710
|
-
className: "w-full mx-auto max-w-screen-xl"
|
|
3711
|
-
}, children));
|
|
3936
|
+
}) => /* @__PURE__ */ React.createElement("div", { className: "py-10 px-12" }, /* @__PURE__ */ React.createElement("div", { className: "w-full mx-auto max-w-screen-xl" }, children));
|
|
3712
3937
|
const DashboardPage = () => {
|
|
3713
3938
|
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => {
|
|
3714
3939
|
var _a, _b;
|
|
3715
|
-
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(PageHeader, {
|
|
3716
|
-
isLocalMode: (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode
|
|
3717
|
-
}, /* @__PURE__ */ React.createElement("h3", {
|
|
3718
|
-
className: "text-2xl font-sans text-gray-700"
|
|
3719
|
-
}, "Welcome to Tina!")), /* @__PURE__ */ React.createElement(PageBodyNarrow, null, "This is your dashboard for editing or creating content. Select a collection on the left to begin.")));
|
|
3940
|
+
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(PageHeader, { isLocalMode: (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode }, /* @__PURE__ */ React.createElement("h3", { className: "text-2xl font-sans text-gray-700" }, "Welcome to Tina!")), /* @__PURE__ */ React.createElement(PageBodyNarrow, null, "This is your dashboard for editing or creating content. Select a collection on the left to begin.")));
|
|
3720
3941
|
});
|
|
3721
3942
|
};
|
|
3722
3943
|
function RiHome2Line(props) {
|
|
3723
3944
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "g", "attr": {}, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" } }, { "tag": "path", "attr": { "d": "M19 21H5a1 1 0 0 1-1-1v-9H1l10.327-9.388a1 1 0 0 1 1.346 0L23 11h-3v9a1 1 0 0 1-1 1zM6 19h12V9.157l-6-5.454-6 5.454V19z" } }] }] })(props);
|
|
3724
3945
|
}
|
|
3725
|
-
const LoadingPage = () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
background: "#FFF",
|
|
3742
|
-
border: "1px solid #EDECF3",
|
|
3743
|
-
boxShadow: "0px 2px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.1)",
|
|
3744
|
-
borderRadius: "8px",
|
|
3745
|
-
padding: "32px 24px",
|
|
3746
|
-
width: "460px",
|
|
3747
|
-
maxWidth: "90%",
|
|
3748
|
-
display: "flex",
|
|
3749
|
-
alignItems: "center",
|
|
3750
|
-
justifyContent: "center",
|
|
3751
|
-
flexDirection: "column"
|
|
3752
|
-
}
|
|
3753
|
-
}, /* @__PURE__ */ React.createElement("svg", {
|
|
3754
|
-
style: {
|
|
3755
|
-
width: "64px",
|
|
3756
|
-
color: "#2296fe",
|
|
3757
|
-
marginTop: "-8px",
|
|
3758
|
-
marginBottom: "16px"
|
|
3946
|
+
const LoadingPage = () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
3947
|
+
"div",
|
|
3948
|
+
{
|
|
3949
|
+
style: {
|
|
3950
|
+
position: "absolute",
|
|
3951
|
+
top: 0,
|
|
3952
|
+
left: 0,
|
|
3953
|
+
width: "100%",
|
|
3954
|
+
height: "100%",
|
|
3955
|
+
zIndex: 200,
|
|
3956
|
+
opacity: "0.8",
|
|
3957
|
+
display: "flex",
|
|
3958
|
+
alignItems: "start",
|
|
3959
|
+
justifyContent: "center",
|
|
3960
|
+
padding: "120px 40px 40px 40px"
|
|
3961
|
+
}
|
|
3759
3962
|
},
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
}
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3963
|
+
/* @__PURE__ */ React.createElement(
|
|
3964
|
+
"div",
|
|
3965
|
+
{
|
|
3966
|
+
style: {
|
|
3967
|
+
background: "#FFF",
|
|
3968
|
+
border: "1px solid #EDECF3",
|
|
3969
|
+
boxShadow: "0px 2px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.1)",
|
|
3970
|
+
borderRadius: "8px",
|
|
3971
|
+
padding: "32px 24px",
|
|
3972
|
+
width: "460px",
|
|
3973
|
+
maxWidth: "90%",
|
|
3974
|
+
display: "flex",
|
|
3975
|
+
alignItems: "center",
|
|
3976
|
+
justifyContent: "center",
|
|
3977
|
+
flexDirection: "column"
|
|
3978
|
+
}
|
|
3979
|
+
},
|
|
3980
|
+
/* @__PURE__ */ React.createElement(
|
|
3981
|
+
"svg",
|
|
3982
|
+
{
|
|
3983
|
+
style: {
|
|
3984
|
+
width: "64px",
|
|
3985
|
+
color: "#2296fe",
|
|
3986
|
+
marginTop: "-8px",
|
|
3987
|
+
marginBottom: "16px"
|
|
3988
|
+
},
|
|
3989
|
+
version: "1.1",
|
|
3990
|
+
id: "L5",
|
|
3991
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3992
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
3993
|
+
x: "0px",
|
|
3994
|
+
y: "0px",
|
|
3995
|
+
viewBox: "0 0 100 64",
|
|
3996
|
+
enableBackground: "new 0 0 0 0",
|
|
3997
|
+
xmlSpace: "preserve"
|
|
3998
|
+
},
|
|
3999
|
+
/* @__PURE__ */ React.createElement("circle", { fill: "currentColor", stroke: "none", cx: 6, cy: 32, r: 6 }, /* @__PURE__ */ React.createElement(
|
|
4000
|
+
"animateTransform",
|
|
4001
|
+
{
|
|
4002
|
+
attributeName: "transform",
|
|
4003
|
+
dur: "1s",
|
|
4004
|
+
type: "translate",
|
|
4005
|
+
values: "0 15 ; 0 -15; 0 15",
|
|
4006
|
+
calcMode: "spline",
|
|
4007
|
+
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
4008
|
+
repeatCount: "indefinite",
|
|
4009
|
+
begin: "0.1"
|
|
4010
|
+
}
|
|
4011
|
+
)),
|
|
4012
|
+
/* @__PURE__ */ React.createElement("circle", { fill: "currentColor", stroke: "none", cx: 30, cy: 32, r: 6 }, /* @__PURE__ */ React.createElement(
|
|
4013
|
+
"animateTransform",
|
|
4014
|
+
{
|
|
4015
|
+
attributeName: "transform",
|
|
4016
|
+
dur: "1s",
|
|
4017
|
+
type: "translate",
|
|
4018
|
+
values: "0 15 ; 0 -10; 0 15",
|
|
4019
|
+
calcMode: "spline",
|
|
4020
|
+
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
4021
|
+
repeatCount: "indefinite",
|
|
4022
|
+
begin: "0.2"
|
|
4023
|
+
}
|
|
4024
|
+
)),
|
|
4025
|
+
/* @__PURE__ */ React.createElement("circle", { fill: "currentColor", stroke: "none", cx: 54, cy: 32, r: 6 }, /* @__PURE__ */ React.createElement(
|
|
4026
|
+
"animateTransform",
|
|
4027
|
+
{
|
|
4028
|
+
attributeName: "transform",
|
|
4029
|
+
dur: "1s",
|
|
4030
|
+
type: "translate",
|
|
4031
|
+
values: "0 15 ; 0 -5; 0 15",
|
|
4032
|
+
calcMode: "spline",
|
|
4033
|
+
keySplines: "0.8 0 0.4 1; 0.4 0 0.2 1",
|
|
4034
|
+
repeatCount: "indefinite",
|
|
4035
|
+
begin: "0.3"
|
|
4036
|
+
}
|
|
4037
|
+
))
|
|
4038
|
+
),
|
|
4039
|
+
/* @__PURE__ */ React.createElement(
|
|
4040
|
+
"p",
|
|
4041
|
+
{
|
|
4042
|
+
style: {
|
|
4043
|
+
fontSize: "16px",
|
|
4044
|
+
color: "#716c7f",
|
|
4045
|
+
textAlign: "center",
|
|
4046
|
+
lineHeight: "1.3",
|
|
4047
|
+
fontFamily: "'Inter', sans-serif",
|
|
4048
|
+
fontWeight: "normal"
|
|
4049
|
+
}
|
|
4050
|
+
},
|
|
4051
|
+
"Please wait, Tina is loading data..."
|
|
4052
|
+
)
|
|
4053
|
+
)
|
|
4054
|
+
));
|
|
3824
4055
|
const FullscreenError = ({
|
|
3825
4056
|
title = "Error",
|
|
3826
4057
|
errorMessage = "It looks like something went wrong."
|
|
3827
4058
|
}) => {
|
|
3828
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
3829
|
-
className: "flex flex-col justify-center items-center h-screen bg-gray-100"
|
|
3830
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
3831
|
-
className: "text-red-500 text-4xl mb-6 flex items-center"
|
|
3832
|
-
}, /* @__PURE__ */ React.createElement(BiError, {
|
|
3833
|
-
className: "w-12 h-auto fill-current text-red-400 opacity-70 mr-1"
|
|
3834
|
-
}), " ", title), /* @__PURE__ */ React.createElement("p", {
|
|
3835
|
-
className: "text-gray-700 text-xl mb-8"
|
|
3836
|
-
}, errorMessage), /* @__PURE__ */ React.createElement(Button, {
|
|
3837
|
-
variant: "danger",
|
|
3838
|
-
onClick: () => window.location.reload()
|
|
3839
|
-
}, /* @__PURE__ */ React.createElement(BiSync, {
|
|
3840
|
-
className: "w-7 h-auto fill-current opacity-70 mr-1"
|
|
3841
|
-
}), " Reload"));
|
|
4059
|
+
return /* @__PURE__ */ React.createElement("div", { className: "flex flex-col justify-center items-center h-screen bg-gray-100" }, /* @__PURE__ */ React.createElement("div", { className: "text-red-500 text-4xl mb-6 flex items-center" }, /* @__PURE__ */ React.createElement(BiError, { className: "w-12 h-auto fill-current text-red-400 opacity-70 mr-1" }), " ", title), /* @__PURE__ */ React.createElement("p", { className: "text-gray-700 text-xl mb-8" }, errorMessage), /* @__PURE__ */ React.createElement(Button, { variant: "danger", onClick: () => window.location.reload() }, /* @__PURE__ */ React.createElement(BiSync, { className: "w-7 h-auto fill-current opacity-70 mr-1" }), " Reload"));
|
|
3842
4060
|
};
|
|
3843
4061
|
const useGetCollection = (cms, collectionName, includeDocuments = true, folder, after = "", sortKey, filterArgs) => {
|
|
3844
4062
|
const api = new TinaAdminApi(cms);
|
|
@@ -3856,10 +4074,20 @@ const useGetCollection = (cms, collectionName, includeDocuments = true, folder,
|
|
|
3856
4074
|
const { name, order } = JSON.parse(sortKey || "{}");
|
|
3857
4075
|
const validSortKey = ((_a = collectionExtra.fields) == null ? void 0 : _a.map((x) => x.name).includes(name)) ? name : void 0;
|
|
3858
4076
|
try {
|
|
3859
|
-
const collection2 = await api.fetchCollection(
|
|
4077
|
+
const collection2 = await api.fetchCollection(
|
|
4078
|
+
collectionName,
|
|
4079
|
+
includeDocuments,
|
|
4080
|
+
(filterArgs == null ? void 0 : filterArgs.filterField) ? "" : folder.fullyQualifiedName,
|
|
4081
|
+
after,
|
|
4082
|
+
validSortKey,
|
|
4083
|
+
order,
|
|
4084
|
+
filterArgs
|
|
4085
|
+
);
|
|
3860
4086
|
setCollection(collection2);
|
|
3861
4087
|
} catch (error2) {
|
|
3862
|
-
cms.alerts.error(
|
|
4088
|
+
cms.alerts.error(
|
|
4089
|
+
`[${error2.name}] GetCollection failed: ${error2.message}`
|
|
4090
|
+
);
|
|
3863
4091
|
console.error(error2);
|
|
3864
4092
|
setCollection(void 0);
|
|
3865
4093
|
setError(error2);
|
|
@@ -3899,14 +4127,19 @@ const useSearchCollection = (cms, collectionName, includeDocuments = true, folde
|
|
|
3899
4127
|
const searchCollection = async () => {
|
|
3900
4128
|
if (await api.isAuthenticated() && !folder.loading && !cancelled) {
|
|
3901
4129
|
try {
|
|
3902
|
-
const response = await cms.api.search.query(
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
4130
|
+
const response = await cms.api.search.query(
|
|
4131
|
+
`${search} AND _collection:${collectionName}`,
|
|
4132
|
+
{
|
|
4133
|
+
limit: 15,
|
|
4134
|
+
cursor: after
|
|
4135
|
+
}
|
|
4136
|
+
);
|
|
4137
|
+
const docs = await Promise.allSettled(
|
|
4138
|
+
response.results.map((result) => {
|
|
4139
|
+
const [collection2, relativePath2] = result._id.split(":");
|
|
4140
|
+
return api.fetchDocument(collection2, relativePath2, false);
|
|
4141
|
+
})
|
|
4142
|
+
);
|
|
3910
4143
|
const edges = docs.filter((p) => {
|
|
3911
4144
|
var _a;
|
|
3912
4145
|
return p.status === "fulfilled" && !!((_a = p.value) == null ? void 0 : _a.document);
|
|
@@ -3928,7 +4161,9 @@ const useSearchCollection = (cms, collectionName, includeDocuments = true, folde
|
|
|
3928
4161
|
}
|
|
3929
4162
|
});
|
|
3930
4163
|
} catch (error2) {
|
|
3931
|
-
cms.alerts.error(
|
|
4164
|
+
cms.alerts.error(
|
|
4165
|
+
`[${error2.name}] GetCollection failed: ${error2.message}`
|
|
4166
|
+
);
|
|
3932
4167
|
console.error(error2);
|
|
3933
4168
|
setCollection(void 0);
|
|
3934
4169
|
setError(error2);
|
|
@@ -3967,18 +4202,43 @@ const GetCollection = ({
|
|
|
3967
4202
|
search
|
|
3968
4203
|
}) => {
|
|
3969
4204
|
const navigate = useNavigate();
|
|
3970
|
-
const { collection, loading, error, reFetchCollection, collectionExtra } = search ? useSearchCollection(
|
|
4205
|
+
const { collection, loading, error, reFetchCollection, collectionExtra } = search ? useSearchCollection(
|
|
4206
|
+
cms,
|
|
4207
|
+
collectionName,
|
|
4208
|
+
includeDocuments,
|
|
4209
|
+
folder,
|
|
4210
|
+
startCursor || "",
|
|
4211
|
+
search
|
|
4212
|
+
) : useGetCollection(
|
|
4213
|
+
cms,
|
|
4214
|
+
collectionName,
|
|
4215
|
+
includeDocuments,
|
|
4216
|
+
folder,
|
|
4217
|
+
startCursor || "",
|
|
4218
|
+
sortKey,
|
|
4219
|
+
filterArgs
|
|
4220
|
+
) || {};
|
|
3971
4221
|
useEffect(() => {
|
|
3972
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i
|
|
4222
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
3973
4223
|
if (loading)
|
|
3974
4224
|
return;
|
|
3975
|
-
const collectionDefinition = cms.api.tina.schema.getCollection(
|
|
3976
|
-
|
|
3977
|
-
|
|
4225
|
+
const collectionDefinition = cms.api.tina.schema.getCollection(
|
|
4226
|
+
collection.name
|
|
4227
|
+
);
|
|
4228
|
+
const allowCreate = ((_b = (_a = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _a.allowedActions) == null ? void 0 : _b.create) ?? true;
|
|
4229
|
+
const allowDelete = ((_d = (_c = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _c.allowedActions) == null ? void 0 : _d.delete) ?? true;
|
|
3978
4230
|
const collectionResponse = collection;
|
|
3979
|
-
if (!allowCreate && !allowDelete &&
|
|
4231
|
+
if (!allowCreate && !allowDelete && // Check there is only one document
|
|
4232
|
+
((_f = (_e = collectionResponse.documents) == null ? void 0 : _e.edges) == null ? void 0 : _f.length) === 1 && // Check to make sure the file is not a folder
|
|
4233
|
+
((_i = (_h = (_g = collectionResponse.documents) == null ? void 0 : _g.edges[0]) == null ? void 0 : _h.node) == null ? void 0 : _i.__typename) !== "Folder") {
|
|
3980
4234
|
const doc = collectionResponse.documents.edges[0].node;
|
|
3981
|
-
handleNavigate(
|
|
4235
|
+
handleNavigate(
|
|
4236
|
+
navigate,
|
|
4237
|
+
cms,
|
|
4238
|
+
collectionResponse,
|
|
4239
|
+
collectionDefinition,
|
|
4240
|
+
doc
|
|
4241
|
+
);
|
|
3982
4242
|
}
|
|
3983
4243
|
}, [(collection == null ? void 0 : collection.name) || "", loading]);
|
|
3984
4244
|
if (error) {
|
|
@@ -4033,43 +4293,38 @@ const TemplateMenu = ({
|
|
|
4033
4293
|
folder,
|
|
4034
4294
|
collectionName
|
|
4035
4295
|
}) => {
|
|
4036
|
-
return /* @__PURE__ */ React.createElement(Menu, {
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
collectionName,
|
|
4069
|
-
template.name
|
|
4070
|
-
].join("/")}`,
|
|
4071
|
-
className: `w-full text-md px-4 py-2 tracking-wide flex items-center transition ease-out duration-100 ${active ? "text-blue-600 opacity-100 bg-gray-50" : "opacity-80 text-gray-600"}`
|
|
4072
|
-
}, template.label))))))));
|
|
4296
|
+
return /* @__PURE__ */ React.createElement(Menu, { as: "div", className: "relative inline-block text-left" }, () => /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Menu.Button, { className: "icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center rounded-full justify-center transition-all duration-150 ease-out shadow text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 text-sm h-10 px-6" }, "Create New ", /* @__PURE__ */ React.createElement(BiPlus, { className: "w-5 h-full ml-1 opacity-70" }))), /* @__PURE__ */ React.createElement(
|
|
4297
|
+
Transition,
|
|
4298
|
+
{
|
|
4299
|
+
as: Fragment,
|
|
4300
|
+
enter: "transition ease-out duration-100",
|
|
4301
|
+
enterFrom: "transform opacity-0 scale-95",
|
|
4302
|
+
enterTo: "transform opacity-100 scale-100",
|
|
4303
|
+
leave: "transition ease-in duration-75",
|
|
4304
|
+
leaveFrom: "transform opacity-100 scale-100",
|
|
4305
|
+
leaveTo: "transform opacity-0 scale-95"
|
|
4306
|
+
},
|
|
4307
|
+
/* @__PURE__ */ React.createElement(Menu.Items, { className: "origin-top-right absolute right-0 mt-2 z-menu w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" }, /* @__PURE__ */ React.createElement("div", { className: "py-1" }, templates.map((template) => /* @__PURE__ */ React.createElement(Menu.Item, { key: `${template.label}-${template.name}` }, ({ active }) => /* @__PURE__ */ React.createElement(
|
|
4308
|
+
Link,
|
|
4309
|
+
{
|
|
4310
|
+
to: `/${folder.fullyQualifiedName ? [
|
|
4311
|
+
"collections",
|
|
4312
|
+
"new",
|
|
4313
|
+
collectionName,
|
|
4314
|
+
template.name,
|
|
4315
|
+
"~",
|
|
4316
|
+
folder.name
|
|
4317
|
+
].join("/") : [
|
|
4318
|
+
"collections",
|
|
4319
|
+
"new",
|
|
4320
|
+
collectionName,
|
|
4321
|
+
template.name
|
|
4322
|
+
].join("/")}`,
|
|
4323
|
+
className: `w-full text-md px-4 py-2 tracking-wide flex items-center transition ease-out duration-100 ${active ? "text-blue-600 opacity-100 bg-gray-50" : "opacity-80 text-gray-600"}`
|
|
4324
|
+
},
|
|
4325
|
+
template.label
|
|
4326
|
+
)))))
|
|
4327
|
+
)));
|
|
4073
4328
|
};
|
|
4074
4329
|
const handleNavigate = (navigate, cms, collection, collectionDefinition, document) => {
|
|
4075
4330
|
var _a, _b;
|
|
@@ -4088,7 +4343,10 @@ const handleNavigate = (navigate, cms, collection, collectionDefinition, documen
|
|
|
4088
4343
|
return null;
|
|
4089
4344
|
} else {
|
|
4090
4345
|
const pathToDoc = document._sys.breadcrumbs;
|
|
4091
|
-
navigate(
|
|
4346
|
+
navigate(
|
|
4347
|
+
`/${["collections", "edit", collection.name, ...pathToDoc].join("/")}`,
|
|
4348
|
+
{ replace: true }
|
|
4349
|
+
);
|
|
4092
4350
|
}
|
|
4093
4351
|
};
|
|
4094
4352
|
const CollectionListPage = () => {
|
|
@@ -4109,10 +4367,13 @@ const CollectionListPage = () => {
|
|
|
4109
4367
|
});
|
|
4110
4368
|
const [endCursor, setEndCursor] = useState("");
|
|
4111
4369
|
const [prevCursors, setPrevCursors] = useState([]);
|
|
4112
|
-
const [sortKey, setSortKey] = useState(
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4370
|
+
const [sortKey, setSortKey] = useState(
|
|
4371
|
+
// set sort key to cached value if it exists
|
|
4372
|
+
isSSR ? "" : window.localStorage.getItem(`${LOCAL_STORAGE_KEY}.${collectionName}`) || JSON.stringify({
|
|
4373
|
+
order: "asc",
|
|
4374
|
+
name: ""
|
|
4375
|
+
})
|
|
4376
|
+
);
|
|
4116
4377
|
const [search, setSearch] = useState("");
|
|
4117
4378
|
const [searchInput, setSearchInput] = useState("");
|
|
4118
4379
|
const { order = "asc", name: sortName } = JSON.parse(sortKey || "{}");
|
|
@@ -4120,10 +4381,12 @@ const CollectionListPage = () => {
|
|
|
4120
4381
|
const loc = useLocation();
|
|
4121
4382
|
const folder = useCollectionFolder();
|
|
4122
4383
|
useEffect(() => {
|
|
4123
|
-
setSortKey(
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4384
|
+
setSortKey(
|
|
4385
|
+
window.localStorage.getItem(`${LOCAL_STORAGE_KEY}.${collectionName}`) || JSON.stringify({
|
|
4386
|
+
order: "asc",
|
|
4387
|
+
name: ""
|
|
4388
|
+
})
|
|
4389
|
+
);
|
|
4127
4390
|
setEndCursor("");
|
|
4128
4391
|
setPrevCursors([]);
|
|
4129
4392
|
setSearch("");
|
|
@@ -4144,377 +4407,412 @@ const CollectionListPage = () => {
|
|
|
4144
4407
|
}));
|
|
4145
4408
|
}, [collectionName]);
|
|
4146
4409
|
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => {
|
|
4147
|
-
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
const documents = collection.documents.edges;
|
|
4170
|
-
const admin = cms.api.admin;
|
|
4171
|
-
const pageInfo = collection.documents.pageInfo;
|
|
4172
|
-
const fields = (_a = collectionExtra.fields) == null ? void 0 : _a.filter((x) => ["string", "number", "datetime", "boolean"].includes(x.type));
|
|
4173
|
-
const sortField = fields == null ? void 0 : fields.find((field) => field.name === sortName);
|
|
4174
|
-
const searchEnabled = !!((_d = (_c = (_b = cms.api.tina.schema) == null ? void 0 : _b.config) == null ? void 0 : _c.config) == null ? void 0 : _d.search);
|
|
4175
|
-
const collectionDefinition = cms.api.tina.schema.getCollection(collection.name);
|
|
4176
|
-
const allowCreate = (_g = (_f = (_e = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _e.allowedActions) == null ? void 0 : _f.create) != null ? _g : true;
|
|
4177
|
-
const allowDelete = (_j = (_i = (_h = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _h.allowedActions) == null ? void 0 : _i.delete) != null ? _j : true;
|
|
4178
|
-
const folderView = folder.fullyQualifiedName !== "";
|
|
4179
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, deleteModalOpen && !cms.api.tina.usingProtectedBranch() && /* @__PURE__ */ React.createElement(DeleteModal, {
|
|
4180
|
-
filename: vars.relativePath,
|
|
4181
|
-
deleteFunc: async () => {
|
|
4182
|
-
try {
|
|
4183
|
-
await admin.deleteDocument(vars);
|
|
4184
|
-
cms.alerts.info("Document was successfully deleted");
|
|
4185
|
-
reFetchCollection();
|
|
4186
|
-
} catch (error) {
|
|
4187
|
-
cms.alerts.warn("Document was not deleted, ask a developer for help or check the console for an error message");
|
|
4188
|
-
console.error(error);
|
|
4189
|
-
throw error;
|
|
4190
|
-
}
|
|
4191
|
-
},
|
|
4192
|
-
close: () => setDeleteModalOpen(false)
|
|
4193
|
-
}), deleteModalOpen && cms.api.tina.usingProtectedBranch() && /* @__PURE__ */ React.createElement(CreateBranchModel, {
|
|
4194
|
-
crudType: "delete",
|
|
4195
|
-
relativePath: collectionExtra.path + "/" + vars.relativePath,
|
|
4196
|
-
values: vars,
|
|
4197
|
-
close: () => setDeleteModalOpen(false),
|
|
4198
|
-
safeSubmit: async () => {
|
|
4199
|
-
try {
|
|
4200
|
-
await admin.deleteDocument(vars);
|
|
4201
|
-
cms.alerts.info("Document was successfully deleted");
|
|
4202
|
-
reFetchCollection();
|
|
4203
|
-
} catch (error) {
|
|
4204
|
-
cms.alerts.warn("Document was not deleted, ask a developer for help or check the console for an error message");
|
|
4205
|
-
console.error(error);
|
|
4206
|
-
throw error;
|
|
4207
|
-
}
|
|
4208
|
-
}
|
|
4209
|
-
}), renameModalOpen && /* @__PURE__ */ React.createElement(RenameModal, {
|
|
4210
|
-
filename: vars.relativePath,
|
|
4211
|
-
newRelativePath: vars.newRelativePath,
|
|
4212
|
-
setNewRelativePath: (newRelativePath) => {
|
|
4213
|
-
setVars((vars2) => {
|
|
4214
|
-
return { ...vars2, newRelativePath };
|
|
4215
|
-
});
|
|
4216
|
-
},
|
|
4217
|
-
renameFunc: async () => {
|
|
4218
|
-
const newRelativePath = `${vars.newRelativePath}.${collection.format}`;
|
|
4219
|
-
try {
|
|
4220
|
-
await admin.renameDocument({
|
|
4221
|
-
collection: vars.collection,
|
|
4222
|
-
relativePath: vars.relativePath,
|
|
4223
|
-
newRelativePath
|
|
4224
|
-
});
|
|
4225
|
-
cms.alerts.info("Document was successfully renamed");
|
|
4226
|
-
reFetchCollection();
|
|
4227
|
-
} catch (error) {
|
|
4228
|
-
cms.alerts.warn("Document was not renamed, ask a developer for help or check the console for an error message");
|
|
4229
|
-
console.error(error);
|
|
4230
|
-
throw error;
|
|
4410
|
+
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(
|
|
4411
|
+
GetCollection,
|
|
4412
|
+
{
|
|
4413
|
+
cms,
|
|
4414
|
+
collectionName,
|
|
4415
|
+
includeDocuments: true,
|
|
4416
|
+
startCursor: endCursor,
|
|
4417
|
+
sortKey,
|
|
4418
|
+
folder,
|
|
4419
|
+
filterArgs: (
|
|
4420
|
+
// only pass filter args if the collection is the same as the current route
|
|
4421
|
+
// We need this hear because this runs before the useEffect above
|
|
4422
|
+
collectionName === vars.collection ? vars : {
|
|
4423
|
+
collection: collectionName,
|
|
4424
|
+
relativePath: "",
|
|
4425
|
+
newRelativePath: "",
|
|
4426
|
+
filterField: "",
|
|
4427
|
+
startsWith: "",
|
|
4428
|
+
endsWith: "",
|
|
4429
|
+
before: "",
|
|
4430
|
+
after: "",
|
|
4431
|
+
booleanEquals: null
|
|
4231
4432
|
}
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
}
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4433
|
+
),
|
|
4434
|
+
search
|
|
4435
|
+
},
|
|
4436
|
+
(collection, _loading, reFetchCollection, collectionExtra) => {
|
|
4437
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
4438
|
+
collection.documents.totalCount;
|
|
4439
|
+
const documents = collection.documents.edges;
|
|
4440
|
+
const admin = cms.api.admin;
|
|
4441
|
+
const pageInfo = collection.documents.pageInfo;
|
|
4442
|
+
const fields = (_a = collectionExtra.fields) == null ? void 0 : _a.filter(
|
|
4443
|
+
(x) => (
|
|
4444
|
+
// only allow sortable fields
|
|
4445
|
+
["string", "number", "datetime", "boolean"].includes(x.type)
|
|
4446
|
+
)
|
|
4447
|
+
);
|
|
4448
|
+
const sortField = fields == null ? void 0 : fields.find(
|
|
4449
|
+
(field) => field.name === sortName
|
|
4450
|
+
);
|
|
4451
|
+
const searchEnabled = !!((_d = (_c = (_b = cms.api.tina.schema) == null ? void 0 : _b.config) == null ? void 0 : _c.config) == null ? void 0 : _d.search);
|
|
4452
|
+
const collectionDefinition = cms.api.tina.schema.getCollection(
|
|
4453
|
+
collection.name
|
|
4454
|
+
);
|
|
4455
|
+
const allowCreate = ((_f = (_e = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _e.allowedActions) == null ? void 0 : _f.create) ?? true;
|
|
4456
|
+
const allowDelete = ((_h = (_g = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _g.allowedActions) == null ? void 0 : _h.delete) ?? true;
|
|
4457
|
+
const folderView = folder.fullyQualifiedName !== "";
|
|
4458
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, deleteModalOpen && !cms.api.tina.usingProtectedBranch() && /* @__PURE__ */ React.createElement(
|
|
4459
|
+
DeleteModal,
|
|
4252
4460
|
{
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4461
|
+
filename: vars.relativePath,
|
|
4462
|
+
deleteFunc: async () => {
|
|
4463
|
+
try {
|
|
4464
|
+
await admin.deleteDocument(vars);
|
|
4465
|
+
cms.alerts.info(
|
|
4466
|
+
"Document was successfully deleted"
|
|
4467
|
+
);
|
|
4468
|
+
reFetchCollection();
|
|
4469
|
+
} catch (error) {
|
|
4470
|
+
cms.alerts.warn(
|
|
4471
|
+
"Document was not deleted, ask a developer for help or check the console for an error message"
|
|
4472
|
+
);
|
|
4473
|
+
console.error(error);
|
|
4474
|
+
throw error;
|
|
4475
|
+
}
|
|
4266
4476
|
},
|
|
4267
|
-
|
|
4268
|
-
label: (x.label || x.name) + (x.type === "datetime" ? " (Newest First)" : " (Descending)"),
|
|
4269
|
-
value: JSON.stringify({
|
|
4270
|
-
name: x.name,
|
|
4271
|
-
order: "desc"
|
|
4272
|
-
})
|
|
4273
|
-
}
|
|
4274
|
-
]).flat()
|
|
4275
|
-
],
|
|
4276
|
-
input: {
|
|
4277
|
-
id: "sort",
|
|
4278
|
-
name: "sort",
|
|
4279
|
-
value: sortKey,
|
|
4280
|
-
onChange: (e) => {
|
|
4281
|
-
const val = JSON.parse(e.target.value);
|
|
4282
|
-
setEndCursor("");
|
|
4283
|
-
setPrevCursors([]);
|
|
4284
|
-
window == null ? void 0 : window.localStorage.setItem(`${LOCAL_STORAGE_KEY}.${collectionName}`, e.target.value);
|
|
4285
|
-
setSortKey(e.target.value);
|
|
4286
|
-
setSortOrder(val.order);
|
|
4477
|
+
close: () => setDeleteModalOpen(false)
|
|
4287
4478
|
}
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
to: `/${folder.fullyQualifiedName ? [
|
|
4308
|
-
"collections",
|
|
4309
|
-
"new",
|
|
4310
|
-
collectionName,
|
|
4311
|
-
"~",
|
|
4312
|
-
folder.name
|
|
4313
|
-
].join("/") : ["collections", "new", collectionName].join("/")}`,
|
|
4314
|
-
className: "icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center rounded-full justify-center transition-all duration-150 ease-out whitespace-nowrap shadow text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 text-sm h-10 px-6"
|
|
4315
|
-
}, "Create New", " ", /* @__PURE__ */ React.createElement(BiPlus, {
|
|
4316
|
-
className: "w-5 h-full ml-1 opacity-70"
|
|
4317
|
-
})), collection.templates && allowCreate && /* @__PURE__ */ React.createElement(TemplateMenu, {
|
|
4318
|
-
collectionName,
|
|
4319
|
-
templates: collection.templates,
|
|
4320
|
-
folder
|
|
4321
|
-
})))), /* @__PURE__ */ React.createElement(PageBody, null, /* @__PURE__ */ React.createElement("div", {
|
|
4322
|
-
className: "w-full mx-auto max-w-screen-xl"
|
|
4323
|
-
}, sortField && !sortField.required && /* @__PURE__ */ React.createElement("p", {
|
|
4324
|
-
className: "mb-4 text-gray-500"
|
|
4325
|
-
}, /* @__PURE__ */ React.createElement("em", null, "Sorting on a non-required field. Some documents may be excluded (if they don't have a value for", " ", sortName, ")")), documents.length > 0 ? /* @__PURE__ */ React.createElement("table", {
|
|
4326
|
-
className: "table-auto shadow bg-white border-b border-gray-200 w-full max-w-full rounded-lg"
|
|
4327
|
-
}, /* @__PURE__ */ React.createElement("tbody", {
|
|
4328
|
-
className: "divide-y divide-gray-150"
|
|
4329
|
-
}, folder.name && !search && /* @__PURE__ */ React.createElement("tr", null, /* @__PURE__ */ React.createElement("td", {
|
|
4330
|
-
colSpan: 5
|
|
4331
|
-
}, /* @__PURE__ */ React.createElement(Breadcrumb, {
|
|
4332
|
-
folder,
|
|
4333
|
-
navigate,
|
|
4334
|
-
collectionName
|
|
4335
|
-
}))), documents.map((document) => {
|
|
4336
|
-
var _a2;
|
|
4337
|
-
if (document.node.__typename === "Folder") {
|
|
4338
|
-
return /* @__PURE__ */ React.createElement("tr", {
|
|
4339
|
-
key: `folder-${document.node.path}`
|
|
4340
|
-
}, /* @__PURE__ */ React.createElement("td", {
|
|
4341
|
-
className: "pl-5 pr-3 py-3 truncate max-w-0"
|
|
4342
|
-
}, /* @__PURE__ */ React.createElement("a", {
|
|
4343
|
-
className: "text-blue-600 hover:text-blue-400 flex items-center gap-3 cursor-pointer truncate",
|
|
4344
|
-
onClick: () => {
|
|
4345
|
-
navigate(`/${[
|
|
4346
|
-
"collections",
|
|
4347
|
-
collectionName,
|
|
4348
|
-
document.node.path
|
|
4349
|
-
].join("/")}`, { replace: true });
|
|
4479
|
+
), deleteModalOpen && cms.api.tina.usingProtectedBranch() && /* @__PURE__ */ React.createElement(
|
|
4480
|
+
CreateBranchModel,
|
|
4481
|
+
{
|
|
4482
|
+
crudType: "delete",
|
|
4483
|
+
relativePath: collectionExtra.path + "/" + vars.relativePath,
|
|
4484
|
+
values: vars,
|
|
4485
|
+
close: () => setDeleteModalOpen(false),
|
|
4486
|
+
safeSubmit: async () => {
|
|
4487
|
+
try {
|
|
4488
|
+
await admin.deleteDocument(vars);
|
|
4489
|
+
cms.alerts.info("Document was successfully deleted");
|
|
4490
|
+
reFetchCollection();
|
|
4491
|
+
} catch (error) {
|
|
4492
|
+
cms.alerts.warn(
|
|
4493
|
+
"Document was not deleted, ask a developer for help or check the console for an error message"
|
|
4494
|
+
);
|
|
4495
|
+
console.error(error);
|
|
4496
|
+
throw error;
|
|
4497
|
+
}
|
|
4350
4498
|
}
|
|
4351
|
-
}, /* @__PURE__ */ React.createElement(BiFolder, {
|
|
4352
|
-
className: "inline-block h-6 w-auto flex-shrink-0 opacity-70"
|
|
4353
|
-
}), /* @__PURE__ */ React.createElement("span", {
|
|
4354
|
-
className: "truncate block"
|
|
4355
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
4356
|
-
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
4357
|
-
}, "Name"), /* @__PURE__ */ React.createElement("span", {
|
|
4358
|
-
className: "h-5 leading-5 block truncate"
|
|
4359
|
-
}, /* @__PURE__ */ React.createElement("span", null, document.node.name))))), /* @__PURE__ */ React.createElement("td", {
|
|
4360
|
-
className: "px-3 py-3 truncate max-w-0",
|
|
4361
|
-
colSpan: 4
|
|
4362
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
4363
|
-
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
4364
|
-
}, "Path"), /* @__PURE__ */ React.createElement("span", {
|
|
4365
|
-
className: "leading-5 block text-sm font-medium text-gray-900 truncate"
|
|
4366
|
-
}, document.node.path.substring(2).split("/").map((node) => {
|
|
4367
|
-
return /* @__PURE__ */ React.createElement("span", {
|
|
4368
|
-
key: node
|
|
4369
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
4370
|
-
className: "text-gray-300 pr-0.5"
|
|
4371
|
-
}, "/"), /* @__PURE__ */ React.createElement("span", {
|
|
4372
|
-
className: "pr-0.5"
|
|
4373
|
-
}, node));
|
|
4374
|
-
}))));
|
|
4375
|
-
}
|
|
4376
|
-
const hasTitle = Boolean(document.node._sys.title);
|
|
4377
|
-
const subfolders = document.node._sys.breadcrumbs.slice(0, -1).join("/");
|
|
4378
|
-
return /* @__PURE__ */ React.createElement("tr", {
|
|
4379
|
-
key: `document-${document.node._sys.relativePath}`,
|
|
4380
|
-
className: ""
|
|
4381
|
-
}, /* @__PURE__ */ React.createElement("td", {
|
|
4382
|
-
className: "pl-5 pr-3 py-3 truncate max-w-0",
|
|
4383
|
-
colSpan: hasTitle ? 1 : 2
|
|
4384
|
-
}, /* @__PURE__ */ React.createElement("a", {
|
|
4385
|
-
className: "text-blue-600 hover:text-blue-400 flex items-center gap-3 cursor-pointer truncate",
|
|
4386
|
-
onClick: () => {
|
|
4387
|
-
handleNavigate(navigate, cms, collection, collectionDefinition, document.node);
|
|
4388
4499
|
}
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
4416
|
-
className: "block text-xs text-gray-400 mb-1 uppercase"
|
|
4417
|
-
}, "Template"), /* @__PURE__ */ React.createElement("span", {
|
|
4418
|
-
className: "h-5 leading-5 block text-sm font-medium text-gray-900"
|
|
4419
|
-
}, document.node._sys.template)), /* @__PURE__ */ React.createElement("td", {
|
|
4420
|
-
className: "w-0"
|
|
4421
|
-
}, /* @__PURE__ */ React.createElement(OverflowMenu, {
|
|
4422
|
-
toolbarItems: [
|
|
4423
|
-
{
|
|
4424
|
-
name: "edit",
|
|
4425
|
-
label: "Edit in Admin",
|
|
4426
|
-
Icon: /* @__PURE__ */ React.createElement(BiEdit, {
|
|
4427
|
-
size: "1.3rem"
|
|
4428
|
-
}),
|
|
4429
|
-
onMouseDown: () => {
|
|
4430
|
-
const pathToDoc = document.node._sys.breadcrumbs;
|
|
4431
|
-
if (folder.fullyQualifiedName) {
|
|
4432
|
-
pathToDoc.unshift("~");
|
|
4433
|
-
}
|
|
4434
|
-
navigate(`/${[
|
|
4435
|
-
"collections",
|
|
4436
|
-
"edit",
|
|
4437
|
-
collectionName,
|
|
4438
|
-
...pathToDoc
|
|
4439
|
-
].join("/")}`, { replace: true });
|
|
4500
|
+
), renameModalOpen && /* @__PURE__ */ React.createElement(
|
|
4501
|
+
RenameModal,
|
|
4502
|
+
{
|
|
4503
|
+
filename: vars.relativePath,
|
|
4504
|
+
newRelativePath: vars.newRelativePath,
|
|
4505
|
+
setNewRelativePath: (newRelativePath) => {
|
|
4506
|
+
setVars((vars2) => {
|
|
4507
|
+
return { ...vars2, newRelativePath };
|
|
4508
|
+
});
|
|
4509
|
+
},
|
|
4510
|
+
renameFunc: async () => {
|
|
4511
|
+
const newRelativePath = `${vars.newRelativePath}.${collection.format}`;
|
|
4512
|
+
try {
|
|
4513
|
+
await admin.renameDocument({
|
|
4514
|
+
collection: vars.collection,
|
|
4515
|
+
relativePath: vars.relativePath,
|
|
4516
|
+
newRelativePath
|
|
4517
|
+
});
|
|
4518
|
+
cms.alerts.info("Document was successfully renamed");
|
|
4519
|
+
reFetchCollection();
|
|
4520
|
+
} catch (error) {
|
|
4521
|
+
cms.alerts.warn(
|
|
4522
|
+
"Document was not renamed, ask a developer for help or check the console for an error message"
|
|
4523
|
+
);
|
|
4524
|
+
console.error(error);
|
|
4525
|
+
throw error;
|
|
4440
4526
|
}
|
|
4441
4527
|
},
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4528
|
+
close: () => setRenameModalOpen(false)
|
|
4529
|
+
}
|
|
4530
|
+
), /* @__PURE__ */ React.createElement(PageHeader, { isLocalMode: (_j = (_i = cms == null ? void 0 : cms.api) == null ? void 0 : _i.tina) == null ? void 0 : _j.isLocalMode }, /* @__PURE__ */ React.createElement("div", { className: "w-full grid grid-flow-col items-end gap-4" }, /* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-4" }, /* @__PURE__ */ React.createElement("h3", { className: "font-sans text-2xl text-gray-700" }, collection.label ? collection.label : collection.name), /* @__PURE__ */ React.createElement("div", { className: "flex gap-4 items-start flex-wrap" }, (fields == null ? void 0 : fields.length) > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, !search && /* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-2 items-start" }, /* @__PURE__ */ React.createElement(
|
|
4531
|
+
"label",
|
|
4532
|
+
{
|
|
4533
|
+
htmlFor: "sort",
|
|
4534
|
+
className: "block font-sans text-xs font-semibold text-gray-500 whitespace-normal"
|
|
4535
|
+
},
|
|
4536
|
+
"Sort by"
|
|
4537
|
+
), /* @__PURE__ */ React.createElement(
|
|
4538
|
+
Select,
|
|
4539
|
+
{
|
|
4540
|
+
name: "sort",
|
|
4541
|
+
options: [
|
|
4542
|
+
{
|
|
4543
|
+
label: "Default",
|
|
4544
|
+
value: JSON.stringify({
|
|
4545
|
+
order: "asc",
|
|
4546
|
+
name: ""
|
|
4547
|
+
})
|
|
4548
|
+
},
|
|
4549
|
+
...fields.map((x) => [
|
|
4550
|
+
{
|
|
4551
|
+
label: (x.label || x.name) + (x.type === "datetime" ? " (Oldest First)" : " (Ascending)"),
|
|
4552
|
+
value: JSON.stringify({
|
|
4553
|
+
name: x.name,
|
|
4554
|
+
order: "asc"
|
|
4555
|
+
})
|
|
4556
|
+
},
|
|
4557
|
+
{
|
|
4558
|
+
label: (x.label || x.name) + (x.type === "datetime" ? " (Newest First)" : " (Descending)"),
|
|
4559
|
+
value: JSON.stringify({
|
|
4560
|
+
name: x.name,
|
|
4561
|
+
order: "desc"
|
|
4562
|
+
})
|
|
4452
4563
|
}
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4564
|
+
]).flat()
|
|
4565
|
+
],
|
|
4566
|
+
input: {
|
|
4567
|
+
id: "sort",
|
|
4568
|
+
name: "sort",
|
|
4569
|
+
value: sortKey,
|
|
4570
|
+
onChange: (e) => {
|
|
4571
|
+
const val = JSON.parse(e.target.value);
|
|
4572
|
+
setEndCursor("");
|
|
4573
|
+
setPrevCursors([]);
|
|
4574
|
+
window == null ? void 0 : window.localStorage.setItem(
|
|
4575
|
+
`${LOCAL_STORAGE_KEY}.${collectionName}`,
|
|
4576
|
+
e.target.value
|
|
4577
|
+
);
|
|
4578
|
+
setSortKey(e.target.value);
|
|
4579
|
+
setSortOrder(val.order);
|
|
4459
4580
|
}
|
|
4581
|
+
}
|
|
4582
|
+
}
|
|
4583
|
+
)), /* @__PURE__ */ React.createElement("div", { className: "flex flex-1 flex-col gap-2 items-start w-full" }, searchEnabled ? /* @__PURE__ */ React.createElement(
|
|
4584
|
+
SearchInput,
|
|
4585
|
+
{
|
|
4586
|
+
loading: _loading,
|
|
4587
|
+
search,
|
|
4588
|
+
setSearch,
|
|
4589
|
+
searchInput,
|
|
4590
|
+
setSearchInput
|
|
4591
|
+
}
|
|
4592
|
+
) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("label", { className: "block font-sans text-xs font-semibold text-gray-500 whitespace-normal" }, "Search"), /* @__PURE__ */ React.createElement(
|
|
4593
|
+
Message,
|
|
4594
|
+
{
|
|
4595
|
+
link: "https://tina.io/docs/reference/search/overview",
|
|
4596
|
+
linkLabel: "Read The Docs",
|
|
4597
|
+
type: "info",
|
|
4598
|
+
size: "small"
|
|
4599
|
+
},
|
|
4600
|
+
"Search not configured."
|
|
4601
|
+
)))))), /* @__PURE__ */ React.createElement("div", { className: "flex self-end justify-self-end" }, !collection.templates && allowCreate && /* @__PURE__ */ React.createElement(
|
|
4602
|
+
Link,
|
|
4603
|
+
{
|
|
4604
|
+
to: `/${folder.fullyQualifiedName ? [
|
|
4605
|
+
"collections",
|
|
4606
|
+
"new",
|
|
4607
|
+
collectionName,
|
|
4608
|
+
"~",
|
|
4609
|
+
folder.name
|
|
4610
|
+
].join("/") : ["collections", "new", collectionName].join(
|
|
4611
|
+
"/"
|
|
4612
|
+
)}`,
|
|
4613
|
+
className: "icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center rounded-full justify-center transition-all duration-150 ease-out whitespace-nowrap shadow text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 text-sm h-10 px-6"
|
|
4614
|
+
},
|
|
4615
|
+
"Create New",
|
|
4616
|
+
" ",
|
|
4617
|
+
/* @__PURE__ */ React.createElement(BiPlus, { className: "w-5 h-full ml-1 opacity-70" })
|
|
4618
|
+
), collection.templates && allowCreate && /* @__PURE__ */ React.createElement(
|
|
4619
|
+
TemplateMenu,
|
|
4620
|
+
{
|
|
4621
|
+
collectionName,
|
|
4622
|
+
templates: collection.templates,
|
|
4623
|
+
folder
|
|
4624
|
+
}
|
|
4625
|
+
)))), /* @__PURE__ */ React.createElement(PageBody, null, /* @__PURE__ */ React.createElement("div", { className: "w-full mx-auto max-w-screen-xl" }, sortField && !sortField.required && /* @__PURE__ */ React.createElement("p", { className: "mb-4 text-gray-500" }, /* @__PURE__ */ React.createElement("em", null, "Sorting on a non-required field. Some documents may be excluded (if they don't have a value for", " ", sortName, ")")), documents.length > 0 ? /* @__PURE__ */ React.createElement("table", { className: "table-auto shadow bg-white border-b border-gray-200 w-full max-w-full rounded-lg" }, /* @__PURE__ */ React.createElement("tbody", { className: "divide-y divide-gray-150" }, folder.name && !search && /* @__PURE__ */ React.createElement("tr", null, /* @__PURE__ */ React.createElement("td", { colSpan: 5 }, /* @__PURE__ */ React.createElement(
|
|
4626
|
+
Breadcrumb,
|
|
4627
|
+
{
|
|
4628
|
+
folder,
|
|
4629
|
+
navigate,
|
|
4630
|
+
collectionName
|
|
4631
|
+
}
|
|
4632
|
+
))), documents.map((document) => {
|
|
4633
|
+
var _a2;
|
|
4634
|
+
if (document.node.__typename === "Folder") {
|
|
4635
|
+
return /* @__PURE__ */ React.createElement("tr", { key: `folder-${document.node.path}` }, /* @__PURE__ */ React.createElement("td", { className: "pl-5 pr-3 py-3 truncate max-w-0" }, /* @__PURE__ */ React.createElement(
|
|
4636
|
+
"a",
|
|
4637
|
+
{
|
|
4638
|
+
className: "text-blue-600 hover:text-blue-400 flex items-center gap-3 cursor-pointer truncate",
|
|
4639
|
+
onClick: () => {
|
|
4640
|
+
navigate(
|
|
4641
|
+
`/${[
|
|
4642
|
+
"collections",
|
|
4643
|
+
collectionName,
|
|
4644
|
+
document.node.path
|
|
4645
|
+
].join("/")}`,
|
|
4646
|
+
{ replace: true }
|
|
4647
|
+
);
|
|
4648
|
+
}
|
|
4649
|
+
},
|
|
4650
|
+
/* @__PURE__ */ React.createElement(BiFolder, { className: "inline-block h-6 w-auto flex-shrink-0 opacity-70" }),
|
|
4651
|
+
/* @__PURE__ */ React.createElement("span", { className: "truncate block" }, /* @__PURE__ */ React.createElement("span", { className: "block text-xs text-gray-400 mb-1 uppercase" }, "Name"), /* @__PURE__ */ React.createElement("span", { className: "h-5 leading-5 block truncate" }, /* @__PURE__ */ React.createElement("span", null, document.node.name)))
|
|
4652
|
+
)), /* @__PURE__ */ React.createElement(
|
|
4653
|
+
"td",
|
|
4654
|
+
{
|
|
4655
|
+
className: "px-3 py-3 truncate max-w-0",
|
|
4656
|
+
colSpan: 4
|
|
4657
|
+
},
|
|
4658
|
+
/* @__PURE__ */ React.createElement("span", { className: "block text-xs text-gray-400 mb-1 uppercase" }, "Path"),
|
|
4659
|
+
/* @__PURE__ */ React.createElement("span", { className: "leading-5 block text-sm font-medium text-gray-900 truncate" }, document.node.path.substring(2).split("/").map((node) => {
|
|
4660
|
+
return /* @__PURE__ */ React.createElement("span", { key: node }, /* @__PURE__ */ React.createElement("span", { className: "text-gray-300 pr-0.5" }, "/"), /* @__PURE__ */ React.createElement("span", { className: "pr-0.5" }, node));
|
|
4661
|
+
}))
|
|
4662
|
+
));
|
|
4663
|
+
}
|
|
4664
|
+
const hasTitle = Boolean(
|
|
4665
|
+
document.node._sys.title
|
|
4666
|
+
);
|
|
4667
|
+
const subfolders = document.node._sys.breadcrumbs.slice(0, -1).join("/");
|
|
4668
|
+
return /* @__PURE__ */ React.createElement(
|
|
4669
|
+
"tr",
|
|
4670
|
+
{
|
|
4671
|
+
key: `document-${document.node._sys.relativePath}`,
|
|
4672
|
+
className: ""
|
|
4460
4673
|
},
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4674
|
+
/* @__PURE__ */ React.createElement(
|
|
4675
|
+
"td",
|
|
4676
|
+
{
|
|
4677
|
+
className: "pl-5 pr-3 py-3 truncate max-w-0",
|
|
4678
|
+
colSpan: hasTitle ? 1 : 2
|
|
4679
|
+
},
|
|
4680
|
+
/* @__PURE__ */ React.createElement(
|
|
4681
|
+
"a",
|
|
4682
|
+
{
|
|
4683
|
+
className: "text-blue-600 hover:text-blue-400 flex items-center gap-3 cursor-pointer truncate",
|
|
4684
|
+
onClick: () => {
|
|
4685
|
+
handleNavigate(
|
|
4686
|
+
navigate,
|
|
4687
|
+
cms,
|
|
4688
|
+
collection,
|
|
4689
|
+
collectionDefinition,
|
|
4690
|
+
document.node
|
|
4691
|
+
);
|
|
4692
|
+
}
|
|
4693
|
+
},
|
|
4694
|
+
/* @__PURE__ */ React.createElement(BiFile, { className: "inline-block h-6 w-auto flex-shrink-0 opacity-70" }),
|
|
4695
|
+
/* @__PURE__ */ React.createElement("span", { className: "truncate block" }, /* @__PURE__ */ React.createElement("span", { className: "block text-xs text-gray-400 mb-1 uppercase" }, hasTitle ? "Title" : "Filename"), /* @__PURE__ */ React.createElement("span", { className: "h-5 leading-5 block truncate" }, !folderView && !hasTitle && subfolders && /* @__PURE__ */ React.createElement("span", { className: "text-xs text-gray-400" }, `${subfolders}/`), /* @__PURE__ */ React.createElement("span", null, hasTitle ? (_a2 = document.node._sys) == null ? void 0 : _a2.title : document.node._sys.filename)))
|
|
4696
|
+
)
|
|
4697
|
+
),
|
|
4698
|
+
hasTitle && /* @__PURE__ */ React.createElement("td", { className: "px-3 py-3 truncate max-w-0" }, /* @__PURE__ */ React.createElement("span", { className: "block text-xs text-gray-400 mb-1 uppercase" }, "Filename"), /* @__PURE__ */ React.createElement("span", { className: "h-5 leading-5 block text-sm font-medium text-gray-900 truncate" }, !folderView && subfolders && /* @__PURE__ */ React.createElement("span", { className: "text-xs text-gray-400" }, `${subfolders}/`), /* @__PURE__ */ React.createElement("span", null, document.node._sys.filename))),
|
|
4699
|
+
/* @__PURE__ */ React.createElement("td", { className: "px-3 py-3 truncate w-[15%]" }, /* @__PURE__ */ React.createElement("span", { className: "block text-xs text-gray-400 mb-1 uppercase" }, "Extension"), /* @__PURE__ */ React.createElement("span", { className: "h-5 leading-5 block text-sm font-medium text-gray-900" }, document.node._sys.extension)),
|
|
4700
|
+
/* @__PURE__ */ React.createElement("td", { className: "px-3 py-3 truncate w-[15%]" }, /* @__PURE__ */ React.createElement("span", { className: "block text-xs text-gray-400 mb-1 uppercase" }, "Template"), /* @__PURE__ */ React.createElement("span", { className: "h-5 leading-5 block text-sm font-medium text-gray-900" }, document.node._sys.template)),
|
|
4701
|
+
/* @__PURE__ */ React.createElement("td", { className: "w-0" }, /* @__PURE__ */ React.createElement(
|
|
4702
|
+
OverflowMenu,
|
|
4703
|
+
{
|
|
4704
|
+
toolbarItems: [
|
|
4705
|
+
{
|
|
4706
|
+
name: "edit",
|
|
4707
|
+
label: "Edit in Admin",
|
|
4708
|
+
Icon: /* @__PURE__ */ React.createElement(BiEdit, { size: "1.3rem" }),
|
|
4709
|
+
onMouseDown: () => {
|
|
4710
|
+
const pathToDoc = document.node._sys.breadcrumbs;
|
|
4711
|
+
if (folder.fullyQualifiedName) {
|
|
4712
|
+
pathToDoc.unshift("~");
|
|
4713
|
+
}
|
|
4714
|
+
navigate(
|
|
4715
|
+
`/${[
|
|
4716
|
+
"collections",
|
|
4717
|
+
"edit",
|
|
4718
|
+
collectionName,
|
|
4719
|
+
...pathToDoc
|
|
4720
|
+
].join("/")}`,
|
|
4721
|
+
{ replace: true }
|
|
4722
|
+
);
|
|
4723
|
+
}
|
|
4724
|
+
},
|
|
4725
|
+
allowCreate && {
|
|
4726
|
+
name: "duplicate",
|
|
4727
|
+
label: "Duplicate",
|
|
4728
|
+
Icon: /* @__PURE__ */ React.createElement(BiCopy, { size: "1.3rem" }),
|
|
4729
|
+
onMouseDown: () => {
|
|
4730
|
+
const pathToDoc = document.node._sys.breadcrumbs;
|
|
4731
|
+
if (folder.fullyQualifiedName) {
|
|
4732
|
+
pathToDoc.unshift("~");
|
|
4733
|
+
}
|
|
4734
|
+
navigate(
|
|
4735
|
+
`/${[
|
|
4736
|
+
"collections",
|
|
4737
|
+
"duplicate",
|
|
4738
|
+
collectionName,
|
|
4739
|
+
...pathToDoc
|
|
4740
|
+
].join("/")}`,
|
|
4741
|
+
{ replace: true }
|
|
4742
|
+
);
|
|
4743
|
+
}
|
|
4744
|
+
},
|
|
4745
|
+
allowDelete && {
|
|
4746
|
+
name: "delete",
|
|
4747
|
+
label: "Delete",
|
|
4748
|
+
Icon: /* @__PURE__ */ React.createElement(
|
|
4749
|
+
BiTrash,
|
|
4750
|
+
{
|
|
4751
|
+
size: "1.3rem",
|
|
4752
|
+
className: "text-red-500"
|
|
4753
|
+
}
|
|
4754
|
+
),
|
|
4755
|
+
onMouseDown: () => {
|
|
4756
|
+
setVars((old) => ({
|
|
4757
|
+
...old,
|
|
4758
|
+
collection: collectionName,
|
|
4759
|
+
relativePath: document.node._sys.breadcrumbs.join(
|
|
4760
|
+
"/"
|
|
4761
|
+
) + document.node._sys.extension,
|
|
4762
|
+
newRelativePath: ""
|
|
4763
|
+
}));
|
|
4764
|
+
setDeleteModalOpen(true);
|
|
4765
|
+
}
|
|
4766
|
+
},
|
|
4767
|
+
allowDelete && {
|
|
4768
|
+
name: "rename",
|
|
4769
|
+
label: "Rename",
|
|
4770
|
+
Icon: /* @__PURE__ */ React.createElement(
|
|
4771
|
+
BiRename,
|
|
4772
|
+
{
|
|
4773
|
+
size: "1.3rem",
|
|
4774
|
+
className: "text-red-500"
|
|
4775
|
+
}
|
|
4776
|
+
),
|
|
4777
|
+
onMouseDown: () => {
|
|
4778
|
+
setVars((old) => ({
|
|
4779
|
+
...old,
|
|
4780
|
+
collection: collectionName,
|
|
4781
|
+
relativePath: document.node._sys.breadcrumbs.join(
|
|
4782
|
+
"/"
|
|
4783
|
+
) + document.node._sys.extension,
|
|
4784
|
+
newRelativePath: ""
|
|
4785
|
+
}));
|
|
4786
|
+
setRenameModalOpen(true);
|
|
4787
|
+
}
|
|
4788
|
+
}
|
|
4789
|
+
].filter(Boolean)
|
|
4476
4790
|
}
|
|
4791
|
+
))
|
|
4792
|
+
);
|
|
4793
|
+
}))) : /* @__PURE__ */ React.createElement(NoDocumentsPlaceholder, null), /* @__PURE__ */ React.createElement("div", { className: "pt-4" }, /* @__PURE__ */ React.createElement(
|
|
4794
|
+
CursorPaginator,
|
|
4795
|
+
{
|
|
4796
|
+
variant: "white",
|
|
4797
|
+
hasNext: sortOrder === "asc" ? pageInfo == null ? void 0 : pageInfo.hasNextPage : pageInfo.hasPreviousPage,
|
|
4798
|
+
navigateNext: () => {
|
|
4799
|
+
const newState = [...prevCursors, endCursor];
|
|
4800
|
+
setPrevCursors(newState);
|
|
4801
|
+
setEndCursor(pageInfo == null ? void 0 : pageInfo.endCursor);
|
|
4477
4802
|
},
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
onMouseDown: () => {
|
|
4486
|
-
setVars((old) => ({
|
|
4487
|
-
...old,
|
|
4488
|
-
collection: collectionName,
|
|
4489
|
-
relativePath: document.node._sys.breadcrumbs.join("/") + document.node._sys.extension,
|
|
4490
|
-
newRelativePath: ""
|
|
4491
|
-
}));
|
|
4492
|
-
setRenameModalOpen(true);
|
|
4803
|
+
hasPrev: prevCursors.length > 0,
|
|
4804
|
+
navigatePrev: () => {
|
|
4805
|
+
const prev = prevCursors[prevCursors.length - 1];
|
|
4806
|
+
if (typeof prev === "string") {
|
|
4807
|
+
const newState = prevCursors.slice(0, -1);
|
|
4808
|
+
setPrevCursors(newState);
|
|
4809
|
+
setEndCursor(prev);
|
|
4493
4810
|
}
|
|
4494
4811
|
}
|
|
4495
|
-
].filter(Boolean)
|
|
4496
|
-
})));
|
|
4497
|
-
}))) : /* @__PURE__ */ React.createElement(NoDocumentsPlaceholder, null), /* @__PURE__ */ React.createElement("div", {
|
|
4498
|
-
className: "pt-4"
|
|
4499
|
-
}, /* @__PURE__ */ React.createElement(CursorPaginator, {
|
|
4500
|
-
variant: "white",
|
|
4501
|
-
hasNext: sortOrder === "asc" ? pageInfo == null ? void 0 : pageInfo.hasNextPage : pageInfo.hasPreviousPage,
|
|
4502
|
-
navigateNext: () => {
|
|
4503
|
-
const newState = [...prevCursors, endCursor];
|
|
4504
|
-
setPrevCursors(newState);
|
|
4505
|
-
setEndCursor(pageInfo == null ? void 0 : pageInfo.endCursor);
|
|
4506
|
-
},
|
|
4507
|
-
hasPrev: prevCursors.length > 0,
|
|
4508
|
-
navigatePrev: () => {
|
|
4509
|
-
const prev = prevCursors[prevCursors.length - 1];
|
|
4510
|
-
if (typeof prev === "string") {
|
|
4511
|
-
const newState = prevCursors.slice(0, -1);
|
|
4512
|
-
setPrevCursors(newState);
|
|
4513
|
-
setEndCursor(prev);
|
|
4514
4812
|
}
|
|
4515
|
-
|
|
4516
|
-
}
|
|
4517
|
-
|
|
4813
|
+
)))));
|
|
4814
|
+
}
|
|
4815
|
+
));
|
|
4518
4816
|
});
|
|
4519
4817
|
};
|
|
4520
4818
|
const SearchInput = ({
|
|
@@ -4532,112 +4830,119 @@ const SearchInput = ({
|
|
|
4532
4830
|
setSearchLoaded(true);
|
|
4533
4831
|
}
|
|
4534
4832
|
}, [loading]);
|
|
4535
|
-
return /* @__PURE__ */ React.createElement("form", {
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4833
|
+
return /* @__PURE__ */ React.createElement("form", { className: "flex flex-1 flex-col gap-2 items-start w-full" }, /* @__PURE__ */ React.createElement(
|
|
4834
|
+
"label",
|
|
4835
|
+
{
|
|
4836
|
+
htmlFor: "search",
|
|
4837
|
+
className: "block font-sans text-xs font-semibold text-gray-500 whitespace-normal"
|
|
4838
|
+
},
|
|
4839
|
+
"Search"
|
|
4840
|
+
), /* @__PURE__ */ React.createElement("div", { className: "flex flex-wrap items-center gap-3" }, /* @__PURE__ */ React.createElement("div", { className: "flex-1 min-w-[200px]" }, /* @__PURE__ */ React.createElement(
|
|
4841
|
+
Input,
|
|
4842
|
+
{
|
|
4843
|
+
type: "text",
|
|
4844
|
+
name: "search",
|
|
4845
|
+
placeholder: "Search",
|
|
4846
|
+
value: searchInput,
|
|
4847
|
+
onChange: (e) => {
|
|
4848
|
+
setSearchInput(e.target.value);
|
|
4849
|
+
}
|
|
4551
4850
|
}
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4851
|
+
)), /* @__PURE__ */ React.createElement("div", { className: "flex gap-3" }, /* @__PURE__ */ React.createElement(
|
|
4852
|
+
Button,
|
|
4853
|
+
{
|
|
4854
|
+
onClick: () => {
|
|
4855
|
+
setSearch(searchInput);
|
|
4856
|
+
setSearchLoaded(false);
|
|
4857
|
+
},
|
|
4858
|
+
variant: "primary",
|
|
4859
|
+
type: "submit"
|
|
4558
4860
|
},
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4861
|
+
"Search ",
|
|
4862
|
+
/* @__PURE__ */ React.createElement(BiSearch, { className: "w-5 h-full ml-1.5 opacity-70" })
|
|
4863
|
+
), search && searchLoaded && /* @__PURE__ */ React.createElement(
|
|
4864
|
+
Button,
|
|
4865
|
+
{
|
|
4866
|
+
onClick: () => {
|
|
4867
|
+
setSearch("");
|
|
4868
|
+
setSearchInput("");
|
|
4869
|
+
},
|
|
4870
|
+
variant: "white"
|
|
4567
4871
|
},
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
})))));
|
|
4872
|
+
"Clear ",
|
|
4873
|
+
/* @__PURE__ */ React.createElement(BiX, { className: "w-5 h-full ml-1 opacity-70" })
|
|
4874
|
+
))));
|
|
4572
4875
|
};
|
|
4573
4876
|
const Breadcrumb = ({ folder, navigate, collectionName }) => {
|
|
4574
4877
|
const folderArray = folder.name.split("/");
|
|
4575
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
onClick: () => {
|
|
4579
|
-
const folders = folder.fullyQualifiedName.split("/");
|
|
4580
|
-
navigate(`/${[
|
|
4581
|
-
"collections",
|
|
4582
|
-
collectionName,
|
|
4583
|
-
...folders.slice(0, folders.length - 1)
|
|
4584
|
-
].join("/")}`, { replace: true });
|
|
4585
|
-
},
|
|
4586
|
-
className: "px-3 py-2 bg-white hover:bg-gray-50/50 transition ease-out duration-100 border-r border-gray-100 text-blue-500 hover:text-blue-600"
|
|
4587
|
-
}, /* @__PURE__ */ React.createElement(BiArrowBack, {
|
|
4588
|
-
className: "w-6 h-full opacity-70"
|
|
4589
|
-
})), /* @__PURE__ */ React.createElement("span", {
|
|
4590
|
-
className: "px-3 py-2 text-gray-600 flex flex-wrap items-center justify-start gap-1"
|
|
4591
|
-
}, /* @__PURE__ */ React.createElement("button", {
|
|
4592
|
-
onClick: () => {
|
|
4593
|
-
navigate(`/collections/${collectionName}/~`, {
|
|
4594
|
-
replace: true
|
|
4595
|
-
});
|
|
4596
|
-
},
|
|
4597
|
-
className: "shrink-0 bg-transparent p-0 border-0 text-blue-400 hover:text-blue-500 transition-all ease-out duration-100 opacity-70 hover:opacity-100"
|
|
4598
|
-
}, /* @__PURE__ */ React.createElement(RiHome2Line, {
|
|
4599
|
-
className: "w-5 h-auto"
|
|
4600
|
-
})), folderArray.map((node, index) => {
|
|
4601
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", {
|
|
4602
|
-
className: "text-gray-200 shrink-0"
|
|
4603
|
-
}, "/"), index < folderArray.length - 1 ? /* @__PURE__ */ React.createElement("button", {
|
|
4604
|
-
className: "bg-transparent whitespace-nowrap truncate p-0 border-0 text-blue-500 hover:text-blue-600 transition-all ease-out duration-100 underline underline-offset-2 decoration-1 decoration-blue-200 hover:decoration-blue-400",
|
|
4878
|
+
return /* @__PURE__ */ React.createElement("div", { className: "w-full bg-gray-50/30 flex items-stretch" }, /* @__PURE__ */ React.createElement(
|
|
4879
|
+
"button",
|
|
4880
|
+
{
|
|
4605
4881
|
onClick: () => {
|
|
4606
4882
|
const folders = folder.fullyQualifiedName.split("/");
|
|
4607
|
-
navigate(
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4883
|
+
navigate(
|
|
4884
|
+
`/${[
|
|
4885
|
+
"collections",
|
|
4886
|
+
collectionName,
|
|
4887
|
+
...folders.slice(0, folders.length - 1)
|
|
4888
|
+
].join("/")}`,
|
|
4889
|
+
{ replace: true }
|
|
4890
|
+
);
|
|
4891
|
+
},
|
|
4892
|
+
className: "px-3 py-2 bg-white hover:bg-gray-50/50 transition ease-out duration-100 border-r border-gray-100 text-blue-500 hover:text-blue-600"
|
|
4893
|
+
},
|
|
4894
|
+
/* @__PURE__ */ React.createElement(BiArrowBack, { className: "w-6 h-full opacity-70" })
|
|
4895
|
+
), /* @__PURE__ */ React.createElement("span", { className: "px-3 py-2 text-gray-600 flex flex-wrap items-center justify-start gap-1" }, /* @__PURE__ */ React.createElement(
|
|
4896
|
+
"button",
|
|
4897
|
+
{
|
|
4898
|
+
onClick: () => {
|
|
4899
|
+
navigate(`/collections/${collectionName}/~`, {
|
|
4900
|
+
replace: true
|
|
4901
|
+
});
|
|
4902
|
+
},
|
|
4903
|
+
className: "shrink-0 bg-transparent p-0 border-0 text-blue-400 hover:text-blue-500 transition-all ease-out duration-100 opacity-70 hover:opacity-100"
|
|
4904
|
+
},
|
|
4905
|
+
/* @__PURE__ */ React.createElement(RiHome2Line, { className: "w-5 h-auto" })
|
|
4906
|
+
), folderArray.map((node, index) => {
|
|
4907
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", { className: "text-gray-200 shrink-0" }, "/"), index < folderArray.length - 1 ? /* @__PURE__ */ React.createElement(
|
|
4908
|
+
"button",
|
|
4909
|
+
{
|
|
4910
|
+
className: "bg-transparent whitespace-nowrap truncate p-0 border-0 text-blue-500 hover:text-blue-600 transition-all ease-out duration-100 underline underline-offset-2 decoration-1 decoration-blue-200 hover:decoration-blue-400",
|
|
4911
|
+
onClick: () => {
|
|
4912
|
+
const folders = folder.fullyQualifiedName.split("/");
|
|
4913
|
+
navigate(
|
|
4914
|
+
`/${[
|
|
4915
|
+
"collections",
|
|
4916
|
+
collectionName,
|
|
4917
|
+
...folders.slice(
|
|
4918
|
+
0,
|
|
4919
|
+
folders.length - (folders.length - (index + 2))
|
|
4920
|
+
)
|
|
4921
|
+
].join("/")}`,
|
|
4922
|
+
{ replace: true }
|
|
4923
|
+
);
|
|
4924
|
+
}
|
|
4925
|
+
},
|
|
4926
|
+
node
|
|
4927
|
+
) : /* @__PURE__ */ React.createElement("span", { className: "whitespace-nowrap truncate" }, node));
|
|
4616
4928
|
})));
|
|
4617
4929
|
};
|
|
4618
4930
|
const NoDocumentsPlaceholder = () => {
|
|
4619
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
4620
|
-
className: "text-center px-5 py-3 flex flex-col items-center justify-center shadow border border-gray-100 bg-gray-50 border-b border-gray-200 w-full max-w-full rounded-lg"
|
|
4621
|
-
}, /* @__PURE__ */ React.createElement("p", {
|
|
4622
|
-
className: "text-base italic font-medium text-gray-300"
|
|
4623
|
-
}, "No documents found."));
|
|
4931
|
+
return /* @__PURE__ */ React.createElement("div", { className: "text-center px-5 py-3 flex flex-col items-center justify-center shadow border border-gray-100 bg-gray-50 border-b border-gray-200 w-full max-w-full rounded-lg" }, /* @__PURE__ */ React.createElement("p", { className: "text-base italic font-medium text-gray-300" }, "No documents found."));
|
|
4624
4932
|
};
|
|
4625
4933
|
const DeleteModal = ({ close: close2, deleteFunc, filename }) => {
|
|
4626
|
-
return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, {
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
close2();
|
|
4639
|
-
}
|
|
4640
|
-
}, "Delete"))));
|
|
4934
|
+
return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, { close: close2 }, "Delete ", filename), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement("p", null, `Are you sure you want to delete ${filename}?`)), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(Button, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React.createElement(
|
|
4935
|
+
Button,
|
|
4936
|
+
{
|
|
4937
|
+
style: { flexGrow: 3 },
|
|
4938
|
+
variant: "danger",
|
|
4939
|
+
onClick: async () => {
|
|
4940
|
+
await deleteFunc();
|
|
4941
|
+
close2();
|
|
4942
|
+
}
|
|
4943
|
+
},
|
|
4944
|
+
"Delete"
|
|
4945
|
+
))));
|
|
4641
4946
|
};
|
|
4642
4947
|
const RenameModal = ({
|
|
4643
4948
|
close: close2,
|
|
@@ -4646,27 +4951,25 @@ const RenameModal = ({
|
|
|
4646
4951
|
newRelativePath,
|
|
4647
4952
|
setNewRelativePath
|
|
4648
4953
|
}) => {
|
|
4649
|
-
return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, {
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
}, "Are you sure you want to rename ", /* @__PURE__ */ React.createElement("strong", null, filename), "? TinaCMS uses the filename as the ID; renaming this file could result in unresolved references."), /* @__PURE__ */ React.createElement(BaseTextField, {
|
|
4656
|
-
placeholder: "Enter a new name for the document's file",
|
|
4657
|
-
value: newRelativePath,
|
|
4658
|
-
onChange: (event) => setNewRelativePath(event.target.value)
|
|
4659
|
-
}))), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(Button, {
|
|
4660
|
-
style: { flexGrow: 2 },
|
|
4661
|
-
onClick: close2
|
|
4662
|
-
}, "Cancel"), /* @__PURE__ */ React.createElement(Button, {
|
|
4663
|
-
style: { flexGrow: 3 },
|
|
4664
|
-
variant: "primary",
|
|
4665
|
-
onClick: async () => {
|
|
4666
|
-
await renameFunc();
|
|
4667
|
-
close2();
|
|
4954
|
+
return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, { close: close2 }, "Rename ", filename), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", { className: "mb-4" }, "Are you sure you want to rename ", /* @__PURE__ */ React.createElement("strong", null, filename), "? TinaCMS uses the filename as the ID; renaming this file could result in unresolved references."), /* @__PURE__ */ React.createElement(
|
|
4955
|
+
BaseTextField,
|
|
4956
|
+
{
|
|
4957
|
+
placeholder: "Enter a new name for the document's file",
|
|
4958
|
+
value: newRelativePath,
|
|
4959
|
+
onChange: (event) => setNewRelativePath(event.target.value)
|
|
4668
4960
|
}
|
|
4669
|
-
}, "
|
|
4961
|
+
))), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(Button, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React.createElement(
|
|
4962
|
+
Button,
|
|
4963
|
+
{
|
|
4964
|
+
style: { flexGrow: 3 },
|
|
4965
|
+
variant: "primary",
|
|
4966
|
+
onClick: async () => {
|
|
4967
|
+
await renameFunc();
|
|
4968
|
+
close2();
|
|
4969
|
+
}
|
|
4970
|
+
},
|
|
4971
|
+
"Rename"
|
|
4972
|
+
))));
|
|
4670
4973
|
};
|
|
4671
4974
|
function FaLock(props) {
|
|
4672
4975
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 448 512" }, "child": [{ "tag": "path", "attr": { "d": "M400 224h-24v-72C376 68.2 307.8 0 224 0S72 68.2 72 152v72H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48zm-104 0H152v-72c0-39.7 32.3-72 72-72s72 32.3 72 72v72z" } }] })(props);
|
|
@@ -4695,42 +4998,64 @@ const createDocument = async (cms, collection, template, mutationInfo, folder, v
|
|
|
4695
4998
|
const CollectionCreatePage = () => {
|
|
4696
4999
|
const folder = useCollectionFolder();
|
|
4697
5000
|
const { collectionName, templateName } = useParams();
|
|
4698
|
-
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => /* @__PURE__ */ React.createElement(
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
folder,
|
|
4702
|
-
includeDocuments: false
|
|
4703
|
-
}, (collection) => {
|
|
4704
|
-
const mutationInfo = {
|
|
4705
|
-
includeCollection: true,
|
|
4706
|
-
includeTemplate: !!collection.templates
|
|
4707
|
-
};
|
|
4708
|
-
return /* @__PURE__ */ React.createElement(RenderForm$1, {
|
|
5001
|
+
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => /* @__PURE__ */ React.createElement(
|
|
5002
|
+
GetCollection,
|
|
5003
|
+
{
|
|
4709
5004
|
cms,
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
5005
|
+
collectionName,
|
|
5006
|
+
folder,
|
|
5007
|
+
includeDocuments: false
|
|
5008
|
+
},
|
|
5009
|
+
(collection) => {
|
|
5010
|
+
const mutationInfo = {
|
|
5011
|
+
includeCollection: true,
|
|
5012
|
+
includeTemplate: !!collection.templates
|
|
5013
|
+
};
|
|
5014
|
+
return /* @__PURE__ */ React.createElement(
|
|
5015
|
+
RenderForm$1,
|
|
5016
|
+
{
|
|
5017
|
+
cms,
|
|
5018
|
+
collection,
|
|
5019
|
+
templateName,
|
|
5020
|
+
mutationInfo,
|
|
5021
|
+
folder
|
|
5022
|
+
}
|
|
5023
|
+
);
|
|
5024
|
+
}
|
|
5025
|
+
));
|
|
4716
5026
|
};
|
|
4717
5027
|
const FilenameInput = (props) => {
|
|
4718
5028
|
const [filenameTouched, setFilenameTouched] = React.useState(false);
|
|
4719
|
-
return /* @__PURE__ */ React.createElement(
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
5029
|
+
return /* @__PURE__ */ React.createElement(
|
|
5030
|
+
"div",
|
|
5031
|
+
{
|
|
5032
|
+
className: "group relative block cursor-pointer",
|
|
5033
|
+
onClick: () => {
|
|
5034
|
+
setFilenameTouched(true);
|
|
5035
|
+
}
|
|
5036
|
+
},
|
|
5037
|
+
/* @__PURE__ */ React.createElement(
|
|
5038
|
+
"input",
|
|
5039
|
+
{
|
|
5040
|
+
type: "text",
|
|
5041
|
+
className: `shadow-inner focus:shadow-outline focus:border-blue-500 focus:outline-none block text-base pr-3 truncate py-2 w-full border transition-all ease-out duration-150 focus:text-gray-900 rounded-md ${props.readonly || !filenameTouched ? "bg-gray-50 text-gray-300 border-gray-150 pointer-events-none pl-8 group-hover:bg-white group-hover:text-gray-600 group-hover:border-gray-200" : "bg-white text-gray-600 border-gray-200 pl-3"}`,
|
|
5042
|
+
...props,
|
|
5043
|
+
disabled: props.readonly || !filenameTouched
|
|
5044
|
+
}
|
|
5045
|
+
),
|
|
5046
|
+
/* @__PURE__ */ React.createElement(
|
|
5047
|
+
FaLock,
|
|
5048
|
+
{
|
|
5049
|
+
className: `text-gray-400 absolute top-1/2 left-2 -translate-y-1/2 pointer-events-none h-5 w-auto transition-opacity duration-150 ease-out ${!filenameTouched && !props.readonly ? "opacity-20 group-hover:opacity-0 group-active:opacity-0" : "opacity-0"}`
|
|
5050
|
+
}
|
|
5051
|
+
),
|
|
5052
|
+
/* @__PURE__ */ React.createElement(
|
|
5053
|
+
FaUnlock,
|
|
5054
|
+
{
|
|
5055
|
+
className: `text-blue-500 absolute top-1/2 left-2 -translate-y-1/2 pointer-events-none h-5 w-auto transition-opacity duration-150 ease-out ${!filenameTouched && !props.readonly ? "opacity-0 group-hover:opacity-80 group-active:opacity-80" : "opacity-0"}`
|
|
5056
|
+
}
|
|
5057
|
+
)
|
|
5058
|
+
);
|
|
4734
5059
|
};
|
|
4735
5060
|
const RenderForm$1 = ({
|
|
4736
5061
|
cms,
|
|
@@ -4757,7 +5082,9 @@ const RenderForm$1 = ({
|
|
|
4757
5082
|
});
|
|
4758
5083
|
let slugFunction = (_b = (_a = schemaCollection.ui) == null ? void 0 : _a.filename) == null ? void 0 : _b.slugify;
|
|
4759
5084
|
if (!slugFunction) {
|
|
4760
|
-
const titleField = (_c = template == null ? void 0 : template.fields.find(
|
|
5085
|
+
const titleField = (_c = template == null ? void 0 : template.fields.find(
|
|
5086
|
+
(x) => x.required && x.type === "string" && x.isTitle
|
|
5087
|
+
)) == null ? void 0 : _c.name;
|
|
4761
5088
|
if (titleField) {
|
|
4762
5089
|
slugFunction = (values) => {
|
|
4763
5090
|
var _a2;
|
|
@@ -4765,7 +5092,9 @@ const RenderForm$1 = ({
|
|
|
4765
5092
|
};
|
|
4766
5093
|
}
|
|
4767
5094
|
}
|
|
4768
|
-
const defaultItem = customDefaults ||
|
|
5095
|
+
const defaultItem = customDefaults || // @ts-ignore internal types aren't up to date
|
|
5096
|
+
((_d = template.ui) == null ? void 0 : _d.defaultItem) || // @ts-ignore
|
|
5097
|
+
(template == null ? void 0 : template.defaultItem);
|
|
4769
5098
|
const form = useMemo(() => {
|
|
4770
5099
|
var _a2, _b2;
|
|
4771
5100
|
const folderName = folder.fullyQualifiedName ? folder.name : "";
|
|
@@ -4792,10 +5121,13 @@ const RenderForm$1 = ({
|
|
|
4792
5121
|
label: "Filename",
|
|
4793
5122
|
component: slugFunction ? wrapFieldsWithMeta(({ field, input, meta }) => {
|
|
4794
5123
|
var _a3, _b3;
|
|
4795
|
-
return /* @__PURE__ */ React.createElement(
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
5124
|
+
return /* @__PURE__ */ React.createElement(
|
|
5125
|
+
FilenameInput,
|
|
5126
|
+
{
|
|
5127
|
+
readonly: (_b3 = (_a3 = schemaCollection == null ? void 0 : schemaCollection.ui) == null ? void 0 : _a3.filename) == null ? void 0 : _b3.readonly,
|
|
5128
|
+
...input
|
|
5129
|
+
}
|
|
5130
|
+
);
|
|
4799
5131
|
}) : "text",
|
|
4800
5132
|
disabled: (_b2 = (_a2 = schemaCollection == null ? void 0 : schemaCollection.ui) == null ? void 0 : _a2.filename) == null ? void 0 : _b2.readonly,
|
|
4801
5133
|
description: /* @__PURE__ */ React.createElement("span", null, "A unique filename for the content.", /* @__PURE__ */ React.createElement("br", null), "Examples: ", /* @__PURE__ */ React.createElement("code", null, "My_Document"), ", ", /* @__PURE__ */ React.createElement("code", null, "My_Document.en"), ",", " ", /* @__PURE__ */ React.createElement("code", null, "sub-folder/My_Document")),
|
|
@@ -4813,7 +5145,9 @@ const RenderForm$1 = ({
|
|
|
4813
5145
|
return "Must begin with a-z, A-Z, 0-9, or _ and contain only a-z, A-Z, 0-9, -, _, ., or /.";
|
|
4814
5146
|
}
|
|
4815
5147
|
if (((_a3 = schemaCollection.match) == null ? void 0 : _a3.exclude) || ((_b3 = schemaCollection.match) == null ? void 0 : _b3.include)) {
|
|
4816
|
-
const filePath = `${normalizePath(
|
|
5148
|
+
const filePath = `${normalizePath(
|
|
5149
|
+
schemaCollection.path
|
|
5150
|
+
)}/${value}.${schemaCollection.format || "md"}`;
|
|
4817
5151
|
const match = schema.matchFiles({
|
|
4818
5152
|
files: [filePath],
|
|
4819
5153
|
collection: schemaCollection
|
|
@@ -4828,20 +5162,33 @@ const RenderForm$1 = ({
|
|
|
4828
5162
|
onSubmit: async (values) => {
|
|
4829
5163
|
try {
|
|
4830
5164
|
const folderName2 = folder.fullyQualifiedName ? folder.name : "";
|
|
4831
|
-
await createDocument(
|
|
5165
|
+
await createDocument(
|
|
5166
|
+
cms,
|
|
5167
|
+
collection,
|
|
5168
|
+
template,
|
|
5169
|
+
mutationInfo,
|
|
5170
|
+
folderName2,
|
|
5171
|
+
values
|
|
5172
|
+
);
|
|
4832
5173
|
cms.alerts.success("Document created!");
|
|
4833
5174
|
setTimeout(() => {
|
|
4834
|
-
navigate(
|
|
5175
|
+
navigate(
|
|
5176
|
+
`/collections/${collection.name}${folder.fullyQualifiedName ? `/${folder.fullyQualifiedName}` : ""}`
|
|
5177
|
+
);
|
|
4835
5178
|
}, 10);
|
|
4836
5179
|
} catch (error) {
|
|
4837
5180
|
console.error(error);
|
|
4838
5181
|
const defaultErrorText = "There was a problem saving your document.";
|
|
4839
5182
|
if (error.message.includes("already exists")) {
|
|
4840
|
-
cms.alerts.error(
|
|
5183
|
+
cms.alerts.error(
|
|
5184
|
+
`${defaultErrorText} The "Filename" is alredy used for another document, please modify it.`
|
|
5185
|
+
);
|
|
4841
5186
|
} else {
|
|
4842
5187
|
cms.alerts.error(defaultErrorText);
|
|
4843
5188
|
}
|
|
4844
|
-
throw new Error(
|
|
5189
|
+
throw new Error(
|
|
5190
|
+
`[${error.name}] CreateDocument failed: ${error.message}`
|
|
5191
|
+
);
|
|
4845
5192
|
}
|
|
4846
5193
|
}
|
|
4847
5194
|
});
|
|
@@ -4861,24 +5208,23 @@ const RenderForm$1 = ({
|
|
|
4861
5208
|
if (!cms.state.activeFormId) {
|
|
4862
5209
|
return null;
|
|
4863
5210
|
}
|
|
4864
|
-
const activeForm = cms.state.forms.find(
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
})));
|
|
5211
|
+
const activeForm = cms.state.forms.find(
|
|
5212
|
+
({ tinaForm }) => tinaForm.id === form.id
|
|
5213
|
+
);
|
|
5214
|
+
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, ((_f = (_e = cms == null ? void 0 : cms.api) == null ? void 0 : _e.tina) == null ? void 0 : _f.isLocalMode) ? /* @__PURE__ */ React.createElement(LocalWarning, null) : /* @__PURE__ */ React.createElement(BillingWarning, null), /* @__PURE__ */ React.createElement(
|
|
5215
|
+
"div",
|
|
5216
|
+
{
|
|
5217
|
+
className: `pt-3 pb-4 border-b border-gray-200 bg-white w-full grow-0 shrink basis-0 flex justify-center ${headerPadding}`
|
|
5218
|
+
},
|
|
5219
|
+
/* @__PURE__ */ React.createElement("div", { className: "w-full max-w-form flex gap-1.5 justify-between items-center" }, /* @__PURE__ */ React.createElement(
|
|
5220
|
+
Link,
|
|
5221
|
+
{
|
|
5222
|
+
to: `/collections/${collection.name}${folder.fullyQualifiedName ? `/${folder.fullyQualifiedName}` : ""}`,
|
|
5223
|
+
className: "flex-0 text-blue-500 hover:text-blue-400 hover:underline underline decoration-blue-200 hover:decoration-blue-400 text-sm leading-tight whitespace-nowrap truncate transition-all duration-150 ease-out"
|
|
5224
|
+
},
|
|
5225
|
+
collection.label ? collection.label : collection.name
|
|
5226
|
+
), /* @__PURE__ */ React.createElement("span", { className: "opacity-30 text-sm leading-tight whitespace-nowrap flex-0" }, "/"), /* @__PURE__ */ React.createElement("span", { className: "flex-1 w-full text-sm leading-tight whitespace-nowrap truncate" }, "Create New"), /* @__PURE__ */ React.createElement(FormStatus, { pristine: formIsPristine }))
|
|
5227
|
+
), activeForm && /* @__PURE__ */ React.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine })));
|
|
4882
5228
|
};
|
|
4883
5229
|
const useGetDocument = (cms, collectionName, relativePath2) => {
|
|
4884
5230
|
const api = new TinaAdminApi(cms);
|
|
@@ -4892,7 +5238,9 @@ const useGetDocument = (cms, collectionName, relativePath2) => {
|
|
|
4892
5238
|
const response = await api.fetchDocument(collectionName, relativePath2);
|
|
4893
5239
|
setDocument(response.document);
|
|
4894
5240
|
} catch (error2) {
|
|
4895
|
-
cms.alerts.error(
|
|
5241
|
+
cms.alerts.error(
|
|
5242
|
+
`[${error2.name}] GetDocument failed: ${error2.message}`
|
|
5243
|
+
);
|
|
4896
5244
|
console.error(error2);
|
|
4897
5245
|
setDocument(void 0);
|
|
4898
5246
|
setError(error2);
|
|
@@ -4911,7 +5259,11 @@ const GetDocument = ({
|
|
|
4911
5259
|
relativePath: relativePath2,
|
|
4912
5260
|
children
|
|
4913
5261
|
}) => {
|
|
4914
|
-
const { document, loading, error } = useGetDocument(
|
|
5262
|
+
const { document, loading, error } = useGetDocument(
|
|
5263
|
+
cms,
|
|
5264
|
+
collectionName,
|
|
5265
|
+
relativePath2
|
|
5266
|
+
);
|
|
4915
5267
|
if (error) {
|
|
4916
5268
|
return /* @__PURE__ */ React.createElement(FullscreenError, null);
|
|
4917
5269
|
}
|
|
@@ -4924,33 +5276,44 @@ const CollectionDuplicatePage = () => {
|
|
|
4924
5276
|
const folder = useCollectionFolder();
|
|
4925
5277
|
const { collectionName, ...rest } = useParams();
|
|
4926
5278
|
const { "*": filename } = rest;
|
|
4927
|
-
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => /* @__PURE__ */ React.createElement(
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
folder,
|
|
4931
|
-
includeDocuments: false
|
|
4932
|
-
}, (collection) => {
|
|
4933
|
-
const relativePath2 = `${filename.startsWith("~/") ? filename.substring(2) : filename}.${collection.format}`;
|
|
4934
|
-
const mutationInfo = {
|
|
4935
|
-
includeCollection: true,
|
|
4936
|
-
includeTemplate: !!collection.templates
|
|
4937
|
-
};
|
|
4938
|
-
return /* @__PURE__ */ React.createElement(GetDocument, {
|
|
5279
|
+
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => /* @__PURE__ */ React.createElement(
|
|
5280
|
+
GetCollection,
|
|
5281
|
+
{
|
|
4939
5282
|
cms,
|
|
4940
|
-
collectionName
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
5283
|
+
collectionName,
|
|
5284
|
+
folder,
|
|
5285
|
+
includeDocuments: false
|
|
5286
|
+
},
|
|
5287
|
+
(collection) => {
|
|
5288
|
+
const relativePath2 = `${filename.startsWith("~/") ? filename.substring(2) : filename}.${collection.format}`;
|
|
5289
|
+
const mutationInfo = {
|
|
5290
|
+
includeCollection: true,
|
|
5291
|
+
includeTemplate: !!collection.templates
|
|
5292
|
+
};
|
|
5293
|
+
return /* @__PURE__ */ React.createElement(
|
|
5294
|
+
GetDocument,
|
|
5295
|
+
{
|
|
5296
|
+
cms,
|
|
5297
|
+
collectionName: collection.name,
|
|
5298
|
+
relativePath: relativePath2
|
|
5299
|
+
},
|
|
5300
|
+
(document) => {
|
|
5301
|
+
var _a;
|
|
5302
|
+
return /* @__PURE__ */ React.createElement(
|
|
5303
|
+
RenderForm$1,
|
|
5304
|
+
{
|
|
5305
|
+
cms,
|
|
5306
|
+
collection,
|
|
5307
|
+
templateName: (_a = document._values) == null ? void 0 : _a._template,
|
|
5308
|
+
folder: parentFolder(folder),
|
|
5309
|
+
mutationInfo,
|
|
5310
|
+
customDefaults: document._values
|
|
5311
|
+
}
|
|
5312
|
+
);
|
|
5313
|
+
}
|
|
5314
|
+
);
|
|
5315
|
+
}
|
|
5316
|
+
));
|
|
4954
5317
|
};
|
|
4955
5318
|
const updateDocument = async (cms, relativePath2, collection, mutationInfo, values) => {
|
|
4956
5319
|
const api = new TinaAdminApi(cms);
|
|
@@ -4969,30 +5332,41 @@ const CollectionUpdatePage = () => {
|
|
|
4969
5332
|
const folder = useCollectionFolder();
|
|
4970
5333
|
const { "*": filename } = rest;
|
|
4971
5334
|
const resolvedFile = folder.fullyQualifiedName ? folder.name : filename;
|
|
4972
|
-
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => /* @__PURE__ */ React.createElement(
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
folder,
|
|
4976
|
-
includeDocuments: false
|
|
4977
|
-
}, (collection) => {
|
|
4978
|
-
const relativePath2 = `${resolvedFile}.${collection.format}`;
|
|
4979
|
-
const mutationInfo = {
|
|
4980
|
-
includeCollection: true,
|
|
4981
|
-
includeTemplate: !!collection.templates
|
|
4982
|
-
};
|
|
4983
|
-
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(GetDocument, {
|
|
4984
|
-
cms,
|
|
4985
|
-
collectionName: collection.name,
|
|
4986
|
-
relativePath: relativePath2
|
|
4987
|
-
}, (document) => /* @__PURE__ */ React.createElement(RenderForm, {
|
|
5335
|
+
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => /* @__PURE__ */ React.createElement(
|
|
5336
|
+
GetCollection,
|
|
5337
|
+
{
|
|
4988
5338
|
cms,
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
5339
|
+
collectionName,
|
|
5340
|
+
folder,
|
|
5341
|
+
includeDocuments: false
|
|
5342
|
+
},
|
|
5343
|
+
(collection) => {
|
|
5344
|
+
const relativePath2 = `${resolvedFile}.${collection.format}`;
|
|
5345
|
+
const mutationInfo = {
|
|
5346
|
+
includeCollection: true,
|
|
5347
|
+
includeTemplate: !!collection.templates
|
|
5348
|
+
};
|
|
5349
|
+
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(
|
|
5350
|
+
GetDocument,
|
|
5351
|
+
{
|
|
5352
|
+
cms,
|
|
5353
|
+
collectionName: collection.name,
|
|
5354
|
+
relativePath: relativePath2
|
|
5355
|
+
},
|
|
5356
|
+
(document) => /* @__PURE__ */ React.createElement(
|
|
5357
|
+
RenderForm,
|
|
5358
|
+
{
|
|
5359
|
+
cms,
|
|
5360
|
+
document,
|
|
5361
|
+
filename: resolvedFile,
|
|
5362
|
+
relativePath: relativePath2,
|
|
5363
|
+
collection,
|
|
5364
|
+
mutationInfo
|
|
5365
|
+
}
|
|
5366
|
+
)
|
|
5367
|
+
));
|
|
5368
|
+
}
|
|
5369
|
+
));
|
|
4996
5370
|
};
|
|
4997
5371
|
const RenderForm = ({
|
|
4998
5372
|
cms,
|
|
@@ -5019,17 +5393,26 @@ const RenderForm = ({
|
|
|
5019
5393
|
});
|
|
5020
5394
|
const form = useMemo(() => {
|
|
5021
5395
|
return new Form({
|
|
5396
|
+
// id is the full document path
|
|
5022
5397
|
id: `${schemaCollection.path}/${relativePath2}`,
|
|
5023
5398
|
label: "form",
|
|
5024
5399
|
fields: formInfo.fields,
|
|
5025
5400
|
initialValues: document._values,
|
|
5026
5401
|
onSubmit: async (values) => {
|
|
5027
5402
|
try {
|
|
5028
|
-
await updateDocument(
|
|
5403
|
+
await updateDocument(
|
|
5404
|
+
cms,
|
|
5405
|
+
relativePath2,
|
|
5406
|
+
collection,
|
|
5407
|
+
mutationInfo,
|
|
5408
|
+
values
|
|
5409
|
+
);
|
|
5029
5410
|
cms.alerts.success("Document updated!");
|
|
5030
5411
|
} catch (error) {
|
|
5031
5412
|
console.error(error);
|
|
5032
|
-
throw new Error(
|
|
5413
|
+
throw new Error(
|
|
5414
|
+
`[${error.name}] UpdateDocument failed: ${error.message}`
|
|
5415
|
+
);
|
|
5033
5416
|
}
|
|
5034
5417
|
}
|
|
5035
5418
|
});
|
|
@@ -5049,24 +5432,23 @@ const RenderForm = ({
|
|
|
5049
5432
|
if (!cms.state.activeFormId) {
|
|
5050
5433
|
return null;
|
|
5051
5434
|
}
|
|
5052
|
-
const activeForm = cms.state.forms.find(
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
}));
|
|
5435
|
+
const activeForm = cms.state.forms.find(
|
|
5436
|
+
({ tinaForm }) => tinaForm.id === form.id
|
|
5437
|
+
);
|
|
5438
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, ((_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode) ? /* @__PURE__ */ React.createElement(LocalWarning, null) : /* @__PURE__ */ React.createElement(BillingWarning, null), /* @__PURE__ */ React.createElement(
|
|
5439
|
+
"div",
|
|
5440
|
+
{
|
|
5441
|
+
className: `pt-3 pb-4 border-b border-gray-200 bg-white w-full grow-0 shrink basis-0 flex justify-center ${headerPadding}`
|
|
5442
|
+
},
|
|
5443
|
+
/* @__PURE__ */ React.createElement("div", { className: "w-full max-w-form flex gap-1.5 justify-between items-center" }, /* @__PURE__ */ React.createElement(
|
|
5444
|
+
Link,
|
|
5445
|
+
{
|
|
5446
|
+
to: `/collections/${collection.name}/~${parentFolder2}`,
|
|
5447
|
+
className: "flex-0 text-blue-500 hover:text-blue-400 hover:underline underline decoration-blue-200 hover:decoration-blue-400 text-sm leading-tight whitespace-nowrap truncate transition-all duration-150 ease-out"
|
|
5448
|
+
},
|
|
5449
|
+
collection.label ? collection.label : collection.name
|
|
5450
|
+
), /* @__PURE__ */ React.createElement("span", { className: "opacity-30 text-sm leading-tight whitespace-nowrap flex-0" }, "/"), /* @__PURE__ */ React.createElement("span", { className: "flex-1 w-full text-sm leading-tight whitespace-nowrap truncate" }, `${filename}.${collection.format}`), /* @__PURE__ */ React.createElement(FormStatus, { pristine: formIsPristine }))
|
|
5451
|
+
), activeForm && /* @__PURE__ */ React.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine }));
|
|
5070
5452
|
};
|
|
5071
5453
|
const ScreenPage = () => {
|
|
5072
5454
|
const { screenName } = useParams();
|
|
@@ -5076,17 +5458,11 @@ const ScreenPage = () => {
|
|
|
5076
5458
|
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => {
|
|
5077
5459
|
var _a, _b;
|
|
5078
5460
|
const screens = cms.plugins.getType("screen").all();
|
|
5079
|
-
const selectedScreen = screens.find(
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
}, ((_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode) ? /* @__PURE__ */ React.createElement(LocalWarning, null) : /* @__PURE__ */ React.createElement(BillingWarning, null), renderNavToggle && /* @__PURE__ */ React.createElement("div", {
|
|
5083
|
-
|
|
5084
|
-
}, selectedScreen.name), /* @__PURE__ */ React.createElement("div", {
|
|
5085
|
-
className: "flex-1 overflow-y-auto relative flex flex-col items-stretch justify-between"
|
|
5086
|
-
}, /* @__PURE__ */ React.createElement(selectedScreen.Component, {
|
|
5087
|
-
close: () => {
|
|
5088
|
-
}
|
|
5089
|
-
})));
|
|
5461
|
+
const selectedScreen = screens.find(
|
|
5462
|
+
({ name }) => slugify(name) === screenName
|
|
5463
|
+
);
|
|
5464
|
+
return /* @__PURE__ */ React.createElement("div", { className: "relative w-full h-full flex flex-col items-stretch justify-between" }, ((_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode) ? /* @__PURE__ */ React.createElement(LocalWarning, null) : /* @__PURE__ */ React.createElement(BillingWarning, null), renderNavToggle && /* @__PURE__ */ React.createElement("div", { className: `py-5 border-b border-gray-200 bg-white pl-18` }, selectedScreen.name), /* @__PURE__ */ React.createElement("div", { className: "flex-1 overflow-y-auto relative flex flex-col items-stretch justify-between" }, /* @__PURE__ */ React.createElement(selectedScreen.Component, { close: () => {
|
|
5465
|
+
} })));
|
|
5090
5466
|
});
|
|
5091
5467
|
};
|
|
5092
5468
|
const IndexingPage = () => {
|
|
@@ -5095,14 +5471,22 @@ const IndexingPage = () => {
|
|
|
5095
5471
|
const currentBranch = tinaApi.branch;
|
|
5096
5472
|
const kind = localStorage == null ? void 0 : localStorage.getItem("tina.createBranchState.kind");
|
|
5097
5473
|
const { setCurrentBranch } = useBranchData();
|
|
5098
|
-
const [state, setState] = React.useState(
|
|
5474
|
+
const [state, setState] = React.useState(
|
|
5475
|
+
localStorage == null ? void 0 : localStorage.getItem("tina.createBranchState")
|
|
5476
|
+
);
|
|
5099
5477
|
const [errorMessage, setErrorMessage] = React.useState("");
|
|
5100
|
-
const [baseBranch, setBaseBranch] = React.useState(
|
|
5478
|
+
const [baseBranch, setBaseBranch] = React.useState(
|
|
5479
|
+
localStorage == null ? void 0 : localStorage.getItem("tina.createBranchState.baseBranch")
|
|
5480
|
+
);
|
|
5101
5481
|
const [searchParams] = useSearchParams();
|
|
5102
5482
|
const back = localStorage == null ? void 0 : localStorage.getItem("tina.createBranchState.back");
|
|
5103
5483
|
const fullPath = localStorage == null ? void 0 : localStorage.getItem("tina.createBranchState.fullPath");
|
|
5104
|
-
const values = JSON.parse(
|
|
5105
|
-
|
|
5484
|
+
const values = JSON.parse(
|
|
5485
|
+
localStorage == null ? void 0 : localStorage.getItem("tina.createBranchState.values")
|
|
5486
|
+
);
|
|
5487
|
+
const [branch, setBranch] = React.useState(
|
|
5488
|
+
"tina/" + searchParams.get("branch")
|
|
5489
|
+
);
|
|
5106
5490
|
useEffect(() => {
|
|
5107
5491
|
const run = async () => {
|
|
5108
5492
|
if (state === "starting") {
|
|
@@ -5122,14 +5506,18 @@ const IndexingPage = () => {
|
|
|
5122
5506
|
} catch (e) {
|
|
5123
5507
|
console.error(e);
|
|
5124
5508
|
cms.alerts.error("Branch creation failed: " + e.message);
|
|
5125
|
-
setErrorMessage(
|
|
5509
|
+
setErrorMessage(
|
|
5510
|
+
"Branch creation failed, please try again. By refreshing the page."
|
|
5511
|
+
);
|
|
5126
5512
|
setState("error");
|
|
5127
5513
|
}
|
|
5128
5514
|
}
|
|
5129
5515
|
if (state === "indexing") {
|
|
5130
5516
|
try {
|
|
5131
5517
|
const [
|
|
5518
|
+
// When this promise resolves, we know the index status is no longer 'inprogress' or 'unknown'
|
|
5132
5519
|
waitForIndexStatusPromise,
|
|
5520
|
+
// Calling this function will cancel the polling
|
|
5133
5521
|
_cancelWaitForIndexFunc
|
|
5134
5522
|
] = tinaApi.waitForIndexStatus({
|
|
5135
5523
|
ref: branch
|
|
@@ -5140,14 +5528,19 @@ const IndexingPage = () => {
|
|
|
5140
5528
|
setState("submitting");
|
|
5141
5529
|
} catch {
|
|
5142
5530
|
cms.alerts.error("Branch indexing failed.");
|
|
5143
|
-
setErrorMessage(
|
|
5531
|
+
setErrorMessage(
|
|
5532
|
+
'Branch indexing failed, please check the Tina Cloud dashboard for more information. To try again chick "re-index" on the branch in the dashboard.'
|
|
5533
|
+
);
|
|
5144
5534
|
setState("error");
|
|
5145
5535
|
}
|
|
5146
5536
|
}
|
|
5147
5537
|
if (state === "submitting") {
|
|
5148
5538
|
try {
|
|
5149
5539
|
setBaseBranch(tinaApi.branch);
|
|
5150
|
-
localStorage.setItem(
|
|
5540
|
+
localStorage.setItem(
|
|
5541
|
+
"tina.createBranchState.baseBranch",
|
|
5542
|
+
tinaApi.branch
|
|
5543
|
+
);
|
|
5151
5544
|
setCurrentBranch(branch);
|
|
5152
5545
|
const collection = tinaApi.schema.getCollectionByFullPath(fullPath);
|
|
5153
5546
|
const api = new TinaAdminApi(cms);
|
|
@@ -5173,7 +5566,9 @@ const IndexingPage = () => {
|
|
|
5173
5566
|
} catch (e) {
|
|
5174
5567
|
console.error(e);
|
|
5175
5568
|
cms.alerts.error("Content save failed.");
|
|
5176
|
-
setErrorMessage(
|
|
5569
|
+
setErrorMessage(
|
|
5570
|
+
"Content save failed, please try again. If the problem persists please contact support."
|
|
5571
|
+
);
|
|
5177
5572
|
setState("error");
|
|
5178
5573
|
}
|
|
5179
5574
|
}
|
|
@@ -5181,7 +5576,7 @@ const IndexingPage = () => {
|
|
|
5181
5576
|
const foo = await tinaApi.createPullRequest({
|
|
5182
5577
|
baseBranch,
|
|
5183
5578
|
branch,
|
|
5184
|
-
title: "PR from TinaCMS
|
|
5579
|
+
title: `${branch.replace("tina/", "").replace("-", " ")} (PR from TinaCMS)`
|
|
5185
5580
|
});
|
|
5186
5581
|
console.log("PR created", foo);
|
|
5187
5582
|
cms.alerts.success("Pull request created.");
|
|
@@ -5199,17 +5594,14 @@ const IndexingPage = () => {
|
|
|
5199
5594
|
if (!back || !fullPath || !values || !branch) {
|
|
5200
5595
|
return /* @__PURE__ */ React.createElement(Wrapper, null, /* @__PURE__ */ React.createElement("p", null, "Missing params please try again."));
|
|
5201
5596
|
}
|
|
5202
|
-
return /* @__PURE__ */ React.createElement(Wrapper, null, state !== "done" && state !== "error" && /* @__PURE__ */ React.createElement(
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
}), " ", /* @__PURE__ */ React.createElement("b", null, "Error:"), " ", errorMessage, " "));
|
|
5597
|
+
return /* @__PURE__ */ React.createElement(Wrapper, null, state !== "done" && state !== "error" && /* @__PURE__ */ React.createElement(
|
|
5598
|
+
BiLoaderAlt,
|
|
5599
|
+
{
|
|
5600
|
+
className: `opacity-70 text-blue-400 animate-spin w-10 h-auto`
|
|
5601
|
+
}
|
|
5602
|
+
), (state === "starting" || state === "creatingBranch") && /* @__PURE__ */ React.createElement("p", null, "Creating branch…"), state === "indexing" && /* @__PURE__ */ React.createElement("p", null, "Indexing Content…"), state === "submitting" && /* @__PURE__ */ React.createElement("p", null, "Saving content…"), state === "creatingPR" && /* @__PURE__ */ React.createElement("p", null, "Creating Pull Request…"), state === "error" && /* @__PURE__ */ React.createElement("p", { className: "flex items-center gap-1 text-red-700" }, /* @__PURE__ */ React.createElement(BiError, { className: "w-7 h-auto text-red-400 flex-shrink-0" }), " ", /* @__PURE__ */ React.createElement("b", null, "Error:"), " ", errorMessage, " "));
|
|
5209
5603
|
};
|
|
5210
|
-
const Wrapper = ({ children }) => /* @__PURE__ */ React.createElement("div", {
|
|
5211
|
-
className: "w-full h-full flex flex-col justify-center items-center gap-4 p-6 text-xl text-gray-700"
|
|
5212
|
-
}, children);
|
|
5604
|
+
const Wrapper = ({ children }) => /* @__PURE__ */ React.createElement("div", { className: "w-full h-full flex flex-col justify-center items-center gap-4 p-6 text-xl text-gray-700" }, children);
|
|
5213
5605
|
const Redirect = () => {
|
|
5214
5606
|
React.useEffect(() => {
|
|
5215
5607
|
if (window) {
|
|
@@ -5272,11 +5664,7 @@ const PreviewInner = ({ preview, config }) => {
|
|
|
5272
5664
|
}, 100);
|
|
5273
5665
|
}, [ref.current]);
|
|
5274
5666
|
const Preview = preview;
|
|
5275
|
-
return /* @__PURE__ */ React.createElement(Preview, {
|
|
5276
|
-
url,
|
|
5277
|
-
iframeRef: ref,
|
|
5278
|
-
...config
|
|
5279
|
-
});
|
|
5667
|
+
return /* @__PURE__ */ React.createElement(Preview, { url, iframeRef: ref, ...config });
|
|
5280
5668
|
};
|
|
5281
5669
|
const CheckSchema = ({
|
|
5282
5670
|
schemaJson,
|
|
@@ -5293,7 +5681,9 @@ const CheckSchema = ({
|
|
|
5293
5681
|
localSchema: schemaJson
|
|
5294
5682
|
}).then((x) => {
|
|
5295
5683
|
if (x === false) {
|
|
5296
|
-
cms.alerts.error(
|
|
5684
|
+
cms.alerts.error(
|
|
5685
|
+
"GraphQL Schema Mismatch. Editing may not work. If you just switched branches, try going back to the previous branch"
|
|
5686
|
+
);
|
|
5297
5687
|
}
|
|
5298
5688
|
}).catch((e) => {
|
|
5299
5689
|
if (e.message.includes("has not been indexed by Tina Cloud")) {
|
|
@@ -5304,23 +5694,19 @@ const CheckSchema = ({
|
|
|
5304
5694
|
});
|
|
5305
5695
|
}
|
|
5306
5696
|
}, [cms, JSON.stringify(schemaJson || {}), url]);
|
|
5307
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, schemaMissingError ? /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, null, "Branch Not Found"), /* @__PURE__ */ React.createElement(ModalBody, {
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
window.localStorage.removeItem("tinacms-current-branch");
|
|
5321
|
-
window.location.reload();
|
|
5322
|
-
}
|
|
5323
|
-
}, "Switch back to default branch")))) : children);
|
|
5697
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, schemaMissingError ? /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, null, "Branch Not Found"), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement("div", { className: "tina-prose" }, "The current branch (", /* @__PURE__ */ React.createElement("span", { className: "font-bold" }, currentBranch), ") has either been merged or deleted.")), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement("div", { className: "flex-1" }), /* @__PURE__ */ React.createElement(
|
|
5698
|
+
Button,
|
|
5699
|
+
{
|
|
5700
|
+
style: { flexGrow: 1 },
|
|
5701
|
+
className: "w-full",
|
|
5702
|
+
variant: "primary",
|
|
5703
|
+
onClick: () => {
|
|
5704
|
+
window.localStorage.removeItem("tinacms-current-branch");
|
|
5705
|
+
window.location.reload();
|
|
5706
|
+
}
|
|
5707
|
+
},
|
|
5708
|
+
"Switch back to default branch"
|
|
5709
|
+
)))) : children);
|
|
5324
5710
|
};
|
|
5325
5711
|
const TinaAdmin = ({
|
|
5326
5712
|
preview,
|
|
@@ -5346,91 +5732,99 @@ const TinaAdmin = ({
|
|
|
5346
5732
|
return typeof ((_a2 = x == null ? void 0 : x.ui) == null ? void 0 : _a2.router) === "function";
|
|
5347
5733
|
});
|
|
5348
5734
|
const hasRouter = Boolean(collectionWithRouter);
|
|
5349
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(CheckSchema, {
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
cms
|
|
5372
|
-
}
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
cms
|
|
5402
|
-
}
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5735
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(CheckSchema, { schemaJson }, /* @__PURE__ */ React.createElement(HashRouter, null, /* @__PURE__ */ React.createElement(SetPreviewFlag, { preview, cms }), /* @__PURE__ */ React.createElement(Routes, null, preview && /* @__PURE__ */ React.createElement(
|
|
5736
|
+
Route,
|
|
5737
|
+
{
|
|
5738
|
+
path: "/~/*",
|
|
5739
|
+
element: /* @__PURE__ */ React.createElement(PreviewInner, { config, preview })
|
|
5740
|
+
}
|
|
5741
|
+
), /* @__PURE__ */ React.createElement(
|
|
5742
|
+
Route,
|
|
5743
|
+
{
|
|
5744
|
+
path: "graphql",
|
|
5745
|
+
element: /* @__PURE__ */ React.createElement(PlainLayout, null, /* @__PURE__ */ React.createElement(Playground, null))
|
|
5746
|
+
}
|
|
5747
|
+
), /* @__PURE__ */ React.createElement(
|
|
5748
|
+
Route,
|
|
5749
|
+
{
|
|
5750
|
+
path: "branch/new",
|
|
5751
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, { cms }, /* @__PURE__ */ React.createElement(IndexingPage, null))
|
|
5752
|
+
}
|
|
5753
|
+
), /* @__PURE__ */ React.createElement(
|
|
5754
|
+
Route,
|
|
5755
|
+
{
|
|
5756
|
+
path: "collections/new/:collectionName",
|
|
5757
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, { cms }, /* @__PURE__ */ React.createElement(CollectionCreatePage, null))
|
|
5758
|
+
}
|
|
5759
|
+
), /* @__PURE__ */ React.createElement(
|
|
5760
|
+
Route,
|
|
5761
|
+
{
|
|
5762
|
+
path: "collections/duplicate/:collectionName/~/*",
|
|
5763
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, { cms }, /* @__PURE__ */ React.createElement(CollectionDuplicatePage, null))
|
|
5764
|
+
}
|
|
5765
|
+
), /* @__PURE__ */ React.createElement(
|
|
5766
|
+
Route,
|
|
5767
|
+
{
|
|
5768
|
+
path: "collections/duplicate/:collectionName/*",
|
|
5769
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, { cms }, /* @__PURE__ */ React.createElement(CollectionDuplicatePage, null))
|
|
5770
|
+
}
|
|
5771
|
+
), /* @__PURE__ */ React.createElement(
|
|
5772
|
+
Route,
|
|
5773
|
+
{
|
|
5774
|
+
path: "collections/new/:collectionName/:templateName",
|
|
5775
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, { cms }, /* @__PURE__ */ React.createElement(CollectionCreatePage, null))
|
|
5776
|
+
}
|
|
5777
|
+
), /* @__PURE__ */ React.createElement(
|
|
5778
|
+
Route,
|
|
5779
|
+
{
|
|
5780
|
+
path: "collections/new/:collectionName/:templateName/~/*",
|
|
5781
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, { cms }, /* @__PURE__ */ React.createElement(CollectionCreatePage, null))
|
|
5782
|
+
}
|
|
5783
|
+
), /* @__PURE__ */ React.createElement(
|
|
5784
|
+
Route,
|
|
5785
|
+
{
|
|
5786
|
+
path: "collections/new/:collectionName/~/*",
|
|
5787
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, { cms }, /* @__PURE__ */ React.createElement(CollectionCreatePage, null))
|
|
5788
|
+
}
|
|
5789
|
+
), /* @__PURE__ */ React.createElement(
|
|
5790
|
+
Route,
|
|
5791
|
+
{
|
|
5792
|
+
path: "collections/edit/:collectionName/*",
|
|
5793
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, { cms }, /* @__PURE__ */ React.createElement(CollectionUpdatePage, null))
|
|
5794
|
+
}
|
|
5795
|
+
), /* @__PURE__ */ React.createElement(
|
|
5796
|
+
Route,
|
|
5797
|
+
{
|
|
5798
|
+
path: "collections/:collectionName/*",
|
|
5799
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, { cms }, /* @__PURE__ */ React.createElement(CollectionListPage, null))
|
|
5800
|
+
}
|
|
5801
|
+
), /* @__PURE__ */ React.createElement(
|
|
5802
|
+
Route,
|
|
5803
|
+
{
|
|
5804
|
+
path: "screens/:screenName",
|
|
5805
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, { cms }, /* @__PURE__ */ React.createElement(ScreenPage, null))
|
|
5806
|
+
}
|
|
5807
|
+
), /* @__PURE__ */ React.createElement(
|
|
5808
|
+
Route,
|
|
5809
|
+
{
|
|
5810
|
+
path: "logout",
|
|
5811
|
+
element: /* @__PURE__ */ React.createElement(DefaultWrapper, { cms }, /* @__PURE__ */ React.createElement(LogoutRedirect, null))
|
|
5812
|
+
}
|
|
5813
|
+
), /* @__PURE__ */ React.createElement(
|
|
5814
|
+
Route,
|
|
5815
|
+
{
|
|
5816
|
+
path: "/",
|
|
5817
|
+
element: /* @__PURE__ */ React.createElement(
|
|
5818
|
+
MaybeRedirectToPreview,
|
|
5819
|
+
{
|
|
5820
|
+
redirect: !!preview && hasRouter
|
|
5821
|
+
},
|
|
5822
|
+
/* @__PURE__ */ React.createElement(DefaultWrapper, { cms }, /* @__PURE__ */ React.createElement(DashboardPage, null))
|
|
5823
|
+
)
|
|
5824
|
+
}
|
|
5825
|
+
)))));
|
|
5426
5826
|
} else {
|
|
5427
|
-
return /* @__PURE__ */ React.createElement(Layout, null, /* @__PURE__ */ React.createElement(HashRouter, null, /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
|
|
5428
|
-
path: "logout",
|
|
5429
|
-
element: /* @__PURE__ */ React.createElement(LogoutPage, null)
|
|
5430
|
-
}), /* @__PURE__ */ React.createElement(Route, {
|
|
5431
|
-
path: "/",
|
|
5432
|
-
element: /* @__PURE__ */ React.createElement(Redirect, null)
|
|
5433
|
-
}))));
|
|
5827
|
+
return /* @__PURE__ */ React.createElement(Layout, null, /* @__PURE__ */ React.createElement(HashRouter, null, /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, { path: "logout", element: /* @__PURE__ */ React.createElement(LogoutPage, null) }), /* @__PURE__ */ React.createElement(Route, { path: "/", element: /* @__PURE__ */ React.createElement(Redirect, null) }))));
|
|
5434
5828
|
}
|
|
5435
5829
|
});
|
|
5436
5830
|
};
|
|
@@ -5438,28 +5832,26 @@ const DefaultWrapper = ({
|
|
|
5438
5832
|
cms,
|
|
5439
5833
|
children
|
|
5440
5834
|
}) => {
|
|
5441
|
-
return /* @__PURE__ */ React.createElement(Layout, null, /* @__PURE__ */ React.createElement("div", {
|
|
5442
|
-
className: "flex items-stretch h-screen overflow-hidden"
|
|
5443
|
-
}, /* @__PURE__ */ React.createElement(Sidebar, {
|
|
5444
|
-
cms
|
|
5445
|
-
}), /* @__PURE__ */ React.createElement("div", {
|
|
5446
|
-
className: "flex-1 relative"
|
|
5447
|
-
}, children)));
|
|
5835
|
+
return /* @__PURE__ */ React.createElement(Layout, null, /* @__PURE__ */ React.createElement("div", { className: "flex items-stretch h-screen overflow-hidden" }, /* @__PURE__ */ React.createElement(Sidebar, { cms }), /* @__PURE__ */ React.createElement("div", { className: "flex-1 relative" }, children)));
|
|
5448
5836
|
};
|
|
5449
5837
|
const PlainLayout = ({ children }) => {
|
|
5450
|
-
return /* @__PURE__ */ React.createElement(
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5838
|
+
return /* @__PURE__ */ React.createElement(
|
|
5839
|
+
"div",
|
|
5840
|
+
{
|
|
5841
|
+
style: {
|
|
5842
|
+
position: "fixed",
|
|
5843
|
+
top: 0,
|
|
5844
|
+
left: 0,
|
|
5845
|
+
width: "100%",
|
|
5846
|
+
height: "100%",
|
|
5847
|
+
overflow: "auto",
|
|
5848
|
+
background: "#F6F6F9",
|
|
5849
|
+
fontFamily: "'Inter', sans-serif",
|
|
5850
|
+
zIndex: 9999
|
|
5851
|
+
}
|
|
5852
|
+
},
|
|
5853
|
+
children
|
|
5854
|
+
);
|
|
5463
5855
|
};
|
|
5464
5856
|
class RouteMappingPlugin {
|
|
5465
5857
|
constructor(mapper) {
|
|
@@ -5484,4 +5876,34 @@ const defineStaticConfig = (config) => {
|
|
|
5484
5876
|
return config;
|
|
5485
5877
|
};
|
|
5486
5878
|
const defineConfig = defineStaticConfig;
|
|
5487
|
-
export {
|
|
5879
|
+
export {
|
|
5880
|
+
AuthWallInner,
|
|
5881
|
+
Client,
|
|
5882
|
+
DEFAULT_LOCAL_TINA_GQL_SERVER_URL,
|
|
5883
|
+
LocalClient,
|
|
5884
|
+
LocalSearchClient,
|
|
5885
|
+
MdxFieldPluginExtendible,
|
|
5886
|
+
NAMER,
|
|
5887
|
+
RouteMappingPlugin,
|
|
5888
|
+
TinaAdmin,
|
|
5889
|
+
TinaAdminApi,
|
|
5890
|
+
TinaCMSProvider2,
|
|
5891
|
+
TinaCMSSearchClient,
|
|
5892
|
+
TinaCloudAuthWall,
|
|
5893
|
+
TinaCloudProvider,
|
|
5894
|
+
assertShape,
|
|
5895
|
+
asyncPoll,
|
|
5896
|
+
createClient,
|
|
5897
|
+
TinaCMSProvider2 as default,
|
|
5898
|
+
defineConfig,
|
|
5899
|
+
defineLegacyConfig,
|
|
5900
|
+
defineSchema,
|
|
5901
|
+
defineStaticConfig,
|
|
5902
|
+
getStaticPropsForTina,
|
|
5903
|
+
gql,
|
|
5904
|
+
resolveField,
|
|
5905
|
+
safeAssertShape,
|
|
5906
|
+
staticRequest,
|
|
5907
|
+
useDocumentCreatorPlugin,
|
|
5908
|
+
useTinaAuthRedirect
|
|
5909
|
+
};
|