tinacms 0.59.0 → 0.60.2
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/CHANGELOG.md +37 -0
- package/dist/admin/components/AuthTemplate.d.ts +17 -0
- package/dist/admin/components/Sidebar.d.ts +17 -0
- package/dist/admin/pages/LogoutPage.d.ts +14 -0
- package/dist/client/index.d.ts +4 -2
- package/dist/edit-state.d.ts +1 -29
- package/dist/edit-state.es.js +14 -38
- package/dist/edit-state.js +29 -42
- package/dist/index.d.ts +1 -23
- package/dist/index.es.js +257 -164
- package/dist/index.js +256 -164
- package/dist/rich-text.d.ts +1 -118
- package/package.json +4 -18
package/dist/index.js
CHANGED
|
@@ -30,8 +30,8 @@ var __objRest = (source, exclude) => {
|
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
32
|
(function(global, factory) {
|
|
33
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("graphql"), require("lodash.set"), require("graphql-tag"), require("
|
|
34
|
-
})(this, function(exports2, graphql, set, gql$1,
|
|
33
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@tinacms/toolkit"), require("graphql"), require("lodash.set"), require("graphql-tag"), require("react"), require("styled-components"), require("yup"), require("@tinacms/sharedctx"), require("final-form"), require("react-router-dom"), require("@headlessui/react")) : typeof define === "function" && define.amd ? define(["exports", "@tinacms/toolkit", "graphql", "lodash.set", "graphql-tag", "react", "styled-components", "yup", "@tinacms/sharedctx", "final-form", "react-router-dom", "@headlessui/react"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP));
|
|
34
|
+
})(this, function(exports2, toolkit, graphql, set, gql$1, React, styled, yup, sharedctx, finalForm, reactRouterDom, react) {
|
|
35
35
|
"use strict";
|
|
36
36
|
function _interopDefaultLegacy(e) {
|
|
37
37
|
return e && typeof e === "object" && "default" in e ? e : { "default": e };
|
|
@@ -444,10 +444,10 @@ mutation addPendingDocumentMutation(
|
|
|
444
444
|
this.clientId = options.clientId;
|
|
445
445
|
switch (tokenStorage) {
|
|
446
446
|
case "LOCAL_STORAGE":
|
|
447
|
-
this.getToken = function() {
|
|
447
|
+
this.getToken = async function() {
|
|
448
448
|
const tokens = localStorage.getItem(AUTH_TOKEN_KEY) || null;
|
|
449
449
|
if (tokens) {
|
|
450
|
-
return
|
|
450
|
+
return await this.getRefreshedToken(tokens);
|
|
451
451
|
} else {
|
|
452
452
|
return {
|
|
453
453
|
access_token: null,
|
|
@@ -461,9 +461,9 @@ mutation addPendingDocumentMutation(
|
|
|
461
461
|
};
|
|
462
462
|
break;
|
|
463
463
|
case "MEMORY":
|
|
464
|
-
this.getToken = () => {
|
|
464
|
+
this.getToken = async () => {
|
|
465
465
|
if (this.token) {
|
|
466
|
-
return
|
|
466
|
+
return await this.getRefreshedToken(this.token);
|
|
467
467
|
} else {
|
|
468
468
|
return {
|
|
469
469
|
access_token: null,
|
|
@@ -502,13 +502,16 @@ mutation addPendingDocumentMutation(
|
|
|
502
502
|
method: "POST",
|
|
503
503
|
headers: {
|
|
504
504
|
"Content-Type": "application/json",
|
|
505
|
-
Authorization: "Bearer " + this.getToken().id_token
|
|
505
|
+
Authorization: "Bearer " + (await this.getToken()).id_token
|
|
506
506
|
},
|
|
507
507
|
body: JSON.stringify({
|
|
508
508
|
query: typeof query === "function" ? graphql.print(query(gql__default["default"])) : query,
|
|
509
509
|
variables
|
|
510
510
|
})
|
|
511
511
|
});
|
|
512
|
+
if (res.status !== 200) {
|
|
513
|
+
throw new Error(`Unable to complete request, ${res.statusText}`);
|
|
514
|
+
}
|
|
512
515
|
const json = await res.json();
|
|
513
516
|
if (json.errors) {
|
|
514
517
|
throw new Error(`Unable to fetch, errors:
|
|
@@ -516,6 +519,47 @@ mutation addPendingDocumentMutation(
|
|
|
516
519
|
}
|
|
517
520
|
return json.data;
|
|
518
521
|
}
|
|
522
|
+
parseJwt(token) {
|
|
523
|
+
const base64Url = token.split(".")[1];
|
|
524
|
+
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
525
|
+
const jsonPayload = decodeURIComponent(atob(base64).split("").map(function(c) {
|
|
526
|
+
return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
|
|
527
|
+
}).join(""));
|
|
528
|
+
return JSON.parse(jsonPayload);
|
|
529
|
+
}
|
|
530
|
+
async getRefreshedToken(tokens) {
|
|
531
|
+
const { access_token, id_token, refresh_token } = JSON.parse(tokens);
|
|
532
|
+
const { exp, iss, client_id } = this.parseJwt(access_token);
|
|
533
|
+
if (Date.now() / 1e3 >= exp) {
|
|
534
|
+
const refreshResponse = await fetch(iss, {
|
|
535
|
+
method: "POST",
|
|
536
|
+
headers: {
|
|
537
|
+
"Content-Type": "application/x-amz-json-1.1",
|
|
538
|
+
"x-amz-target": "AWSCognitoIdentityProviderService.InitiateAuth"
|
|
539
|
+
},
|
|
540
|
+
body: JSON.stringify({
|
|
541
|
+
ClientId: client_id,
|
|
542
|
+
AuthFlow: "REFRESH_TOKEN_AUTH",
|
|
543
|
+
AuthParameters: {
|
|
544
|
+
REFRESH_TOKEN: refresh_token,
|
|
545
|
+
DEVICE_KEY: null
|
|
546
|
+
}
|
|
547
|
+
})
|
|
548
|
+
});
|
|
549
|
+
if (refreshResponse.status !== 200) {
|
|
550
|
+
throw new Error("Unable to refresh auth tokens");
|
|
551
|
+
}
|
|
552
|
+
const responseJson = await refreshResponse.json();
|
|
553
|
+
const newToken = {
|
|
554
|
+
access_token: responseJson.AuthenticationResult.AccessToken,
|
|
555
|
+
id_token: responseJson.AuthenticationResult.IdToken,
|
|
556
|
+
refresh_token
|
|
557
|
+
};
|
|
558
|
+
this.setToken(newToken);
|
|
559
|
+
return Promise.resolve(newToken);
|
|
560
|
+
}
|
|
561
|
+
return Promise.resolve({ access_token, id_token, refresh_token });
|
|
562
|
+
}
|
|
519
563
|
async isAuthorized() {
|
|
520
564
|
return this.isAuthenticated();
|
|
521
565
|
}
|
|
@@ -531,7 +575,7 @@ mutation addPendingDocumentMutation(
|
|
|
531
575
|
const headers = (init == null ? void 0 : init.headers) || {};
|
|
532
576
|
return await fetch(input, __spreadProps(__spreadValues({}, init), {
|
|
533
577
|
headers: new Headers(__spreadValues({
|
|
534
|
-
Authorization: "Bearer " + this.getToken().id_token
|
|
578
|
+
Authorization: "Bearer " + (await this.getToken()).id_token
|
|
535
579
|
}, headers))
|
|
536
580
|
}));
|
|
537
581
|
}
|
|
@@ -673,24 +717,6 @@ mutation addPendingDocumentMutation(
|
|
|
673
717
|
return false;
|
|
674
718
|
}
|
|
675
719
|
}
|
|
676
|
-
const LOCALSTORAGEKEY = "tina.isEditing";
|
|
677
|
-
const isSSR = typeof window === "undefined";
|
|
678
|
-
const isEditing = () => {
|
|
679
|
-
if (!isSSR) {
|
|
680
|
-
const isEdit = window.localStorage.getItem(LOCALSTORAGEKEY);
|
|
681
|
-
return isEdit && isEdit === "true";
|
|
682
|
-
}
|
|
683
|
-
return false;
|
|
684
|
-
};
|
|
685
|
-
const setEditing = (isEditing2) => {
|
|
686
|
-
if (!isSSR) {
|
|
687
|
-
window.localStorage.setItem(LOCALSTORAGEKEY, isEditing2 ? "true" : "false");
|
|
688
|
-
}
|
|
689
|
-
};
|
|
690
|
-
React__default["default"].createContext({
|
|
691
|
-
edit: isEditing(),
|
|
692
|
-
setEdit: void 0
|
|
693
|
-
});
|
|
694
720
|
function sleep(ms) {
|
|
695
721
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
696
722
|
}
|
|
@@ -736,7 +762,7 @@ mutation addPendingDocumentMutation(
|
|
|
736
762
|
...otherModalActions,
|
|
737
763
|
{
|
|
738
764
|
action: async () => {
|
|
739
|
-
setEditing(false);
|
|
765
|
+
sharedctx.setEditing(false);
|
|
740
766
|
window.location.reload();
|
|
741
767
|
},
|
|
742
768
|
name: "Close",
|
|
@@ -913,6 +939,9 @@ mutation addPendingDocumentMutation(
|
|
|
913
939
|
function BiLogIn(props) {
|
|
914
940
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "m13 16 5-4-5-4v3H4v2h9z" } }, { "tag": "path", "attr": { "d": "M20 3h-9c-1.103 0-2 .897-2 2v4h2V5h9v14h-9v-4H9v4c0 1.103.897 2 2 2h9c1.103 0 2-.897 2-2V5c0-1.103-.897-2-2-2z" } }] })(props);
|
|
915
941
|
}
|
|
942
|
+
function BiLogOut(props) {
|
|
943
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M16 13v-2H7V8l-5 4 5 4v-3z" } }, { "tag": "path", "attr": { "d": "M20 3h-9c-1.103 0-2 .897-2 2v4h2V5h9v14h-9v-4H9v4c0 1.103.897 2 2 2h9c1.103 0 2-.897 2-2V5c0-1.103-.897-2-2-2z" } }] })(props);
|
|
944
|
+
}
|
|
916
945
|
function useGraphqlForms({
|
|
917
946
|
query,
|
|
918
947
|
variables,
|
|
@@ -1030,25 +1059,30 @@ mutation addPendingDocumentMutation(
|
|
|
1030
1059
|
setPendingReset(queryName);
|
|
1031
1060
|
},
|
|
1032
1061
|
onSubmit: async (payload2) => {
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
onSubmit
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
});
|
|
1042
|
-
} else {
|
|
1043
|
-
try {
|
|
1044
|
-
await cms.api.tina.request(mutationString, {
|
|
1062
|
+
try {
|
|
1063
|
+
const params = transformDocumentIntoMutationRequestPayload(payload2, result.form.mutationInfo);
|
|
1064
|
+
const variables2 = { params };
|
|
1065
|
+
const mutationString = result.form.mutationInfo.string;
|
|
1066
|
+
if (onSubmit) {
|
|
1067
|
+
onSubmit({
|
|
1068
|
+
queryString: mutationString,
|
|
1069
|
+
mutationString,
|
|
1045
1070
|
variables: variables2
|
|
1046
1071
|
});
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1072
|
+
} else {
|
|
1073
|
+
try {
|
|
1074
|
+
await cms.api.tina.request(mutationString, {
|
|
1075
|
+
variables: variables2
|
|
1076
|
+
});
|
|
1077
|
+
cms.alerts.success("Document saved!");
|
|
1078
|
+
} catch (e) {
|
|
1079
|
+
cms.alerts.error("There was a problem saving your document");
|
|
1080
|
+
console.error(e);
|
|
1081
|
+
}
|
|
1051
1082
|
}
|
|
1083
|
+
} catch (e) {
|
|
1084
|
+
console.error(e);
|
|
1085
|
+
cms.alerts.error("There was a problem saving your document");
|
|
1052
1086
|
}
|
|
1053
1087
|
}
|
|
1054
1088
|
};
|
|
@@ -1160,6 +1194,9 @@ mutation addPendingDocumentMutation(
|
|
|
1160
1194
|
return { [_template]: nested };
|
|
1161
1195
|
} catch (e) {
|
|
1162
1196
|
if (e.message === "Failed to assertShape - _template is a required field") {
|
|
1197
|
+
if (!data) {
|
|
1198
|
+
return [];
|
|
1199
|
+
}
|
|
1163
1200
|
const accum = {};
|
|
1164
1201
|
Object.entries(data).map(([keyName, value]) => {
|
|
1165
1202
|
accum[keyName] = transformParams(value);
|
|
@@ -1617,12 +1654,6 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
1617
1654
|
});
|
|
1618
1655
|
return str;
|
|
1619
1656
|
}
|
|
1620
|
-
function ImFilesEmpty(props) {
|
|
1621
|
-
return GenIcon({ "tag": "svg", "attr": { "version": "1.1", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M14.341 5.579c-0.347-0.473-0.831-1.027-1.362-1.558s-1.085-1.015-1.558-1.362c-0.806-0.591-1.197-0.659-1.421-0.659h-5.75c-0.689 0-1.25 0.561-1.25 1.25v11.5c0 0.689 0.561 1.25 1.25 1.25h9.5c0.689 0 1.25-0.561 1.25-1.25v-7.75c0-0.224-0.068-0.615-0.659-1.421zM12.271 4.729c0.48 0.48 0.856 0.912 1.134 1.271h-2.406v-2.405c0.359 0.278 0.792 0.654 1.271 1.134v0zM14 14.75c0 0.136-0.114 0.25-0.25 0.25h-9.5c-0.136 0-0.25-0.114-0.25-0.25v-11.5c0-0.135 0.114-0.25 0.25-0.25 0 0 5.749-0 5.75 0v3.5c0 0.276 0.224 0.5 0.5 0.5h3.5v7.75z" } }, { "tag": "path", "attr": { "d": "M9.421 0.659c-0.806-0.591-1.197-0.659-1.421-0.659h-5.75c-0.689 0-1.25 0.561-1.25 1.25v11.5c0 0.604 0.43 1.109 1 1.225v-12.725c0-0.135 0.115-0.25 0.25-0.25h7.607c-0.151-0.124-0.297-0.238-0.437-0.341z" } }] })(props);
|
|
1622
|
-
}
|
|
1623
|
-
function VscOpenPreview(props) {
|
|
1624
|
-
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 16 16", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "clipRule": "evenodd", "d": "M3 1h11l1 1v5.3a3.21 3.21 0 0 0-1-.3V2H9v10.88L7.88 14H3l-1-1V2l1-1zm0 12h5V2H3v11zm10.379-4.998a2.53 2.53 0 0 0-1.19.348h-.03a2.51 2.51 0 0 0-.799 3.53L9 14.23l.71.71 2.35-2.36c.325.22.7.358 1.09.4a2.47 2.47 0 0 0 1.14-.13 2.51 2.51 0 0 0 1-.63 2.46 2.46 0 0 0 .58-1 2.63 2.63 0 0 0 .07-1.15 2.53 2.53 0 0 0-1.35-1.81 2.53 2.53 0 0 0-1.211-.258zm.24 3.992a1.5 1.5 0 0 1-.979-.244 1.55 1.55 0 0 1-.56-.68 1.49 1.49 0 0 1-.08-.86 1.49 1.49 0 0 1 1.18-1.18 1.49 1.49 0 0 1 .86.08c.276.117.512.311.68.56a1.5 1.5 0 0 1-1.1 2.324z" } }] })(props);
|
|
1625
|
-
}
|
|
1626
1657
|
const Layout = ({ children }) => {
|
|
1627
1658
|
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
1628
1659
|
style: {
|
|
@@ -1637,14 +1668,12 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
1637
1668
|
}
|
|
1638
1669
|
}, children);
|
|
1639
1670
|
};
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
}
|
|
1647
|
-
};
|
|
1671
|
+
function ImFilesEmpty(props) {
|
|
1672
|
+
return GenIcon({ "tag": "svg", "attr": { "version": "1.1", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M14.341 5.579c-0.347-0.473-0.831-1.027-1.362-1.558s-1.085-1.015-1.558-1.362c-0.806-0.591-1.197-0.659-1.421-0.659h-5.75c-0.689 0-1.25 0.561-1.25 1.25v11.5c0 0.689 0.561 1.25 1.25 1.25h9.5c0.689 0 1.25-0.561 1.25-1.25v-7.75c0-0.224-0.068-0.615-0.659-1.421zM12.271 4.729c0.48 0.48 0.856 0.912 1.134 1.271h-2.406v-2.405c0.359 0.278 0.792 0.654 1.271 1.134v0zM14 14.75c0 0.136-0.114 0.25-0.25 0.25h-9.5c-0.136 0-0.25-0.114-0.25-0.25v-11.5c0-0.135 0.114-0.25 0.25-0.25 0 0 5.749-0 5.75 0v3.5c0 0.276 0.224 0.5 0.5 0.5h3.5v7.75z" } }, { "tag": "path", "attr": { "d": "M9.421 0.659c-0.806-0.591-1.197-0.659-1.421-0.659h-5.75c-0.689 0-1.25 0.561-1.25 1.25v11.5c0 0.604 0.43 1.109 1 1.225v-12.725c0-0.135 0.115-0.25 0.25-0.25h7.607c-0.151-0.124-0.297-0.238-0.437-0.341z" } }] })(props);
|
|
1673
|
+
}
|
|
1674
|
+
function VscOpenPreview(props) {
|
|
1675
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 16 16", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "clipRule": "evenodd", "d": "M3 1h11l1 1v5.3a3.21 3.21 0 0 0-1-.3V2H9v10.88L7.88 14H3l-1-1V2l1-1zm0 12h5V2H3v11zm10.379-4.998a2.53 2.53 0 0 0-1.19.348h-.03a2.51 2.51 0 0 0-.799 3.53L9 14.23l.71.71 2.35-2.36c.325.22.7.358 1.09.4a2.47 2.47 0 0 0 1.14-.13 2.51 2.51 0 0 0 1-.63 2.46 2.46 0 0 0 .58-1 2.63 2.63 0 0 0 .07-1.15 2.53 2.53 0 0 0-1.35-1.81 2.53 2.53 0 0 0-1.211-.258zm.24 3.992a1.5 1.5 0 0 1-.979-.244 1.55 1.55 0 0 1-.56-.68 1.49 1.49 0 0 1-.08-.86 1.49 1.49 0 0 1 1.18-1.18 1.49 1.49 0 0 1 .86.08c.276.117.512.311.68.56a1.5 1.5 0 0 1-1.1 2.324z" } }] })(props);
|
|
1676
|
+
}
|
|
1648
1677
|
const useGetCollections = (cms) => {
|
|
1649
1678
|
const [collections, setCollections] = React.useState([]);
|
|
1650
1679
|
React.useEffect(() => {
|
|
@@ -1662,14 +1691,98 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
1662
1691
|
return null;
|
|
1663
1692
|
return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, children(collections));
|
|
1664
1693
|
};
|
|
1694
|
+
const Sidebar = ({ cms }) => {
|
|
1695
|
+
const { setEdit } = sharedctx.useEditState();
|
|
1696
|
+
const logout2 = () => setEdit(false);
|
|
1697
|
+
return /* @__PURE__ */ React__default["default"].createElement(GetCollections, {
|
|
1698
|
+
cms
|
|
1699
|
+
}, (collections) => /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
1700
|
+
className: "flex flex-col w-80 lg:w-96 flex-shrink-0 bg-gradient-to-b from-white to-gray-50 border-r border-gray-200"
|
|
1701
|
+
}, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
1702
|
+
className: "border-b border-gray-200"
|
|
1703
|
+
}, /* @__PURE__ */ React__default["default"].createElement(react.Menu, {
|
|
1704
|
+
as: "div",
|
|
1705
|
+
className: "relative block"
|
|
1706
|
+
}, ({ open }) => /* @__PURE__ */ React__default["default"].createElement("div", null, /* @__PURE__ */ React__default["default"].createElement(react.Menu.Button, {
|
|
1707
|
+
className: `group w-full px-6 py-4 flex justify-between items-center transition-colors duration-150 ease-out ${open ? `bg-gray-50` : `bg-transparent`}`
|
|
1708
|
+
}, /* @__PURE__ */ React__default["default"].createElement("span", {
|
|
1709
|
+
className: "text-left inline-flex items-center text-2xl tracking-wide text-gray-800 flex-1 gap-1 opacity-80 group-hover:opacity-100 transition-opacity duration-150 ease-out"
|
|
1710
|
+
}, /* @__PURE__ */ React__default["default"].createElement("svg", {
|
|
1711
|
+
viewBox: "0 0 32 32",
|
|
1712
|
+
fill: "#EC4815",
|
|
1713
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1714
|
+
className: "w-10 h-auto -ml-1"
|
|
1715
|
+
}, /* @__PURE__ */ React__default["default"].createElement("path", {
|
|
1716
|
+
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"
|
|
1717
|
+
}), /* @__PURE__ */ React__default["default"].createElement("path", {
|
|
1718
|
+
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"
|
|
1719
|
+
})), /* @__PURE__ */ React__default["default"].createElement("span", null, "Tina Admin")), /* @__PURE__ */ React__default["default"].createElement("svg", {
|
|
1720
|
+
width: "20",
|
|
1721
|
+
height: "20",
|
|
1722
|
+
viewBox: "0 0 20 20",
|
|
1723
|
+
fill: "none",
|
|
1724
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1725
|
+
className: `flex-0 inline-block opacity-50 group-hover:opacity-80 transition-all duration-300 ease-in-out transform ${open ? `rotate-90 opacity-100` : `rotate-0`}`
|
|
1726
|
+
}, /* @__PURE__ */ React__default["default"].createElement("g", {
|
|
1727
|
+
opacity: "0.3"
|
|
1728
|
+
}, /* @__PURE__ */ React__default["default"].createElement("path", {
|
|
1729
|
+
d: "M7.91675 13.8086L9.16675 15.0586L14.2253 10L9.16675 4.9414L7.91675 6.1914L11.7253 10L7.91675 13.8086Z",
|
|
1730
|
+
fill: "currentColor"
|
|
1731
|
+
})))), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
1732
|
+
className: "transform translate-y-full absolute bottom-3 right-5 w-2/3 z-50"
|
|
1733
|
+
}, /* @__PURE__ */ React__default["default"].createElement(react.Transition, {
|
|
1734
|
+
enter: "transition duration-150 ease-out",
|
|
1735
|
+
enterFrom: "transform opacity-0 -translate-y-2",
|
|
1736
|
+
enterTo: "transform opacity-100 translate-y-0",
|
|
1737
|
+
leave: "transition duration-75 ease-in",
|
|
1738
|
+
leaveFrom: "transform opacity-100 translate-y-0",
|
|
1739
|
+
leaveTo: "transform opacity-0 -translate-y-2"
|
|
1740
|
+
}, /* @__PURE__ */ React__default["default"].createElement(react.Menu.Items, {
|
|
1741
|
+
className: "w-full py-1 bg-white border border-gray-150 rounded-lg shadow-lg"
|
|
1742
|
+
}, /* @__PURE__ */ React__default["default"].createElement(react.Menu.Item, null, ({ active }) => /* @__PURE__ */ React__default["default"].createElement("a", {
|
|
1743
|
+
className: `w-full text-lg px-4 py-2 tracking-wide flex items-center opacity-80 text-gray-600 ${active && "text-gray-800 opacity-100"}`,
|
|
1744
|
+
href: "/"
|
|
1745
|
+
}, /* @__PURE__ */ React__default["default"].createElement(VscOpenPreview, {
|
|
1746
|
+
className: "w-6 h-auto mr-1.5 text-blue-400"
|
|
1747
|
+
}), " ", "View Website")), /* @__PURE__ */ React__default["default"].createElement(react.Menu.Item, null, ({ active }) => /* @__PURE__ */ React__default["default"].createElement("button", {
|
|
1748
|
+
className: `w-full text-lg px-4 py-2 tracking-wide flex items-center opacity-80 text-gray-600 ${active && "text-gray-800 opacity-100"}`,
|
|
1749
|
+
onClick: () => logout2()
|
|
1750
|
+
}, /* @__PURE__ */ React__default["default"].createElement(BiExit, {
|
|
1751
|
+
className: "w-6 h-auto mr-1.5 text-blue-400"
|
|
1752
|
+
}), " ", "Log out")))))))), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
1753
|
+
className: "px-6 py-7 flex-1"
|
|
1754
|
+
}, /* @__PURE__ */ React__default["default"].createElement("h4", {
|
|
1755
|
+
className: "uppercase font-bold text-sm mb-3"
|
|
1756
|
+
}, "Collections"), /* @__PURE__ */ React__default["default"].createElement("ul", {
|
|
1757
|
+
className: "flex flex-col gap-4"
|
|
1758
|
+
}, collections.map((collection) => {
|
|
1759
|
+
return /* @__PURE__ */ React__default["default"].createElement("li", {
|
|
1760
|
+
key: `${collection.name}-link`
|
|
1761
|
+
}, /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.NavLink, {
|
|
1762
|
+
className: ({ isActive }) => {
|
|
1763
|
+
return `text-lg tracking-wide ${isActive ? "text-blue-600" : ""} hover:text-blue-600 flex items-center opacity-90 hover:opacity-100`;
|
|
1764
|
+
},
|
|
1765
|
+
to: `/admin/collections/${collection.name}`
|
|
1766
|
+
}, /* @__PURE__ */ React__default["default"].createElement(ImFilesEmpty, {
|
|
1767
|
+
className: "mr-2 h-6 opacity-80 w-auto"
|
|
1768
|
+
}), " ", collection.label));
|
|
1769
|
+
})))));
|
|
1770
|
+
};
|
|
1771
|
+
const GetCMS = ({ children }) => {
|
|
1772
|
+
try {
|
|
1773
|
+
const cms = toolkit.useCMS();
|
|
1774
|
+
return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, children(cms));
|
|
1775
|
+
} catch (e) {
|
|
1776
|
+
return null;
|
|
1777
|
+
}
|
|
1778
|
+
};
|
|
1665
1779
|
function MdOutlineArrowBack(props) {
|
|
1666
1780
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" } }, { "tag": "path", "attr": { "d": "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" } }] })(props);
|
|
1667
1781
|
}
|
|
1668
|
-
const
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
}
|
|
1672
|
-
const LoginPage = () => {
|
|
1782
|
+
const AuthTemplate = ({
|
|
1783
|
+
message,
|
|
1784
|
+
children
|
|
1785
|
+
}) => {
|
|
1673
1786
|
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
1674
1787
|
className: "h-screen w-full bg-gradient-to-b from-blue-900 to-gray-900 flex items-center justify-center px-4 py-6"
|
|
1675
1788
|
}, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
@@ -1687,12 +1800,19 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
1687
1800
|
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"
|
|
1688
1801
|
}), /* @__PURE__ */ React__default["default"].createElement("path", {
|
|
1689
1802
|
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"
|
|
1690
|
-
})), /* @__PURE__ */ React__default["default"].createElement("span", null, "Tina Admin"))), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
1803
|
+
})), /* @__PURE__ */ React__default["default"].createElement("span", null, "Tina Admin"))), message && /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
1691
1804
|
className: "px-5 py-4 "
|
|
1692
1805
|
}, /* @__PURE__ */ React__default["default"].createElement("p", {
|
|
1693
1806
|
className: "text-base font-sans leading-normal"
|
|
1694
|
-
},
|
|
1807
|
+
}, message)), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
1695
1808
|
className: "px-5 py-4 flex gap-4 w-full justify-between"
|
|
1809
|
+
}, children)));
|
|
1810
|
+
};
|
|
1811
|
+
const LoginPage = () => {
|
|
1812
|
+
const { setEdit } = sharedctx.useEditState();
|
|
1813
|
+
const login = () => setEdit(true);
|
|
1814
|
+
return /* @__PURE__ */ React__default["default"].createElement(AuthTemplate, {
|
|
1815
|
+
message: "Please log in to Tina Cloud to access your content."
|
|
1696
1816
|
}, /* @__PURE__ */ React__default["default"].createElement("a", {
|
|
1697
1817
|
href: "/",
|
|
1698
1818
|
className: "flex-1 text-center inline-flex justify-center items-center px-8 py-3 shadow-sm text-sm leading-4 font-medium rounded-full text-gray-600 border border-gray-150 hover:opacity-80 hover:bg-gray-50 focus:outline-none focus:shadow-outline-blue transition duration-150 ease-out"
|
|
@@ -1705,7 +1825,26 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
1705
1825
|
style: { background: "#0084FF" }
|
|
1706
1826
|
}, /* @__PURE__ */ React__default["default"].createElement(BiLogIn, {
|
|
1707
1827
|
className: "w-6 h-auto mr-1.5 opacity-80"
|
|
1708
|
-
}), " Log in"))
|
|
1828
|
+
}), " Log in"));
|
|
1829
|
+
};
|
|
1830
|
+
const logout = () => {
|
|
1831
|
+
sharedctx.setEditing(false);
|
|
1832
|
+
window.location.href = "/";
|
|
1833
|
+
};
|
|
1834
|
+
const LogoutPage = () => {
|
|
1835
|
+
return /* @__PURE__ */ React__default["default"].createElement(AuthTemplate, null, /* @__PURE__ */ React__default["default"].createElement("a", {
|
|
1836
|
+
href: "/",
|
|
1837
|
+
className: "flex-1 text-center inline-flex justify-center items-center px-8 py-3 shadow-sm text-sm leading-4 font-medium rounded-full text-gray-600 border border-gray-150 hover:opacity-80 hover:bg-gray-50 focus:outline-none focus:shadow-outline-blue transition duration-150 ease-out"
|
|
1838
|
+
}, /* @__PURE__ */ React__default["default"].createElement(MdOutlineArrowBack, {
|
|
1839
|
+
className: "w-6 h-auto mr-1.5 opacity-80"
|
|
1840
|
+
}), " Back to site"), /* @__PURE__ */ React__default["default"].createElement("button", {
|
|
1841
|
+
type: "submit",
|
|
1842
|
+
onClick: () => logout(),
|
|
1843
|
+
className: "flex-1 justify-center text-center inline-flex items-center px-8 py-3 shadow-sm border border-transparent text-sm leading-4 font-medium rounded-full text-white hover:opacity-80 focus:outline-none focus:shadow-outline-blue transition duration-150 ease-out",
|
|
1844
|
+
style: { background: "#0084FF" }
|
|
1845
|
+
}, /* @__PURE__ */ React__default["default"].createElement(BiLogOut, {
|
|
1846
|
+
className: "w-6 h-auto mr-1.5 opacity-80"
|
|
1847
|
+
}), " Log out"));
|
|
1709
1848
|
};
|
|
1710
1849
|
const DashboardPage = () => {
|
|
1711
1850
|
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
@@ -1951,7 +2090,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
1951
2090
|
};
|
|
1952
2091
|
const CollectionCreatePage = () => {
|
|
1953
2092
|
const { collectionName, templateName } = reactRouterDom.useParams();
|
|
1954
|
-
const
|
|
2093
|
+
const navigate = reactRouterDom.useNavigate();
|
|
1955
2094
|
return /* @__PURE__ */ React__default["default"].createElement(GetCMS, null, (cms) => /* @__PURE__ */ React__default["default"].createElement(GetDocumentFields, {
|
|
1956
2095
|
cms,
|
|
1957
2096
|
collectionName,
|
|
@@ -1972,7 +2111,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
1972
2111
|
],
|
|
1973
2112
|
onSubmit: async (values) => {
|
|
1974
2113
|
await createDocument(cms, collection, template, mutationInfo, values);
|
|
1975
|
-
|
|
2114
|
+
navigate(`/admin/collections/${collection.name}`);
|
|
1976
2115
|
}
|
|
1977
2116
|
});
|
|
1978
2117
|
const formLabel = template ? `${collection.label} - Create New ${template.label}` : `${collection.label} - Create New`;
|
|
@@ -2039,7 +2178,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
2039
2178
|
};
|
|
2040
2179
|
const CollectionUpdatePage = () => {
|
|
2041
2180
|
const { collectionName, filename } = reactRouterDom.useParams();
|
|
2042
|
-
const
|
|
2181
|
+
const navigate = reactRouterDom.useNavigate();
|
|
2043
2182
|
return /* @__PURE__ */ React__default["default"].createElement(GetCMS, null, (cms) => /* @__PURE__ */ React__default["default"].createElement(GetDocumentFields, {
|
|
2044
2183
|
cms,
|
|
2045
2184
|
collectionName
|
|
@@ -2057,7 +2196,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
2057
2196
|
initialValues: document2.values,
|
|
2058
2197
|
onSubmit: async (values) => {
|
|
2059
2198
|
await updateDocument(cms, relativePath, collection, mutationInfo, values);
|
|
2060
|
-
|
|
2199
|
+
navigate(`/collections/${collection.name}`);
|
|
2061
2200
|
}
|
|
2062
2201
|
});
|
|
2063
2202
|
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
@@ -2073,8 +2212,8 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
2073
2212
|
};
|
|
2074
2213
|
const useEmbedTailwind = () => {
|
|
2075
2214
|
React.useEffect(() => {
|
|
2076
|
-
const
|
|
2077
|
-
if (!
|
|
2215
|
+
const isSSR = typeof window === "undefined";
|
|
2216
|
+
if (!isSSR) {
|
|
2078
2217
|
const head = document.head;
|
|
2079
2218
|
const link = document.createElement("link");
|
|
2080
2219
|
link.id = "tina-admin-stylesheet";
|
|
@@ -2085,106 +2224,59 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
2085
2224
|
}
|
|
2086
2225
|
}, []);
|
|
2087
2226
|
};
|
|
2088
|
-
const
|
|
2089
|
-
|
|
2090
|
-
|
|
2227
|
+
const Redirect = () => {
|
|
2228
|
+
React__default["default"].useEffect(() => {
|
|
2229
|
+
if (window) {
|
|
2230
|
+
window.location.assign("/");
|
|
2231
|
+
}
|
|
2232
|
+
}, []);
|
|
2233
|
+
return null;
|
|
2091
2234
|
};
|
|
2092
2235
|
const TinaAdmin = () => {
|
|
2093
2236
|
useEmbedTailwind();
|
|
2094
|
-
const
|
|
2095
|
-
|
|
2237
|
+
const isSSR = typeof window === "undefined";
|
|
2238
|
+
const { edit } = sharedctx.useEditState();
|
|
2239
|
+
if (isSSR) {
|
|
2096
2240
|
return null;
|
|
2097
2241
|
}
|
|
2098
|
-
|
|
2099
|
-
if (!isEdit) {
|
|
2242
|
+
if (!edit) {
|
|
2100
2243
|
return /* @__PURE__ */ React__default["default"].createElement(Layout, null, /* @__PURE__ */ React__default["default"].createElement(LoginPage, null));
|
|
2101
2244
|
}
|
|
2102
|
-
return /* @__PURE__ */ React__default["default"].createElement(GetCMS, null, (cms) =>
|
|
2103
|
-
cms
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
fill: "currentColor"
|
|
2138
|
-
})))), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
2139
|
-
className: "transform translate-y-full absolute bottom-3 right-5 w-2/3 z-50"
|
|
2140
|
-
}, /* @__PURE__ */ React__default["default"].createElement(react.Transition, {
|
|
2141
|
-
enter: "transition duration-150 ease-out",
|
|
2142
|
-
enterFrom: "transform opacity-0 -translate-y-2",
|
|
2143
|
-
enterTo: "transform opacity-100 translate-y-0",
|
|
2144
|
-
leave: "transition duration-75 ease-in",
|
|
2145
|
-
leaveFrom: "transform opacity-100 translate-y-0",
|
|
2146
|
-
leaveTo: "transform opacity-0 -translate-y-2"
|
|
2147
|
-
}, /* @__PURE__ */ React__default["default"].createElement(react.Menu.Items, {
|
|
2148
|
-
className: "w-full py-1 bg-white border border-gray-150 rounded-lg shadow-lg"
|
|
2149
|
-
}, /* @__PURE__ */ React__default["default"].createElement(react.Menu.Item, null, ({ active }) => /* @__PURE__ */ React__default["default"].createElement("a", {
|
|
2150
|
-
className: `w-full text-lg px-4 py-2 tracking-wide flex items-center opacity-80 text-gray-600 ${active && "text-gray-800 opacity-100"}`,
|
|
2151
|
-
href: "/"
|
|
2152
|
-
}, /* @__PURE__ */ React__default["default"].createElement(VscOpenPreview, {
|
|
2153
|
-
className: "w-6 h-auto mr-1.5 text-blue-400"
|
|
2154
|
-
}), " ", "View Website")), /* @__PURE__ */ React__default["default"].createElement(react.Menu.Item, null, ({ active }) => /* @__PURE__ */ React__default["default"].createElement("button", {
|
|
2155
|
-
className: `w-full text-lg px-4 py-2 tracking-wide flex items-center opacity-80 text-gray-600 ${active && "text-gray-800 opacity-100"}`,
|
|
2156
|
-
onClick: () => logout()
|
|
2157
|
-
}, /* @__PURE__ */ React__default["default"].createElement(BiExit, {
|
|
2158
|
-
className: "w-6 h-auto mr-1.5 text-blue-400"
|
|
2159
|
-
}), " ", "Log out")))))))), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
2160
|
-
className: "px-6 py-7 flex-1"
|
|
2161
|
-
}, /* @__PURE__ */ React__default["default"].createElement("h4", {
|
|
2162
|
-
className: "uppercase font-bold text-sm mb-3"
|
|
2163
|
-
}, "Collections"), /* @__PURE__ */ React__default["default"].createElement("ul", {
|
|
2164
|
-
className: "flex flex-col gap-4"
|
|
2165
|
-
}, collections.map((collection) => {
|
|
2166
|
-
return /* @__PURE__ */ React__default["default"].createElement("li", {
|
|
2167
|
-
key: `${collection.name}-link`
|
|
2168
|
-
}, /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.NavLink, {
|
|
2169
|
-
className: `text-lg tracking-wide hover:text-blue-600 flex items-center opacity-90 hover:opacity-100`,
|
|
2170
|
-
activeClassName: "text-blue-600",
|
|
2171
|
-
to: `/admin/collections/${collection.name}`
|
|
2172
|
-
}, /* @__PURE__ */ React__default["default"].createElement(ImFilesEmpty, {
|
|
2173
|
-
className: "mr-2 h-6 opacity-80 w-auto"
|
|
2174
|
-
}), " ", collection.label));
|
|
2175
|
-
})))), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
2176
|
-
className: "flex-1"
|
|
2177
|
-
}, /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Switch, null, /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
2178
|
-
path: `/admin/collections/:collectionName/new`
|
|
2179
|
-
}, /* @__PURE__ */ React__default["default"].createElement(CollectionCreatePage, null)), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
2180
|
-
path: `/admin/collections/:collectionName/:templateName/new`
|
|
2181
|
-
}, /* @__PURE__ */ React__default["default"].createElement(CollectionCreatePage, null)), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
2182
|
-
path: `/admin/collections/:collectionName/:filename`
|
|
2183
|
-
}, /* @__PURE__ */ React__default["default"].createElement(CollectionUpdatePage, null)), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
2184
|
-
path: `/admin/collections/:collectionName`
|
|
2185
|
-
}, /* @__PURE__ */ React__default["default"].createElement(CollectionListPage, null)), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
2186
|
-
path: `/admin`
|
|
2187
|
-
}, /* @__PURE__ */ React__default["default"].createElement(DashboardPage, null)))))))));
|
|
2245
|
+
return /* @__PURE__ */ React__default["default"].createElement(GetCMS, null, (cms) => {
|
|
2246
|
+
const isTinaAdminEnabled = cms.flags.get("tina-admin");
|
|
2247
|
+
if (isTinaAdminEnabled) {
|
|
2248
|
+
return /* @__PURE__ */ React__default["default"].createElement(Layout, null, /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.BrowserRouter, null, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
2249
|
+
className: "flex items-stretch h-screen overflow-hidden"
|
|
2250
|
+
}, /* @__PURE__ */ React__default["default"].createElement(Sidebar, {
|
|
2251
|
+
cms
|
|
2252
|
+
}), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
2253
|
+
className: "flex-1"
|
|
2254
|
+
}, /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Routes, null, /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
2255
|
+
path: "/admin/collections/:collectionName/new",
|
|
2256
|
+
element: /* @__PURE__ */ React__default["default"].createElement(CollectionCreatePage, null)
|
|
2257
|
+
}), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
2258
|
+
path: "/admin/collections/:collectionName/:templateName/new",
|
|
2259
|
+
element: /* @__PURE__ */ React__default["default"].createElement(CollectionCreatePage, null)
|
|
2260
|
+
}), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
2261
|
+
path: "/admin/collections/:collectionName/:filename",
|
|
2262
|
+
element: /* @__PURE__ */ React__default["default"].createElement(CollectionUpdatePage, null)
|
|
2263
|
+
}), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
2264
|
+
path: "/admin/collections/:collectionName",
|
|
2265
|
+
element: /* @__PURE__ */ React__default["default"].createElement(CollectionListPage, null)
|
|
2266
|
+
}), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
2267
|
+
path: "/admin",
|
|
2268
|
+
element: /* @__PURE__ */ React__default["default"].createElement(DashboardPage, null)
|
|
2269
|
+
}))))));
|
|
2270
|
+
} else {
|
|
2271
|
+
return /* @__PURE__ */ React__default["default"].createElement(Layout, null, /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.BrowserRouter, null, /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Routes, null, /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
2272
|
+
path: "/admin/logout",
|
|
2273
|
+
element: /* @__PURE__ */ React__default["default"].createElement(LogoutPage, null)
|
|
2274
|
+
}), /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
|
|
2275
|
+
path: "/admin",
|
|
2276
|
+
element: /* @__PURE__ */ React__default["default"].createElement(Redirect, null)
|
|
2277
|
+
}))));
|
|
2278
|
+
}
|
|
2279
|
+
});
|
|
2188
2280
|
};
|
|
2189
2281
|
class RouteMappingPlugin {
|
|
2190
2282
|
constructor(mapper) {
|