tinacms 2.7.5 → 2.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +1 -0
- package/dist/client.js.map +1 -0
- package/dist/client.mjs +1 -0
- package/dist/client.mjs.map +1 -0
- package/dist/index.js +2166 -2161
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2160 -2155
- package/dist/index.mjs.map +1 -0
- package/dist/node-cache-5e8db9f0.mjs +1 -0
- package/dist/node-cache-5e8db9f0.mjs.map +1 -0
- package/dist/react.js +1 -0
- package/dist/react.js.map +1 -0
- package/dist/react.mjs +1 -0
- package/dist/react.mjs.map +1 -0
- package/dist/rich-text/index.js +1 -0
- package/dist/rich-text/index.js.map +1 -0
- package/dist/rich-text/index.mjs +1 -0
- package/dist/rich-text/index.mjs.map +1 -0
- package/dist/rich-text/prism.js +2 -1
- package/dist/rich-text/prism.js.map +1 -0
- package/dist/rich-text/prism.mjs +2 -1
- package/dist/rich-text/prism.mjs.map +1 -0
- package/dist/toolkit/tina-cms.d.ts +3 -3
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("zod"), require("react"), require("react-dom"), require("@udecode/cn"), require("@udecode/plate"), require("@udecode/plate-common"), require("@udecode/plate-slash-command"), require("
|
|
3
|
-
})(this, function(exports2, zod, React, reactDom, cn$1, plate, plateCommon, plateSlashCommand,
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("zod"), require("react"), require("react-dom"), require("@udecode/cn"), require("@udecode/plate"), require("@udecode/plate-common"), require("@udecode/plate-slash-command"), require("@udecode/plate-code-block"), require("@monaco-editor/react"), require("slate-react"), require("@headlessui/react"), require("class-variance-authority"), require("lucide-react"), require("mermaid"), require("@udecode/plate-heading"), require("@ariakit/react"), require("@udecode/plate-combobox"), require("@udecode/plate-table"), require("@udecode/plate-resizable"), require("@radix-ui/react-popover"), require("@radix-ui/react-slot"), require("@radix-ui/react-dropdown-menu"), require("@radix-ui/react-separator"), require("final-form-arrays"), require("final-form-set-field-data"), require("final-form"), require("react-final-form"), require("prop-types"), require("react-beautiful-dnd"), require("react-color"), require("color-string"), require("react-dropzone"), require("clsx"), require("tailwind-merge"), require("cmdk"), require("is-hotkey"), require("slate"), require("@react-hook/window-size"), require("lodash.get"), require("moment"), require("date-fns"), require("@udecode/plate-link"), require("@radix-ui/react-toolbar"), require("@radix-ui/react-tooltip"), require("@udecode/plate-paragraph"), require("@udecode/plate-block-quote"), require("@udecode/plate-floating"), require("graphql"), require("@tinacms/schema-tools"), require("graphql-tag"), require("@graphql-inspector/core"), require("yup"), require("react-router-dom"), require("@tinacms/mdx")) : typeof define === "function" && define.amd ? define(["exports", "zod", "react", "react-dom", "@udecode/cn", "@udecode/plate", "@udecode/plate-common", "@udecode/plate-slash-command", "@udecode/plate-code-block", "@monaco-editor/react", "slate-react", "@headlessui/react", "class-variance-authority", "lucide-react", "mermaid", "@udecode/plate-heading", "@ariakit/react", "@udecode/plate-combobox", "@udecode/plate-table", "@udecode/plate-resizable", "@radix-ui/react-popover", "@radix-ui/react-slot", "@radix-ui/react-dropdown-menu", "@radix-ui/react-separator", "final-form-arrays", "final-form-set-field-data", "final-form", "react-final-form", "prop-types", "react-beautiful-dnd", "react-color", "color-string", "react-dropzone", "clsx", "tailwind-merge", "cmdk", "is-hotkey", "slate", "@react-hook/window-size", "lodash.get", "moment", "date-fns", "@udecode/plate-link", "@radix-ui/react-toolbar", "@radix-ui/react-tooltip", "@udecode/plate-paragraph", "@udecode/plate-block-quote", "@udecode/plate-floating", "graphql", "@tinacms/schema-tools", "graphql-tag", "@graphql-inspector/core", "yup", "react-router-dom", "@tinacms/mdx"], 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, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP));
|
|
3
|
+
})(this, function(exports2, zod, React, reactDom, cn$1, plate, plateCommon, plateSlashCommand, plateCodeBlock, MonacoEditor, slateReact, react, classVarianceAuthority, lucideReact, mermaid, plateHeading, react$1, plateCombobox, plateTable, plateResizable, PopoverPrimitive, reactSlot, DropdownMenuPrimitive, SeparatorPrimitive, arrayMutators, setFieldData, finalForm, reactFinalForm, PropTypes, reactBeautifulDnd, pkg$1, pkg, dropzone, clsx, tailwindMerge, cmdk, isHotkey, slate, windowSize, get, moment, dateFns, plateLink, ToolbarPrimitive, TooltipPrimitive, plateParagraph, plateBlockQuote, plateFloating, graphql, schemaTools, gql, core, yup, reactRouterDom, mdx) {
|
|
4
4
|
"use strict";var __defProp = Object.defineProperty;
|
|
5
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
6
|
var __publicField = (obj, key, value) => {
|
|
@@ -2954,7 +2954,6 @@ flowchart TD
|
|
|
2954
2954
|
children,
|
|
2955
2955
|
...props
|
|
2956
2956
|
}) => {
|
|
2957
|
-
const selected = slateReact.useSelected();
|
|
2958
2957
|
return /* @__PURE__ */ React.createElement(
|
|
2959
2958
|
"div",
|
|
2960
2959
|
{
|
|
@@ -2965,8 +2964,7 @@ flowchart TD
|
|
|
2965
2964
|
...attributes,
|
|
2966
2965
|
...props
|
|
2967
2966
|
},
|
|
2968
|
-
children
|
|
2969
|
-
selected && /* @__PURE__ */ React.createElement("span", { className: "absolute h-4 -top-2 inset-0 ring-2 ring-blue-100 ring-inset rounded-md z-10 pointer-events-none" })
|
|
2967
|
+
children
|
|
2970
2968
|
);
|
|
2971
2969
|
},
|
|
2972
2970
|
[plate.ELEMENT_TABLE]: TableElement,
|
|
@@ -8697,6 +8695,73 @@ flowchart TD
|
|
|
8697
8695
|
};
|
|
8698
8696
|
}
|
|
8699
8697
|
}
|
|
8698
|
+
let Alerts$1 = class Alerts {
|
|
8699
|
+
constructor(events, map = {}) {
|
|
8700
|
+
this.events = events;
|
|
8701
|
+
this.map = map;
|
|
8702
|
+
this.alerts = /* @__PURE__ */ new Map();
|
|
8703
|
+
this.mapEventToAlert = (event) => {
|
|
8704
|
+
const toAlert = this.map[event.type];
|
|
8705
|
+
if (toAlert) {
|
|
8706
|
+
let getArgs;
|
|
8707
|
+
if (typeof toAlert === "function") {
|
|
8708
|
+
getArgs = toAlert;
|
|
8709
|
+
} else {
|
|
8710
|
+
getArgs = () => toAlert;
|
|
8711
|
+
}
|
|
8712
|
+
const { level, message, timeout } = getArgs(event);
|
|
8713
|
+
this.add(level, message, timeout);
|
|
8714
|
+
}
|
|
8715
|
+
};
|
|
8716
|
+
this.events.subscribe("*", this.mapEventToAlert);
|
|
8717
|
+
}
|
|
8718
|
+
setMap(eventsToAlerts) {
|
|
8719
|
+
this.map = {
|
|
8720
|
+
...this.map,
|
|
8721
|
+
...eventsToAlerts
|
|
8722
|
+
};
|
|
8723
|
+
}
|
|
8724
|
+
add(level, message, timeout = 4e3) {
|
|
8725
|
+
const alert = {
|
|
8726
|
+
level,
|
|
8727
|
+
message,
|
|
8728
|
+
timeout,
|
|
8729
|
+
id: `${message}|${Date.now()}`
|
|
8730
|
+
};
|
|
8731
|
+
this.alerts.set(alert.id, alert);
|
|
8732
|
+
this.events.dispatch({ type: "alerts:add", alert });
|
|
8733
|
+
let timeoutId = null;
|
|
8734
|
+
const dismiss = () => {
|
|
8735
|
+
clearTimeout(timeoutId);
|
|
8736
|
+
this.dismiss(alert);
|
|
8737
|
+
};
|
|
8738
|
+
timeoutId = level !== "error" ? setTimeout(dismiss, alert.timeout) : null;
|
|
8739
|
+
return dismiss;
|
|
8740
|
+
}
|
|
8741
|
+
dismiss(alert) {
|
|
8742
|
+
this.alerts.delete(alert.id);
|
|
8743
|
+
this.events.dispatch({ type: "alerts:remove", alert });
|
|
8744
|
+
}
|
|
8745
|
+
subscribe(cb) {
|
|
8746
|
+
const unsub = this.events.subscribe("alerts", cb);
|
|
8747
|
+
return () => unsub();
|
|
8748
|
+
}
|
|
8749
|
+
get all() {
|
|
8750
|
+
return Array.from(this.alerts.values());
|
|
8751
|
+
}
|
|
8752
|
+
info(message, timeout) {
|
|
8753
|
+
return this.add("info", message, timeout);
|
|
8754
|
+
}
|
|
8755
|
+
success(message, timeout) {
|
|
8756
|
+
return this.add("success", message, timeout);
|
|
8757
|
+
}
|
|
8758
|
+
warn(message, timeout) {
|
|
8759
|
+
return this.add("warn", message, timeout);
|
|
8760
|
+
}
|
|
8761
|
+
error(message, timeout) {
|
|
8762
|
+
return this.add("error", message, timeout);
|
|
8763
|
+
}
|
|
8764
|
+
};
|
|
8700
8765
|
class PluginTypeManager {
|
|
8701
8766
|
constructor(events) {
|
|
8702
8767
|
this.events = events;
|
|
@@ -9541,128 +9606,42 @@ flowchart TD
|
|
|
9541
9606
|
_CMS.ENABLED = { type: "cms:enable" };
|
|
9542
9607
|
_CMS.DISABLED = { type: "cms:disable" };
|
|
9543
9608
|
let CMS = _CMS;
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
const toAlert = this.map[event.type];
|
|
9551
|
-
if (toAlert) {
|
|
9552
|
-
let getArgs;
|
|
9553
|
-
if (typeof toAlert === "function") {
|
|
9554
|
-
getArgs = toAlert;
|
|
9555
|
-
} else {
|
|
9556
|
-
getArgs = () => toAlert;
|
|
9557
|
-
}
|
|
9558
|
-
const { level, message, timeout } = getArgs(event);
|
|
9559
|
-
this.add(level, message, timeout);
|
|
9560
|
-
}
|
|
9561
|
-
};
|
|
9562
|
-
this.events.subscribe("*", this.mapEventToAlert);
|
|
9563
|
-
}
|
|
9564
|
-
setMap(eventsToAlerts) {
|
|
9565
|
-
this.map = {
|
|
9566
|
-
...this.map,
|
|
9567
|
-
...eventsToAlerts
|
|
9568
|
-
};
|
|
9569
|
-
}
|
|
9570
|
-
add(level, message, timeout = 4e3) {
|
|
9571
|
-
const alert = {
|
|
9572
|
-
level,
|
|
9573
|
-
message,
|
|
9574
|
-
timeout,
|
|
9575
|
-
id: `${message}|${Date.now()}`
|
|
9576
|
-
};
|
|
9577
|
-
this.alerts.set(alert.id, alert);
|
|
9578
|
-
this.events.dispatch({ type: "alerts:add", alert });
|
|
9579
|
-
let timeoutId = null;
|
|
9580
|
-
const dismiss = () => {
|
|
9581
|
-
clearTimeout(timeoutId);
|
|
9582
|
-
this.dismiss(alert);
|
|
9583
|
-
};
|
|
9584
|
-
timeoutId = level !== "error" ? setTimeout(dismiss, alert.timeout) : null;
|
|
9585
|
-
return dismiss;
|
|
9586
|
-
}
|
|
9587
|
-
dismiss(alert) {
|
|
9588
|
-
this.alerts.delete(alert.id);
|
|
9589
|
-
this.events.dispatch({ type: "alerts:remove", alert });
|
|
9590
|
-
}
|
|
9591
|
-
subscribe(cb) {
|
|
9592
|
-
const unsub = this.events.subscribe("alerts", cb);
|
|
9593
|
-
return () => unsub();
|
|
9594
|
-
}
|
|
9595
|
-
get all() {
|
|
9596
|
-
return Array.from(this.alerts.values());
|
|
9597
|
-
}
|
|
9598
|
-
info(message, timeout) {
|
|
9599
|
-
return this.add("info", message, timeout);
|
|
9600
|
-
}
|
|
9601
|
-
success(message, timeout) {
|
|
9602
|
-
return this.add("success", message, timeout);
|
|
9603
|
-
}
|
|
9604
|
-
warn(message, timeout) {
|
|
9605
|
-
return this.add("warn", message, timeout);
|
|
9606
|
-
}
|
|
9607
|
-
error(message, timeout) {
|
|
9608
|
-
return this.add("error", message, timeout);
|
|
9609
|
-
}
|
|
9609
|
+
const MarkdownFieldPlaceholder = {
|
|
9610
|
+
__type: "field",
|
|
9611
|
+
name: "markdown",
|
|
9612
|
+
Component: createPlaceholder(
|
|
9613
|
+
"Markdown"
|
|
9614
|
+
)
|
|
9610
9615
|
};
|
|
9611
|
-
const
|
|
9612
|
-
"
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
|
|
9620
|
-
|
|
9621
|
-
|
|
9622
|
-
|
|
9623
|
-
|
|
9624
|
-
|
|
9625
|
-
|
|
9626
|
-
|
|
9627
|
-
|
|
9628
|
-
|
|
9629
|
-
|
|
9630
|
-
|
|
9631
|
-
|
|
9632
|
-
|
|
9633
|
-
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
9638
|
-
|
|
9639
|
-
|
|
9640
|
-
this.loadingPlaceholder = options.placeholder || SidebarLoadingPlaceholder;
|
|
9641
|
-
if ((_a = options.buttons) == null ? void 0 : _a.save) {
|
|
9642
|
-
this.buttons.save = options.buttons.save;
|
|
9643
|
-
}
|
|
9644
|
-
if ((_b = options.buttons) == null ? void 0 : _b.reset) {
|
|
9645
|
-
this.buttons.reset = options.buttons.reset;
|
|
9646
|
-
}
|
|
9647
|
-
}
|
|
9648
|
-
get isOpen() {
|
|
9649
|
-
return this._isOpen;
|
|
9650
|
-
}
|
|
9651
|
-
set isOpen(nextValue) {
|
|
9652
|
-
if (this._isOpen === nextValue) {
|
|
9653
|
-
return;
|
|
9654
|
-
}
|
|
9655
|
-
this._isOpen = nextValue;
|
|
9656
|
-
if (nextValue) {
|
|
9657
|
-
this.events.dispatch({ type: "sidebar:opened" });
|
|
9658
|
-
} else {
|
|
9659
|
-
this.events.dispatch({ type: "sidebar:closed" });
|
|
9660
|
-
}
|
|
9661
|
-
}
|
|
9662
|
-
subscribe(callback) {
|
|
9663
|
-
const unsub = this.events.subscribe("sidebar", callback);
|
|
9664
|
-
return () => unsub();
|
|
9665
|
-
}
|
|
9616
|
+
const HtmlFieldPlaceholder = {
|
|
9617
|
+
__type: "field",
|
|
9618
|
+
name: "html",
|
|
9619
|
+
Component: createPlaceholder(
|
|
9620
|
+
"HTML"
|
|
9621
|
+
)
|
|
9622
|
+
};
|
|
9623
|
+
function createPlaceholder(name, _pr) {
|
|
9624
|
+
return (props) => {
|
|
9625
|
+
return /* @__PURE__ */ React.createElement(
|
|
9626
|
+
FieldMeta,
|
|
9627
|
+
{
|
|
9628
|
+
name: props.input.name,
|
|
9629
|
+
label: `${name} Field not Registered`,
|
|
9630
|
+
tinaForm: props.tinaForm
|
|
9631
|
+
},
|
|
9632
|
+
/* @__PURE__ */ React.createElement("p", { className: "whitespace-normal text-[15px] mt-2" }, "The ", name, " field is not registered. Some built-in field types are not bundled by default in an effort to control bundle size. Consult the Tina docs to learn how to use this field type."),
|
|
9633
|
+
/* @__PURE__ */ React.createElement("p", { className: "whitespace-normal text-[15px] mt-2" }, /* @__PURE__ */ React.createElement(
|
|
9634
|
+
"a",
|
|
9635
|
+
{
|
|
9636
|
+
className: "text-blue-500 underline",
|
|
9637
|
+
href: "https://tina.io/docs/editing/markdown/#registering-the-field-plugins",
|
|
9638
|
+
target: "_blank",
|
|
9639
|
+
rel: "noreferrer noopener"
|
|
9640
|
+
},
|
|
9641
|
+
"Tina Docs: Registering Field Plugins"
|
|
9642
|
+
))
|
|
9643
|
+
);
|
|
9644
|
+
};
|
|
9666
9645
|
}
|
|
9667
9646
|
function createScreen({
|
|
9668
9647
|
Component,
|
|
@@ -9711,2209 +9690,2228 @@ flowchart TD
|
|
|
9711
9690
|
children
|
|
9712
9691
|
)));
|
|
9713
9692
|
};
|
|
9714
|
-
function
|
|
9715
|
-
|
|
9693
|
+
function dirname(path) {
|
|
9694
|
+
var _a, _b;
|
|
9695
|
+
const pattern = new RegExp("(?<prevDir>.*)/");
|
|
9696
|
+
return (_b = (_a = path.match(pattern)) == null ? void 0 : _a.groups) == null ? void 0 : _b.prevDir;
|
|
9716
9697
|
}
|
|
9717
|
-
|
|
9718
|
-
|
|
9698
|
+
const BreadcrumbButton = ({ className = "", ...props }) => /* @__PURE__ */ React.createElement(
|
|
9699
|
+
"button",
|
|
9700
|
+
{
|
|
9701
|
+
className: "capitalize transition-colors duration-150 border-0 bg-transparent hover:text-blue-500 " + className,
|
|
9702
|
+
...props
|
|
9703
|
+
}
|
|
9704
|
+
);
|
|
9705
|
+
function Breadcrumb$1({ directory = "", setDirectory }) {
|
|
9706
|
+
directory = directory.replace(/^\/|\/$/g, "");
|
|
9707
|
+
let prevDir = dirname(directory) || "";
|
|
9708
|
+
if (prevDir === ".") {
|
|
9709
|
+
prevDir = "";
|
|
9710
|
+
}
|
|
9711
|
+
return /* @__PURE__ */ React.createElement("div", { className: "w-full flex items-center text-[16px] text-gray-300" }, directory !== "" && /* @__PURE__ */ React.createElement(
|
|
9712
|
+
IconButton,
|
|
9713
|
+
{
|
|
9714
|
+
variant: "ghost",
|
|
9715
|
+
className: "mr-2",
|
|
9716
|
+
onClick: () => setDirectory(prevDir)
|
|
9717
|
+
},
|
|
9718
|
+
/* @__PURE__ */ React.createElement(
|
|
9719
|
+
LeftArrowIcon,
|
|
9720
|
+
{
|
|
9721
|
+
className: `w-7 h-auto fill-gray-300 hover:fill-gray-900 transition duration-150 ease-out`
|
|
9722
|
+
}
|
|
9723
|
+
)
|
|
9724
|
+
), /* @__PURE__ */ React.createElement(
|
|
9725
|
+
BreadcrumbButton,
|
|
9726
|
+
{
|
|
9727
|
+
onClick: () => setDirectory(""),
|
|
9728
|
+
className: directory === "" ? "text-gray-500 font-bold" : "text-gray-300 font-medium after:pl-1.5 after:content-['/']"
|
|
9729
|
+
},
|
|
9730
|
+
"Media"
|
|
9731
|
+
), directory && directory.split("/").map((part, index, parts) => {
|
|
9732
|
+
const currentDir = parts.slice(0, index + 1).join("/");
|
|
9733
|
+
return /* @__PURE__ */ React.createElement(
|
|
9734
|
+
BreadcrumbButton,
|
|
9735
|
+
{
|
|
9736
|
+
className: "pl-1.5 " + (index + 1 === parts.length ? "text-gray-500 font-bold" : "text-gray-300 font-medium after:pl-1.5 after:content-['/']"),
|
|
9737
|
+
key: currentDir,
|
|
9738
|
+
onClick: () => {
|
|
9739
|
+
setDirectory(currentDir);
|
|
9740
|
+
}
|
|
9741
|
+
},
|
|
9742
|
+
part
|
|
9743
|
+
);
|
|
9744
|
+
}));
|
|
9719
9745
|
}
|
|
9720
|
-
const
|
|
9721
|
-
|
|
9722
|
-
|
|
9746
|
+
const CopyField = ({ label, description, value }) => {
|
|
9747
|
+
const [copied, setCopied] = React.useState(false);
|
|
9748
|
+
const [fadeOut, setFadeOut] = React.useState(false);
|
|
9749
|
+
return /* @__PURE__ */ React.createElement("div", { className: "w-full" }, label && /* @__PURE__ */ React.createElement("label", { className: "w-full mb-1 block flex-1 text-sm font-bold leading-5 text-gray-700" }, label), /* @__PURE__ */ React.createElement(
|
|
9750
|
+
"span",
|
|
9723
9751
|
{
|
|
9724
|
-
|
|
9725
|
-
|
|
9726
|
-
|
|
9752
|
+
onClick: () => {
|
|
9753
|
+
if (copied === true)
|
|
9754
|
+
return;
|
|
9755
|
+
setCopied(true);
|
|
9756
|
+
setTimeout(() => {
|
|
9757
|
+
setFadeOut(true);
|
|
9758
|
+
}, 2500);
|
|
9759
|
+
setTimeout(() => {
|
|
9760
|
+
setCopied(false);
|
|
9761
|
+
setFadeOut(false);
|
|
9762
|
+
}, 3e3);
|
|
9763
|
+
navigator.clipboard.writeText(value);
|
|
9764
|
+
},
|
|
9765
|
+
className: `shadow-inner text-base leading-5 whitespace-normal break-all px-3 py-2 text-gray-600 w-full bg-gray-50 border border-gray-200 transition-all ease-out duration-150 rounded-md relative overflow-hidden appearance-none flex items-center w-full cursor-pointer hover:bg-white hover:text-blue-500 ${copied ? `pointer-events-none` : ``}`
|
|
9727
9766
|
},
|
|
9728
|
-
/* @__PURE__ */
|
|
9767
|
+
/* @__PURE__ */ React.createElement(BiCopyAlt, { className: "relative text-blue-500 shrink-0 w-5 h-auto mr-1.5 -ml-0.5 z-20" }),
|
|
9729
9768
|
" ",
|
|
9730
|
-
|
|
9731
|
-
|
|
9732
|
-
|
|
9769
|
+
value,
|
|
9770
|
+
" ",
|
|
9771
|
+
copied && /* @__PURE__ */ React.createElement(
|
|
9772
|
+
"span",
|
|
9773
|
+
{
|
|
9774
|
+
className: `${fadeOut ? `opacity-0` : `opacity-100`} text-blue-500 transition-opacity duration-500 absolute right-0 w-full h-full px-3 py-2 bg-white bg-opacity-90 flex items-center justify-center text-center tracking-wide font-medium z-10`
|
|
9775
|
+
},
|
|
9776
|
+
/* @__PURE__ */ React.createElement("span", null, "Copied to clipboard!")
|
|
9777
|
+
)
|
|
9778
|
+
), description && /* @__PURE__ */ React.createElement("p", { className: "mt-2 text-sm text-gray-500" }, description));
|
|
9733
9779
|
};
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
null
|
|
9741
|
-
);
|
|
9742
|
-
React__namespace.useEffect(() => {
|
|
9743
|
-
const fetchBillingState = async () => {
|
|
9744
|
-
if (typeof (api == null ? void 0 : api.getBillingState) !== "function")
|
|
9745
|
-
return;
|
|
9746
|
-
const billingRes = await (api == null ? void 0 : api.getBillingState());
|
|
9747
|
-
setBillingState(billingRes);
|
|
9748
|
-
};
|
|
9749
|
-
if (!isCustomContentApi)
|
|
9750
|
-
fetchBillingState();
|
|
9751
|
-
}, []);
|
|
9752
|
-
if (isCustomContentApi || !billingState || billingState.billingState === "current") {
|
|
9753
|
-
return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null);
|
|
9780
|
+
function ListMediaItem({ item, onClick, active }) {
|
|
9781
|
+
let FileIcon = BiFile;
|
|
9782
|
+
if (item.type === "dir") {
|
|
9783
|
+
FileIcon = BiFolder;
|
|
9784
|
+
} else if (isVideo(item.src)) {
|
|
9785
|
+
FileIcon = BiMovie;
|
|
9754
9786
|
}
|
|
9755
|
-
|
|
9756
|
-
|
|
9787
|
+
const thumbnail = (item.thumbnails || {})["75x75"];
|
|
9788
|
+
return /* @__PURE__ */ React.createElement(
|
|
9789
|
+
"li",
|
|
9757
9790
|
{
|
|
9758
|
-
className:
|
|
9759
|
-
|
|
9760
|
-
|
|
9791
|
+
className: `group relative flex shrink-0 items-center transition duration-150 ease-out cursor-pointer border-b border-gray-150 ${active ? "bg-gradient-to-r from-white to-gray-50/50 text-blue-500 hover:bg-gray-50" : "bg-white hover:bg-gray-50/50 hover:text-blue-500"}`,
|
|
9792
|
+
onClick: () => {
|
|
9793
|
+
if (!active) {
|
|
9794
|
+
onClick(item);
|
|
9795
|
+
} else {
|
|
9796
|
+
onClick(false);
|
|
9797
|
+
}
|
|
9798
|
+
}
|
|
9761
9799
|
},
|
|
9762
|
-
"
|
|
9763
|
-
/* @__PURE__ */
|
|
9764
|
-
|
|
9765
|
-
|
|
9766
|
-
|
|
9767
|
-
|
|
9768
|
-
|
|
9769
|
-
function FiMoreVertical(props) {
|
|
9770
|
-
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "circle", "attr": { "cx": "12", "cy": "12", "r": "1" }, "child": [] }, { "tag": "circle", "attr": { "cx": "12", "cy": "5", "r": "1" }, "child": [] }, { "tag": "circle", "attr": { "cx": "12", "cy": "19", "r": "1" }, "child": [] }] })(props);
|
|
9771
|
-
}
|
|
9772
|
-
function VscNewFile(props) {
|
|
9773
|
-
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 16 16", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "clipRule": "evenodd", "d": "M9.5 1.1l3.4 3.5.1.4v2h-1V6H8V2H3v11h4v1H2.5l-.5-.5v-12l.5-.5h6.7l.3.1zM9 2v3h2.9L9 2zm4 14h-1v-3H9v-1h3V9h1v3h3v1h-3v3z" }, "child": [] }] })(props);
|
|
9774
|
-
}
|
|
9775
|
-
const FormModal = ({ plugin, close: close2 }) => {
|
|
9776
|
-
const cms = useCMS$1();
|
|
9777
|
-
const form = React.useMemo(
|
|
9778
|
-
() => new Form({
|
|
9779
|
-
id: "create-form-id",
|
|
9780
|
-
label: "create-form",
|
|
9781
|
-
fields: plugin.fields,
|
|
9782
|
-
actions: plugin.actions,
|
|
9783
|
-
buttons: plugin.buttons,
|
|
9784
|
-
initialValues: plugin.initialValues || {},
|
|
9785
|
-
reset: plugin.reset,
|
|
9786
|
-
onChange: plugin.onChange,
|
|
9787
|
-
onSubmit: async (values) => {
|
|
9788
|
-
await plugin.onSubmit(values, cms).then(() => {
|
|
9789
|
-
close2();
|
|
9790
|
-
});
|
|
9800
|
+
item.new && /* @__PURE__ */ React.createElement("span", { className: "absolute top-1.5 left-1.5 rounded-full shadow bg-green-100 border border-green-200 text-[10px] tracking-wide font-bold text-green-600 px-1.5 py-0.5 z-10" }, "NEW"),
|
|
9801
|
+
/* @__PURE__ */ React.createElement("div", { className: "w-16 h-16 bg-gray-50 border-r border-gray-150 overflow-hidden flex justify-center flex-shrink-0" }, isImage(thumbnail) ? /* @__PURE__ */ React.createElement(
|
|
9802
|
+
"img",
|
|
9803
|
+
{
|
|
9804
|
+
className: "object-contain object-center w-full h-full origin-center transition-all duration-150 ease-out group-hover:scale-110",
|
|
9805
|
+
src: thumbnail,
|
|
9806
|
+
alt: item.filename
|
|
9791
9807
|
}
|
|
9792
|
-
}),
|
|
9793
|
-
|
|
9808
|
+
) : /* @__PURE__ */ React.createElement(FileIcon, { className: "w-1/2 h-full fill-gray-300" })),
|
|
9809
|
+
/* @__PURE__ */ React.createElement(
|
|
9810
|
+
"span",
|
|
9811
|
+
{
|
|
9812
|
+
className: "text-base flex-grow w-full break-words truncate px-3 py-2"
|
|
9813
|
+
},
|
|
9814
|
+
item.filename
|
|
9815
|
+
)
|
|
9794
9816
|
);
|
|
9795
|
-
return /* @__PURE__ */ React__namespace.createElement(Modal, { id: "content-creator-modal", onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React__namespace.createElement(PopupModal, null, /* @__PURE__ */ React__namespace.createElement(ModalHeader, { close: close2 }, plugin.name), /* @__PURE__ */ React__namespace.createElement(ModalBody, null, /* @__PURE__ */ React__namespace.createElement(FormBuilder, { form: { tinaForm: form } }))));
|
|
9796
|
-
};
|
|
9797
|
-
function HiOutlineClipboardList(props) {
|
|
9798
|
-
return GenIcon({ "tag": "svg", "attr": { "fill": "none", "viewBox": "0 0 24 24", "strokeWidth": "2", "stroke": "currentColor", "aria-hidden": "true" }, "child": [{ "tag": "path", "attr": { "strokeLinecap": "round", "strokeLinejoin": "round", "d": "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }, "child": [] }] })(props);
|
|
9799
9817
|
}
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
|
|
9810
|
-
|
|
9811
|
-
}
|
|
9812
|
-
|
|
9813
|
-
|
|
9814
|
-
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
|
|
9819
|
-
|
|
9820
|
-
|
|
9821
|
-
// 30 seconds
|
|
9822
|
-
);
|
|
9823
|
-
console.error(error2);
|
|
9824
|
-
setEvents(void 0);
|
|
9825
|
-
setError(error2);
|
|
9826
|
-
}
|
|
9827
|
-
setLoading(false);
|
|
9828
|
-
}
|
|
9829
|
-
};
|
|
9830
|
-
setLoading(true);
|
|
9831
|
-
fetchEvents();
|
|
9832
|
-
}, [cms, cursor]);
|
|
9833
|
-
return { events, cursor: nextCursor, loading, error };
|
|
9834
|
-
};
|
|
9835
|
-
function useSyncStatus$1(cms) {
|
|
9836
|
-
var _a, _b;
|
|
9837
|
-
const [syncStatus, setSyncStatus] = React.useState({ state: "loading", message: "Loading..." });
|
|
9838
|
-
React__namespace.useEffect(() => {
|
|
9839
|
-
const interval = setInterval(async () => {
|
|
9840
|
-
var _a2, _b2, _c, _d, _e;
|
|
9841
|
-
let doFetchEvents = false;
|
|
9842
|
-
if (!((_b2 = (_a2 = cms.api) == null ? void 0 : _a2.tina) == null ? void 0 : _b2.isCustomContentApi)) {
|
|
9843
|
-
doFetchEvents = await ((_e = (_d = (_c = cms.api) == null ? void 0 : _c.tina) == null ? void 0 : _d.authProvider) == null ? void 0 : _e.isAuthenticated());
|
|
9844
|
-
}
|
|
9845
|
-
if (doFetchEvents) {
|
|
9846
|
-
const { events } = await cms.api.tina.fetchEvents();
|
|
9847
|
-
if (events.length === 0) {
|
|
9848
|
-
setSyncStatus({ state: "success", message: "No Events" });
|
|
9849
|
-
} else {
|
|
9850
|
-
if (events[0].isError) {
|
|
9851
|
-
setSyncStatus({
|
|
9852
|
-
state: "error",
|
|
9853
|
-
message: `Sync Failure ${events[0].message}`
|
|
9854
|
-
});
|
|
9818
|
+
function GridMediaItem({ item, active, onClick }) {
|
|
9819
|
+
let FileIcon = BiFile;
|
|
9820
|
+
if (item.type === "dir") {
|
|
9821
|
+
FileIcon = BiFolder;
|
|
9822
|
+
} else if (isVideo(item.src)) {
|
|
9823
|
+
FileIcon = BiMovie;
|
|
9824
|
+
}
|
|
9825
|
+
const thumbnail = (item.thumbnails || {})["400x400"];
|
|
9826
|
+
return /* @__PURE__ */ React.createElement(
|
|
9827
|
+
"li",
|
|
9828
|
+
{
|
|
9829
|
+
className: `relative pb-[100%] h-0 block border border-gray-100 rounded-md overflow-hidden flex justify-center shrink-0 w-full transition duration-150 ease-out ${active ? "shadow-outline" : "shadow hover:shadow-md hover:scale-103 hover:border-gray-150"} ${item.type === "dir" ? "cursor-pointer" : ""}`
|
|
9830
|
+
},
|
|
9831
|
+
item.new && /* @__PURE__ */ React.createElement("span", { className: "absolute top-1.5 left-1.5 rounded-full shadow bg-green-100 border border-green-200 text-[10px] tracking-wide font-bold text-green-600 px-1.5 py-0.5 z-10" }, "NEW"),
|
|
9832
|
+
/* @__PURE__ */ React.createElement(
|
|
9833
|
+
"button",
|
|
9834
|
+
{
|
|
9835
|
+
className: "absolute w-full h-full flex items-center justify-center bg-white",
|
|
9836
|
+
onClick: () => {
|
|
9837
|
+
if (!active) {
|
|
9838
|
+
onClick(item);
|
|
9855
9839
|
} else {
|
|
9856
|
-
|
|
9840
|
+
onClick(false);
|
|
9857
9841
|
}
|
|
9858
9842
|
}
|
|
9859
|
-
}
|
|
9860
|
-
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
9864
|
-
|
|
9865
|
-
|
|
9843
|
+
},
|
|
9844
|
+
isImage(thumbnail) ? /* @__PURE__ */ React.createElement(
|
|
9845
|
+
"img",
|
|
9846
|
+
{
|
|
9847
|
+
className: "object-contain object-center w-full h-full",
|
|
9848
|
+
src: thumbnail,
|
|
9849
|
+
alt: item.filename
|
|
9850
|
+
}
|
|
9851
|
+
) : /* @__PURE__ */ React.createElement("div", { className: "p-4 w-full flex flex-col gap-4 items-center justify-center" }, /* @__PURE__ */ React.createElement(FileIcon, { className: "w-[30%] h-auto fill-gray-300" }), /* @__PURE__ */ React.createElement("span", { className: "block text-base text-gray-600 w-full break-words truncate" }, item.filename))
|
|
9852
|
+
)
|
|
9853
|
+
);
|
|
9866
9854
|
}
|
|
9867
|
-
const
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
9855
|
+
const DeleteModal$1 = ({
|
|
9856
|
+
close: close2,
|
|
9857
|
+
deleteFunc,
|
|
9858
|
+
filename
|
|
9859
|
+
}) => {
|
|
9860
|
+
const [processing, setProcessing] = React.useState(false);
|
|
9861
|
+
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 ", /* @__PURE__ */ React.createElement("strong", null, filename), "?")), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(Button$1, { style: { flexGrow: 2 }, disabled: processing, onClick: close2 }, "Cancel"), /* @__PURE__ */ React.createElement(
|
|
9862
|
+
Button$1,
|
|
9874
9863
|
{
|
|
9875
|
-
|
|
9876
|
-
|
|
9864
|
+
style: { flexGrow: 3 },
|
|
9865
|
+
disabled: processing,
|
|
9866
|
+
variant: "danger",
|
|
9867
|
+
onClick: async () => {
|
|
9868
|
+
setProcessing(true);
|
|
9869
|
+
try {
|
|
9870
|
+
await deleteFunc();
|
|
9871
|
+
} catch (e) {
|
|
9872
|
+
console.error(e);
|
|
9873
|
+
} finally {
|
|
9874
|
+
close2();
|
|
9875
|
+
}
|
|
9876
|
+
}
|
|
9877
9877
|
},
|
|
9878
|
-
/* @__PURE__ */
|
|
9879
|
-
|
|
9878
|
+
/* @__PURE__ */ React.createElement("span", { className: "mr-1" }, "Delete"),
|
|
9879
|
+
processing && /* @__PURE__ */ React.createElement(LoadingDots, null)
|
|
9880
|
+
))));
|
|
9880
9881
|
};
|
|
9881
|
-
const
|
|
9882
|
-
const [
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
|
|
9888
|
-
|
|
9889
|
-
|
|
9890
|
-
|
|
9891
|
-
|
|
9892
|
-
const time = new Date(event.timestamp).toTimeString();
|
|
9893
|
-
return /* @__PURE__ */ React__namespace.createElement("tr", { className: index % 2 === 0 ? "" : "bg-gray-50" }, event.isError ? /* @__PURE__ */ React__namespace.createElement(
|
|
9894
|
-
"td",
|
|
9895
|
-
{
|
|
9896
|
-
key: `${event.id}_error_icon`,
|
|
9897
|
-
className: "py-3 pl-4 pr-0 w-0"
|
|
9898
|
-
},
|
|
9899
|
-
/* @__PURE__ */ React__namespace.createElement(BsExclamationOctagonFill, { className: "text-red-500 fill-current w-5 h-auto" })
|
|
9900
|
-
) : /* @__PURE__ */ React__namespace.createElement(
|
|
9901
|
-
"td",
|
|
9902
|
-
{
|
|
9903
|
-
key: `${event.id}_ok_icon`,
|
|
9904
|
-
className: "py-3 pl-4 pr-0 w-0"
|
|
9905
|
-
},
|
|
9906
|
-
/* @__PURE__ */ React__namespace.createElement(BsCheckCircleFill, { className: "text-green-500 fill-current w-5 h-auto" })
|
|
9907
|
-
), /* @__PURE__ */ React__namespace.createElement(
|
|
9908
|
-
"td",
|
|
9909
|
-
{
|
|
9910
|
-
key: `${event.id}_msg`,
|
|
9911
|
-
className: "whitespace-nowrap p-3 text-base text-gray-500"
|
|
9912
|
-
},
|
|
9913
|
-
event.message,
|
|
9914
|
-
event.isError && /* @__PURE__ */ React__namespace.createElement("div", { className: "w-full text-gray-300 text-xs mt-0.5" }, event.id)
|
|
9915
|
-
), /* @__PURE__ */ React__namespace.createElement(
|
|
9916
|
-
"td",
|
|
9917
|
-
{
|
|
9918
|
-
key: `${event.id}_ts`,
|
|
9919
|
-
className: "whitespace-nowrap py-3 pl-3 pr-4 text-sm text-gray-500"
|
|
9920
|
-
},
|
|
9921
|
-
date,
|
|
9922
|
-
/* @__PURE__ */ React__namespace.createElement("span", { className: "w-full block text-gray-300 text-xs mt-0.5" }, time)
|
|
9923
|
-
));
|
|
9924
|
-
}).flat())), loading && /* @__PURE__ */ React__namespace.createElement("div", { className: "text-sm text-gray-400 text-center" }, "Loading..."), error && /* @__PURE__ */ React__namespace.createElement("div", null, "Error: ", error.message), /* @__PURE__ */ React__namespace.createElement("div", { className: "text-center flex-1" }, /* @__PURE__ */ React__namespace.createElement(
|
|
9882
|
+
const NewFolderModal = ({ onSubmit, close: close2 }) => {
|
|
9883
|
+
const [folderName, setFolderName] = React.useState("");
|
|
9884
|
+
return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, { close: close2 }, "New Folder"), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement("p", { className: "text-base text-gray-700 mb-2" }, "Please provide a name for your folder."), /* @__PURE__ */ React.createElement("p", { className: "text-sm text-gray-500 mb-4 italic" }, /* @__PURE__ */ React.createElement("span", { className: "font-bold" }, "Note"), " – If you navigate away before uploading a media item, the folder will disappear."), /* @__PURE__ */ React.createElement(
|
|
9885
|
+
Input,
|
|
9886
|
+
{
|
|
9887
|
+
value: folderName,
|
|
9888
|
+
placeholder: "Folder Name",
|
|
9889
|
+
required: true,
|
|
9890
|
+
onChange: (e) => setFolderName(e.target.value)
|
|
9891
|
+
}
|
|
9892
|
+
)), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(Button$1, { style: { flexGrow: 2 }, onClick: close2 }, "Cancel"), /* @__PURE__ */ React.createElement(
|
|
9925
9893
|
Button$1,
|
|
9926
9894
|
{
|
|
9895
|
+
disabled: !folderName,
|
|
9896
|
+
style: { flexGrow: 3 },
|
|
9897
|
+
variant: "primary",
|
|
9927
9898
|
onClick: () => {
|
|
9928
|
-
|
|
9929
|
-
|
|
9899
|
+
if (!folderName)
|
|
9900
|
+
return;
|
|
9901
|
+
onSubmit(folderName);
|
|
9902
|
+
close2();
|
|
9930
9903
|
}
|
|
9931
9904
|
},
|
|
9932
|
-
"
|
|
9933
|
-
)));
|
|
9905
|
+
"Create New Folder"
|
|
9906
|
+
))));
|
|
9934
9907
|
};
|
|
9935
|
-
const
|
|
9936
|
-
const
|
|
9937
|
-
|
|
9938
|
-
const
|
|
9939
|
-
|
|
9940
|
-
|
|
9941
|
-
|
|
9942
|
-
|
|
9908
|
+
const { useDropzone } = dropzone__namespace;
|
|
9909
|
+
const join = function(...parts) {
|
|
9910
|
+
const [first, last, slash] = [0, parts.length - 1, "/"];
|
|
9911
|
+
const matchLeadingSlash = new RegExp("^" + slash);
|
|
9912
|
+
const matchTrailingSlash = new RegExp(slash + "$");
|
|
9913
|
+
parts = parts.map(function(part, index) {
|
|
9914
|
+
if (index === first && part === "file://")
|
|
9915
|
+
return part;
|
|
9916
|
+
if (index > first)
|
|
9917
|
+
part = part.replace(matchLeadingSlash, "");
|
|
9918
|
+
if (index < last)
|
|
9919
|
+
part = part.replace(matchTrailingSlash, "");
|
|
9920
|
+
return part;
|
|
9921
|
+
});
|
|
9922
|
+
return parts.join(slash);
|
|
9923
|
+
};
|
|
9924
|
+
function MediaManager() {
|
|
9925
|
+
const cms = useCMS();
|
|
9926
|
+
const [request, setRequest] = React.useState();
|
|
9927
|
+
React.useEffect(() => {
|
|
9928
|
+
return cms.events.subscribe("media:open", ({ type, ...request2 }) => {
|
|
9929
|
+
setRequest(request2);
|
|
9930
|
+
});
|
|
9931
|
+
}, []);
|
|
9932
|
+
if (!request)
|
|
9943
9933
|
return null;
|
|
9944
|
-
|
|
9945
|
-
return /* @__PURE__ */
|
|
9946
|
-
"
|
|
9934
|
+
const close2 = () => setRequest(void 0);
|
|
9935
|
+
return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(FullscreenModal, null, /* @__PURE__ */ React.createElement("div", { className: "w-full bg-gray-50 flex items-center justify-between px-5 pt-3 m-0" }, /* @__PURE__ */ React.createElement("h2", { className: "text-gray-500 font-sans font-medium text-base leading-none m-0 block truncate" }, "Media Manager"), /* @__PURE__ */ React.createElement(
|
|
9936
|
+
"div",
|
|
9947
9937
|
{
|
|
9948
|
-
|
|
9949
|
-
|
|
9938
|
+
onClick: close2,
|
|
9939
|
+
className: "flex items-center fill-gray-400 cursor-pointer transition-colors duration-100 ease-out hover:fill-gray-700"
|
|
9950
9940
|
},
|
|
9951
|
-
|
|
9952
|
-
|
|
9953
|
-
|
|
9954
|
-
|
|
9955
|
-
|
|
9956
|
-
|
|
9957
|
-
|
|
9958
|
-
|
|
9959
|
-
|
|
9960
|
-
|
|
9961
|
-
|
|
9962
|
-
|
|
9963
|
-
screens,
|
|
9964
|
-
cloudConfigs,
|
|
9965
|
-
contentCreators,
|
|
9966
|
-
sidebarWidth,
|
|
9967
|
-
RenderNavSite,
|
|
9968
|
-
RenderNavCloud,
|
|
9969
|
-
RenderNavCollection,
|
|
9970
|
-
AuthRenderNavCollection,
|
|
9941
|
+
/* @__PURE__ */ React.createElement(CloseIcon, { className: "w-6 h-auto" })
|
|
9942
|
+
)), /* @__PURE__ */ React.createElement(ModalBody, { className: "flex h-full flex-col" }, /* @__PURE__ */ React.createElement(MediaPicker, { ...request, close: close2 }))));
|
|
9943
|
+
}
|
|
9944
|
+
const defaultListError = new MediaListError({
|
|
9945
|
+
title: "Error fetching media",
|
|
9946
|
+
message: "Something went wrong while requesting the resource.",
|
|
9947
|
+
docsLink: "https://tina.io/docs/media/#media-store"
|
|
9948
|
+
});
|
|
9949
|
+
function MediaPicker({
|
|
9950
|
+
allowDelete,
|
|
9951
|
+
onSelect,
|
|
9952
|
+
close: close2,
|
|
9971
9953
|
...props
|
|
9972
|
-
})
|
|
9973
|
-
|
|
9974
|
-
const
|
|
9975
|
-
const
|
|
9976
|
-
(
|
|
9977
|
-
|
|
9978
|
-
|
|
9954
|
+
}) {
|
|
9955
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9956
|
+
const cms = useCMS();
|
|
9957
|
+
const [listState, setListState] = React.useState(() => {
|
|
9958
|
+
if (cms.media.isConfigured)
|
|
9959
|
+
return "loading";
|
|
9960
|
+
return "not-configured";
|
|
9961
|
+
});
|
|
9962
|
+
const [deleteModalOpen, setDeleteModalOpen] = React.useState(false);
|
|
9963
|
+
const [newFolderModalOpen, setNewFolderModalOpen] = React.useState(false);
|
|
9964
|
+
const [listError, setListError] = React.useState(defaultListError);
|
|
9965
|
+
const [directory, setDirectory] = React.useState(
|
|
9966
|
+
props.directory
|
|
9967
|
+
);
|
|
9968
|
+
const [list, setList] = React.useState({
|
|
9969
|
+
items: [],
|
|
9970
|
+
nextOffset: void 0
|
|
9971
|
+
});
|
|
9972
|
+
const resetList = () => setList({
|
|
9973
|
+
items: [],
|
|
9974
|
+
nextOffset: void 0
|
|
9975
|
+
});
|
|
9976
|
+
const [viewMode, setViewMode] = React.useState("grid");
|
|
9977
|
+
const [activeItem, setActiveItem] = React.useState(false);
|
|
9978
|
+
const closePreview = () => setActiveItem(false);
|
|
9979
|
+
const [refreshing, setRefreshing] = React.useState(false);
|
|
9980
|
+
const [loadFolders, setLoadFolders] = React.useState(true);
|
|
9981
|
+
const [offsetHistory, setOffsetHistory] = React.useState([]);
|
|
9982
|
+
const offset = offsetHistory[offsetHistory.length - 1];
|
|
9983
|
+
const resetOffset = () => setOffsetHistory([]);
|
|
9984
|
+
async function loadMedia(loadFolders2 = true) {
|
|
9985
|
+
setListState("loading");
|
|
9986
|
+
try {
|
|
9987
|
+
const _list = await cms.media.list({
|
|
9988
|
+
offset,
|
|
9989
|
+
limit: cms.media.pageSize,
|
|
9990
|
+
directory,
|
|
9991
|
+
thumbnailSizes: [
|
|
9992
|
+
{ w: 75, h: 75 },
|
|
9993
|
+
{ w: 400, h: 400 },
|
|
9994
|
+
{ w: 1e3, h: 1e3 }
|
|
9995
|
+
],
|
|
9996
|
+
filesOnly: !loadFolders2
|
|
9997
|
+
});
|
|
9998
|
+
setList({
|
|
9999
|
+
items: [...list.items, ..._list.items],
|
|
10000
|
+
nextOffset: _list.nextOffset
|
|
10001
|
+
});
|
|
10002
|
+
setListState("loaded");
|
|
10003
|
+
} catch (e) {
|
|
10004
|
+
console.error(e);
|
|
10005
|
+
if (e.ERR_TYPE === "MediaListError") {
|
|
10006
|
+
setListError(e);
|
|
9979
10007
|
} else {
|
|
9980
|
-
|
|
10008
|
+
setListError(defaultListError);
|
|
9981
10009
|
}
|
|
9982
|
-
|
|
9983
|
-
},
|
|
9984
|
-
{
|
|
9985
|
-
contentCollections: []
|
|
10010
|
+
setListState("error");
|
|
9986
10011
|
}
|
|
9987
|
-
);
|
|
9988
|
-
function closeEventsModal() {
|
|
9989
|
-
setEventsOpen(false);
|
|
9990
10012
|
}
|
|
9991
|
-
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
9995
|
-
(
|
|
9996
|
-
|
|
9997
|
-
|
|
9998
|
-
|
|
9999
|
-
return
|
|
10000
|
-
|
|
10001
|
-
|
|
10002
|
-
|
|
10003
|
-
|
|
10004
|
-
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10008
|
-
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
|
|
10020
|
-
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
|
|
10026
|
-
|
|
10027
|
-
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
)
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10042
|
-
|
|
10043
|
-
|
|
10044
|
-
|
|
10045
|
-
|
|
10046
|
-
|
|
10047
|
-
|
|
10048
|
-
|
|
10049
|
-
|
|
10050
|
-
|
|
10051
|
-
|
|
10052
|
-
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
|
|
10056
|
-
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
|
|
10063
|
-
|
|
10064
|
-
|
|
10065
|
-
|
|
10066
|
-
|
|
10067
|
-
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10013
|
+
React.useEffect(() => {
|
|
10014
|
+
if (!refreshing)
|
|
10015
|
+
return;
|
|
10016
|
+
loadMedia();
|
|
10017
|
+
setRefreshing(false);
|
|
10018
|
+
}, [refreshing]);
|
|
10019
|
+
React.useEffect(() => {
|
|
10020
|
+
if (!cms.media.isConfigured)
|
|
10021
|
+
return;
|
|
10022
|
+
if (refreshing)
|
|
10023
|
+
return;
|
|
10024
|
+
loadMedia(loadFolders);
|
|
10025
|
+
if (loadFolders)
|
|
10026
|
+
setLoadFolders(false);
|
|
10027
|
+
return cms.events.subscribe(
|
|
10028
|
+
["media:delete:success", "media:pageSize"],
|
|
10029
|
+
() => {
|
|
10030
|
+
setRefreshing(true);
|
|
10031
|
+
resetOffset();
|
|
10032
|
+
resetList();
|
|
10033
|
+
}
|
|
10034
|
+
);
|
|
10035
|
+
}, [offset, directory, cms.media.isConfigured]);
|
|
10036
|
+
const onClickMediaItem = (item) => {
|
|
10037
|
+
if (!item) {
|
|
10038
|
+
setActiveItem(false);
|
|
10039
|
+
} else if (item.type === "dir") {
|
|
10040
|
+
setDirectory(
|
|
10041
|
+
item.directory === "." || item.directory === "" ? item.filename : join(item.directory, item.filename)
|
|
10042
|
+
);
|
|
10043
|
+
setLoadFolders(true);
|
|
10044
|
+
resetOffset();
|
|
10045
|
+
resetList();
|
|
10046
|
+
setActiveItem(false);
|
|
10047
|
+
} else {
|
|
10048
|
+
setActiveItem(item);
|
|
10049
|
+
}
|
|
10050
|
+
};
|
|
10051
|
+
let deleteMediaItem;
|
|
10052
|
+
if (allowDelete) {
|
|
10053
|
+
deleteMediaItem = async (item) => {
|
|
10054
|
+
await cms.media.delete(item);
|
|
10055
|
+
};
|
|
10056
|
+
}
|
|
10057
|
+
let selectMediaItem;
|
|
10058
|
+
if (onSelect) {
|
|
10059
|
+
selectMediaItem = (item) => {
|
|
10060
|
+
onSelect(item);
|
|
10061
|
+
if (close2)
|
|
10062
|
+
close2();
|
|
10063
|
+
};
|
|
10064
|
+
}
|
|
10065
|
+
const [uploading, setUploading] = React.useState(false);
|
|
10066
|
+
const accept = Array.isArray(
|
|
10067
|
+
(_c = (_b = (_a = cms.api.tina.schema.schema) == null ? void 0 : _a.config) == null ? void 0 : _b.media) == null ? void 0 : _c.accept
|
|
10068
|
+
) ? (_f = (_e = (_d = cms.api.tina.schema.schema) == null ? void 0 : _d.config) == null ? void 0 : _e.media) == null ? void 0 : _f.accept.join(",") : (_i = (_h = (_g = cms.api.tina.schema.schema) == null ? void 0 : _g.config) == null ? void 0 : _h.media) == null ? void 0 : _i.accept;
|
|
10069
|
+
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
|
10070
|
+
accept: dropzoneAcceptFromString(
|
|
10071
|
+
accept || cms.media.accept || DEFAULT_MEDIA_UPLOAD_TYPES
|
|
10072
|
+
),
|
|
10073
|
+
maxSize: cms.media.maxSize,
|
|
10074
|
+
multiple: true,
|
|
10075
|
+
onDrop: async (files, fileRejections) => {
|
|
10076
|
+
try {
|
|
10077
|
+
setUploading(true);
|
|
10078
|
+
const mediaItems = await cms.media.persist(
|
|
10079
|
+
files.map((file) => {
|
|
10080
|
+
return {
|
|
10081
|
+
directory: directory || "/",
|
|
10082
|
+
file
|
|
10083
|
+
};
|
|
10084
|
+
})
|
|
10085
|
+
);
|
|
10086
|
+
const errorCodes = {
|
|
10087
|
+
"file-invalid-type": "Invalid file type",
|
|
10088
|
+
"file-too-large": "File too large",
|
|
10089
|
+
"file-too-small": "File too small",
|
|
10090
|
+
"too-many-files": "Too many files"
|
|
10091
|
+
};
|
|
10092
|
+
const printError = (error) => {
|
|
10093
|
+
const message = errorCodes[error.code];
|
|
10094
|
+
if (message) {
|
|
10095
|
+
return message;
|
|
10072
10096
|
}
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
|
|
10097
|
+
console.error(error);
|
|
10098
|
+
return "Unknown error";
|
|
10099
|
+
};
|
|
10100
|
+
if (fileRejections.length > 0) {
|
|
10101
|
+
const messages = [];
|
|
10102
|
+
fileRejections.map((fileRejection) => {
|
|
10103
|
+
messages.push(
|
|
10104
|
+
`${fileRejection.file.name}: ${fileRejection.errors.map((error) => printError(error)).join(", ")}`
|
|
10105
|
+
);
|
|
10106
|
+
});
|
|
10107
|
+
cms.alerts.error(() => {
|
|
10108
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, "Upload Failed. ", /* @__PURE__ */ React.createElement("br", null), messages.join(". "), ".");
|
|
10109
|
+
});
|
|
10081
10110
|
}
|
|
10082
|
-
|
|
10083
|
-
|
|
10084
|
-
|
|
10085
|
-
|
|
10086
|
-
|
|
10087
|
-
|
|
10088
|
-
|
|
10089
|
-
|
|
10090
|
-
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
{
|
|
10096
|
-
RenderNavCollection,
|
|
10097
|
-
collections: contentCollections
|
|
10111
|
+
if (mediaItems.length !== 0) {
|
|
10112
|
+
setActiveItem(mediaItems[0]);
|
|
10113
|
+
setList((mediaList) => {
|
|
10114
|
+
return {
|
|
10115
|
+
items: [
|
|
10116
|
+
// all the newly added items are new
|
|
10117
|
+
...mediaItems.map((x) => ({ ...x, new: true })),
|
|
10118
|
+
...mediaList.items
|
|
10119
|
+
],
|
|
10120
|
+
nextOffset: mediaList.nextOffset
|
|
10121
|
+
};
|
|
10122
|
+
});
|
|
10123
|
+
}
|
|
10124
|
+
} catch {
|
|
10098
10125
|
}
|
|
10099
|
-
|
|
10100
|
-
|
|
10101
|
-
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
|
|
10106
|
-
|
|
10107
|
-
|
|
10126
|
+
setUploading(false);
|
|
10127
|
+
}
|
|
10128
|
+
});
|
|
10129
|
+
const { onClick, ...rootProps } = getRootProps();
|
|
10130
|
+
function disableScrollBody() {
|
|
10131
|
+
const body = document == null ? void 0 : document.body;
|
|
10132
|
+
body.style.overflow = "hidden";
|
|
10133
|
+
return () => {
|
|
10134
|
+
body.style.overflow = "auto";
|
|
10135
|
+
};
|
|
10136
|
+
}
|
|
10137
|
+
React.useEffect(disableScrollBody, []);
|
|
10138
|
+
const loaderRef = React.useRef(null);
|
|
10139
|
+
React.useEffect(() => {
|
|
10140
|
+
const observer = new IntersectionObserver((entries) => {
|
|
10141
|
+
const target = entries[0];
|
|
10142
|
+
if (target.isIntersecting && list.nextOffset) {
|
|
10143
|
+
setOffsetHistory((offsetHistory2) => [
|
|
10144
|
+
...offsetHistory2,
|
|
10145
|
+
list.nextOffset
|
|
10146
|
+
]);
|
|
10108
10147
|
}
|
|
10109
|
-
)
|
|
10110
|
-
|
|
10111
|
-
|
|
10112
|
-
|
|
10113
|
-
|
|
10148
|
+
});
|
|
10149
|
+
if (loaderRef.current) {
|
|
10150
|
+
observer.observe(loaderRef.current);
|
|
10151
|
+
}
|
|
10152
|
+
return () => {
|
|
10153
|
+
if (loaderRef.current) {
|
|
10154
|
+
observer.unobserve(loaderRef.current);
|
|
10114
10155
|
}
|
|
10115
|
-
}
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
};
|
|
10120
|
-
const CollectionsList = ({
|
|
10121
|
-
collections,
|
|
10122
|
-
RenderNavCollection
|
|
10123
|
-
}) => {
|
|
10124
|
-
if (collections.length === 0) {
|
|
10125
|
-
return /* @__PURE__ */ React__namespace.createElement("div", null, "No collections found");
|
|
10156
|
+
};
|
|
10157
|
+
}, [list.nextOffset, loaderRef.current]);
|
|
10158
|
+
if (listState === "loading" && !((_j = list == null ? void 0 : list.items) == null ? void 0 : _j.length) || uploading) {
|
|
10159
|
+
return /* @__PURE__ */ React.createElement(LoadingMediaList, null);
|
|
10126
10160
|
}
|
|
10127
|
-
|
|
10128
|
-
return /* @__PURE__ */
|
|
10129
|
-
|
|
10130
|
-
|
|
10131
|
-
|
|
10132
|
-
|
|
10133
|
-
|
|
10134
|
-
"button",
|
|
10135
|
-
{
|
|
10136
|
-
className: "text-base tracking-wide text-gray-500 hover:text-blue-600 flex items-center opacity-90 hover:opacity-100",
|
|
10137
|
-
onClick: () => {
|
|
10138
|
-
setOpen(true);
|
|
10161
|
+
if (listState === "not-configured") {
|
|
10162
|
+
return /* @__PURE__ */ React.createElement(
|
|
10163
|
+
DocsLink,
|
|
10164
|
+
{
|
|
10165
|
+
title: "No Media Store Configured",
|
|
10166
|
+
message: "To use the media manager, you need to configure a Media Store.",
|
|
10167
|
+
docsLink: "https://tina.io/docs/reference/media/overview/"
|
|
10139
10168
|
}
|
|
10140
|
-
|
|
10141
|
-
|
|
10142
|
-
|
|
10143
|
-
|
|
10144
|
-
|
|
10145
|
-
|
|
10146
|
-
|
|
10147
|
-
|
|
10148
|
-
|
|
10149
|
-
|
|
10150
|
-
|
|
10151
|
-
|
|
10152
|
-
|
|
10153
|
-
|
|
10154
|
-
React__namespace.useEffect(() => {
|
|
10155
|
-
const handleMouseUp = () => setResizingSidebar(false);
|
|
10156
|
-
window.addEventListener("mouseup", handleMouseUp);
|
|
10157
|
-
return () => {
|
|
10158
|
-
window.removeEventListener("mouseup", handleMouseUp);
|
|
10159
|
-
};
|
|
10160
|
-
}, []);
|
|
10161
|
-
React__namespace.useEffect(() => {
|
|
10162
|
-
const handleMouseMove = (e) => {
|
|
10163
|
-
setSidebarWidth((sidebarWidth) => {
|
|
10164
|
-
const newWidth = sidebarWidth + e.movementX;
|
|
10165
|
-
const maxWidth = window.innerWidth - 8;
|
|
10166
|
-
if (newWidth < minSidebarWidth) {
|
|
10167
|
-
return minSidebarWidth;
|
|
10168
|
-
} else if (newWidth > maxWidth) {
|
|
10169
|
-
return maxWidth;
|
|
10170
|
-
} else {
|
|
10171
|
-
return newWidth;
|
|
10169
|
+
);
|
|
10170
|
+
}
|
|
10171
|
+
if (listState === "error") {
|
|
10172
|
+
const { title, message, docsLink } = listError;
|
|
10173
|
+
return /* @__PURE__ */ React.createElement(DocsLink, { title, message, docsLink });
|
|
10174
|
+
}
|
|
10175
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, deleteModalOpen && /* @__PURE__ */ React.createElement(
|
|
10176
|
+
DeleteModal$1,
|
|
10177
|
+
{
|
|
10178
|
+
filename: activeItem ? activeItem.filename : "",
|
|
10179
|
+
deleteFunc: async () => {
|
|
10180
|
+
if (activeItem) {
|
|
10181
|
+
await deleteMediaItem(activeItem);
|
|
10182
|
+
setActiveItem(false);
|
|
10172
10183
|
}
|
|
10173
|
-
}
|
|
10174
|
-
|
|
10175
|
-
if (resizingSidebar) {
|
|
10176
|
-
window.addEventListener("mousemove", handleMouseMove);
|
|
10177
|
-
document.body.classList.add("select-none");
|
|
10184
|
+
},
|
|
10185
|
+
close: () => setDeleteModalOpen(false)
|
|
10178
10186
|
}
|
|
10179
|
-
|
|
10180
|
-
|
|
10181
|
-
document.body.classList.remove("select-none");
|
|
10182
|
-
};
|
|
10183
|
-
}, [resizingSidebar]);
|
|
10184
|
-
const handleresizingSidebar = () => setResizingSidebar(true);
|
|
10185
|
-
if (fullscreen) {
|
|
10186
|
-
return null;
|
|
10187
|
-
}
|
|
10188
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
10189
|
-
"div",
|
|
10187
|
+
), newFolderModalOpen && /* @__PURE__ */ React.createElement(
|
|
10188
|
+
NewFolderModal,
|
|
10190
10189
|
{
|
|
10191
|
-
|
|
10192
|
-
|
|
10193
|
-
|
|
10190
|
+
onSubmit: (name) => {
|
|
10191
|
+
setDirectory((oldDir) => {
|
|
10192
|
+
if (oldDir) {
|
|
10193
|
+
return join(oldDir, name);
|
|
10194
|
+
} else {
|
|
10195
|
+
return name;
|
|
10196
|
+
}
|
|
10197
|
+
});
|
|
10198
|
+
resetOffset();
|
|
10199
|
+
resetList();
|
|
10200
|
+
},
|
|
10201
|
+
close: () => setNewFolderModalOpen(false)
|
|
10202
|
+
}
|
|
10203
|
+
), /* @__PURE__ */ React.createElement(MediaPickerWrap, null, /* @__PURE__ */ React.createElement(SyncStatusContainer, null, /* @__PURE__ */ React.createElement("div", { className: "flex flex-wrap items-center bg-gray-50 border-b border-gray-150 gap-4 py-3 px-5 shadow-sm flex-shrink-0" }, /* @__PURE__ */ React.createElement("div", { className: "flex flex-1 items-center gap-4" }, /* @__PURE__ */ React.createElement(ViewModeToggle, { viewMode, setViewMode }), /* @__PURE__ */ React.createElement(
|
|
10204
|
+
Breadcrumb$1,
|
|
10205
|
+
{
|
|
10206
|
+
directory,
|
|
10207
|
+
setDirectory: (dir) => {
|
|
10208
|
+
setDirectory(dir);
|
|
10209
|
+
setLoadFolders(true);
|
|
10210
|
+
resetOffset();
|
|
10211
|
+
resetList();
|
|
10212
|
+
setActiveItem(false);
|
|
10213
|
+
}
|
|
10214
|
+
}
|
|
10215
|
+
)), cms.media.store.isStatic ? null : /* @__PURE__ */ React.createElement("div", { className: "flex flex-wrap items-center gap-4" }, /* @__PURE__ */ React.createElement(
|
|
10216
|
+
Button$1,
|
|
10217
|
+
{
|
|
10218
|
+
busy: false,
|
|
10219
|
+
variant: "white",
|
|
10220
|
+
onClick: () => {
|
|
10221
|
+
setRefreshing(true);
|
|
10222
|
+
resetOffset();
|
|
10223
|
+
resetList();
|
|
10224
|
+
setActiveItem(false);
|
|
10225
|
+
},
|
|
10226
|
+
className: "whitespace-nowrap"
|
|
10194
10227
|
},
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
item,
|
|
10200
|
-
depth,
|
|
10201
|
-
setActiveFormId
|
|
10202
|
-
}) => {
|
|
10203
|
-
const cms = useCMS();
|
|
10204
|
-
const depths = ["pl-6", "pl-10", "pl-14"];
|
|
10205
|
-
const form = React__namespace.useMemo(
|
|
10206
|
-
() => cms.state.forms.find(({ tinaForm }) => item.formId === tinaForm.id),
|
|
10207
|
-
[item.formId]
|
|
10208
|
-
);
|
|
10209
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
10210
|
-
"button",
|
|
10228
|
+
"Refresh",
|
|
10229
|
+
/* @__PURE__ */ React.createElement(IoMdRefresh, { className: "w-6 h-full ml-2 opacity-70 text-blue-500" })
|
|
10230
|
+
), /* @__PURE__ */ React.createElement(
|
|
10231
|
+
Button$1,
|
|
10211
10232
|
{
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
onClick: () =>
|
|
10215
|
-
|
|
10233
|
+
busy: false,
|
|
10234
|
+
variant: "white",
|
|
10235
|
+
onClick: () => {
|
|
10236
|
+
setNewFolderModalOpen(true);
|
|
10237
|
+
},
|
|
10238
|
+
className: "whitespace-nowrap"
|
|
10216
10239
|
},
|
|
10217
|
-
|
|
10218
|
-
/* @__PURE__ */
|
|
10219
|
-
)
|
|
10220
|
-
|
|
10221
|
-
const FormListItem = ({
|
|
10222
|
-
item,
|
|
10223
|
-
depth,
|
|
10224
|
-
setActiveFormId
|
|
10225
|
-
}) => {
|
|
10226
|
-
var _a;
|
|
10227
|
-
return /* @__PURE__ */ React__namespace.createElement("div", { className: "divide-y divide-gray-200" }, /* @__PURE__ */ React__namespace.createElement(Item, { setActiveFormId, item, depth }), item.subItems && /* @__PURE__ */ React__namespace.createElement("ul", { className: "divide-y divide-gray-200" }, (_a = item.subItems) == null ? void 0 : _a.map((subItem) => {
|
|
10228
|
-
if (subItem.type === "document") {
|
|
10229
|
-
return /* @__PURE__ */ React__namespace.createElement("li", { key: subItem.formId }, /* @__PURE__ */ React__namespace.createElement(
|
|
10230
|
-
Item,
|
|
10231
|
-
{
|
|
10232
|
-
setActiveFormId,
|
|
10233
|
-
depth: depth + 1,
|
|
10234
|
-
item: subItem
|
|
10235
|
-
}
|
|
10236
|
-
));
|
|
10237
|
-
}
|
|
10238
|
-
})));
|
|
10239
|
-
};
|
|
10240
|
-
const FormLists = (props) => {
|
|
10241
|
-
const cms = useCMS();
|
|
10242
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
10243
|
-
react.Transition,
|
|
10240
|
+
"New Folder",
|
|
10241
|
+
/* @__PURE__ */ React.createElement(BiFolder, { className: "w-6 h-full ml-2 opacity-70 text-blue-500" })
|
|
10242
|
+
), /* @__PURE__ */ React.createElement(UploadButton, { onClick, uploading }))), /* @__PURE__ */ React.createElement("div", { className: "flex h-full overflow-hidden bg-white" }, /* @__PURE__ */ React.createElement("div", { className: "flex w-full flex-col h-full @container" }, /* @__PURE__ */ React.createElement(
|
|
10243
|
+
"ul",
|
|
10244
10244
|
{
|
|
10245
|
-
|
|
10246
|
-
|
|
10247
|
-
as: "div",
|
|
10248
|
-
enter: "transition-all ease-out duration-150",
|
|
10249
|
-
enterFrom: "opacity-0 -translate-x-1/2",
|
|
10250
|
-
enterTo: "opacity-100",
|
|
10251
|
-
leave: "transition-all ease-out duration-150",
|
|
10252
|
-
leaveFrom: "opacity-100",
|
|
10253
|
-
leaveTo: "opacity-0 -translate-x-1/2"
|
|
10245
|
+
...rootProps,
|
|
10246
|
+
className: `h-full grow overflow-y-auto transition duration-150 ease-out bg-gradient-to-b from-gray-50/50 to-gray-50 ${list.items.length === 0 || viewMode === "list" && "w-full flex flex-1 flex-col justify-start -mb-px"} ${list.items.length > 0 && viewMode === "grid" && "w-full p-4 gap-4 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 4xl:grid-cols-6 6xl:grid-cols-9 auto-rows-auto content-start justify-start"} ${isDragActive ? `border-2 border-blue-500 rounded-lg` : ``}`
|
|
10254
10247
|
},
|
|
10255
|
-
|
|
10256
|
-
|
|
10248
|
+
/* @__PURE__ */ React.createElement("input", { ...getInputProps() }),
|
|
10249
|
+
listState === "loaded" && list.items.length === 0 && /* @__PURE__ */ React.createElement(EmptyMediaList, null),
|
|
10250
|
+
viewMode === "list" && list.items.map((item) => /* @__PURE__ */ React.createElement(
|
|
10251
|
+
ListMediaItem,
|
|
10257
10252
|
{
|
|
10258
|
-
|
|
10259
|
-
|
|
10260
|
-
|
|
10261
|
-
|
|
10262
|
-
formList
|
|
10263
|
-
}
|
|
10264
|
-
)))
|
|
10265
|
-
);
|
|
10266
|
-
};
|
|
10267
|
-
const FormList = (props) => {
|
|
10268
|
-
const cms = useCMS();
|
|
10269
|
-
const listItems = React__namespace.useMemo(() => {
|
|
10270
|
-
var _a;
|
|
10271
|
-
const orderedListItems = [];
|
|
10272
|
-
const globalItems = [];
|
|
10273
|
-
const topItems = [];
|
|
10274
|
-
props.formList.items.forEach((item) => {
|
|
10275
|
-
if (item.type === "document") {
|
|
10276
|
-
const form = cms.state.forms.find(
|
|
10277
|
-
({ tinaForm }) => tinaForm.id === item.formId
|
|
10278
|
-
);
|
|
10279
|
-
if (form.tinaForm.global) {
|
|
10280
|
-
globalItems.push(item);
|
|
10281
|
-
} else {
|
|
10282
|
-
orderedListItems.push(item);
|
|
10283
|
-
}
|
|
10284
|
-
} else {
|
|
10285
|
-
orderedListItems.push(item);
|
|
10253
|
+
key: item.id,
|
|
10254
|
+
item,
|
|
10255
|
+
onClick: onClickMediaItem,
|
|
10256
|
+
active: activeItem && activeItem.id === item.id
|
|
10286
10257
|
}
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
}
|
|
10291
|
-
let extra = [];
|
|
10292
|
-
if (globalItems.length) {
|
|
10293
|
-
extra = [{ type: "list", label: "Global Documents" }, ...globalItems];
|
|
10294
|
-
}
|
|
10295
|
-
return [...topItems, ...orderedListItems, ...extra];
|
|
10296
|
-
}, [JSON.stringify(props.formList.items)]);
|
|
10297
|
-
return /* @__PURE__ */ React__namespace.createElement("ul", null, /* @__PURE__ */ React__namespace.createElement("li", { className: "divide-y divide-gray-200" }, listItems.map((item, index) => {
|
|
10298
|
-
if (item.type === "list") {
|
|
10299
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
10300
|
-
"div",
|
|
10301
|
-
{
|
|
10302
|
-
key: item.label,
|
|
10303
|
-
className: `relative group text-left w-full bg-white shadow-sm
|
|
10304
|
-
border-gray-100 px-6 -mt-px pb-3 ${index > 0 ? "pt-6 bg-gradient-to-b from-gray-50 via-white to-white" : "pt-3"}`
|
|
10305
|
-
},
|
|
10306
|
-
/* @__PURE__ */ React__namespace.createElement(
|
|
10307
|
-
"span",
|
|
10308
|
-
{
|
|
10309
|
-
className: "text-sm tracking-wide font-bold text-gray-700 uppercase"
|
|
10310
|
-
},
|
|
10311
|
-
item.label
|
|
10312
|
-
)
|
|
10313
|
-
);
|
|
10314
|
-
}
|
|
10315
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
10316
|
-
FormListItem,
|
|
10258
|
+
)),
|
|
10259
|
+
viewMode === "grid" && list.items.map((item) => /* @__PURE__ */ React.createElement(
|
|
10260
|
+
GridMediaItem,
|
|
10317
10261
|
{
|
|
10318
|
-
|
|
10319
|
-
key: item.formId,
|
|
10262
|
+
key: item.id,
|
|
10320
10263
|
item,
|
|
10321
|
-
|
|
10264
|
+
onClick: onClickMediaItem,
|
|
10265
|
+
active: activeItem && activeItem.id === item.id
|
|
10322
10266
|
}
|
|
10323
|
-
)
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
"div",
|
|
10328
|
-
{
|
|
10329
|
-
className: "relative flex flex-col items-center justify-center text-center p-5 pb-16 w-full h-full overflow-y-auto",
|
|
10330
|
-
style: {
|
|
10331
|
-
animationName: "fade-in",
|
|
10332
|
-
animationDelay: "300ms",
|
|
10333
|
-
animationTimingFunction: "ease-out",
|
|
10334
|
-
animationIterationCount: 1,
|
|
10335
|
-
animationFillMode: "both",
|
|
10336
|
-
animationDuration: "150ms"
|
|
10337
|
-
}
|
|
10338
|
-
},
|
|
10339
|
-
/* @__PURE__ */ React__namespace.createElement("p", { className: "block pb-5" }, "Looks like there's ", /* @__PURE__ */ React__namespace.createElement("br", null), "nothing to edit on ", /* @__PURE__ */ React__namespace.createElement("br", null), "this page."),
|
|
10340
|
-
/* @__PURE__ */ React__namespace.createElement("p", { className: "block pt-5" }, /* @__PURE__ */ React__namespace.createElement(
|
|
10341
|
-
Button$1,
|
|
10342
|
-
{
|
|
10343
|
-
href: "https://tina.io/docs/contextual-editing/overview",
|
|
10344
|
-
target: "_blank",
|
|
10345
|
-
as: "a"
|
|
10346
|
-
},
|
|
10347
|
-
/* @__PURE__ */ React__namespace.createElement(Emoji$1, { className: "mr-1.5" }, "📖"),
|
|
10348
|
-
" Contextual Editing Docs"
|
|
10349
|
-
))
|
|
10350
|
-
);
|
|
10351
|
-
const Emoji$1 = ({ className = "", ...props }) => /* @__PURE__ */ React__namespace.createElement(
|
|
10352
|
-
"span",
|
|
10353
|
-
{
|
|
10354
|
-
className: `text-[24px] leading-none inline-block ${className}`,
|
|
10355
|
-
...props
|
|
10356
|
-
}
|
|
10357
|
-
);
|
|
10358
|
-
const minimumTimeToShowLoadingIndicator = 1e3;
|
|
10359
|
-
const FormsView = ({ loadingPlaceholder } = {}) => {
|
|
10360
|
-
const cms = useCMS$1();
|
|
10361
|
-
const { setFormIsPristine } = React__namespace.useContext(SidebarContext);
|
|
10362
|
-
const [isShowingLoading, setIsShowingLoading] = React__namespace.useState(true);
|
|
10363
|
-
const [initialLoadComplete, setInitialLoadComplete] = React__namespace.useState(false);
|
|
10364
|
-
React__namespace.useEffect(() => {
|
|
10365
|
-
if (cms.state.isLoadingContent) {
|
|
10366
|
-
setIsShowingLoading(true);
|
|
10367
|
-
const timer = setTimeout(() => {
|
|
10368
|
-
if (!cms.state.isLoadingContent) {
|
|
10369
|
-
setIsShowingLoading(false);
|
|
10370
|
-
setInitialLoadComplete(true);
|
|
10371
|
-
}
|
|
10372
|
-
}, minimumTimeToShowLoadingIndicator);
|
|
10373
|
-
return () => clearTimeout(timer);
|
|
10374
|
-
} else {
|
|
10375
|
-
const timer = setTimeout(() => {
|
|
10376
|
-
setIsShowingLoading(false);
|
|
10377
|
-
setInitialLoadComplete(true);
|
|
10378
|
-
}, minimumTimeToShowLoadingIndicator);
|
|
10379
|
-
return () => clearTimeout(timer);
|
|
10380
|
-
}
|
|
10381
|
-
}, [cms.state.isLoadingContent]);
|
|
10382
|
-
if (isShowingLoading || !initialLoadComplete) {
|
|
10383
|
-
const LoadingPlaceholder = loadingPlaceholder || SidebarLoadingPlaceholder;
|
|
10384
|
-
return /* @__PURE__ */ React__namespace.createElement(LoadingPlaceholder, null);
|
|
10385
|
-
}
|
|
10386
|
-
if (!cms.state.formLists.length) {
|
|
10387
|
-
return /* @__PURE__ */ React__namespace.createElement(SidebarNoFormsPlaceholder, null);
|
|
10388
|
-
}
|
|
10389
|
-
const isMultiform = cms.state.forms.length > 1;
|
|
10390
|
-
const activeForm = cms.state.forms.find(
|
|
10391
|
-
({ tinaForm }) => tinaForm.id === cms.state.activeFormId
|
|
10392
|
-
);
|
|
10393
|
-
const isEditing = !!activeForm;
|
|
10394
|
-
if (isMultiform && !activeForm) {
|
|
10395
|
-
return /* @__PURE__ */ React__namespace.createElement(FormLists, { isEditing });
|
|
10396
|
-
}
|
|
10397
|
-
const formMetas = cms.plugins.all("form:meta");
|
|
10398
|
-
return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, activeForm && /* @__PURE__ */ React__namespace.createElement(FormWrapper$1, { isEditing, isMultiform }, isMultiform && /* @__PURE__ */ React__namespace.createElement(MultiformFormHeader, { activeForm }), !isMultiform && /* @__PURE__ */ React__namespace.createElement(FormHeader, { activeForm }), formMetas == null ? void 0 : formMetas.map((meta) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, { key: meta.name }, /* @__PURE__ */ React__namespace.createElement(meta.Component, null))), /* @__PURE__ */ React__namespace.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine })));
|
|
10399
|
-
};
|
|
10400
|
-
const FormWrapper$1 = ({ isEditing, children }) => {
|
|
10401
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
10402
|
-
"div",
|
|
10267
|
+
)),
|
|
10268
|
+
!!list.nextOffset && /* @__PURE__ */ React.createElement(LoadingMediaList, { ref: loaderRef })
|
|
10269
|
+
)), /* @__PURE__ */ React.createElement(
|
|
10270
|
+
ActiveItemPreview,
|
|
10403
10271
|
{
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
animationIterationCount: 1,
|
|
10411
|
-
animationTimingFunction: "ease-out"
|
|
10412
|
-
} : {
|
|
10413
|
-
transform: "translate3d(100%, 0, 0)"
|
|
10272
|
+
activeItem,
|
|
10273
|
+
close: closePreview,
|
|
10274
|
+
selectMediaItem,
|
|
10275
|
+
allowDelete: cms.media.store.isStatic ? false : allowDelete,
|
|
10276
|
+
deleteMediaItem: () => {
|
|
10277
|
+
setDeleteModalOpen(true);
|
|
10414
10278
|
}
|
|
10415
|
-
}
|
|
10416
|
-
|
|
10417
|
-
|
|
10418
|
-
|
|
10419
|
-
|
|
10420
|
-
|
|
10279
|
+
}
|
|
10280
|
+
)))));
|
|
10281
|
+
}
|
|
10282
|
+
const ActiveItemPreview = ({
|
|
10283
|
+
activeItem,
|
|
10284
|
+
close: close2,
|
|
10285
|
+
selectMediaItem,
|
|
10286
|
+
deleteMediaItem,
|
|
10287
|
+
allowDelete
|
|
10421
10288
|
}) => {
|
|
10422
|
-
const
|
|
10423
|
-
|
|
10424
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
10289
|
+
const thumbnail = activeItem ? (activeItem.thumbnails || {})["1000x1000"] : "";
|
|
10290
|
+
return /* @__PURE__ */ React.createElement(
|
|
10425
10291
|
"div",
|
|
10426
10292
|
{
|
|
10427
|
-
className:
|
|
10293
|
+
className: `shrink-0 h-full flex flex-col items-start gap-3 overflow-y-auto bg-white border-l border-gray-100 bg-white shadow-md transition ease-out duration-150 ${activeItem ? `p-4 opacity-100 w-[35%] max-w-[560px] min-w-[240px]` : `translate-x-8 opacity-0 w-[0px]`}`
|
|
10428
10294
|
},
|
|
10429
|
-
/* @__PURE__ */
|
|
10430
|
-
|
|
10295
|
+
activeItem && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "flex grow-0 shrink-0 gap-2 w-full items-center justify-between" }, /* @__PURE__ */ React.createElement("h3", { className: "text-lg text-gray-600 w-full max-w-full break-words block truncate flex-1" }, activeItem.filename), /* @__PURE__ */ React.createElement(
|
|
10296
|
+
IconButton,
|
|
10431
10297
|
{
|
|
10432
|
-
|
|
10433
|
-
className: "
|
|
10434
|
-
onClick:
|
|
10435
|
-
|
|
10436
|
-
|
|
10437
|
-
|
|
10438
|
-
|
|
10439
|
-
|
|
10440
|
-
}
|
|
10298
|
+
variant: "ghost",
|
|
10299
|
+
className: "group grow-0 shrink-0",
|
|
10300
|
+
onClick: close2
|
|
10301
|
+
},
|
|
10302
|
+
/* @__PURE__ */ React.createElement(
|
|
10303
|
+
BiX,
|
|
10304
|
+
{
|
|
10305
|
+
className: `w-7 h-auto text-gray-500 opacity-50 group-hover:opacity-100 transition duration-150 ease-out`
|
|
10441
10306
|
}
|
|
10307
|
+
)
|
|
10308
|
+
)), isImage(thumbnail) ? /* @__PURE__ */ React.createElement("div", { className: "w-full max-h-[75%]" }, /* @__PURE__ */ React.createElement(
|
|
10309
|
+
"img",
|
|
10310
|
+
{
|
|
10311
|
+
className: "block border border-gray-100 rounded-md overflow-hidden object-center object-contain max-w-full max-h-full m-auto shadow",
|
|
10312
|
+
src: thumbnail,
|
|
10313
|
+
alt: activeItem.filename
|
|
10314
|
+
}
|
|
10315
|
+
)) : /* @__PURE__ */ React.createElement("span", { className: "p-3 border border-gray-100 rounded-md overflow-hidden bg-gray-50 shadow" }, /* @__PURE__ */ React.createElement(BiFile, { className: "w-14 h-auto fill-gray-300" })), /* @__PURE__ */ React.createElement("div", { className: "grow h-full w-full shrink flex flex-col gap-3 items-start justify-start" }, /* @__PURE__ */ React.createElement(CopyField, { value: absoluteImgURL(activeItem.src), label: "URL" })), /* @__PURE__ */ React.createElement("div", { className: "shrink-0 w-full flex flex-col justify-end items-start" }, /* @__PURE__ */ React.createElement("div", { className: "flex w-full gap-3" }, selectMediaItem && /* @__PURE__ */ React.createElement(
|
|
10316
|
+
Button$1,
|
|
10317
|
+
{
|
|
10318
|
+
size: "medium",
|
|
10319
|
+
variant: "primary",
|
|
10320
|
+
className: "grow",
|
|
10321
|
+
onClick: () => selectMediaItem(activeItem)
|
|
10442
10322
|
},
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10323
|
+
"Insert",
|
|
10324
|
+
/* @__PURE__ */ React.createElement(BiArrowToBottom, { className: "ml-1 -mr-0.5 w-6 h-auto text-white opacity-70" })
|
|
10325
|
+
), allowDelete && /* @__PURE__ */ React.createElement(
|
|
10326
|
+
Button$1,
|
|
10446
10327
|
{
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
cms.state.activeFormId
|
|
10452
|
-
).name;
|
|
10453
|
-
window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
|
|
10454
|
-
}
|
|
10328
|
+
variant: "white",
|
|
10329
|
+
size: "medium",
|
|
10330
|
+
className: "grow max-w-[40%]",
|
|
10331
|
+
onClick: deleteMediaItem
|
|
10455
10332
|
},
|
|
10456
|
-
|
|
10457
|
-
|
|
10333
|
+
"Delete",
|
|
10334
|
+
/* @__PURE__ */ React.createElement(TrashIcon, { className: "ml-1 -mr-0.5 w-6 h-auto text-red-500 opacity-70" })
|
|
10335
|
+
))))
|
|
10458
10336
|
);
|
|
10459
10337
|
};
|
|
10460
|
-
const
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
const shortFormLabel = activeForm.tinaForm.label ? activeForm.tinaForm.label.replace(/^.*[\\\/]/, "") : false;
|
|
10464
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
10465
|
-
"div",
|
|
10338
|
+
const UploadButton = ({ onClick, uploading }) => {
|
|
10339
|
+
return /* @__PURE__ */ React.createElement(
|
|
10340
|
+
Button$1,
|
|
10466
10341
|
{
|
|
10467
|
-
|
|
10342
|
+
variant: "primary",
|
|
10343
|
+
size: "custom",
|
|
10344
|
+
className: "text-sm h-10 px-6",
|
|
10345
|
+
busy: uploading,
|
|
10346
|
+
onClick
|
|
10468
10347
|
},
|
|
10469
|
-
/* @__PURE__ */
|
|
10470
|
-
|
|
10348
|
+
uploading ? /* @__PURE__ */ React.createElement(LoadingDots, null) : /* @__PURE__ */ React.createElement(React.Fragment, null, "Upload ", /* @__PURE__ */ React.createElement(BiCloudUpload, { className: "w-6 h-full ml-2 opacity-70" }))
|
|
10349
|
+
);
|
|
10350
|
+
};
|
|
10351
|
+
const LoadingMediaList = React.forwardRef(
|
|
10352
|
+
(props, ref) => {
|
|
10353
|
+
const { extraText, ...rest } = props;
|
|
10354
|
+
return /* @__PURE__ */ React.createElement(
|
|
10355
|
+
"div",
|
|
10471
10356
|
{
|
|
10472
|
-
|
|
10473
|
-
className: "
|
|
10474
|
-
|
|
10475
|
-
const collectionName = cms.api.tina.schema.getCollectionByFullPath(
|
|
10476
|
-
cms.state.activeFormId
|
|
10477
|
-
).name;
|
|
10478
|
-
window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
|
|
10479
|
-
}
|
|
10357
|
+
ref,
|
|
10358
|
+
className: "w-full h-full flex flex-col items-center justify-center",
|
|
10359
|
+
...rest
|
|
10480
10360
|
},
|
|
10481
|
-
/* @__PURE__ */
|
|
10482
|
-
|
|
10483
|
-
|
|
10361
|
+
extraText && /* @__PURE__ */ React.createElement("p", null, extraText),
|
|
10362
|
+
/* @__PURE__ */ React.createElement(LoadingDots, { color: "var(--tina-color-primary)" })
|
|
10363
|
+
);
|
|
10364
|
+
}
|
|
10365
|
+
);
|
|
10366
|
+
const MediaPickerWrap = ({ children }) => {
|
|
10367
|
+
return /* @__PURE__ */ React.createElement("div", { className: "h-full flex-1 text-gray-700 flex flex-col relative bg-gray-50 outline-none active:outline-none focus:outline-none" }, children);
|
|
10484
10368
|
};
|
|
10485
|
-
const
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
const
|
|
10489
|
-
const LOCALSTATEKEY = "tina.sidebarState";
|
|
10490
|
-
const LOCALWIDTHKEY = "tina.sidebarWidth";
|
|
10491
|
-
const defaultSidebarWidth = 440;
|
|
10492
|
-
const defaultSidebarPosition = "displace";
|
|
10493
|
-
const defaultSidebarState = "open";
|
|
10494
|
-
function SidebarProvider({
|
|
10495
|
-
position = defaultSidebarPosition,
|
|
10496
|
-
resizingSidebar,
|
|
10497
|
-
setResizingSidebar,
|
|
10498
|
-
defaultWidth = defaultSidebarWidth,
|
|
10499
|
-
sidebar
|
|
10500
|
-
}) {
|
|
10369
|
+
const SyncStatusContext = React.createContext(
|
|
10370
|
+
void 0
|
|
10371
|
+
);
|
|
10372
|
+
const SyncStatusContainer = ({ children }) => {
|
|
10501
10373
|
var _a, _b, _c;
|
|
10502
|
-
|
|
10503
|
-
const
|
|
10504
|
-
|
|
10505
|
-
|
|
10506
|
-
|
|
10507
|
-
|
|
10508
|
-
|
|
10509
|
-
|
|
10510
|
-
|
|
10511
|
-
|
|
10512
|
-
|
|
10513
|
-
renderNav: (
|
|
10514
|
-
// @ts-ignore
|
|
10515
|
-
typeof ((_c = cms == null ? void 0 : cms.sidebar) == null ? void 0 : _c.renderNav) !== "undefined" ? (
|
|
10516
|
-
// @ts-ignore
|
|
10517
|
-
cms.sidebar.renderNav
|
|
10518
|
-
) : true
|
|
10519
|
-
),
|
|
10520
|
-
sidebar
|
|
10521
|
-
}
|
|
10522
|
-
);
|
|
10523
|
-
}
|
|
10524
|
-
const useFetchCollections = (cms) => {
|
|
10525
|
-
return { collections: cms.api.admin.fetchCollections(), loading: false };
|
|
10526
|
-
};
|
|
10527
|
-
const Sidebar$1 = ({
|
|
10528
|
-
sidebar,
|
|
10529
|
-
defaultWidth,
|
|
10530
|
-
// defaultState,
|
|
10531
|
-
position,
|
|
10532
|
-
renderNav,
|
|
10533
|
-
resizingSidebar,
|
|
10534
|
-
setResizingSidebar
|
|
10535
|
-
}) => {
|
|
10536
|
-
var _a, _b, _c, _d, _e, _f;
|
|
10537
|
-
const cms = useCMS$1();
|
|
10538
|
-
const collectionsInfo = useFetchCollections(cms);
|
|
10539
|
-
const [branchingEnabled, setBranchingEnabled] = React__namespace.useState(
|
|
10540
|
-
() => cms.flags.get("branch-switcher")
|
|
10541
|
-
);
|
|
10542
|
-
React__namespace.useEffect(() => {
|
|
10543
|
-
cms.events.subscribe("flag:set", ({ key, value }) => {
|
|
10544
|
-
if (key === "branch-switcher") {
|
|
10545
|
-
setBranchingEnabled(value);
|
|
10546
|
-
}
|
|
10547
|
-
});
|
|
10548
|
-
}, [cms.events]);
|
|
10549
|
-
const screens = cms.plugins.getType("screen");
|
|
10550
|
-
const cloudConfigs = cms.plugins.getType("cloud-config");
|
|
10551
|
-
useSubscribable(sidebar);
|
|
10552
|
-
useSubscribable(screens);
|
|
10553
|
-
const allScreens = screens.all();
|
|
10554
|
-
const allConfigs = cloudConfigs.all();
|
|
10555
|
-
const [menuIsOpen, setMenuIsOpen] = React.useState(false);
|
|
10556
|
-
const [activeScreen, setActiveView] = React.useState(null);
|
|
10557
|
-
const [sidebarWidth, setSidebarWidth] = React__namespace.useState(defaultWidth);
|
|
10558
|
-
const [formIsPristine, setFormIsPristine] = React__namespace.useState(true);
|
|
10559
|
-
const activeScreens = allScreens.filter(
|
|
10560
|
-
(screen) => {
|
|
10561
|
-
var _a2, _b2;
|
|
10562
|
-
return screen.navCategory !== "Account" || ((_b2 = (_a2 = cms.api.tina) == null ? void 0 : _a2.authProvider) == null ? void 0 : _b2.getLoginStrategy()) === "UsernamePassword";
|
|
10563
|
-
}
|
|
10564
|
-
);
|
|
10565
|
-
const setDisplayState = (value) => cms.dispatch({ type: "sidebar:set-display-state", value });
|
|
10566
|
-
const displayState = cms.state.sidebarDisplayState;
|
|
10567
|
-
React__namespace.useEffect(() => {
|
|
10568
|
-
if (typeof window !== "undefined") {
|
|
10569
|
-
const localSidebarState = window.localStorage.getItem(LOCALSTATEKEY);
|
|
10570
|
-
const localSidebarWidth = window.localStorage.getItem(LOCALWIDTHKEY);
|
|
10571
|
-
if (localSidebarState !== null) {
|
|
10572
|
-
setDisplayState(JSON.parse(localSidebarState));
|
|
10573
|
-
}
|
|
10574
|
-
if (localSidebarWidth !== null) {
|
|
10575
|
-
setSidebarWidth(JSON.parse(localSidebarWidth));
|
|
10374
|
+
const cms = useCMS();
|
|
10375
|
+
const isLocal = cms.api.tina.isLocalMode;
|
|
10376
|
+
const tinaMedia = (_c = (_b = (_a = cms.api.tina.schema.schema) == null ? void 0 : _a.config) == null ? void 0 : _b.media) == null ? void 0 : _c.tina;
|
|
10377
|
+
const hasTinaMedia = !!((tinaMedia == null ? void 0 : tinaMedia.mediaRoot) || (tinaMedia == null ? void 0 : tinaMedia.publicFolder));
|
|
10378
|
+
const doCheckSyncStatus = hasTinaMedia && !isLocal;
|
|
10379
|
+
const [syncStatus, setSyncStatus] = React.useState(doCheckSyncStatus ? "loading" : "synced");
|
|
10380
|
+
React.useEffect(() => {
|
|
10381
|
+
const checkSyncStatus = async () => {
|
|
10382
|
+
if (doCheckSyncStatus) {
|
|
10383
|
+
const project = await cms.api.tina.getProject();
|
|
10384
|
+
setSyncStatus(project.mediaBranch ? "synced" : "needs-sync");
|
|
10576
10385
|
}
|
|
10386
|
+
};
|
|
10387
|
+
if (!cms.media.store.isStatic) {
|
|
10388
|
+
checkSyncStatus();
|
|
10577
10389
|
}
|
|
10578
10390
|
}, []);
|
|
10579
|
-
|
|
10580
|
-
|
|
10581
|
-
const localSidebarState = window.localStorage.getItem(LOCALSTATEKEY);
|
|
10582
|
-
if (localSidebarState === null) {
|
|
10583
|
-
setDisplayState(defaultSidebarState);
|
|
10584
|
-
}
|
|
10585
|
-
}
|
|
10586
|
-
}, [defaultSidebarState]);
|
|
10587
|
-
React__namespace.useEffect(() => {
|
|
10588
|
-
if (typeof window !== "undefined" && cms.enabled) {
|
|
10589
|
-
window.localStorage.setItem(LOCALSTATEKEY, JSON.stringify(displayState));
|
|
10590
|
-
}
|
|
10591
|
-
}, [displayState, cms]);
|
|
10592
|
-
React__namespace.useEffect(() => {
|
|
10593
|
-
if (resizingSidebar) {
|
|
10594
|
-
window.localStorage.setItem(LOCALWIDTHKEY, JSON.stringify(sidebarWidth));
|
|
10595
|
-
}
|
|
10596
|
-
}, [sidebarWidth, resizingSidebar]);
|
|
10597
|
-
const isTinaAdminEnabled = cms.flags.get("tina-admin") === false ? false : true;
|
|
10598
|
-
const contentCreators = isTinaAdminEnabled ? [] : cms.plugins.getType("content-creator").all();
|
|
10599
|
-
const toggleFullscreen = () => {
|
|
10600
|
-
if (displayState === "fullscreen") {
|
|
10601
|
-
setDisplayState("open");
|
|
10602
|
-
} else {
|
|
10603
|
-
setDisplayState("fullscreen");
|
|
10604
|
-
}
|
|
10605
|
-
};
|
|
10606
|
-
const toggleSidebarOpen = () => {
|
|
10607
|
-
cms.dispatch({ type: "toggle-edit-state" });
|
|
10608
|
-
};
|
|
10609
|
-
const toggleMenu = () => {
|
|
10610
|
-
setMenuIsOpen((menuIsOpen2) => !menuIsOpen2);
|
|
10611
|
-
};
|
|
10612
|
-
React__namespace.useEffect(() => {
|
|
10613
|
-
const updateLayout = () => {
|
|
10614
|
-
if (displayState === "fullscreen") {
|
|
10615
|
-
return;
|
|
10616
|
-
}
|
|
10617
|
-
updateBodyDisplacement({
|
|
10618
|
-
position,
|
|
10619
|
-
displayState,
|
|
10620
|
-
sidebarWidth,
|
|
10621
|
-
resizingSidebar
|
|
10622
|
-
});
|
|
10623
|
-
};
|
|
10624
|
-
updateLayout();
|
|
10625
|
-
window.addEventListener("resize", updateLayout);
|
|
10626
|
-
return () => {
|
|
10627
|
-
window.removeEventListener("resize", updateLayout);
|
|
10628
|
-
};
|
|
10629
|
-
}, [displayState, position, sidebarWidth, resizingSidebar]);
|
|
10630
|
-
const windowWidth = windowSize.useWindowWidth();
|
|
10631
|
-
const displayNav = renderNav && (sidebarWidth > navBreakpoint && windowWidth > navBreakpoint || displayState === "fullscreen" && windowWidth > navBreakpoint);
|
|
10632
|
-
const renderMobileNav = renderNav && (sidebarWidth < navBreakpoint + 1 || windowWidth < navBreakpoint + 1);
|
|
10633
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
10634
|
-
SidebarContext.Provider,
|
|
10391
|
+
return syncStatus == "needs-sync" ? /* @__PURE__ */ React.createElement("div", { className: "h-full flex items-center justify-center p-6 bg-gradient-to-t from-gray-200 to-transparent" }, /* @__PURE__ */ React.createElement("div", { className: "rounded-lg border shadow-sm px-4 lg:px-6 py-3 lg:py-4 bg-gradient-to-r from-yellow-50 to-yellow-100 border-yellow-200 mx-auto mb-12" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-start sm:items-center gap-2" }, /* @__PURE__ */ React.createElement(
|
|
10392
|
+
BiError,
|
|
10635
10393
|
{
|
|
10636
|
-
|
|
10637
|
-
sidebarWidth,
|
|
10638
|
-
setSidebarWidth,
|
|
10639
|
-
displayState,
|
|
10640
|
-
setDisplayState,
|
|
10641
|
-
position,
|
|
10642
|
-
toggleFullscreen,
|
|
10643
|
-
toggleSidebarOpen,
|
|
10644
|
-
resizingSidebar,
|
|
10645
|
-
setResizingSidebar,
|
|
10646
|
-
menuIsOpen,
|
|
10647
|
-
setMenuIsOpen,
|
|
10648
|
-
toggleMenu,
|
|
10649
|
-
setActiveView,
|
|
10650
|
-
formIsPristine,
|
|
10651
|
-
setFormIsPristine
|
|
10652
|
-
}
|
|
10653
|
-
},
|
|
10654
|
-
/* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(SidebarWrapper, null, /* @__PURE__ */ React__namespace.createElement(EditButton, null), displayNav && /* @__PURE__ */ React__namespace.createElement(
|
|
10655
|
-
Nav,
|
|
10656
|
-
{
|
|
10657
|
-
isLocalMode: (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode,
|
|
10658
|
-
showCollections: isTinaAdminEnabled,
|
|
10659
|
-
collectionsInfo,
|
|
10660
|
-
screens: activeScreens,
|
|
10661
|
-
cloudConfigs: allConfigs,
|
|
10662
|
-
contentCreators,
|
|
10663
|
-
sidebarWidth,
|
|
10664
|
-
RenderNavSite: ({ view }) => /* @__PURE__ */ React__namespace.createElement(
|
|
10665
|
-
SidebarSiteLink,
|
|
10666
|
-
{
|
|
10667
|
-
view,
|
|
10668
|
-
onClick: () => {
|
|
10669
|
-
setActiveView(view);
|
|
10670
|
-
setMenuIsOpen(false);
|
|
10671
|
-
}
|
|
10672
|
-
}
|
|
10673
|
-
),
|
|
10674
|
-
RenderNavCloud: ({ config }) => /* @__PURE__ */ React__namespace.createElement(SidebarCloudLink$1, { config }),
|
|
10675
|
-
RenderNavCollection: ({ collection }) => /* @__PURE__ */ React__namespace.createElement(
|
|
10676
|
-
SidebarCollectionLink,
|
|
10677
|
-
{
|
|
10678
|
-
onClick: () => {
|
|
10679
|
-
setMenuIsOpen(false);
|
|
10680
|
-
},
|
|
10681
|
-
collection
|
|
10682
|
-
}
|
|
10683
|
-
),
|
|
10684
|
-
AuthRenderNavCollection: ({ collection }) => /* @__PURE__ */ React__namespace.createElement(
|
|
10685
|
-
SidebarCollectionLink,
|
|
10686
|
-
{
|
|
10687
|
-
onClick: () => {
|
|
10688
|
-
setMenuIsOpen(false);
|
|
10689
|
-
},
|
|
10690
|
-
collection,
|
|
10691
|
-
Icon: ImUsers
|
|
10692
|
-
}
|
|
10693
|
-
)
|
|
10694
|
-
}
|
|
10695
|
-
), /* @__PURE__ */ React__namespace.createElement(SidebarBody, null, /* @__PURE__ */ React__namespace.createElement(
|
|
10696
|
-
SidebarHeader,
|
|
10697
|
-
{
|
|
10698
|
-
displayNav,
|
|
10699
|
-
renderNav,
|
|
10700
|
-
isLocalMode: (_d = (_c = cms.api) == null ? void 0 : _c.tina) == null ? void 0 : _d.isLocalMode,
|
|
10701
|
-
branchingEnabled
|
|
10702
|
-
}
|
|
10703
|
-
), /* @__PURE__ */ React__namespace.createElement(FormsView, { loadingPlaceholder: sidebar.loadingPlaceholder }), activeScreen && /* @__PURE__ */ React__namespace.createElement(
|
|
10704
|
-
ScreenPluginModal,
|
|
10705
|
-
{
|
|
10706
|
-
screen: activeScreen,
|
|
10707
|
-
close: () => setActiveView(null)
|
|
10708
|
-
}
|
|
10709
|
-
)), /* @__PURE__ */ React__namespace.createElement(ResizeHandle, null)), renderMobileNav && /* @__PURE__ */ React__namespace.createElement(react.Transition, { show: menuIsOpen, as: "div" }, /* @__PURE__ */ React__namespace.createElement(
|
|
10710
|
-
react.TransitionChild,
|
|
10711
|
-
{
|
|
10712
|
-
enter: "transform transition-all ease-out duration-300",
|
|
10713
|
-
enterFrom: "opacity-0 -translate-x-full",
|
|
10714
|
-
enterTo: "opacity-100 translate-x-0",
|
|
10715
|
-
leave: "transform transition-all ease-in duration-200",
|
|
10716
|
-
leaveFrom: "opacity-100 translate-x-0",
|
|
10717
|
-
leaveTo: "opacity-0 -translate-x-full"
|
|
10718
|
-
},
|
|
10719
|
-
/* @__PURE__ */ React__namespace.createElement("div", { className: "fixed left-0 top-0 z-overlay h-full transform" }, /* @__PURE__ */ React__namespace.createElement(
|
|
10720
|
-
Nav,
|
|
10721
|
-
{
|
|
10722
|
-
isLocalMode: (_f = (_e = cms.api) == null ? void 0 : _e.tina) == null ? void 0 : _f.isLocalMode,
|
|
10723
|
-
className: "rounded-r-md",
|
|
10724
|
-
showCollections: isTinaAdminEnabled,
|
|
10725
|
-
collectionsInfo,
|
|
10726
|
-
screens: activeScreens,
|
|
10727
|
-
cloudConfigs: allConfigs,
|
|
10728
|
-
contentCreators,
|
|
10729
|
-
sidebarWidth,
|
|
10730
|
-
RenderNavSite: ({ view }) => /* @__PURE__ */ React__namespace.createElement(
|
|
10731
|
-
SidebarSiteLink,
|
|
10732
|
-
{
|
|
10733
|
-
view,
|
|
10734
|
-
onClick: () => {
|
|
10735
|
-
setActiveView(view);
|
|
10736
|
-
setMenuIsOpen(false);
|
|
10737
|
-
}
|
|
10738
|
-
}
|
|
10739
|
-
),
|
|
10740
|
-
RenderNavCloud: ({ config }) => /* @__PURE__ */ React__namespace.createElement(SidebarCloudLink$1, { config }),
|
|
10741
|
-
RenderNavCollection: ({ collection }) => /* @__PURE__ */ React__namespace.createElement(
|
|
10742
|
-
SidebarCollectionLink,
|
|
10743
|
-
{
|
|
10744
|
-
onClick: () => {
|
|
10745
|
-
setMenuIsOpen(false);
|
|
10746
|
-
},
|
|
10747
|
-
collection
|
|
10748
|
-
}
|
|
10749
|
-
),
|
|
10750
|
-
AuthRenderNavCollection: ({ collection }) => /* @__PURE__ */ React__namespace.createElement(
|
|
10751
|
-
SidebarCollectionLink,
|
|
10752
|
-
{
|
|
10753
|
-
onClick: () => {
|
|
10754
|
-
setMenuIsOpen(false);
|
|
10755
|
-
},
|
|
10756
|
-
collection,
|
|
10757
|
-
Icon: ImUsers
|
|
10758
|
-
}
|
|
10759
|
-
)
|
|
10760
|
-
},
|
|
10761
|
-
/* @__PURE__ */ React__namespace.createElement("div", { className: "absolute top-8 right-0 transform translate-x-full overflow-hidden" }, /* @__PURE__ */ React__namespace.createElement(
|
|
10762
|
-
Button$1,
|
|
10763
|
-
{
|
|
10764
|
-
rounded: "right",
|
|
10765
|
-
variant: "secondary",
|
|
10766
|
-
onClick: () => {
|
|
10767
|
-
setMenuIsOpen(false);
|
|
10768
|
-
},
|
|
10769
|
-
className: "transition-opacity duration-150 ease-out"
|
|
10770
|
-
},
|
|
10771
|
-
/* @__PURE__ */ React__namespace.createElement(IoMdClose, { className: "h-5 w-auto text-blue-500" })
|
|
10772
|
-
))
|
|
10773
|
-
))
|
|
10774
|
-
), /* @__PURE__ */ React__namespace.createElement(
|
|
10775
|
-
react.TransitionChild,
|
|
10776
|
-
{
|
|
10777
|
-
enter: "ease-out duration-300",
|
|
10778
|
-
enterFrom: "opacity-0",
|
|
10779
|
-
enterTo: "opacity-80",
|
|
10780
|
-
entered: "opacity-80",
|
|
10781
|
-
leave: "ease-in duration-200",
|
|
10782
|
-
leaveFrom: "opacity-80",
|
|
10783
|
-
leaveTo: "opacity-0"
|
|
10784
|
-
},
|
|
10785
|
-
/* @__PURE__ */ React__namespace.createElement(
|
|
10786
|
-
"div",
|
|
10787
|
-
{
|
|
10788
|
-
onClick: () => {
|
|
10789
|
-
setMenuIsOpen(false);
|
|
10790
|
-
},
|
|
10791
|
-
className: "fixed z-menu inset-0 bg-gradient-to-br from-gray-800 via-gray-900 to-black"
|
|
10792
|
-
}
|
|
10793
|
-
)
|
|
10794
|
-
)))
|
|
10795
|
-
);
|
|
10796
|
-
};
|
|
10797
|
-
const updateBodyDisplacement = ({
|
|
10798
|
-
position = "overlay",
|
|
10799
|
-
displayState,
|
|
10800
|
-
sidebarWidth,
|
|
10801
|
-
resizingSidebar
|
|
10802
|
-
}) => {
|
|
10803
|
-
const body = document.getElementsByTagName("body")[0];
|
|
10804
|
-
const windowWidth = window.innerWidth;
|
|
10805
|
-
if (position === "displace") {
|
|
10806
|
-
body.style.transition = resizingSidebar ? "" : displayState === "fullscreen" ? "padding 0ms 150ms" : displayState === "closed" ? "padding 0ms 0ms" : "padding 0ms 300ms";
|
|
10807
|
-
if (displayState === "open") {
|
|
10808
|
-
const bodyDisplacement = Math.min(
|
|
10809
|
-
sidebarWidth,
|
|
10810
|
-
windowWidth - minPreviewWidth
|
|
10811
|
-
);
|
|
10812
|
-
body.style.paddingLeft = `${bodyDisplacement}px`;
|
|
10813
|
-
} else {
|
|
10814
|
-
body.style.paddingLeft = "0";
|
|
10394
|
+
className: `w-7 h-auto flex-shrink-0 text-yellow-400 -mt-px`
|
|
10815
10395
|
}
|
|
10816
|
-
|
|
10817
|
-
body.style.transition = "";
|
|
10818
|
-
body.style.paddingLeft = "0";
|
|
10819
|
-
}
|
|
10820
|
-
};
|
|
10821
|
-
const SidebarHeader = ({
|
|
10822
|
-
branchingEnabled,
|
|
10823
|
-
renderNav,
|
|
10824
|
-
displayNav,
|
|
10825
|
-
isLocalMode
|
|
10826
|
-
}) => {
|
|
10827
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
10828
|
-
const { toggleFullscreen, displayState, setMenuIsOpen, toggleSidebarOpen } = React__namespace.useContext(SidebarContext);
|
|
10829
|
-
const displayMenuButton = renderNav && !displayNav;
|
|
10830
|
-
const cms = useCMS$1();
|
|
10831
|
-
const previewFunction = (_f = (_e = (_d = (_c = (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.schema) == null ? void 0 : _c.config) == null ? void 0 : _d.config) == null ? void 0 : _e.ui) == null ? void 0 : _f.previewUrl;
|
|
10832
|
-
const branch = (_h = (_g = cms.api) == null ? void 0 : _g.tina) == null ? void 0 : _h.branch;
|
|
10833
|
-
const previewUrl = typeof previewFunction === "function" ? (_i = previewFunction({ branch })) == null ? void 0 : _i.url : null;
|
|
10834
|
-
return /* @__PURE__ */ React__namespace.createElement("div", { className: "flex-grow-0 w-full overflow-visible z-20" }, isLocalMode && /* @__PURE__ */ React__namespace.createElement(LocalWarning, null), !isLocalMode && /* @__PURE__ */ React__namespace.createElement(BillingWarning, null), /* @__PURE__ */ React__namespace.createElement("div", { className: "mt-4 -mb-14 w-full flex gap-3 items-center justify-between pointer-events-none" }, displayMenuButton && /* @__PURE__ */ React__namespace.createElement(
|
|
10835
|
-
Button$1,
|
|
10836
|
-
{
|
|
10837
|
-
rounded: "right",
|
|
10838
|
-
variant: "white",
|
|
10839
|
-
onClick: () => {
|
|
10840
|
-
setMenuIsOpen(true);
|
|
10841
|
-
},
|
|
10842
|
-
className: "pointer-events-auto -ml-px"
|
|
10843
|
-
},
|
|
10844
|
-
/* @__PURE__ */ React__namespace.createElement(BiMenu, { className: "h-6 w-auto text-blue-500" })
|
|
10845
|
-
), /* @__PURE__ */ React__namespace.createElement("div", { className: "flex-1 flex gap-3 items-center shrink min-w-0" }, branchingEnabled && !isLocalMode && /* @__PURE__ */ React__namespace.createElement(BranchButton, null), branchingEnabled && !isLocalMode && previewUrl && /* @__PURE__ */ React__namespace.createElement(
|
|
10846
|
-
"button",
|
|
10847
|
-
{
|
|
10848
|
-
className: "pointer-events-auto flex min-w-0 shrink gap-1 items-center justify-between form-select text-sm h-10 px-4 shadow text-gray-500 hover:text-blue-500 bg-white hover:bg-gray-50 border border-gray-100 transition-color duration-150 ease-out rounded-full focus:outline-none focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out text-[12px] leading-tight min-w-[5rem]",
|
|
10849
|
-
onClick: () => {
|
|
10850
|
-
window.open(previewUrl, "_blank");
|
|
10851
|
-
}
|
|
10852
|
-
},
|
|
10853
|
-
/* @__PURE__ */ React__namespace.createElement(BiLinkExternal, { className: "flex-shrink-0 w-4 h-auto text-blue-500/70 mr-1" }),
|
|
10854
|
-
/* @__PURE__ */ React__namespace.createElement("span", { className: "truncate max-w-full min-w-0 shrink" }, "Preview")
|
|
10855
|
-
)), /* @__PURE__ */ React__namespace.createElement(
|
|
10396
|
+
), /* @__PURE__ */ React.createElement(
|
|
10856
10397
|
"div",
|
|
10857
10398
|
{
|
|
10858
|
-
className:
|
|
10859
|
-
},
|
|
10860
|
-
/* @__PURE__ */ React__namespace.createElement(
|
|
10861
|
-
Button$1,
|
|
10862
|
-
{
|
|
10863
|
-
rounded: "left",
|
|
10864
|
-
variant: "white",
|
|
10865
|
-
onClick: toggleSidebarOpen,
|
|
10866
|
-
"aria-label": "closes cms sidebar",
|
|
10867
|
-
className: "-mr-px"
|
|
10868
|
-
},
|
|
10869
|
-
/* @__PURE__ */ React__namespace.createElement(MdOutlineArrowBackIos, { className: "h-[18px] w-auto -mr-1 text-blue-500" })
|
|
10870
|
-
),
|
|
10871
|
-
/* @__PURE__ */ React__namespace.createElement(Button$1, { rounded: "custom", variant: "white", onClick: toggleFullscreen }, displayState === "fullscreen" ? (
|
|
10872
|
-
// BiCollapseAlt
|
|
10873
|
-
/* @__PURE__ */ React__namespace.createElement(
|
|
10874
|
-
"svg",
|
|
10875
|
-
{
|
|
10876
|
-
className: "h-5 w-auto -mx-1 text-blue-500",
|
|
10877
|
-
stroke: "currentColor",
|
|
10878
|
-
fill: "currentColor",
|
|
10879
|
-
strokeWidth: "0",
|
|
10880
|
-
viewBox: "0 0 24 24",
|
|
10881
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
10882
|
-
},
|
|
10883
|
-
/* @__PURE__ */ React__namespace.createElement("path", { d: "M2 15h7v7h2v-9H2v2zM15 2h-2v9h9V9h-7V2z" })
|
|
10884
|
-
)
|
|
10885
|
-
) : /* @__PURE__ */ React__namespace.createElement(BiExpandAlt, { className: "h-5 -mx-1 w-auto text-blue-500" }))
|
|
10886
|
-
)));
|
|
10887
|
-
};
|
|
10888
|
-
const SidebarSiteLink = ({
|
|
10889
|
-
view,
|
|
10890
|
-
onClick
|
|
10891
|
-
}) => {
|
|
10892
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
10893
|
-
"button",
|
|
10894
|
-
{
|
|
10895
|
-
className: "text-base tracking-wide text-gray-500 hover:text-blue-600 flex items-center opacity-90 hover:opacity-100",
|
|
10896
|
-
value: view.name,
|
|
10897
|
-
onClick
|
|
10399
|
+
className: `flex-1 flex flex-col items-start gap-0.5 text-base text-yellow-700`
|
|
10898
10400
|
},
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
view.name
|
|
10902
|
-
);
|
|
10903
|
-
};
|
|
10904
|
-
const SidebarCloudLink$1 = ({ config }) => {
|
|
10905
|
-
if (config.text) {
|
|
10906
|
-
return /* @__PURE__ */ React__namespace.createElement("span", { className: "text-base tracking-wide text-gray-500 flex items-center opacity-90" }, config.text, " ", /* @__PURE__ */ React__namespace.createElement(
|
|
10401
|
+
"Media needs to be turned on for this project.",
|
|
10402
|
+
/* @__PURE__ */ React.createElement(
|
|
10907
10403
|
"a",
|
|
10908
10404
|
{
|
|
10405
|
+
className: "transition-all duration-150 ease-out text-blue-500 hover:text-blue-400 hover:underline underline decoration-blue-200 hover:decoration-blue-400 font-medium flex items-center justify-start gap-1",
|
|
10909
10406
|
target: "_blank",
|
|
10910
|
-
|
|
10911
|
-
href: config.link.href
|
|
10407
|
+
href: `${cms.api.tina.appDashboardLink}/media`
|
|
10912
10408
|
},
|
|
10913
|
-
|
|
10914
|
-
|
|
10409
|
+
"Sync Your Media In TinaCloud.",
|
|
10410
|
+
/* @__PURE__ */ React.createElement(BiLinkExternal, { className: `w-5 h-auto flex-shrink-0` })
|
|
10411
|
+
)
|
|
10412
|
+
)))) : /* @__PURE__ */ React.createElement(SyncStatusContext.Provider, { value: { syncStatus } }, children);
|
|
10413
|
+
};
|
|
10414
|
+
const useSyncStatus$1 = () => {
|
|
10415
|
+
const context = React.useContext(SyncStatusContext);
|
|
10416
|
+
if (!context) {
|
|
10417
|
+
throw new Error("useSyncStatus must be used within a SyncStatusProvider");
|
|
10915
10418
|
}
|
|
10916
|
-
return
|
|
10419
|
+
return context;
|
|
10917
10420
|
};
|
|
10918
|
-
const
|
|
10919
|
-
|
|
10920
|
-
|
|
10921
|
-
onClick
|
|
10922
|
-
}) => {
|
|
10923
|
-
const cms = useCMS$1();
|
|
10924
|
-
const tinaPreview = cms.flags.get("tina-preview") || false;
|
|
10925
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
10926
|
-
"a",
|
|
10927
|
-
{
|
|
10928
|
-
onClick,
|
|
10929
|
-
href: `${tinaPreview ? `/${tinaPreview}/index.html#` : "/admin#"}/collections/${collection.name}/~`,
|
|
10930
|
-
className: "text-base tracking-wide text-gray-500 hover:text-blue-600 flex items-center opacity-90 hover:opacity-100"
|
|
10931
|
-
},
|
|
10932
|
-
/* @__PURE__ */ React__namespace.createElement(Icon, { className: "mr-2 h-6 opacity-80 w-auto" }),
|
|
10933
|
-
" ",
|
|
10934
|
-
collection.label ? collection.label : collection.name
|
|
10935
|
-
);
|
|
10421
|
+
const EmptyMediaList = () => {
|
|
10422
|
+
const { syncStatus } = useSyncStatus$1();
|
|
10423
|
+
return /* @__PURE__ */ React.createElement("div", { className: `p-12 text-xl opacity-50 text-center` }, syncStatus == "synced" ? "Drag and drop assets here" : "Loading...");
|
|
10936
10424
|
};
|
|
10937
|
-
const
|
|
10938
|
-
|
|
10939
|
-
|
|
10940
|
-
Button$1,
|
|
10425
|
+
const DocsLink = ({ title, message, docsLink, ...props }) => {
|
|
10426
|
+
return /* @__PURE__ */ React.createElement("div", { className: "h-3/4 text-center flex flex-col justify-center", ...props }, /* @__PURE__ */ React.createElement("h2", { className: "mb-3 text-xl text-gray-600" }, title), /* @__PURE__ */ React.createElement("div", { className: "mb-3 text-base text-gray-700" }, message), /* @__PURE__ */ React.createElement(
|
|
10427
|
+
"a",
|
|
10941
10428
|
{
|
|
10942
|
-
|
|
10943
|
-
|
|
10944
|
-
|
|
10945
|
-
|
|
10946
|
-
className: `z-chrome absolute top-6 right-0 translate-x-full text-sm h-10 pl-3 pr-4 transition-all duration-300 ${displayState !== "closed" ? "opacity-0 ease-in pointer-events-none" : "ease-out pointer-events-auto"}`,
|
|
10947
|
-
"aria-label": "opens cms sidebar"
|
|
10429
|
+
href: docsLink,
|
|
10430
|
+
target: "_blank",
|
|
10431
|
+
rel: "noreferrer noopener",
|
|
10432
|
+
className: "font-bold text-blue-500 hover:text-blue-600 hover:underline transition-all ease-out duration-150"
|
|
10948
10433
|
},
|
|
10949
|
-
|
|
10950
|
-
);
|
|
10434
|
+
"Learn More"
|
|
10435
|
+
));
|
|
10951
10436
|
};
|
|
10952
|
-
const
|
|
10953
|
-
const
|
|
10954
|
-
|
|
10437
|
+
const ViewModeToggle = ({ viewMode, setViewMode }) => {
|
|
10438
|
+
const toggleClasses = {
|
|
10439
|
+
base: "relative whitespace-nowrap flex items-center justify-center flex-1 block font-medium text-base py-1 transition-all ease-out duration-150 border",
|
|
10440
|
+
active: "bg-white text-blue-500 shadow-inner border-gray-50 border-t-gray-100",
|
|
10441
|
+
inactive: "bg-gray-50 text-gray-400 shadow border-gray-100 border-t-white"
|
|
10442
|
+
};
|
|
10443
|
+
return /* @__PURE__ */ React.createElement(
|
|
10955
10444
|
"div",
|
|
10956
10445
|
{
|
|
10957
|
-
className: `
|
|
10446
|
+
className: `grow-0 flex justify-between rounded-md border border-gray-100`
|
|
10958
10447
|
},
|
|
10959
|
-
/* @__PURE__ */
|
|
10960
|
-
"
|
|
10448
|
+
/* @__PURE__ */ React.createElement(
|
|
10449
|
+
"button",
|
|
10961
10450
|
{
|
|
10962
|
-
className:
|
|
10963
|
-
|
|
10964
|
-
|
|
10965
|
-
maxWidth: displayState === "fullscreen" ? "100vw" : "calc(100vw - 8px)",
|
|
10966
|
-
minWidth: "360px"
|
|
10451
|
+
className: `${toggleClasses.base} px-2.5 rounded-l-md ${viewMode === "grid" ? toggleClasses.active : toggleClasses.inactive}`,
|
|
10452
|
+
onClick: () => {
|
|
10453
|
+
setViewMode("grid");
|
|
10967
10454
|
}
|
|
10968
10455
|
},
|
|
10969
|
-
|
|
10970
|
-
)
|
|
10971
|
-
);
|
|
10972
|
-
};
|
|
10973
|
-
const SidebarBody = ({ children }) => {
|
|
10974
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
10975
|
-
"div",
|
|
10976
|
-
{
|
|
10977
|
-
className: "relative left-0 w-full h-full flex flex-col items-stretch bg-white border-r border-gray-200 overflow-hidden"
|
|
10978
|
-
},
|
|
10979
|
-
children
|
|
10980
|
-
);
|
|
10981
|
-
};
|
|
10982
|
-
const MarkdownFieldPlaceholder = {
|
|
10983
|
-
__type: "field",
|
|
10984
|
-
name: "markdown",
|
|
10985
|
-
Component: createPlaceholder(
|
|
10986
|
-
"Markdown"
|
|
10987
|
-
)
|
|
10988
|
-
};
|
|
10989
|
-
const HtmlFieldPlaceholder = {
|
|
10990
|
-
__type: "field",
|
|
10991
|
-
name: "html",
|
|
10992
|
-
Component: createPlaceholder(
|
|
10993
|
-
"HTML"
|
|
10994
|
-
)
|
|
10995
|
-
};
|
|
10996
|
-
function createPlaceholder(name, _pr) {
|
|
10997
|
-
return (props) => {
|
|
10998
|
-
return /* @__PURE__ */ React.createElement(
|
|
10999
|
-
FieldMeta,
|
|
11000
|
-
{
|
|
11001
|
-
name: props.input.name,
|
|
11002
|
-
label: `${name} Field not Registered`,
|
|
11003
|
-
tinaForm: props.tinaForm
|
|
11004
|
-
},
|
|
11005
|
-
/* @__PURE__ */ React.createElement("p", { className: "whitespace-normal text-[15px] mt-2" }, "The ", name, " field is not registered. Some built-in field types are not bundled by default in an effort to control bundle size. Consult the Tina docs to learn how to use this field type."),
|
|
11006
|
-
/* @__PURE__ */ React.createElement("p", { className: "whitespace-normal text-[15px] mt-2" }, /* @__PURE__ */ React.createElement(
|
|
11007
|
-
"a",
|
|
11008
|
-
{
|
|
11009
|
-
className: "text-blue-500 underline",
|
|
11010
|
-
href: "https://tina.io/docs/editing/markdown/#registering-the-field-plugins",
|
|
11011
|
-
target: "_blank",
|
|
11012
|
-
rel: "noreferrer noopener"
|
|
11013
|
-
},
|
|
11014
|
-
"Tina Docs: Registering Field Plugins"
|
|
11015
|
-
))
|
|
11016
|
-
);
|
|
11017
|
-
};
|
|
11018
|
-
}
|
|
11019
|
-
function dirname(path) {
|
|
11020
|
-
var _a, _b;
|
|
11021
|
-
const pattern = new RegExp("(?<prevDir>.*)/");
|
|
11022
|
-
return (_b = (_a = path.match(pattern)) == null ? void 0 : _a.groups) == null ? void 0 : _b.prevDir;
|
|
11023
|
-
}
|
|
11024
|
-
const BreadcrumbButton = ({ className = "", ...props }) => /* @__PURE__ */ React.createElement(
|
|
11025
|
-
"button",
|
|
11026
|
-
{
|
|
11027
|
-
className: "capitalize transition-colors duration-150 border-0 bg-transparent hover:text-blue-500 " + className,
|
|
11028
|
-
...props
|
|
11029
|
-
}
|
|
11030
|
-
);
|
|
11031
|
-
function Breadcrumb$1({ directory = "", setDirectory }) {
|
|
11032
|
-
directory = directory.replace(/^\/|\/$/g, "");
|
|
11033
|
-
let prevDir = dirname(directory) || "";
|
|
11034
|
-
if (prevDir === ".") {
|
|
11035
|
-
prevDir = "";
|
|
11036
|
-
}
|
|
11037
|
-
return /* @__PURE__ */ React.createElement("div", { className: "w-full flex items-center text-[16px] text-gray-300" }, directory !== "" && /* @__PURE__ */ React.createElement(
|
|
11038
|
-
IconButton,
|
|
11039
|
-
{
|
|
11040
|
-
variant: "ghost",
|
|
11041
|
-
className: "mr-2",
|
|
11042
|
-
onClick: () => setDirectory(prevDir)
|
|
11043
|
-
},
|
|
10456
|
+
/* @__PURE__ */ React.createElement(BiGridAlt, { className: "w-6 h-full opacity-70" })
|
|
10457
|
+
),
|
|
11044
10458
|
/* @__PURE__ */ React.createElement(
|
|
11045
|
-
|
|
11046
|
-
{
|
|
11047
|
-
className: `w-7 h-auto fill-gray-300 hover:fill-gray-900 transition duration-150 ease-out`
|
|
11048
|
-
}
|
|
11049
|
-
)
|
|
11050
|
-
), /* @__PURE__ */ React.createElement(
|
|
11051
|
-
BreadcrumbButton,
|
|
11052
|
-
{
|
|
11053
|
-
onClick: () => setDirectory(""),
|
|
11054
|
-
className: directory === "" ? "text-gray-500 font-bold" : "text-gray-300 font-medium after:pl-1.5 after:content-['/']"
|
|
11055
|
-
},
|
|
11056
|
-
"Media"
|
|
11057
|
-
), directory && directory.split("/").map((part, index, parts) => {
|
|
11058
|
-
const currentDir = parts.slice(0, index + 1).join("/");
|
|
11059
|
-
return /* @__PURE__ */ React.createElement(
|
|
11060
|
-
BreadcrumbButton,
|
|
10459
|
+
"button",
|
|
11061
10460
|
{
|
|
11062
|
-
className:
|
|
11063
|
-
key: currentDir,
|
|
10461
|
+
className: `${toggleClasses.base} px-2 rounded-r-md ${viewMode === "list" ? toggleClasses.active : toggleClasses.inactive}`,
|
|
11064
10462
|
onClick: () => {
|
|
11065
|
-
|
|
10463
|
+
setViewMode("list");
|
|
11066
10464
|
}
|
|
11067
10465
|
},
|
|
11068
|
-
|
|
11069
|
-
);
|
|
11070
|
-
}));
|
|
11071
|
-
}
|
|
11072
|
-
const CopyField = ({ label, description, value }) => {
|
|
11073
|
-
const [copied, setCopied] = React.useState(false);
|
|
11074
|
-
const [fadeOut, setFadeOut] = React.useState(false);
|
|
11075
|
-
return /* @__PURE__ */ React.createElement("div", { className: "w-full" }, label && /* @__PURE__ */ React.createElement("label", { className: "w-full mb-1 block flex-1 text-sm font-bold leading-5 text-gray-700" }, label), /* @__PURE__ */ React.createElement(
|
|
11076
|
-
"span",
|
|
11077
|
-
{
|
|
11078
|
-
onClick: () => {
|
|
11079
|
-
if (copied === true)
|
|
11080
|
-
return;
|
|
11081
|
-
setCopied(true);
|
|
11082
|
-
setTimeout(() => {
|
|
11083
|
-
setFadeOut(true);
|
|
11084
|
-
}, 2500);
|
|
11085
|
-
setTimeout(() => {
|
|
11086
|
-
setCopied(false);
|
|
11087
|
-
setFadeOut(false);
|
|
11088
|
-
}, 3e3);
|
|
11089
|
-
navigator.clipboard.writeText(value);
|
|
11090
|
-
},
|
|
11091
|
-
className: `shadow-inner text-base leading-5 whitespace-normal break-all px-3 py-2 text-gray-600 w-full bg-gray-50 border border-gray-200 transition-all ease-out duration-150 rounded-md relative overflow-hidden appearance-none flex items-center w-full cursor-pointer hover:bg-white hover:text-blue-500 ${copied ? `pointer-events-none` : ``}`
|
|
11092
|
-
},
|
|
11093
|
-
/* @__PURE__ */ React.createElement(BiCopyAlt, { className: "relative text-blue-500 shrink-0 w-5 h-auto mr-1.5 -ml-0.5 z-20" }),
|
|
11094
|
-
" ",
|
|
11095
|
-
value,
|
|
11096
|
-
" ",
|
|
11097
|
-
copied && /* @__PURE__ */ React.createElement(
|
|
11098
|
-
"span",
|
|
11099
|
-
{
|
|
11100
|
-
className: `${fadeOut ? `opacity-0` : `opacity-100`} text-blue-500 transition-opacity duration-500 absolute right-0 w-full h-full px-3 py-2 bg-white bg-opacity-90 flex items-center justify-center text-center tracking-wide font-medium z-10`
|
|
11101
|
-
},
|
|
11102
|
-
/* @__PURE__ */ React.createElement("span", null, "Copied to clipboard!")
|
|
10466
|
+
/* @__PURE__ */ React.createElement(BiListUl, { className: "w-8 h-full opacity-70" })
|
|
11103
10467
|
)
|
|
11104
|
-
)
|
|
10468
|
+
);
|
|
11105
10469
|
};
|
|
11106
|
-
|
|
11107
|
-
|
|
11108
|
-
|
|
11109
|
-
|
|
11110
|
-
|
|
11111
|
-
|
|
10470
|
+
const MediaManagerScreenPlugin = createScreen({
|
|
10471
|
+
name: "Media Manager",
|
|
10472
|
+
Component: MediaPicker,
|
|
10473
|
+
Icon: MdOutlinePhotoLibrary,
|
|
10474
|
+
layout: "fullscreen",
|
|
10475
|
+
props: {
|
|
10476
|
+
allowDelete: true
|
|
11112
10477
|
}
|
|
11113
|
-
|
|
11114
|
-
|
|
11115
|
-
|
|
11116
|
-
|
|
11117
|
-
|
|
11118
|
-
|
|
11119
|
-
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
|
|
11131
|
-
|
|
11132
|
-
alt: item.filename
|
|
11133
|
-
}
|
|
11134
|
-
) : /* @__PURE__ */ React.createElement(FileIcon, { className: "w-1/2 h-full fill-gray-300" })),
|
|
11135
|
-
/* @__PURE__ */ React.createElement(
|
|
11136
|
-
"span",
|
|
11137
|
-
{
|
|
11138
|
-
className: "text-base flex-grow w-full break-words truncate px-3 py-2"
|
|
11139
|
-
},
|
|
11140
|
-
item.filename
|
|
11141
|
-
)
|
|
11142
|
-
);
|
|
11143
|
-
}
|
|
11144
|
-
function GridMediaItem({ item, active, onClick }) {
|
|
11145
|
-
let FileIcon = BiFile;
|
|
11146
|
-
if (item.type === "dir") {
|
|
11147
|
-
FileIcon = BiFolder;
|
|
11148
|
-
} else if (isVideo(item.src)) {
|
|
11149
|
-
FileIcon = BiMovie;
|
|
10478
|
+
});
|
|
10479
|
+
function UpdatePassword(props) {
|
|
10480
|
+
const cms = useCMS$1();
|
|
10481
|
+
const client = cms.api.tina;
|
|
10482
|
+
const [password, setPassword] = React.useState("");
|
|
10483
|
+
const [confirmPassword, setConfirmPassword] = React.useState("");
|
|
10484
|
+
const [dirty, setDirty] = React.useState(false);
|
|
10485
|
+
const [result, setResult] = React.useState(null);
|
|
10486
|
+
const [formState, setFormState] = React.useState("idle");
|
|
10487
|
+
const [passwordChangeRequired, setPasswordChangeRequired] = React.useState(false);
|
|
10488
|
+
React.useEffect(() => {
|
|
10489
|
+
var _a;
|
|
10490
|
+
(_a = client == null ? void 0 : client.authProvider) == null ? void 0 : _a.getUser().then(
|
|
10491
|
+
(user) => setPasswordChangeRequired((user == null ? void 0 : user.passwordChangeRequired) ?? false)
|
|
10492
|
+
);
|
|
10493
|
+
}, []);
|
|
10494
|
+
let err = null;
|
|
10495
|
+
if (dirty && password !== confirmPassword) {
|
|
10496
|
+
err = "Passwords do not match";
|
|
11150
10497
|
}
|
|
11151
|
-
|
|
11152
|
-
|
|
11153
|
-
|
|
11154
|
-
|
|
11155
|
-
|
|
11156
|
-
|
|
11157
|
-
|
|
11158
|
-
|
|
11159
|
-
|
|
10498
|
+
if (dirty && !password) {
|
|
10499
|
+
err = "Please enter a password";
|
|
10500
|
+
}
|
|
10501
|
+
const updatePassword = async () => {
|
|
10502
|
+
var _a;
|
|
10503
|
+
setResult(null);
|
|
10504
|
+
setFormState("busy");
|
|
10505
|
+
const res = await cms.api.tina.request(
|
|
10506
|
+
`mutation($password: String!) { updatePassword(password: $password) }`,
|
|
11160
10507
|
{
|
|
11161
|
-
|
|
11162
|
-
|
|
11163
|
-
if (!active) {
|
|
11164
|
-
onClick(item);
|
|
11165
|
-
} else {
|
|
11166
|
-
onClick(false);
|
|
11167
|
-
}
|
|
10508
|
+
variables: {
|
|
10509
|
+
password
|
|
11168
10510
|
}
|
|
11169
|
-
}
|
|
11170
|
-
|
|
11171
|
-
|
|
11172
|
-
|
|
11173
|
-
|
|
11174
|
-
|
|
11175
|
-
|
|
10511
|
+
}
|
|
10512
|
+
);
|
|
10513
|
+
if (!(res == null ? void 0 : res.updatePassword)) {
|
|
10514
|
+
setResult("Error updating password");
|
|
10515
|
+
} else {
|
|
10516
|
+
setDirty(false);
|
|
10517
|
+
setPassword("");
|
|
10518
|
+
setConfirmPassword("");
|
|
10519
|
+
setResult("Password updated");
|
|
10520
|
+
setPasswordChangeRequired(false);
|
|
10521
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
10522
|
+
(_a = client == null ? void 0 : client.authProvider) == null ? void 0 : _a.logout().then(async () => {
|
|
10523
|
+
if (typeof (client == null ? void 0 : client.onLogout) === "function") {
|
|
10524
|
+
await client.onLogout();
|
|
10525
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
11176
10526
|
}
|
|
11177
|
-
|
|
11178
|
-
|
|
11179
|
-
|
|
11180
|
-
|
|
11181
|
-
|
|
11182
|
-
|
|
11183
|
-
|
|
11184
|
-
filename
|
|
11185
|
-
}) => {
|
|
11186
|
-
const [processing, setProcessing] = React.useState(false);
|
|
11187
|
-
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 ", /* @__PURE__ */ React.createElement("strong", null, filename), "?")), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(Button$1, { style: { flexGrow: 2 }, disabled: processing, onClick: close2 }, "Cancel"), /* @__PURE__ */ React.createElement(
|
|
11188
|
-
Button$1,
|
|
10527
|
+
window.location.href = new URL(window.location.href).pathname;
|
|
10528
|
+
}).catch((e) => console.error(e));
|
|
10529
|
+
}
|
|
10530
|
+
setFormState("idle");
|
|
10531
|
+
};
|
|
10532
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "flex justify-center items-center h-full" }, /* @__PURE__ */ React.createElement("div", { className: "flex flex-col space-y-8 p-6" }, passwordChangeRequired && /* @__PURE__ */ React.createElement("div", { className: "text-center text-red-500" }, "Your password has expired. Please update your password."), /* @__PURE__ */ React.createElement("label", { className: "block" }, /* @__PURE__ */ React.createElement("span", { className: "text-gray-700" }, "New Password"), /* @__PURE__ */ React.createElement(
|
|
10533
|
+
BaseTextField,
|
|
11189
10534
|
{
|
|
11190
|
-
|
|
11191
|
-
|
|
11192
|
-
|
|
11193
|
-
|
|
11194
|
-
|
|
11195
|
-
|
|
11196
|
-
|
|
11197
|
-
|
|
11198
|
-
|
|
11199
|
-
|
|
11200
|
-
|
|
11201
|
-
|
|
11202
|
-
|
|
11203
|
-
|
|
11204
|
-
|
|
11205
|
-
processing && /* @__PURE__ */ React.createElement(LoadingDots, null)
|
|
11206
|
-
))));
|
|
11207
|
-
};
|
|
11208
|
-
const NewFolderModal = ({ onSubmit, close: close2 }) => {
|
|
11209
|
-
const [folderName, setFolderName] = React.useState("");
|
|
11210
|
-
return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(PopupModal, null, /* @__PURE__ */ React.createElement(ModalHeader, { close: close2 }, "New Folder"), /* @__PURE__ */ React.createElement(ModalBody, { padded: true }, /* @__PURE__ */ React.createElement("p", { className: "text-base text-gray-700 mb-2" }, "Please provide a name for your folder."), /* @__PURE__ */ React.createElement("p", { className: "text-sm text-gray-500 mb-4 italic" }, /* @__PURE__ */ React.createElement("span", { className: "font-bold" }, "Note"), " – If you navigate away before uploading a media item, the folder will disappear."), /* @__PURE__ */ React.createElement(
|
|
11211
|
-
Input,
|
|
10535
|
+
type: "password",
|
|
10536
|
+
name: "password",
|
|
10537
|
+
id: "password",
|
|
10538
|
+
placeholder: "Enter password",
|
|
10539
|
+
className: err ? "border-red-500" : "border-gray-300 focus:ring-indigo-500 focus:border-indigo-500",
|
|
10540
|
+
value: password,
|
|
10541
|
+
onKeyDown: () => {
|
|
10542
|
+
setDirty(true);
|
|
10543
|
+
setResult(null);
|
|
10544
|
+
},
|
|
10545
|
+
onChange: (e) => setPassword(e.target.value),
|
|
10546
|
+
required: true
|
|
10547
|
+
}
|
|
10548
|
+
)), /* @__PURE__ */ React.createElement("label", { className: "block" }, /* @__PURE__ */ React.createElement("span", { className: "text-gray-700" }, "Confirm New Password"), /* @__PURE__ */ React.createElement(
|
|
10549
|
+
BaseTextField,
|
|
11212
10550
|
{
|
|
11213
|
-
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
|
|
10551
|
+
type: "password",
|
|
10552
|
+
name: "confirmPassword",
|
|
10553
|
+
id: "confirmPassword",
|
|
10554
|
+
placeholder: "Confirm password",
|
|
10555
|
+
className: err ? "border-red-500" : "border-gray-300 focus:ring-indigo-500 focus:border-indigo-500",
|
|
10556
|
+
value: confirmPassword,
|
|
10557
|
+
onKeyDown: () => {
|
|
10558
|
+
setDirty(true);
|
|
10559
|
+
setResult(null);
|
|
10560
|
+
},
|
|
10561
|
+
onChange: (e) => setConfirmPassword(e.target.value),
|
|
10562
|
+
required: true
|
|
11217
10563
|
}
|
|
11218
|
-
)), /* @__PURE__ */ React.createElement(
|
|
10564
|
+
)), result && /* @__PURE__ */ React.createElement("div", { className: "text-center text-sm text-gray-500" }, result), err && /* @__PURE__ */ React.createElement("div", { className: "text-center text-sm text-red-500" }, err), /* @__PURE__ */ React.createElement(
|
|
11219
10565
|
Button$1,
|
|
11220
10566
|
{
|
|
11221
|
-
|
|
11222
|
-
|
|
10567
|
+
onClick: updatePassword,
|
|
10568
|
+
disabled: err,
|
|
11223
10569
|
variant: "primary",
|
|
11224
|
-
|
|
11225
|
-
if (!folderName)
|
|
11226
|
-
return;
|
|
11227
|
-
onSubmit(folderName);
|
|
11228
|
-
close2();
|
|
11229
|
-
}
|
|
10570
|
+
busy: formState === "busy"
|
|
11230
10571
|
},
|
|
11231
|
-
"
|
|
10572
|
+
"Update"
|
|
11232
10573
|
))));
|
|
11233
|
-
};
|
|
11234
|
-
const { useDropzone } = dropzone__namespace;
|
|
11235
|
-
const join = function(...parts) {
|
|
11236
|
-
const [first, last, slash] = [0, parts.length - 1, "/"];
|
|
11237
|
-
const matchLeadingSlash = new RegExp("^" + slash);
|
|
11238
|
-
const matchTrailingSlash = new RegExp(slash + "$");
|
|
11239
|
-
parts = parts.map(function(part, index) {
|
|
11240
|
-
if (index === first && part === "file://")
|
|
11241
|
-
return part;
|
|
11242
|
-
if (index > first)
|
|
11243
|
-
part = part.replace(matchLeadingSlash, "");
|
|
11244
|
-
if (index < last)
|
|
11245
|
-
part = part.replace(matchTrailingSlash, "");
|
|
11246
|
-
return part;
|
|
11247
|
-
});
|
|
11248
|
-
return parts.join(slash);
|
|
11249
|
-
};
|
|
11250
|
-
function MediaManager() {
|
|
11251
|
-
const cms = useCMS();
|
|
11252
|
-
const [request, setRequest] = React.useState();
|
|
11253
|
-
React.useEffect(() => {
|
|
11254
|
-
return cms.events.subscribe("media:open", ({ type, ...request2 }) => {
|
|
11255
|
-
setRequest(request2);
|
|
11256
|
-
});
|
|
11257
|
-
}, []);
|
|
11258
|
-
if (!request)
|
|
11259
|
-
return null;
|
|
11260
|
-
const close2 = () => setRequest(void 0);
|
|
11261
|
-
return /* @__PURE__ */ React.createElement(Modal, null, /* @__PURE__ */ React.createElement(FullscreenModal, null, /* @__PURE__ */ React.createElement("div", { className: "w-full bg-gray-50 flex items-center justify-between px-5 pt-3 m-0" }, /* @__PURE__ */ React.createElement("h2", { className: "text-gray-500 font-sans font-medium text-base leading-none m-0 block truncate" }, "Media Manager"), /* @__PURE__ */ React.createElement(
|
|
11262
|
-
"div",
|
|
11263
|
-
{
|
|
11264
|
-
onClick: close2,
|
|
11265
|
-
className: "flex items-center fill-gray-400 cursor-pointer transition-colors duration-100 ease-out hover:fill-gray-700"
|
|
11266
|
-
},
|
|
11267
|
-
/* @__PURE__ */ React.createElement(CloseIcon, { className: "w-6 h-auto" })
|
|
11268
|
-
)), /* @__PURE__ */ React.createElement(ModalBody, { className: "flex h-full flex-col" }, /* @__PURE__ */ React.createElement(MediaPicker, { ...request, close: close2 }))));
|
|
11269
10574
|
}
|
|
11270
|
-
const
|
|
11271
|
-
|
|
11272
|
-
|
|
11273
|
-
|
|
10575
|
+
const PasswordScreenPlugin = createScreen({
|
|
10576
|
+
name: "Change Password",
|
|
10577
|
+
Component: UpdatePassword,
|
|
10578
|
+
Icon: MdVpnKey,
|
|
10579
|
+
layout: "fullscreen",
|
|
10580
|
+
navCategory: "Account"
|
|
11274
10581
|
});
|
|
11275
|
-
function
|
|
11276
|
-
|
|
11277
|
-
onSelect,
|
|
11278
|
-
close: close2,
|
|
11279
|
-
...props
|
|
10582
|
+
function createCloudConfig({
|
|
10583
|
+
...options
|
|
11280
10584
|
}) {
|
|
11281
|
-
|
|
11282
|
-
|
|
11283
|
-
|
|
11284
|
-
|
|
11285
|
-
|
|
11286
|
-
|
|
11287
|
-
|
|
11288
|
-
|
|
11289
|
-
|
|
11290
|
-
|
|
11291
|
-
|
|
11292
|
-
|
|
11293
|
-
|
|
11294
|
-
|
|
11295
|
-
|
|
11296
|
-
|
|
11297
|
-
|
|
11298
|
-
|
|
11299
|
-
|
|
11300
|
-
|
|
11301
|
-
})
|
|
11302
|
-
|
|
11303
|
-
|
|
11304
|
-
|
|
11305
|
-
|
|
11306
|
-
|
|
11307
|
-
|
|
11308
|
-
|
|
11309
|
-
|
|
11310
|
-
|
|
11311
|
-
|
|
11312
|
-
|
|
11313
|
-
|
|
11314
|
-
|
|
11315
|
-
|
|
11316
|
-
|
|
11317
|
-
|
|
11318
|
-
|
|
11319
|
-
|
|
11320
|
-
|
|
11321
|
-
|
|
11322
|
-
filesOnly: !loadFolders2
|
|
11323
|
-
});
|
|
11324
|
-
setList({
|
|
11325
|
-
items: [...list.items, ..._list.items],
|
|
11326
|
-
nextOffset: _list.nextOffset
|
|
11327
|
-
});
|
|
11328
|
-
setListState("loaded");
|
|
11329
|
-
} catch (e) {
|
|
11330
|
-
console.error(e);
|
|
11331
|
-
if (e.ERR_TYPE === "MediaListError") {
|
|
11332
|
-
setListError(e);
|
|
11333
|
-
} else {
|
|
11334
|
-
setListError(defaultListError);
|
|
11335
|
-
}
|
|
11336
|
-
setListState("error");
|
|
10585
|
+
return {
|
|
10586
|
+
__type: "cloud-config",
|
|
10587
|
+
Icon: MdOutlineCloud,
|
|
10588
|
+
...options
|
|
10589
|
+
};
|
|
10590
|
+
}
|
|
10591
|
+
const SidebarLoadingPlaceholder = () => /* @__PURE__ */ React__namespace.createElement(
|
|
10592
|
+
"div",
|
|
10593
|
+
{
|
|
10594
|
+
className: "relative flex flex-col items-center justify-center text-center p-5 pb-16 w-full h-full overflow-y-auto",
|
|
10595
|
+
style: {
|
|
10596
|
+
animationName: "fade-in",
|
|
10597
|
+
animationDelay: "300ms",
|
|
10598
|
+
animationTimingFunction: "ease-out",
|
|
10599
|
+
animationIterationCount: 1,
|
|
10600
|
+
animationFillMode: "both",
|
|
10601
|
+
animationDuration: "150ms"
|
|
10602
|
+
}
|
|
10603
|
+
},
|
|
10604
|
+
/* @__PURE__ */ React__namespace.createElement("p", { className: "block pb-5" }, "Please wait while TinaCMS", /* @__PURE__ */ React__namespace.createElement("br", null), "loads your content"),
|
|
10605
|
+
/* @__PURE__ */ React__namespace.createElement(LoadingDots, { color: "var(--tina-color-primary)" })
|
|
10606
|
+
);
|
|
10607
|
+
class SidebarState {
|
|
10608
|
+
constructor(events, options = {}) {
|
|
10609
|
+
var _a, _b;
|
|
10610
|
+
this.events = events;
|
|
10611
|
+
this._isOpen = false;
|
|
10612
|
+
this.position = "displace";
|
|
10613
|
+
this.renderNav = true;
|
|
10614
|
+
this.buttons = {
|
|
10615
|
+
save: "Save",
|
|
10616
|
+
reset: "Reset"
|
|
10617
|
+
};
|
|
10618
|
+
this.position = options.position || "displace";
|
|
10619
|
+
this.renderNav = options.renderNav || true;
|
|
10620
|
+
this.loadingPlaceholder = options.placeholder || SidebarLoadingPlaceholder;
|
|
10621
|
+
if ((_a = options.buttons) == null ? void 0 : _a.save) {
|
|
10622
|
+
this.buttons.save = options.buttons.save;
|
|
10623
|
+
}
|
|
10624
|
+
if ((_b = options.buttons) == null ? void 0 : _b.reset) {
|
|
10625
|
+
this.buttons.reset = options.buttons.reset;
|
|
11337
10626
|
}
|
|
11338
10627
|
}
|
|
11339
|
-
|
|
11340
|
-
|
|
11341
|
-
|
|
11342
|
-
|
|
11343
|
-
|
|
11344
|
-
}, [refreshing]);
|
|
11345
|
-
React.useEffect(() => {
|
|
11346
|
-
if (!cms.media.isConfigured)
|
|
11347
|
-
return;
|
|
11348
|
-
if (refreshing)
|
|
10628
|
+
get isOpen() {
|
|
10629
|
+
return this._isOpen;
|
|
10630
|
+
}
|
|
10631
|
+
set isOpen(nextValue) {
|
|
10632
|
+
if (this._isOpen === nextValue) {
|
|
11349
10633
|
return;
|
|
11350
|
-
|
|
11351
|
-
|
|
11352
|
-
|
|
11353
|
-
|
|
11354
|
-
["media:delete:success", "media:pageSize"],
|
|
11355
|
-
() => {
|
|
11356
|
-
setRefreshing(true);
|
|
11357
|
-
resetOffset();
|
|
11358
|
-
resetList();
|
|
11359
|
-
}
|
|
11360
|
-
);
|
|
11361
|
-
}, [offset, directory, cms.media.isConfigured]);
|
|
11362
|
-
const onClickMediaItem = (item) => {
|
|
11363
|
-
if (!item) {
|
|
11364
|
-
setActiveItem(false);
|
|
11365
|
-
} else if (item.type === "dir") {
|
|
11366
|
-
setDirectory(
|
|
11367
|
-
item.directory === "." || item.directory === "" ? item.filename : join(item.directory, item.filename)
|
|
11368
|
-
);
|
|
11369
|
-
setLoadFolders(true);
|
|
11370
|
-
resetOffset();
|
|
11371
|
-
resetList();
|
|
11372
|
-
setActiveItem(false);
|
|
10634
|
+
}
|
|
10635
|
+
this._isOpen = nextValue;
|
|
10636
|
+
if (nextValue) {
|
|
10637
|
+
this.events.dispatch({ type: "sidebar:opened" });
|
|
11373
10638
|
} else {
|
|
11374
|
-
|
|
10639
|
+
this.events.dispatch({ type: "sidebar:closed" });
|
|
11375
10640
|
}
|
|
11376
|
-
};
|
|
11377
|
-
let deleteMediaItem;
|
|
11378
|
-
if (allowDelete) {
|
|
11379
|
-
deleteMediaItem = async (item) => {
|
|
11380
|
-
await cms.media.delete(item);
|
|
11381
|
-
};
|
|
11382
10641
|
}
|
|
11383
|
-
|
|
11384
|
-
|
|
11385
|
-
|
|
11386
|
-
|
|
11387
|
-
|
|
11388
|
-
|
|
10642
|
+
subscribe(callback) {
|
|
10643
|
+
const unsub = this.events.subscribe("sidebar", callback);
|
|
10644
|
+
return () => unsub();
|
|
10645
|
+
}
|
|
10646
|
+
}
|
|
10647
|
+
function ImFilesEmpty(props) {
|
|
10648
|
+
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" }, "child": [] }, { "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" }, "child": [] }] })(props);
|
|
10649
|
+
}
|
|
10650
|
+
function ImUsers(props) {
|
|
10651
|
+
return GenIcon({ "tag": "svg", "attr": { "version": "1.1", "viewBox": "0 0 18 16" }, "child": [{ "tag": "path", "attr": { "d": "M12 12.041v-0.825c1.102-0.621 2-2.168 2-3.716 0-2.485 0-4.5-3-4.5s-3 2.015-3 4.5c0 1.548 0.898 3.095 2 3.716v0.825c-3.392 0.277-6 1.944-6 3.959h14c0-2.015-2.608-3.682-6-3.959z" }, "child": [] }, { "tag": "path", "attr": { "d": "M5.112 12.427c0.864-0.565 1.939-0.994 3.122-1.256-0.235-0.278-0.449-0.588-0.633-0.922-0.475-0.863-0.726-1.813-0.726-2.748 0-1.344 0-2.614 0.478-3.653 0.464-1.008 1.299-1.633 2.488-1.867-0.264-1.195-0.968-1.98-2.841-1.98-3 0-3 2.015-3 4.5 0 1.548 0.898 3.095 2 3.716v0.825c-3.392 0.277-6 1.944-6 3.959h4.359c0.227-0.202 0.478-0.393 0.753-0.573z" }, "child": [] }] })(props);
|
|
10652
|
+
}
|
|
10653
|
+
const LocalWarning = () => {
|
|
10654
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
10655
|
+
"a",
|
|
10656
|
+
{
|
|
10657
|
+
className: "flex-grow-0 flex w-full text-xs items-center py-1 px-4 text-yellow-600 bg-gradient-to-r from-yellow-50 to-yellow-100 border-b border-gray-150 shadow-sm",
|
|
10658
|
+
href: "https://tina.io/docs/tina-cloud/",
|
|
10659
|
+
target: "_blank"
|
|
10660
|
+
},
|
|
10661
|
+
/* @__PURE__ */ React__namespace.createElement(AiFillWarning, { className: "w-5 h-auto inline-block mr-1 opacity-70 text-yellow-600" }),
|
|
10662
|
+
" ",
|
|
10663
|
+
"You are currently in",
|
|
10664
|
+
/* @__PURE__ */ React__namespace.createElement("strong", { className: "ml-1 font-bold text-yellow-700" }, "Local Mode")
|
|
10665
|
+
);
|
|
10666
|
+
};
|
|
10667
|
+
const BillingWarning = () => {
|
|
10668
|
+
var _a;
|
|
10669
|
+
const cms = useCMS$1();
|
|
10670
|
+
const api = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina;
|
|
10671
|
+
const isCustomContentApi = (api == null ? void 0 : api.isCustomContentApi) || false;
|
|
10672
|
+
const [billingState, setBillingState] = React__namespace.useState(
|
|
10673
|
+
null
|
|
10674
|
+
);
|
|
10675
|
+
React__namespace.useEffect(() => {
|
|
10676
|
+
const fetchBillingState = async () => {
|
|
10677
|
+
if (typeof (api == null ? void 0 : api.getBillingState) !== "function")
|
|
10678
|
+
return;
|
|
10679
|
+
const billingRes = await (api == null ? void 0 : api.getBillingState());
|
|
10680
|
+
setBillingState(billingRes);
|
|
11389
10681
|
};
|
|
10682
|
+
if (!isCustomContentApi)
|
|
10683
|
+
fetchBillingState();
|
|
10684
|
+
}, []);
|
|
10685
|
+
if (isCustomContentApi || !billingState || billingState.billingState === "current") {
|
|
10686
|
+
return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null);
|
|
11390
10687
|
}
|
|
11391
|
-
|
|
11392
|
-
|
|
11393
|
-
|
|
11394
|
-
|
|
11395
|
-
|
|
11396
|
-
|
|
11397
|
-
|
|
11398
|
-
|
|
11399
|
-
|
|
11400
|
-
|
|
11401
|
-
|
|
11402
|
-
|
|
11403
|
-
|
|
11404
|
-
|
|
11405
|
-
|
|
11406
|
-
|
|
11407
|
-
|
|
11408
|
-
|
|
11409
|
-
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
|
|
11414
|
-
|
|
11415
|
-
|
|
11416
|
-
|
|
11417
|
-
|
|
11418
|
-
|
|
11419
|
-
|
|
11420
|
-
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
|
|
11424
|
-
|
|
11425
|
-
|
|
11426
|
-
|
|
11427
|
-
|
|
11428
|
-
|
|
11429
|
-
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
|
|
11433
|
-
|
|
11434
|
-
|
|
11435
|
-
|
|
11436
|
-
|
|
11437
|
-
|
|
11438
|
-
|
|
11439
|
-
|
|
11440
|
-
|
|
11441
|
-
|
|
11442
|
-
|
|
11443
|
-
|
|
11444
|
-
|
|
11445
|
-
|
|
11446
|
-
|
|
11447
|
-
|
|
11448
|
-
|
|
10688
|
+
return /* @__PURE__ */ React__namespace.createElement("div", { className: "flex-grow-0 flex flex-wrap w-full text-xs items-center justify-between gap-1.5 py-1.5 px-3 text-red-700 bg-gradient-to-br from-white via-red-50 to-red-100 border-b border-red-200" }, /* @__PURE__ */ React__namespace.createElement("span", { className: "flex items-center gap-1 font-bold" }, /* @__PURE__ */ React__namespace.createElement(BiError, { className: "w-5 h-auto flex-shrink-0 flex-grow-0 inline-block opacity-70 text-red-600" }), /* @__PURE__ */ React__namespace.createElement("span", { className: "flex whitespace-nowrap" }, "There is an issue with your billing.")), /* @__PURE__ */ React__namespace.createElement(
|
|
10689
|
+
"a",
|
|
10690
|
+
{
|
|
10691
|
+
className: "text-xs text-blue-600 underline decoration-blue-200 hover:text-blue-500 hover:decoration-blue-500 transition-all ease-out duration-150 flex items-center gap-1 self-end",
|
|
10692
|
+
href: `https://app.tina.io/projects/${billingState.clientId}/billing`,
|
|
10693
|
+
target: "_blank"
|
|
10694
|
+
},
|
|
10695
|
+
"Visit Billing Page",
|
|
10696
|
+
/* @__PURE__ */ React__namespace.createElement(BiRightArrowAlt, { className: "w-5 h-full opacity-70" })
|
|
10697
|
+
));
|
|
10698
|
+
};
|
|
10699
|
+
function FiInfo(props) {
|
|
10700
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "circle", "attr": { "cx": "12", "cy": "12", "r": "10" }, "child": [] }, { "tag": "line", "attr": { "x1": "12", "y1": "16", "x2": "12", "y2": "12" }, "child": [] }, { "tag": "line", "attr": { "x1": "12", "y1": "8", "x2": "12.01", "y2": "8" }, "child": [] }] })(props);
|
|
10701
|
+
}
|
|
10702
|
+
function FiMoreVertical(props) {
|
|
10703
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "circle", "attr": { "cx": "12", "cy": "12", "r": "1" }, "child": [] }, { "tag": "circle", "attr": { "cx": "12", "cy": "5", "r": "1" }, "child": [] }, { "tag": "circle", "attr": { "cx": "12", "cy": "19", "r": "1" }, "child": [] }] })(props);
|
|
10704
|
+
}
|
|
10705
|
+
function VscNewFile(props) {
|
|
10706
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 16 16", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "clipRule": "evenodd", "d": "M9.5 1.1l3.4 3.5.1.4v2h-1V6H8V2H3v11h4v1H2.5l-.5-.5v-12l.5-.5h6.7l.3.1zM9 2v3h2.9L9 2zm4 14h-1v-3H9v-1h3V9h1v3h3v1h-3v3z" }, "child": [] }] })(props);
|
|
10707
|
+
}
|
|
10708
|
+
const FormModal = ({ plugin, close: close2 }) => {
|
|
10709
|
+
const cms = useCMS$1();
|
|
10710
|
+
const form = React.useMemo(
|
|
10711
|
+
() => new Form({
|
|
10712
|
+
id: "create-form-id",
|
|
10713
|
+
label: "create-form",
|
|
10714
|
+
fields: plugin.fields,
|
|
10715
|
+
actions: plugin.actions,
|
|
10716
|
+
buttons: plugin.buttons,
|
|
10717
|
+
initialValues: plugin.initialValues || {},
|
|
10718
|
+
reset: plugin.reset,
|
|
10719
|
+
onChange: plugin.onChange,
|
|
10720
|
+
onSubmit: async (values) => {
|
|
10721
|
+
await plugin.onSubmit(values, cms).then(() => {
|
|
10722
|
+
close2();
|
|
10723
|
+
});
|
|
10724
|
+
}
|
|
10725
|
+
}),
|
|
10726
|
+
[close2, cms, plugin]
|
|
10727
|
+
);
|
|
10728
|
+
return /* @__PURE__ */ React__namespace.createElement(Modal, { id: "content-creator-modal", onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React__namespace.createElement(PopupModal, null, /* @__PURE__ */ React__namespace.createElement(ModalHeader, { close: close2 }, plugin.name), /* @__PURE__ */ React__namespace.createElement(ModalBody, null, /* @__PURE__ */ React__namespace.createElement(FormBuilder, { form: { tinaForm: form } }))));
|
|
10729
|
+
};
|
|
10730
|
+
function HiOutlineClipboardList(props) {
|
|
10731
|
+
return GenIcon({ "tag": "svg", "attr": { "fill": "none", "viewBox": "0 0 24 24", "strokeWidth": "2", "stroke": "currentColor", "aria-hidden": "true" }, "child": [{ "tag": "path", "attr": { "strokeLinecap": "round", "strokeLinejoin": "round", "d": "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" }, "child": [] }] })(props);
|
|
10732
|
+
}
|
|
10733
|
+
const useGetEvents = (cms, cursor, existingEvents) => {
|
|
10734
|
+
const [events, setEvents] = React.useState([]);
|
|
10735
|
+
const [nextCursor, setNextCursor] = React.useState(void 0);
|
|
10736
|
+
const [loading, setLoading] = React.useState(true);
|
|
10737
|
+
const [error, setError] = React.useState(void 0);
|
|
10738
|
+
React__namespace.useEffect(() => {
|
|
10739
|
+
const fetchEvents = async () => {
|
|
10740
|
+
var _a, _b, _c, _d, _e;
|
|
10741
|
+
let doFetchEvents = false;
|
|
10742
|
+
if (!((_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isCustomContentApi)) {
|
|
10743
|
+
doFetchEvents = await ((_e = (_d = (_c = cms.api) == null ? void 0 : _c.tina) == null ? void 0 : _d.authProvider) == null ? void 0 : _e.isAuthenticated());
|
|
10744
|
+
}
|
|
10745
|
+
if (doFetchEvents) {
|
|
10746
|
+
try {
|
|
10747
|
+
const { events: nextEvents, cursor: nextCursor2 } = await cms.api.tina.fetchEvents(15, cursor);
|
|
10748
|
+
setEvents([...existingEvents, ...nextEvents]);
|
|
10749
|
+
setNextCursor(nextCursor2);
|
|
10750
|
+
} catch (error2) {
|
|
10751
|
+
cms.alerts.error(
|
|
10752
|
+
`[${error2.name}] GetEvents failed: ${error2.message}`,
|
|
10753
|
+
30 * 1e3
|
|
10754
|
+
// 30 seconds
|
|
10755
|
+
);
|
|
10756
|
+
console.error(error2);
|
|
10757
|
+
setEvents(void 0);
|
|
10758
|
+
setError(error2);
|
|
11449
10759
|
}
|
|
11450
|
-
|
|
10760
|
+
setLoading(false);
|
|
11451
10761
|
}
|
|
11452
|
-
setUploading(false);
|
|
11453
|
-
}
|
|
11454
|
-
});
|
|
11455
|
-
const { onClick, ...rootProps } = getRootProps();
|
|
11456
|
-
function disableScrollBody() {
|
|
11457
|
-
const body = document == null ? void 0 : document.body;
|
|
11458
|
-
body.style.overflow = "hidden";
|
|
11459
|
-
return () => {
|
|
11460
|
-
body.style.overflow = "auto";
|
|
11461
10762
|
};
|
|
11462
|
-
|
|
11463
|
-
|
|
11464
|
-
|
|
11465
|
-
|
|
11466
|
-
|
|
11467
|
-
|
|
11468
|
-
|
|
11469
|
-
|
|
11470
|
-
|
|
11471
|
-
|
|
11472
|
-
|
|
10763
|
+
setLoading(true);
|
|
10764
|
+
fetchEvents();
|
|
10765
|
+
}, [cms, cursor]);
|
|
10766
|
+
return { events, cursor: nextCursor, loading, error };
|
|
10767
|
+
};
|
|
10768
|
+
function useSyncStatus(cms) {
|
|
10769
|
+
var _a, _b;
|
|
10770
|
+
const [syncStatus, setSyncStatus] = React.useState({ state: "loading", message: "Loading..." });
|
|
10771
|
+
React__namespace.useEffect(() => {
|
|
10772
|
+
const interval = setInterval(async () => {
|
|
10773
|
+
var _a2, _b2, _c, _d, _e;
|
|
10774
|
+
let doFetchEvents = false;
|
|
10775
|
+
if (!((_b2 = (_a2 = cms.api) == null ? void 0 : _a2.tina) == null ? void 0 : _b2.isCustomContentApi)) {
|
|
10776
|
+
doFetchEvents = await ((_e = (_d = (_c = cms.api) == null ? void 0 : _c.tina) == null ? void 0 : _d.authProvider) == null ? void 0 : _e.isAuthenticated());
|
|
11473
10777
|
}
|
|
11474
|
-
|
|
11475
|
-
|
|
11476
|
-
|
|
11477
|
-
|
|
11478
|
-
|
|
11479
|
-
|
|
11480
|
-
|
|
10778
|
+
if (doFetchEvents) {
|
|
10779
|
+
const { events } = await cms.api.tina.fetchEvents();
|
|
10780
|
+
if (events.length === 0) {
|
|
10781
|
+
setSyncStatus({ state: "success", message: "No Events" });
|
|
10782
|
+
} else {
|
|
10783
|
+
if (events[0].isError) {
|
|
10784
|
+
setSyncStatus({
|
|
10785
|
+
state: "error",
|
|
10786
|
+
message: `Sync Failure ${events[0].message}`
|
|
10787
|
+
});
|
|
10788
|
+
} else {
|
|
10789
|
+
setSyncStatus({ state: "success", message: "Sync Successful" });
|
|
10790
|
+
}
|
|
10791
|
+
}
|
|
10792
|
+
} else {
|
|
10793
|
+
setSyncStatus({ state: "unauthorized", message: "Not Authenticated" });
|
|
11481
10794
|
}
|
|
11482
|
-
};
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
10795
|
+
}, 5e3);
|
|
10796
|
+
return () => clearInterval(interval);
|
|
10797
|
+
}, [(_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isCustomContentApi]);
|
|
10798
|
+
return syncStatus;
|
|
10799
|
+
}
|
|
10800
|
+
const SyncErrorWidget = ({ cms }) => {
|
|
10801
|
+
const syncStatus = useSyncStatus(cms);
|
|
10802
|
+
if (syncStatus.state !== "error") {
|
|
10803
|
+
return null;
|
|
11486
10804
|
}
|
|
11487
|
-
|
|
11488
|
-
|
|
11489
|
-
|
|
10805
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
10806
|
+
"div",
|
|
10807
|
+
{
|
|
10808
|
+
title: syncStatus.message,
|
|
10809
|
+
className: "flex-grow-0 flex text-xs items-center"
|
|
10810
|
+
},
|
|
10811
|
+
/* @__PURE__ */ React__namespace.createElement(MdSyncProblem, { className: "w-6 h-full ml-2 text-red-500 fill-current" })
|
|
10812
|
+
);
|
|
10813
|
+
};
|
|
10814
|
+
const EventsList = ({ cms }) => {
|
|
10815
|
+
const [cursor, setCursor] = React__namespace.useState(void 0);
|
|
10816
|
+
const [existingEvents, setExistingEvents] = React__namespace.useState([]);
|
|
10817
|
+
const {
|
|
10818
|
+
events,
|
|
10819
|
+
cursor: nextCursor,
|
|
10820
|
+
loading,
|
|
10821
|
+
error
|
|
10822
|
+
} = useGetEvents(cms, cursor, existingEvents);
|
|
10823
|
+
return /* @__PURE__ */ React__namespace.createElement("div", { className: "flex flex-col gap-4 w-full h-full grow-0" }, events.length > 0 && /* @__PURE__ */ React__namespace.createElement("div", { className: "shrink grow-0 overflow-scroll w-full rounded-md shadow ring-1 ring-black ring-opacity-5" }, /* @__PURE__ */ React__namespace.createElement("table", { className: "w-full divide-y divide-gray-100" }, events.map((event, index) => {
|
|
10824
|
+
const date = new Date(event.timestamp).toDateString();
|
|
10825
|
+
const time = new Date(event.timestamp).toTimeString();
|
|
10826
|
+
return /* @__PURE__ */ React__namespace.createElement("tr", { className: index % 2 === 0 ? "" : "bg-gray-50" }, event.isError ? /* @__PURE__ */ React__namespace.createElement(
|
|
10827
|
+
"td",
|
|
11490
10828
|
{
|
|
11491
|
-
|
|
11492
|
-
|
|
11493
|
-
|
|
10829
|
+
key: `${event.id}_error_icon`,
|
|
10830
|
+
className: "py-3 pl-4 pr-0 w-0"
|
|
10831
|
+
},
|
|
10832
|
+
/* @__PURE__ */ React__namespace.createElement(BsExclamationOctagonFill, { className: "text-red-500 fill-current w-5 h-auto" })
|
|
10833
|
+
) : /* @__PURE__ */ React__namespace.createElement(
|
|
10834
|
+
"td",
|
|
10835
|
+
{
|
|
10836
|
+
key: `${event.id}_ok_icon`,
|
|
10837
|
+
className: "py-3 pl-4 pr-0 w-0"
|
|
10838
|
+
},
|
|
10839
|
+
/* @__PURE__ */ React__namespace.createElement(BsCheckCircleFill, { className: "text-green-500 fill-current w-5 h-auto" })
|
|
10840
|
+
), /* @__PURE__ */ React__namespace.createElement(
|
|
10841
|
+
"td",
|
|
10842
|
+
{
|
|
10843
|
+
key: `${event.id}_msg`,
|
|
10844
|
+
className: "whitespace-nowrap p-3 text-base text-gray-500"
|
|
10845
|
+
},
|
|
10846
|
+
event.message,
|
|
10847
|
+
event.isError && /* @__PURE__ */ React__namespace.createElement("div", { className: "w-full text-gray-300 text-xs mt-0.5" }, event.id)
|
|
10848
|
+
), /* @__PURE__ */ React__namespace.createElement(
|
|
10849
|
+
"td",
|
|
10850
|
+
{
|
|
10851
|
+
key: `${event.id}_ts`,
|
|
10852
|
+
className: "whitespace-nowrap py-3 pl-3 pr-4 text-sm text-gray-500"
|
|
10853
|
+
},
|
|
10854
|
+
date,
|
|
10855
|
+
/* @__PURE__ */ React__namespace.createElement("span", { className: "w-full block text-gray-300 text-xs mt-0.5" }, time)
|
|
10856
|
+
));
|
|
10857
|
+
}).flat())), loading && /* @__PURE__ */ React__namespace.createElement("div", { className: "text-sm text-gray-400 text-center" }, "Loading..."), error && /* @__PURE__ */ React__namespace.createElement("div", null, "Error: ", error.message), /* @__PURE__ */ React__namespace.createElement("div", { className: "text-center flex-1" }, /* @__PURE__ */ React__namespace.createElement(
|
|
10858
|
+
Button$1,
|
|
10859
|
+
{
|
|
10860
|
+
onClick: () => {
|
|
10861
|
+
setExistingEvents(events);
|
|
10862
|
+
setCursor(nextCursor);
|
|
11494
10863
|
}
|
|
11495
|
-
|
|
10864
|
+
},
|
|
10865
|
+
"Load More Events"
|
|
10866
|
+
)));
|
|
10867
|
+
};
|
|
10868
|
+
const SyncStatusModal = ({ closeEventsModal, cms }) => /* @__PURE__ */ React__namespace.createElement(Modal, null, /* @__PURE__ */ React__namespace.createElement(FullscreenModal, null, /* @__PURE__ */ React__namespace.createElement(ModalHeader, { close: closeEventsModal }, "Event Log"), /* @__PURE__ */ React__namespace.createElement(ModalBody, { className: "flex h-full flex-col", padded: true }, /* @__PURE__ */ React__namespace.createElement(EventsList, { cms }))));
|
|
10869
|
+
const SyncStatus = ({ cms, setEventsOpen }) => {
|
|
10870
|
+
var _a, _b;
|
|
10871
|
+
const syncStatus = useSyncStatus(cms);
|
|
10872
|
+
function openEventsModal() {
|
|
10873
|
+
setEventsOpen(true);
|
|
11496
10874
|
}
|
|
11497
|
-
if (
|
|
11498
|
-
|
|
11499
|
-
return /* @__PURE__ */ React.createElement(DocsLink, { title, message, docsLink });
|
|
10875
|
+
if ((_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isCustomContentApi) {
|
|
10876
|
+
return null;
|
|
11500
10877
|
}
|
|
11501
|
-
return /* @__PURE__ */
|
|
11502
|
-
|
|
10878
|
+
return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
|
|
10879
|
+
"button",
|
|
11503
10880
|
{
|
|
11504
|
-
|
|
11505
|
-
|
|
11506
|
-
|
|
11507
|
-
|
|
11508
|
-
|
|
11509
|
-
|
|
11510
|
-
|
|
11511
|
-
|
|
10881
|
+
className: `text-lg px-4 py-2 first:pt-3 last:pb-3 tracking-wide whitespace-nowrap flex items-center opacity-80 text-gray-600 hover:text-blue-400 hover:bg-gray-50 hover:opacity-100`,
|
|
10882
|
+
onClick: openEventsModal
|
|
10883
|
+
},
|
|
10884
|
+
syncStatus.state !== "error" ? /* @__PURE__ */ React__namespace.createElement(HiOutlineClipboardList, { className: "w-6 h-auto mr-2 text-blue-400" }) : /* @__PURE__ */ React__namespace.createElement(MdSyncProblem, { className: "w-6 h-auto mr-2 text-red-400" }),
|
|
10885
|
+
" ",
|
|
10886
|
+
"Event Log"
|
|
10887
|
+
));
|
|
10888
|
+
};
|
|
10889
|
+
const version = "2.7.7";
|
|
10890
|
+
const Nav = ({
|
|
10891
|
+
isLocalMode,
|
|
10892
|
+
className = "",
|
|
10893
|
+
children,
|
|
10894
|
+
showCollections,
|
|
10895
|
+
collectionsInfo,
|
|
10896
|
+
screens,
|
|
10897
|
+
cloudConfigs,
|
|
10898
|
+
contentCreators,
|
|
10899
|
+
sidebarWidth,
|
|
10900
|
+
RenderNavSite,
|
|
10901
|
+
RenderNavCloud,
|
|
10902
|
+
RenderNavCollection,
|
|
10903
|
+
AuthRenderNavCollection,
|
|
10904
|
+
...props
|
|
10905
|
+
}) => {
|
|
10906
|
+
const cms = useCMS$1();
|
|
10907
|
+
const [eventsOpen, setEventsOpen] = React__namespace.useState(false);
|
|
10908
|
+
const { contentCollections, authCollection } = collectionsInfo.collections.reduce(
|
|
10909
|
+
(acc, collection) => {
|
|
10910
|
+
if (collection.isAuthCollection) {
|
|
10911
|
+
acc.authCollection = collection;
|
|
10912
|
+
} else {
|
|
10913
|
+
acc.contentCollections.push(collection);
|
|
10914
|
+
}
|
|
10915
|
+
return acc;
|
|
10916
|
+
},
|
|
10917
|
+
{
|
|
10918
|
+
contentCollections: []
|
|
11512
10919
|
}
|
|
11513
|
-
)
|
|
11514
|
-
|
|
10920
|
+
);
|
|
10921
|
+
function closeEventsModal() {
|
|
10922
|
+
setEventsOpen(false);
|
|
10923
|
+
}
|
|
10924
|
+
const WrappedSyncStatus = React__namespace.forwardRef(
|
|
10925
|
+
(props2, ref) => /* @__PURE__ */ React__namespace.createElement(SyncStatus, { ...props2 })
|
|
10926
|
+
);
|
|
10927
|
+
const screenCategories = screens.reduce(
|
|
10928
|
+
(acc, screen) => {
|
|
10929
|
+
const category = screen.navCategory || "Site";
|
|
10930
|
+
acc[category] = acc[category] || [];
|
|
10931
|
+
acc[category].push(screen);
|
|
10932
|
+
return acc;
|
|
10933
|
+
},
|
|
10934
|
+
{ Site: [] }
|
|
10935
|
+
);
|
|
10936
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
10937
|
+
"div",
|
|
11515
10938
|
{
|
|
11516
|
-
|
|
11517
|
-
|
|
11518
|
-
|
|
11519
|
-
|
|
11520
|
-
|
|
11521
|
-
|
|
10939
|
+
className: `relative z-30 flex flex-col bg-white border-r border-gray-200 w-96 h-full ${className}`,
|
|
10940
|
+
style: { maxWidth: `${sidebarWidth}px` },
|
|
10941
|
+
...props
|
|
10942
|
+
},
|
|
10943
|
+
/* @__PURE__ */ React__namespace.createElement("div", { className: "border-b border-gray-200" }, /* @__PURE__ */ React__namespace.createElement(react.Menu, { as: "div", className: "relative block" }, ({ open: open2 }) => /* @__PURE__ */ React__namespace.createElement("div", null, /* @__PURE__ */ React__namespace.createElement(
|
|
10944
|
+
react.MenuButton,
|
|
10945
|
+
{
|
|
10946
|
+
className: `group w-full px-6 py-3 gap-2 flex justify-between items-center transition-colors duration-150 ease-out ${open2 ? "bg-gray-50" : "bg-transparent"}`
|
|
10947
|
+
},
|
|
10948
|
+
/* @__PURE__ */ React__namespace.createElement("span", { className: "text-left inline-flex items-center text-xl tracking-wide text-gray-800 flex-1 gap-1 opacity-80 group-hover:opacity-100 transition-opacity duration-150 ease-out" }, /* @__PURE__ */ React__namespace.createElement(
|
|
10949
|
+
"svg",
|
|
10950
|
+
{
|
|
10951
|
+
viewBox: "0 0 32 32",
|
|
10952
|
+
fill: "#EC4815",
|
|
10953
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10954
|
+
className: "w-10 h-auto -ml-1"
|
|
10955
|
+
},
|
|
10956
|
+
/* @__PURE__ */ React__namespace.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" }),
|
|
10957
|
+
/* @__PURE__ */ React__namespace.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" })
|
|
10958
|
+
), /* @__PURE__ */ React__namespace.createElement("span", null, "Tina")),
|
|
10959
|
+
/* @__PURE__ */ React__namespace.createElement(SyncErrorWidget, { cms }),
|
|
10960
|
+
/* @__PURE__ */ React__namespace.createElement(
|
|
10961
|
+
FiMoreVertical,
|
|
10962
|
+
{
|
|
10963
|
+
className: `flex-0 w-6 h-full inline-block group-hover:opacity-80 transition-all duration-300 ease-in-out transform ${open2 ? "opacity-100 text-blue-400" : "text-gray-400 opacity-50 hover:opacity-70"}`
|
|
10964
|
+
}
|
|
10965
|
+
)
|
|
10966
|
+
), /* @__PURE__ */ React__namespace.createElement("div", { className: "transform translate-y-full absolute bottom-3 right-5 z-50" }, /* @__PURE__ */ React__namespace.createElement(
|
|
10967
|
+
react.Transition,
|
|
10968
|
+
{
|
|
10969
|
+
enter: "transition duration-150 ease-out",
|
|
10970
|
+
enterFrom: "transform opacity-0 -translate-y-2",
|
|
10971
|
+
enterTo: "transform opacity-100 translate-y-0",
|
|
10972
|
+
leave: "transition duration-75 ease-in",
|
|
10973
|
+
leaveFrom: "transform opacity-100 translate-y-0",
|
|
10974
|
+
leaveTo: "transform opacity-0 -translate-y-2"
|
|
10975
|
+
},
|
|
10976
|
+
/* @__PURE__ */ React__namespace.createElement(react.MenuItems, { className: "bg-white border border-gray-150 rounded-lg shadow-lg flex flex-col items-stretch overflow-hidden" }, /* @__PURE__ */ React__namespace.createElement(react.MenuItem, null, /* @__PURE__ */ React__namespace.createElement(
|
|
10977
|
+
"button",
|
|
10978
|
+
{
|
|
10979
|
+
className: `text-lg px-4 py-2 first:pt-3 last:pb-3 tracking-wide whitespace-nowrap flex items-center opacity-80 text-gray-600 hover:text-blue-400 hover:bg-gray-50 hover:opacity-100`,
|
|
10980
|
+
onClick: async () => {
|
|
10981
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
10982
|
+
updateBodyDisplacement({
|
|
10983
|
+
displayState: "closed",
|
|
10984
|
+
sidebarWidth: null,
|
|
10985
|
+
resizingSidebar: false
|
|
10986
|
+
});
|
|
10987
|
+
try {
|
|
10988
|
+
if ((_c = (_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.authProvider) == null ? void 0 : _c.logout) {
|
|
10989
|
+
await ((_d = cms.api.tina) == null ? void 0 : _d.authProvider.logout());
|
|
10990
|
+
if ((_f = (_e = cms == null ? void 0 : cms.api) == null ? void 0 : _e.tina) == null ? void 0 : _f.onLogout) {
|
|
10991
|
+
await ((_h = (_g = cms == null ? void 0 : cms.api) == null ? void 0 : _g.tina) == null ? void 0 : _h.onLogout());
|
|
10992
|
+
await new Promise(
|
|
10993
|
+
(resolve) => setTimeout(resolve, 500)
|
|
10994
|
+
);
|
|
10995
|
+
}
|
|
10996
|
+
window.location.href = new URL(
|
|
10997
|
+
window.location.href
|
|
10998
|
+
).pathname;
|
|
10999
|
+
}
|
|
11000
|
+
} catch (e) {
|
|
11001
|
+
cms.alerts.error(`Error logging out: ${e}`);
|
|
11002
|
+
console.error("Unexpected error calling logout");
|
|
11003
|
+
console.error(e);
|
|
11004
|
+
}
|
|
11522
11005
|
}
|
|
11523
|
-
}
|
|
11524
|
-
|
|
11525
|
-
|
|
11006
|
+
},
|
|
11007
|
+
/* @__PURE__ */ React__namespace.createElement(BiExit, { className: "w-6 h-auto mr-2 text-blue-400" }),
|
|
11008
|
+
" Log Out"
|
|
11009
|
+
)), /* @__PURE__ */ React__namespace.createElement(react.MenuItem, null, /* @__PURE__ */ React__namespace.createElement(
|
|
11010
|
+
WrappedSyncStatus,
|
|
11011
|
+
{
|
|
11012
|
+
cms,
|
|
11013
|
+
setEventsOpen
|
|
11014
|
+
}
|
|
11015
|
+
)))
|
|
11016
|
+
))))),
|
|
11017
|
+
eventsOpen && /* @__PURE__ */ React__namespace.createElement(SyncStatusModal, { cms, closeEventsModal }),
|
|
11018
|
+
children,
|
|
11019
|
+
/* @__PURE__ */ React__namespace.createElement("div", { className: "flex flex-col px-6 flex-1 overflow-auto" }, showCollections && /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement("h4", { className: "flex space-x-1 justify-items-start uppercase font-sans font-bold text-sm mb-3 mt-8 text-gray-700" }, /* @__PURE__ */ React__namespace.createElement("span", null, "Collections"), isLocalMode && /* @__PURE__ */ React__namespace.createElement("span", { className: "flex items-center" }, /* @__PURE__ */ React__namespace.createElement(
|
|
11020
|
+
"a",
|
|
11021
|
+
{
|
|
11022
|
+
href: "https://tina.io/docs/schema/#defining-collections",
|
|
11023
|
+
target: "_blank"
|
|
11024
|
+
},
|
|
11025
|
+
/* @__PURE__ */ React__namespace.createElement(FiInfo, null)
|
|
11026
|
+
))), /* @__PURE__ */ React__namespace.createElement(
|
|
11027
|
+
CollectionsList,
|
|
11028
|
+
{
|
|
11029
|
+
RenderNavCollection,
|
|
11030
|
+
collections: contentCollections
|
|
11031
|
+
}
|
|
11032
|
+
)), (screenCategories.Site.length > 0 || contentCreators.length) > 0 && /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement("h4", { className: "uppercase font-sans font-bold text-sm mb-3 mt-8 text-gray-700" }, "Site"), /* @__PURE__ */ React__namespace.createElement("ul", { className: "flex flex-col gap-4" }, screenCategories.Site.map((view) => {
|
|
11033
|
+
return /* @__PURE__ */ React__namespace.createElement("li", { key: `nav-site-${view.name}` }, /* @__PURE__ */ React__namespace.createElement(RenderNavSite, { view }));
|
|
11034
|
+
}), contentCreators.map((plugin, idx) => {
|
|
11035
|
+
return /* @__PURE__ */ React__namespace.createElement(CreateContentNavItem, { key: `plugin-${idx}`, plugin });
|
|
11036
|
+
}), authCollection && /* @__PURE__ */ React__namespace.createElement(
|
|
11037
|
+
CollectionsList,
|
|
11038
|
+
{
|
|
11039
|
+
RenderNavCollection: AuthRenderNavCollection,
|
|
11040
|
+
collections: [authCollection]
|
|
11041
|
+
}
|
|
11042
|
+
))), Object.entries(screenCategories).map(([category, screens2]) => {
|
|
11043
|
+
if (category !== "Site") {
|
|
11044
|
+
return /* @__PURE__ */ React__namespace.createElement("div", { key: category }, /* @__PURE__ */ React__namespace.createElement("h4", { className: "uppercase font-sans font-bold text-sm mb-3 mt-8 text-gray-700" }, category), /* @__PURE__ */ React__namespace.createElement("ul", { className: "flex flex-col gap-4" }, screens2.map((view) => {
|
|
11045
|
+
return /* @__PURE__ */ React__namespace.createElement("li", { key: `nav-site-${view.name}` }, /* @__PURE__ */ React__namespace.createElement(RenderNavSite, { view }));
|
|
11046
|
+
})));
|
|
11047
|
+
}
|
|
11048
|
+
}), !!(cloudConfigs == null ? void 0 : cloudConfigs.length) && /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement("h4", { className: "uppercase font-sans font-bold text-sm mb-3 mt-8 text-gray-700" }, "Cloud"), /* @__PURE__ */ React__namespace.createElement("ul", { className: "flex flex-col gap-4" }, cloudConfigs.map((config) => {
|
|
11049
|
+
return /* @__PURE__ */ React__namespace.createElement("li", { key: `nav-site-${config.name}` }, /* @__PURE__ */ React__namespace.createElement(RenderNavCloud, { config }));
|
|
11050
|
+
}))), /* @__PURE__ */ React__namespace.createElement("div", { className: "grow" }), /* @__PURE__ */ React__namespace.createElement("span", { className: "font-sans font-light text-xs mb-3 mt-8 text-gray-500" }, "v", version))
|
|
11051
|
+
);
|
|
11052
|
+
};
|
|
11053
|
+
const CollectionsList = ({
|
|
11054
|
+
collections,
|
|
11055
|
+
RenderNavCollection
|
|
11056
|
+
}) => {
|
|
11057
|
+
if (collections.length === 0) {
|
|
11058
|
+
return /* @__PURE__ */ React__namespace.createElement("div", null, "No collections found");
|
|
11059
|
+
}
|
|
11060
|
+
return /* @__PURE__ */ React__namespace.createElement("ul", { className: "flex flex-col gap-4" }, collections.map((collection) => {
|
|
11061
|
+
return /* @__PURE__ */ React__namespace.createElement("li", { key: `nav-collection-${collection.name}` }, /* @__PURE__ */ React__namespace.createElement(RenderNavCollection, { collection }));
|
|
11062
|
+
}));
|
|
11063
|
+
};
|
|
11064
|
+
const CreateContentNavItem = ({ plugin }) => {
|
|
11065
|
+
const [open2, setOpen] = React__namespace.useState(false);
|
|
11066
|
+
return /* @__PURE__ */ React__namespace.createElement("li", { key: plugin.name }, /* @__PURE__ */ React__namespace.createElement(
|
|
11067
|
+
"button",
|
|
11068
|
+
{
|
|
11069
|
+
className: "text-base tracking-wide text-gray-500 hover:text-blue-600 flex items-center opacity-90 hover:opacity-100",
|
|
11070
|
+
onClick: () => {
|
|
11071
|
+
setOpen(true);
|
|
11072
|
+
}
|
|
11073
|
+
},
|
|
11074
|
+
/* @__PURE__ */ React__namespace.createElement(VscNewFile, { className: "mr-3 h-6 opacity-80 w-auto" }),
|
|
11075
|
+
" ",
|
|
11076
|
+
plugin.name
|
|
11077
|
+
), open2 && /* @__PURE__ */ React__namespace.createElement(FormModal, { plugin, close: () => setOpen(false) }));
|
|
11078
|
+
};
|
|
11079
|
+
const ResizeHandle = () => {
|
|
11080
|
+
const {
|
|
11081
|
+
resizingSidebar,
|
|
11082
|
+
setResizingSidebar,
|
|
11083
|
+
fullscreen,
|
|
11084
|
+
setSidebarWidth,
|
|
11085
|
+
displayState
|
|
11086
|
+
} = React__namespace.useContext(SidebarContext);
|
|
11087
|
+
React__namespace.useEffect(() => {
|
|
11088
|
+
const handleMouseUp = () => setResizingSidebar(false);
|
|
11089
|
+
window.addEventListener("mouseup", handleMouseUp);
|
|
11090
|
+
return () => {
|
|
11091
|
+
window.removeEventListener("mouseup", handleMouseUp);
|
|
11092
|
+
};
|
|
11093
|
+
}, []);
|
|
11094
|
+
React__namespace.useEffect(() => {
|
|
11095
|
+
const handleMouseMove = (e) => {
|
|
11096
|
+
setSidebarWidth((sidebarWidth) => {
|
|
11097
|
+
const newWidth = sidebarWidth + e.movementX;
|
|
11098
|
+
const maxWidth = window.innerWidth - 8;
|
|
11099
|
+
if (newWidth < minSidebarWidth) {
|
|
11100
|
+
return minSidebarWidth;
|
|
11101
|
+
} else if (newWidth > maxWidth) {
|
|
11102
|
+
return maxWidth;
|
|
11103
|
+
} else {
|
|
11104
|
+
return newWidth;
|
|
11105
|
+
}
|
|
11106
|
+
});
|
|
11107
|
+
};
|
|
11108
|
+
if (resizingSidebar) {
|
|
11109
|
+
window.addEventListener("mousemove", handleMouseMove);
|
|
11110
|
+
document.body.classList.add("select-none");
|
|
11111
|
+
}
|
|
11112
|
+
return () => {
|
|
11113
|
+
window.removeEventListener("mousemove", handleMouseMove);
|
|
11114
|
+
document.body.classList.remove("select-none");
|
|
11115
|
+
};
|
|
11116
|
+
}, [resizingSidebar]);
|
|
11117
|
+
const handleresizingSidebar = () => setResizingSidebar(true);
|
|
11118
|
+
if (fullscreen) {
|
|
11119
|
+
return null;
|
|
11120
|
+
}
|
|
11121
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
11122
|
+
"div",
|
|
11123
|
+
{
|
|
11124
|
+
onMouseDown: handleresizingSidebar,
|
|
11125
|
+
className: `z-100 absolute top-1/2 right-px w-2 h-32 bg-white rounded-r-md border border-gray-150 shadow-sm hover:shadow-md origin-left transition-all duration-150 ease-out transform translate-x-full -translate-y-1/2 group hover:bg-gray-50 ${displayState !== "closed" ? `opacity-100` : `opacity-0`} ${resizingSidebar ? `scale-110` : `scale-90 hover:scale-100`}`,
|
|
11126
|
+
style: { cursor: "grab" }
|
|
11127
|
+
},
|
|
11128
|
+
/* @__PURE__ */ React__namespace.createElement("span", { className: "absolute top-1/2 left-1/2 h-4/6 w-px bg-gray-200 transform -translate-y-1/2 -translate-x-1/2 opacity-30 transition-opacity duration-150 ease-out group-hover:opacity-100" })
|
|
11129
|
+
);
|
|
11130
|
+
};
|
|
11131
|
+
const Item = ({
|
|
11132
|
+
item,
|
|
11133
|
+
depth,
|
|
11134
|
+
setActiveFormId
|
|
11135
|
+
}) => {
|
|
11136
|
+
const cms = useCMS();
|
|
11137
|
+
const depths = ["pl-6", "pl-10", "pl-14"];
|
|
11138
|
+
const form = React__namespace.useMemo(
|
|
11139
|
+
() => cms.state.forms.find(({ tinaForm }) => item.formId === tinaForm.id),
|
|
11140
|
+
[item.formId]
|
|
11141
|
+
);
|
|
11142
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
11143
|
+
"button",
|
|
11144
|
+
{
|
|
11145
|
+
type: "button",
|
|
11146
|
+
key: item.path,
|
|
11147
|
+
onClick: () => setActiveFormId(item.formId),
|
|
11148
|
+
className: `${depths[depth] || "pl-12"} pr-6 py-3 w-full h-full bg-transparent border-none text-lg text-gray-700 group hover:bg-gray-50 transition-all ease-out duration-150 flex items-center justify-between gap-2`
|
|
11149
|
+
},
|
|
11150
|
+
/* @__PURE__ */ React__namespace.createElement(BiEdit, { className: "opacity-70 w-5 h-auto text-blue-500 flex-none" }),
|
|
11151
|
+
/* @__PURE__ */ React__namespace.createElement("div", { className: "flex-1 flex flex-col gap-0.5 items-start" }, /* @__PURE__ */ React__namespace.createElement("div", { className: "group-hover:text-blue-500 font-sans text-xs font-semibold text-gray-700 whitespace-normal" }, form.tinaForm.label), /* @__PURE__ */ React__namespace.createElement("div", { className: "group-hover:text-blue-500 text-base truncate leading-tight text-gray-600" }, form.tinaForm.id))
|
|
11152
|
+
);
|
|
11153
|
+
};
|
|
11154
|
+
const FormListItem = ({
|
|
11155
|
+
item,
|
|
11156
|
+
depth,
|
|
11157
|
+
setActiveFormId
|
|
11158
|
+
}) => {
|
|
11159
|
+
var _a;
|
|
11160
|
+
return /* @__PURE__ */ React__namespace.createElement("div", { className: "divide-y divide-gray-200" }, /* @__PURE__ */ React__namespace.createElement(Item, { setActiveFormId, item, depth }), item.subItems && /* @__PURE__ */ React__namespace.createElement("ul", { className: "divide-y divide-gray-200" }, (_a = item.subItems) == null ? void 0 : _a.map((subItem) => {
|
|
11161
|
+
if (subItem.type === "document") {
|
|
11162
|
+
return /* @__PURE__ */ React__namespace.createElement("li", { key: subItem.formId }, /* @__PURE__ */ React__namespace.createElement(
|
|
11163
|
+
Item,
|
|
11164
|
+
{
|
|
11165
|
+
setActiveFormId,
|
|
11166
|
+
depth: depth + 1,
|
|
11167
|
+
item: subItem
|
|
11168
|
+
}
|
|
11169
|
+
));
|
|
11170
|
+
}
|
|
11171
|
+
})));
|
|
11172
|
+
};
|
|
11173
|
+
const FormLists = (props) => {
|
|
11174
|
+
const cms = useCMS();
|
|
11175
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
11176
|
+
react.Transition,
|
|
11177
|
+
{
|
|
11178
|
+
appear: true,
|
|
11179
|
+
show: true,
|
|
11180
|
+
as: "div",
|
|
11181
|
+
enter: "transition-all ease-out duration-150",
|
|
11182
|
+
enterFrom: "opacity-0 -translate-x-1/2",
|
|
11183
|
+
enterTo: "opacity-100",
|
|
11184
|
+
leave: "transition-all ease-out duration-150",
|
|
11185
|
+
leaveFrom: "opacity-100",
|
|
11186
|
+
leaveTo: "opacity-0 -translate-x-1/2"
|
|
11187
|
+
},
|
|
11188
|
+
cms.state.formLists.map((formList, index) => /* @__PURE__ */ React__namespace.createElement("div", { key: `${formList.id}-${index}`, className: "pt-16" }, /* @__PURE__ */ React__namespace.createElement(
|
|
11189
|
+
FormList,
|
|
11190
|
+
{
|
|
11191
|
+
isEditing: props.isEditing,
|
|
11192
|
+
setActiveFormId: (id) => {
|
|
11193
|
+
cms.dispatch({ type: "forms:set-active-form-id", value: id });
|
|
11194
|
+
},
|
|
11195
|
+
formList
|
|
11196
|
+
}
|
|
11197
|
+
)))
|
|
11198
|
+
);
|
|
11199
|
+
};
|
|
11200
|
+
const FormList = (props) => {
|
|
11201
|
+
const cms = useCMS();
|
|
11202
|
+
const listItems = React__namespace.useMemo(() => {
|
|
11203
|
+
var _a;
|
|
11204
|
+
const orderedListItems = [];
|
|
11205
|
+
const globalItems = [];
|
|
11206
|
+
const topItems = [];
|
|
11207
|
+
props.formList.items.forEach((item) => {
|
|
11208
|
+
if (item.type === "document") {
|
|
11209
|
+
const form = cms.state.forms.find(
|
|
11210
|
+
({ tinaForm }) => tinaForm.id === item.formId
|
|
11211
|
+
);
|
|
11212
|
+
if (form.tinaForm.global) {
|
|
11213
|
+
globalItems.push(item);
|
|
11214
|
+
} else {
|
|
11215
|
+
orderedListItems.push(item);
|
|
11216
|
+
}
|
|
11217
|
+
} else {
|
|
11218
|
+
orderedListItems.push(item);
|
|
11219
|
+
}
|
|
11220
|
+
});
|
|
11221
|
+
if (((_a = orderedListItems[0]) == null ? void 0 : _a.type) === "document") {
|
|
11222
|
+
topItems.push({ type: "list", label: "Documents" });
|
|
11223
|
+
}
|
|
11224
|
+
let extra = [];
|
|
11225
|
+
if (globalItems.length) {
|
|
11226
|
+
extra = [{ type: "list", label: "Global Documents" }, ...globalItems];
|
|
11227
|
+
}
|
|
11228
|
+
return [...topItems, ...orderedListItems, ...extra];
|
|
11229
|
+
}, [JSON.stringify(props.formList.items)]);
|
|
11230
|
+
return /* @__PURE__ */ React__namespace.createElement("ul", null, /* @__PURE__ */ React__namespace.createElement("li", { className: "divide-y divide-gray-200" }, listItems.map((item, index) => {
|
|
11231
|
+
if (item.type === "list") {
|
|
11232
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
11233
|
+
"div",
|
|
11234
|
+
{
|
|
11235
|
+
key: item.label,
|
|
11236
|
+
className: `relative group text-left w-full bg-white shadow-sm
|
|
11237
|
+
border-gray-100 px-6 -mt-px pb-3 ${index > 0 ? "pt-6 bg-gradient-to-b from-gray-50 via-white to-white" : "pt-3"}`
|
|
11238
|
+
},
|
|
11239
|
+
/* @__PURE__ */ React__namespace.createElement(
|
|
11240
|
+
"span",
|
|
11241
|
+
{
|
|
11242
|
+
className: "text-sm tracking-wide font-bold text-gray-700 uppercase"
|
|
11243
|
+
},
|
|
11244
|
+
item.label
|
|
11245
|
+
)
|
|
11246
|
+
);
|
|
11247
|
+
}
|
|
11248
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
11249
|
+
FormListItem,
|
|
11250
|
+
{
|
|
11251
|
+
setActiveFormId: (id) => props.setActiveFormId(id),
|
|
11252
|
+
key: item.formId,
|
|
11253
|
+
item,
|
|
11254
|
+
depth: 0
|
|
11255
|
+
}
|
|
11256
|
+
);
|
|
11257
|
+
})));
|
|
11258
|
+
};
|
|
11259
|
+
const SidebarNoFormsPlaceholder = () => /* @__PURE__ */ React__namespace.createElement(
|
|
11260
|
+
"div",
|
|
11261
|
+
{
|
|
11262
|
+
className: "relative flex flex-col items-center justify-center text-center p-5 pb-16 w-full h-full overflow-y-auto",
|
|
11263
|
+
style: {
|
|
11264
|
+
animationName: "fade-in",
|
|
11265
|
+
animationDelay: "300ms",
|
|
11266
|
+
animationTimingFunction: "ease-out",
|
|
11267
|
+
animationIterationCount: 1,
|
|
11268
|
+
animationFillMode: "both",
|
|
11269
|
+
animationDuration: "150ms"
|
|
11270
|
+
}
|
|
11271
|
+
},
|
|
11272
|
+
/* @__PURE__ */ React__namespace.createElement("p", { className: "block pb-5" }, "Looks like there's ", /* @__PURE__ */ React__namespace.createElement("br", null), "nothing to edit on ", /* @__PURE__ */ React__namespace.createElement("br", null), "this page."),
|
|
11273
|
+
/* @__PURE__ */ React__namespace.createElement("p", { className: "block pt-5" }, /* @__PURE__ */ React__namespace.createElement(
|
|
11274
|
+
Button$1,
|
|
11275
|
+
{
|
|
11276
|
+
href: "https://tina.io/docs/contextual-editing/overview",
|
|
11277
|
+
target: "_blank",
|
|
11278
|
+
as: "a"
|
|
11279
|
+
},
|
|
11280
|
+
/* @__PURE__ */ React__namespace.createElement(Emoji$1, { className: "mr-1.5" }, "📖"),
|
|
11281
|
+
" Contextual Editing Docs"
|
|
11282
|
+
))
|
|
11283
|
+
);
|
|
11284
|
+
const Emoji$1 = ({ className = "", ...props }) => /* @__PURE__ */ React__namespace.createElement(
|
|
11285
|
+
"span",
|
|
11286
|
+
{
|
|
11287
|
+
className: `text-[24px] leading-none inline-block ${className}`,
|
|
11288
|
+
...props
|
|
11289
|
+
}
|
|
11290
|
+
);
|
|
11291
|
+
const minimumTimeToShowLoadingIndicator = 1e3;
|
|
11292
|
+
const FormsView = ({ loadingPlaceholder } = {}) => {
|
|
11293
|
+
const cms = useCMS$1();
|
|
11294
|
+
const { setFormIsPristine } = React__namespace.useContext(SidebarContext);
|
|
11295
|
+
const [isShowingLoading, setIsShowingLoading] = React__namespace.useState(true);
|
|
11296
|
+
const [initialLoadComplete, setInitialLoadComplete] = React__namespace.useState(false);
|
|
11297
|
+
React__namespace.useEffect(() => {
|
|
11298
|
+
if (cms.state.isLoadingContent) {
|
|
11299
|
+
setIsShowingLoading(true);
|
|
11300
|
+
const timer = setTimeout(() => {
|
|
11301
|
+
if (!cms.state.isLoadingContent) {
|
|
11302
|
+
setIsShowingLoading(false);
|
|
11303
|
+
setInitialLoadComplete(true);
|
|
11304
|
+
}
|
|
11305
|
+
}, minimumTimeToShowLoadingIndicator);
|
|
11306
|
+
return () => clearTimeout(timer);
|
|
11307
|
+
} else {
|
|
11308
|
+
const timer = setTimeout(() => {
|
|
11309
|
+
setIsShowingLoading(false);
|
|
11310
|
+
setInitialLoadComplete(true);
|
|
11311
|
+
}, minimumTimeToShowLoadingIndicator);
|
|
11312
|
+
return () => clearTimeout(timer);
|
|
11313
|
+
}
|
|
11314
|
+
}, [cms.state.isLoadingContent]);
|
|
11315
|
+
if (isShowingLoading || !initialLoadComplete) {
|
|
11316
|
+
const LoadingPlaceholder = loadingPlaceholder || SidebarLoadingPlaceholder;
|
|
11317
|
+
return /* @__PURE__ */ React__namespace.createElement(LoadingPlaceholder, null);
|
|
11318
|
+
}
|
|
11319
|
+
if (!cms.state.formLists.length) {
|
|
11320
|
+
return /* @__PURE__ */ React__namespace.createElement(SidebarNoFormsPlaceholder, null);
|
|
11321
|
+
}
|
|
11322
|
+
const isMultiform = cms.state.forms.length > 1;
|
|
11323
|
+
const activeForm = cms.state.forms.find(
|
|
11324
|
+
({ tinaForm }) => tinaForm.id === cms.state.activeFormId
|
|
11325
|
+
);
|
|
11326
|
+
const isEditing = !!activeForm;
|
|
11327
|
+
if (isMultiform && !activeForm) {
|
|
11328
|
+
return /* @__PURE__ */ React__namespace.createElement(FormLists, { isEditing });
|
|
11329
|
+
}
|
|
11330
|
+
const formMetas = cms.plugins.all("form:meta");
|
|
11331
|
+
return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, activeForm && /* @__PURE__ */ React__namespace.createElement(FormWrapper$1, { isEditing, isMultiform }, isMultiform && /* @__PURE__ */ React__namespace.createElement(MultiformFormHeader, { activeForm }), !isMultiform && /* @__PURE__ */ React__namespace.createElement(FormHeader, { activeForm }), formMetas == null ? void 0 : formMetas.map((meta) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, { key: meta.name }, /* @__PURE__ */ React__namespace.createElement(meta.Component, null))), /* @__PURE__ */ React__namespace.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine })));
|
|
11332
|
+
};
|
|
11333
|
+
const FormWrapper$1 = ({ isEditing, children }) => {
|
|
11334
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
11335
|
+
"div",
|
|
11336
|
+
{
|
|
11337
|
+
className: "flex-1 flex flex-col flex-nowrap overflow-hidden h-full w-full relative bg-white",
|
|
11338
|
+
style: isEditing ? {
|
|
11339
|
+
transform: "none",
|
|
11340
|
+
animationName: "fly-in-left",
|
|
11341
|
+
animationDuration: "150ms",
|
|
11342
|
+
animationDelay: "0",
|
|
11343
|
+
animationIterationCount: 1,
|
|
11344
|
+
animationTimingFunction: "ease-out"
|
|
11345
|
+
} : {
|
|
11346
|
+
transform: "translate3d(100%, 0, 0)"
|
|
11347
|
+
}
|
|
11348
|
+
},
|
|
11349
|
+
children
|
|
11350
|
+
);
|
|
11351
|
+
};
|
|
11352
|
+
const MultiformFormHeader = ({
|
|
11353
|
+
activeForm
|
|
11354
|
+
}) => {
|
|
11355
|
+
const cms = useCMS$1();
|
|
11356
|
+
const { formIsPristine } = React__namespace.useContext(SidebarContext);
|
|
11357
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
11358
|
+
"div",
|
|
11359
|
+
{
|
|
11360
|
+
className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
|
|
11361
|
+
},
|
|
11362
|
+
/* @__PURE__ */ React__namespace.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React__namespace.createElement(
|
|
11363
|
+
"button",
|
|
11364
|
+
{
|
|
11365
|
+
type: "button",
|
|
11366
|
+
className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
|
|
11367
|
+
onClick: () => {
|
|
11368
|
+
const state = activeForm.tinaForm.finalForm.getState();
|
|
11369
|
+
if (state.invalid === true) {
|
|
11370
|
+
cms.alerts.error("Cannot navigate away from an invalid form.");
|
|
11371
|
+
} else {
|
|
11372
|
+
cms.dispatch({ type: "forms:set-active-form-id", value: null });
|
|
11373
|
+
}
|
|
11374
|
+
}
|
|
11375
|
+
},
|
|
11376
|
+
/* @__PURE__ */ React__namespace.createElement(BiDotsVertical, { className: "h-auto w-5 inline-block opacity-70" })
|
|
11377
|
+
), /* @__PURE__ */ React__namespace.createElement(
|
|
11378
|
+
"button",
|
|
11379
|
+
{
|
|
11380
|
+
type: "button",
|
|
11381
|
+
className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
|
|
11382
|
+
onClick: () => {
|
|
11383
|
+
const collectionName = cms.api.tina.schema.getCollectionByFullPath(
|
|
11384
|
+
cms.state.activeFormId
|
|
11385
|
+
).name;
|
|
11386
|
+
window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
|
|
11387
|
+
}
|
|
11388
|
+
},
|
|
11389
|
+
/* @__PURE__ */ React__namespace.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
|
|
11390
|
+
), /* @__PURE__ */ React__namespace.createElement("span", { className: "opacity-30 text-sm leading-tight whitespace-nowrap flex-0" }, "/"), /* @__PURE__ */ React__namespace.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, activeForm.tinaForm.label || activeForm.tinaForm.id), /* @__PURE__ */ React__namespace.createElement(FormStatus, { pristine: formIsPristine }))
|
|
11391
|
+
);
|
|
11392
|
+
};
|
|
11393
|
+
const FormHeader = ({ activeForm }) => {
|
|
11394
|
+
const { formIsPristine } = React__namespace.useContext(SidebarContext);
|
|
11395
|
+
const cms = useCMS$1();
|
|
11396
|
+
const shortFormLabel = activeForm.tinaForm.label ? activeForm.tinaForm.label.replace(/^.*[\\\/]/, "") : false;
|
|
11397
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
11398
|
+
"div",
|
|
11399
|
+
{
|
|
11400
|
+
className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
|
|
11401
|
+
},
|
|
11402
|
+
/* @__PURE__ */ React__namespace.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React__namespace.createElement(
|
|
11403
|
+
"button",
|
|
11404
|
+
{
|
|
11405
|
+
type: "button",
|
|
11406
|
+
className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
|
|
11407
|
+
onClick: () => {
|
|
11408
|
+
const collectionName = cms.api.tina.schema.getCollectionByFullPath(
|
|
11409
|
+
cms.state.activeFormId
|
|
11410
|
+
).name;
|
|
11411
|
+
window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
|
|
11412
|
+
}
|
|
11413
|
+
},
|
|
11414
|
+
/* @__PURE__ */ React__namespace.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
|
|
11415
|
+
), shortFormLabel && /* @__PURE__ */ React__namespace.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, shortFormLabel), /* @__PURE__ */ React__namespace.createElement(FormStatus, { pristine: formIsPristine }))
|
|
11416
|
+
);
|
|
11417
|
+
};
|
|
11418
|
+
const SidebarContext = React__namespace.createContext(null);
|
|
11419
|
+
const minPreviewWidth = 440;
|
|
11420
|
+
const minSidebarWidth = 360;
|
|
11421
|
+
const navBreakpoint = 1279;
|
|
11422
|
+
const LOCALSTATEKEY = "tina.sidebarState";
|
|
11423
|
+
const LOCALWIDTHKEY = "tina.sidebarWidth";
|
|
11424
|
+
const defaultSidebarWidth = 440;
|
|
11425
|
+
const defaultSidebarPosition = "displace";
|
|
11426
|
+
const defaultSidebarState = "open";
|
|
11427
|
+
function SidebarProvider({
|
|
11428
|
+
position = defaultSidebarPosition,
|
|
11429
|
+
resizingSidebar,
|
|
11430
|
+
setResizingSidebar,
|
|
11431
|
+
defaultWidth = defaultSidebarWidth,
|
|
11432
|
+
sidebar
|
|
11433
|
+
}) {
|
|
11434
|
+
var _a, _b, _c;
|
|
11435
|
+
useSubscribable(sidebar);
|
|
11436
|
+
const cms = useCMS$1();
|
|
11437
|
+
if (!cms.enabled)
|
|
11438
|
+
return null;
|
|
11439
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
11440
|
+
Sidebar$1,
|
|
11441
|
+
{
|
|
11442
|
+
position: ((_a = cms == null ? void 0 : cms.sidebar) == null ? void 0 : _a.position) || position,
|
|
11443
|
+
defaultWidth: ((_b = cms == null ? void 0 : cms.sidebar) == null ? void 0 : _b.defaultWidth) || defaultWidth,
|
|
11444
|
+
resizingSidebar,
|
|
11445
|
+
setResizingSidebar,
|
|
11446
|
+
renderNav: (
|
|
11447
|
+
// @ts-ignore
|
|
11448
|
+
typeof ((_c = cms == null ? void 0 : cms.sidebar) == null ? void 0 : _c.renderNav) !== "undefined" ? (
|
|
11449
|
+
// @ts-ignore
|
|
11450
|
+
cms.sidebar.renderNav
|
|
11451
|
+
) : true
|
|
11452
|
+
),
|
|
11453
|
+
sidebar
|
|
11454
|
+
}
|
|
11455
|
+
);
|
|
11456
|
+
}
|
|
11457
|
+
const useFetchCollections = (cms) => {
|
|
11458
|
+
return { collections: cms.api.admin.fetchCollections(), loading: false };
|
|
11459
|
+
};
|
|
11460
|
+
const Sidebar$1 = ({
|
|
11461
|
+
sidebar,
|
|
11462
|
+
defaultWidth,
|
|
11463
|
+
// defaultState,
|
|
11464
|
+
position,
|
|
11465
|
+
renderNav,
|
|
11466
|
+
resizingSidebar,
|
|
11467
|
+
setResizingSidebar
|
|
11468
|
+
}) => {
|
|
11469
|
+
var _a, _b, _c, _d, _e, _f;
|
|
11470
|
+
const cms = useCMS$1();
|
|
11471
|
+
const collectionsInfo = useFetchCollections(cms);
|
|
11472
|
+
const [branchingEnabled, setBranchingEnabled] = React__namespace.useState(
|
|
11473
|
+
() => cms.flags.get("branch-switcher")
|
|
11474
|
+
);
|
|
11475
|
+
React__namespace.useEffect(() => {
|
|
11476
|
+
cms.events.subscribe("flag:set", ({ key, value }) => {
|
|
11477
|
+
if (key === "branch-switcher") {
|
|
11478
|
+
setBranchingEnabled(value);
|
|
11479
|
+
}
|
|
11480
|
+
});
|
|
11481
|
+
}, [cms.events]);
|
|
11482
|
+
const screens = cms.plugins.getType("screen");
|
|
11483
|
+
const cloudConfigs = cms.plugins.getType("cloud-config");
|
|
11484
|
+
useSubscribable(sidebar);
|
|
11485
|
+
useSubscribable(screens);
|
|
11486
|
+
const allScreens = screens.all();
|
|
11487
|
+
const allConfigs = cloudConfigs.all();
|
|
11488
|
+
const [menuIsOpen, setMenuIsOpen] = React.useState(false);
|
|
11489
|
+
const [activeScreen, setActiveView] = React.useState(null);
|
|
11490
|
+
const [sidebarWidth, setSidebarWidth] = React__namespace.useState(defaultWidth);
|
|
11491
|
+
const [formIsPristine, setFormIsPristine] = React__namespace.useState(true);
|
|
11492
|
+
const activeScreens = allScreens.filter(
|
|
11493
|
+
(screen) => {
|
|
11494
|
+
var _a2, _b2;
|
|
11495
|
+
return screen.navCategory !== "Account" || ((_b2 = (_a2 = cms.api.tina) == null ? void 0 : _a2.authProvider) == null ? void 0 : _b2.getLoginStrategy()) === "UsernamePassword";
|
|
11496
|
+
}
|
|
11497
|
+
);
|
|
11498
|
+
const setDisplayState = (value) => cms.dispatch({ type: "sidebar:set-display-state", value });
|
|
11499
|
+
const displayState = cms.state.sidebarDisplayState;
|
|
11500
|
+
React__namespace.useEffect(() => {
|
|
11501
|
+
if (typeof window !== "undefined") {
|
|
11502
|
+
const localSidebarState = window.localStorage.getItem(LOCALSTATEKEY);
|
|
11503
|
+
const localSidebarWidth = window.localStorage.getItem(LOCALWIDTHKEY);
|
|
11504
|
+
if (localSidebarState !== null) {
|
|
11505
|
+
setDisplayState(JSON.parse(localSidebarState));
|
|
11506
|
+
}
|
|
11507
|
+
if (localSidebarWidth !== null) {
|
|
11508
|
+
setSidebarWidth(JSON.parse(localSidebarWidth));
|
|
11509
|
+
}
|
|
11510
|
+
}
|
|
11511
|
+
}, []);
|
|
11512
|
+
React__namespace.useEffect(() => {
|
|
11513
|
+
if (typeof window !== "undefined") {
|
|
11514
|
+
const localSidebarState = window.localStorage.getItem(LOCALSTATEKEY);
|
|
11515
|
+
if (localSidebarState === null) {
|
|
11516
|
+
setDisplayState(defaultSidebarState);
|
|
11517
|
+
}
|
|
11518
|
+
}
|
|
11519
|
+
}, [defaultSidebarState]);
|
|
11520
|
+
React__namespace.useEffect(() => {
|
|
11521
|
+
if (typeof window !== "undefined" && cms.enabled) {
|
|
11522
|
+
window.localStorage.setItem(LOCALSTATEKEY, JSON.stringify(displayState));
|
|
11523
|
+
}
|
|
11524
|
+
}, [displayState, cms]);
|
|
11525
|
+
React__namespace.useEffect(() => {
|
|
11526
|
+
if (resizingSidebar) {
|
|
11527
|
+
window.localStorage.setItem(LOCALWIDTHKEY, JSON.stringify(sidebarWidth));
|
|
11528
|
+
}
|
|
11529
|
+
}, [sidebarWidth, resizingSidebar]);
|
|
11530
|
+
const isTinaAdminEnabled = cms.flags.get("tina-admin") === false ? false : true;
|
|
11531
|
+
const contentCreators = isTinaAdminEnabled ? [] : cms.plugins.getType("content-creator").all();
|
|
11532
|
+
const toggleFullscreen = () => {
|
|
11533
|
+
if (displayState === "fullscreen") {
|
|
11534
|
+
setDisplayState("open");
|
|
11535
|
+
} else {
|
|
11536
|
+
setDisplayState("fullscreen");
|
|
11537
|
+
}
|
|
11538
|
+
};
|
|
11539
|
+
const toggleSidebarOpen = () => {
|
|
11540
|
+
cms.dispatch({ type: "toggle-edit-state" });
|
|
11541
|
+
};
|
|
11542
|
+
const toggleMenu = () => {
|
|
11543
|
+
setMenuIsOpen((menuIsOpen2) => !menuIsOpen2);
|
|
11544
|
+
};
|
|
11545
|
+
React__namespace.useEffect(() => {
|
|
11546
|
+
const updateLayout = () => {
|
|
11547
|
+
if (displayState === "fullscreen") {
|
|
11548
|
+
return;
|
|
11549
|
+
}
|
|
11550
|
+
updateBodyDisplacement({
|
|
11551
|
+
position,
|
|
11552
|
+
displayState,
|
|
11553
|
+
sidebarWidth,
|
|
11554
|
+
resizingSidebar
|
|
11555
|
+
});
|
|
11556
|
+
};
|
|
11557
|
+
updateLayout();
|
|
11558
|
+
window.addEventListener("resize", updateLayout);
|
|
11559
|
+
return () => {
|
|
11560
|
+
window.removeEventListener("resize", updateLayout);
|
|
11561
|
+
};
|
|
11562
|
+
}, [displayState, position, sidebarWidth, resizingSidebar]);
|
|
11563
|
+
const windowWidth = windowSize.useWindowWidth();
|
|
11564
|
+
const displayNav = renderNav && (sidebarWidth > navBreakpoint && windowWidth > navBreakpoint || displayState === "fullscreen" && windowWidth > navBreakpoint);
|
|
11565
|
+
const renderMobileNav = renderNav && (sidebarWidth < navBreakpoint + 1 || windowWidth < navBreakpoint + 1);
|
|
11566
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
11567
|
+
SidebarContext.Provider,
|
|
11568
|
+
{
|
|
11569
|
+
value: {
|
|
11570
|
+
sidebarWidth,
|
|
11571
|
+
setSidebarWidth,
|
|
11572
|
+
displayState,
|
|
11573
|
+
setDisplayState,
|
|
11574
|
+
position,
|
|
11575
|
+
toggleFullscreen,
|
|
11576
|
+
toggleSidebarOpen,
|
|
11577
|
+
resizingSidebar,
|
|
11578
|
+
setResizingSidebar,
|
|
11579
|
+
menuIsOpen,
|
|
11580
|
+
setMenuIsOpen,
|
|
11581
|
+
toggleMenu,
|
|
11582
|
+
setActiveView,
|
|
11583
|
+
formIsPristine,
|
|
11584
|
+
setFormIsPristine
|
|
11585
|
+
}
|
|
11586
|
+
},
|
|
11587
|
+
/* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(SidebarWrapper, null, /* @__PURE__ */ React__namespace.createElement(EditButton, null), displayNav && /* @__PURE__ */ React__namespace.createElement(
|
|
11588
|
+
Nav,
|
|
11589
|
+
{
|
|
11590
|
+
isLocalMode: (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode,
|
|
11591
|
+
showCollections: isTinaAdminEnabled,
|
|
11592
|
+
collectionsInfo,
|
|
11593
|
+
screens: activeScreens,
|
|
11594
|
+
cloudConfigs: allConfigs,
|
|
11595
|
+
contentCreators,
|
|
11596
|
+
sidebarWidth,
|
|
11597
|
+
RenderNavSite: ({ view }) => /* @__PURE__ */ React__namespace.createElement(
|
|
11598
|
+
SidebarSiteLink,
|
|
11599
|
+
{
|
|
11600
|
+
view,
|
|
11601
|
+
onClick: () => {
|
|
11602
|
+
setActiveView(view);
|
|
11603
|
+
setMenuIsOpen(false);
|
|
11604
|
+
}
|
|
11605
|
+
}
|
|
11606
|
+
),
|
|
11607
|
+
RenderNavCloud: ({ config }) => /* @__PURE__ */ React__namespace.createElement(SidebarCloudLink$1, { config }),
|
|
11608
|
+
RenderNavCollection: ({ collection }) => /* @__PURE__ */ React__namespace.createElement(
|
|
11609
|
+
SidebarCollectionLink,
|
|
11610
|
+
{
|
|
11611
|
+
onClick: () => {
|
|
11612
|
+
setMenuIsOpen(false);
|
|
11613
|
+
},
|
|
11614
|
+
collection
|
|
11615
|
+
}
|
|
11616
|
+
),
|
|
11617
|
+
AuthRenderNavCollection: ({ collection }) => /* @__PURE__ */ React__namespace.createElement(
|
|
11618
|
+
SidebarCollectionLink,
|
|
11619
|
+
{
|
|
11620
|
+
onClick: () => {
|
|
11621
|
+
setMenuIsOpen(false);
|
|
11622
|
+
},
|
|
11623
|
+
collection,
|
|
11624
|
+
Icon: ImUsers
|
|
11625
|
+
}
|
|
11626
|
+
)
|
|
11627
|
+
}
|
|
11628
|
+
), /* @__PURE__ */ React__namespace.createElement(SidebarBody, null, /* @__PURE__ */ React__namespace.createElement(
|
|
11629
|
+
SidebarHeader,
|
|
11630
|
+
{
|
|
11631
|
+
displayNav,
|
|
11632
|
+
renderNav,
|
|
11633
|
+
isLocalMode: (_d = (_c = cms.api) == null ? void 0 : _c.tina) == null ? void 0 : _d.isLocalMode,
|
|
11634
|
+
branchingEnabled
|
|
11635
|
+
}
|
|
11636
|
+
), /* @__PURE__ */ React__namespace.createElement(FormsView, { loadingPlaceholder: sidebar.loadingPlaceholder }), activeScreen && /* @__PURE__ */ React__namespace.createElement(
|
|
11637
|
+
ScreenPluginModal,
|
|
11638
|
+
{
|
|
11639
|
+
screen: activeScreen,
|
|
11640
|
+
close: () => setActiveView(null)
|
|
11641
|
+
}
|
|
11642
|
+
)), /* @__PURE__ */ React__namespace.createElement(ResizeHandle, null)), renderMobileNav && /* @__PURE__ */ React__namespace.createElement(react.Transition, { show: menuIsOpen, as: "div" }, /* @__PURE__ */ React__namespace.createElement(
|
|
11643
|
+
react.TransitionChild,
|
|
11644
|
+
{
|
|
11645
|
+
enter: "transform transition-all ease-out duration-300",
|
|
11646
|
+
enterFrom: "opacity-0 -translate-x-full",
|
|
11647
|
+
enterTo: "opacity-100 translate-x-0",
|
|
11648
|
+
leave: "transform transition-all ease-in duration-200",
|
|
11649
|
+
leaveFrom: "opacity-100 translate-x-0",
|
|
11650
|
+
leaveTo: "opacity-0 -translate-x-full"
|
|
11651
|
+
},
|
|
11652
|
+
/* @__PURE__ */ React__namespace.createElement("div", { className: "fixed left-0 top-0 z-overlay h-full transform" }, /* @__PURE__ */ React__namespace.createElement(
|
|
11653
|
+
Nav,
|
|
11654
|
+
{
|
|
11655
|
+
isLocalMode: (_f = (_e = cms.api) == null ? void 0 : _e.tina) == null ? void 0 : _f.isLocalMode,
|
|
11656
|
+
className: "rounded-r-md",
|
|
11657
|
+
showCollections: isTinaAdminEnabled,
|
|
11658
|
+
collectionsInfo,
|
|
11659
|
+
screens: activeScreens,
|
|
11660
|
+
cloudConfigs: allConfigs,
|
|
11661
|
+
contentCreators,
|
|
11662
|
+
sidebarWidth,
|
|
11663
|
+
RenderNavSite: ({ view }) => /* @__PURE__ */ React__namespace.createElement(
|
|
11664
|
+
SidebarSiteLink,
|
|
11665
|
+
{
|
|
11666
|
+
view,
|
|
11667
|
+
onClick: () => {
|
|
11668
|
+
setActiveView(view);
|
|
11669
|
+
setMenuIsOpen(false);
|
|
11670
|
+
}
|
|
11671
|
+
}
|
|
11672
|
+
),
|
|
11673
|
+
RenderNavCloud: ({ config }) => /* @__PURE__ */ React__namespace.createElement(SidebarCloudLink$1, { config }),
|
|
11674
|
+
RenderNavCollection: ({ collection }) => /* @__PURE__ */ React__namespace.createElement(
|
|
11675
|
+
SidebarCollectionLink,
|
|
11676
|
+
{
|
|
11677
|
+
onClick: () => {
|
|
11678
|
+
setMenuIsOpen(false);
|
|
11679
|
+
},
|
|
11680
|
+
collection
|
|
11681
|
+
}
|
|
11682
|
+
),
|
|
11683
|
+
AuthRenderNavCollection: ({ collection }) => /* @__PURE__ */ React__namespace.createElement(
|
|
11684
|
+
SidebarCollectionLink,
|
|
11685
|
+
{
|
|
11686
|
+
onClick: () => {
|
|
11687
|
+
setMenuIsOpen(false);
|
|
11688
|
+
},
|
|
11689
|
+
collection,
|
|
11690
|
+
Icon: ImUsers
|
|
11691
|
+
}
|
|
11692
|
+
)
|
|
11693
|
+
},
|
|
11694
|
+
/* @__PURE__ */ React__namespace.createElement("div", { className: "absolute top-8 right-0 transform translate-x-full overflow-hidden" }, /* @__PURE__ */ React__namespace.createElement(
|
|
11695
|
+
Button$1,
|
|
11696
|
+
{
|
|
11697
|
+
rounded: "right",
|
|
11698
|
+
variant: "secondary",
|
|
11699
|
+
onClick: () => {
|
|
11700
|
+
setMenuIsOpen(false);
|
|
11701
|
+
},
|
|
11702
|
+
className: "transition-opacity duration-150 ease-out"
|
|
11703
|
+
},
|
|
11704
|
+
/* @__PURE__ */ React__namespace.createElement(IoMdClose, { className: "h-5 w-auto text-blue-500" })
|
|
11705
|
+
))
|
|
11706
|
+
))
|
|
11707
|
+
), /* @__PURE__ */ React__namespace.createElement(
|
|
11708
|
+
react.TransitionChild,
|
|
11709
|
+
{
|
|
11710
|
+
enter: "ease-out duration-300",
|
|
11711
|
+
enterFrom: "opacity-0",
|
|
11712
|
+
enterTo: "opacity-80",
|
|
11713
|
+
entered: "opacity-80",
|
|
11714
|
+
leave: "ease-in duration-200",
|
|
11715
|
+
leaveFrom: "opacity-80",
|
|
11716
|
+
leaveTo: "opacity-0"
|
|
11526
11717
|
},
|
|
11527
|
-
|
|
11528
|
-
|
|
11529
|
-
|
|
11530
|
-
|
|
11531
|
-
|
|
11532
|
-
|
|
11533
|
-
|
|
11534
|
-
|
|
11535
|
-
|
|
11536
|
-
|
|
11537
|
-
|
|
11538
|
-
|
|
11539
|
-
|
|
11718
|
+
/* @__PURE__ */ React__namespace.createElement(
|
|
11719
|
+
"div",
|
|
11720
|
+
{
|
|
11721
|
+
onClick: () => {
|
|
11722
|
+
setMenuIsOpen(false);
|
|
11723
|
+
},
|
|
11724
|
+
className: "fixed z-menu inset-0 bg-gradient-to-br from-gray-800 via-gray-900 to-black"
|
|
11725
|
+
}
|
|
11726
|
+
)
|
|
11727
|
+
)))
|
|
11728
|
+
);
|
|
11729
|
+
};
|
|
11730
|
+
const updateBodyDisplacement = ({
|
|
11731
|
+
position = "overlay",
|
|
11732
|
+
displayState,
|
|
11733
|
+
sidebarWidth,
|
|
11734
|
+
resizingSidebar
|
|
11735
|
+
}) => {
|
|
11736
|
+
const body = document.getElementsByTagName("body")[0];
|
|
11737
|
+
const windowWidth = window.innerWidth;
|
|
11738
|
+
if (position === "displace") {
|
|
11739
|
+
body.style.transition = resizingSidebar ? "" : displayState === "fullscreen" ? "padding 0ms 150ms" : displayState === "closed" ? "padding 0ms 0ms" : "padding 0ms 300ms";
|
|
11740
|
+
if (displayState === "open") {
|
|
11741
|
+
const bodyDisplacement = Math.min(
|
|
11742
|
+
sidebarWidth,
|
|
11743
|
+
windowWidth - minPreviewWidth
|
|
11744
|
+
);
|
|
11745
|
+
body.style.paddingLeft = `${bodyDisplacement}px`;
|
|
11746
|
+
} else {
|
|
11747
|
+
body.style.paddingLeft = "0";
|
|
11540
11748
|
}
|
|
11541
|
-
|
|
11749
|
+
} else {
|
|
11750
|
+
body.style.transition = "";
|
|
11751
|
+
body.style.paddingLeft = "0";
|
|
11752
|
+
}
|
|
11753
|
+
};
|
|
11754
|
+
const SidebarHeader = ({
|
|
11755
|
+
branchingEnabled,
|
|
11756
|
+
renderNav,
|
|
11757
|
+
displayNav,
|
|
11758
|
+
isLocalMode
|
|
11759
|
+
}) => {
|
|
11760
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
11761
|
+
const { toggleFullscreen, displayState, setMenuIsOpen, toggleSidebarOpen } = React__namespace.useContext(SidebarContext);
|
|
11762
|
+
const displayMenuButton = renderNav && !displayNav;
|
|
11763
|
+
const cms = useCMS$1();
|
|
11764
|
+
const previewFunction = (_f = (_e = (_d = (_c = (_b = (_a = cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.schema) == null ? void 0 : _c.config) == null ? void 0 : _d.config) == null ? void 0 : _e.ui) == null ? void 0 : _f.previewUrl;
|
|
11765
|
+
const branch = (_h = (_g = cms.api) == null ? void 0 : _g.tina) == null ? void 0 : _h.branch;
|
|
11766
|
+
const previewUrl = typeof previewFunction === "function" ? (_i = previewFunction({ branch })) == null ? void 0 : _i.url : null;
|
|
11767
|
+
return /* @__PURE__ */ React__namespace.createElement("div", { className: "flex-grow-0 w-full overflow-visible z-20" }, isLocalMode && /* @__PURE__ */ React__namespace.createElement(LocalWarning, null), !isLocalMode && /* @__PURE__ */ React__namespace.createElement(BillingWarning, null), /* @__PURE__ */ React__namespace.createElement("div", { className: "mt-4 -mb-14 w-full flex gap-3 items-center justify-between pointer-events-none" }, displayMenuButton && /* @__PURE__ */ React__namespace.createElement(
|
|
11542
11768
|
Button$1,
|
|
11543
11769
|
{
|
|
11544
|
-
|
|
11770
|
+
rounded: "right",
|
|
11545
11771
|
variant: "white",
|
|
11546
11772
|
onClick: () => {
|
|
11547
|
-
|
|
11548
|
-
resetOffset();
|
|
11549
|
-
resetList();
|
|
11550
|
-
setActiveItem(false);
|
|
11773
|
+
setMenuIsOpen(true);
|
|
11551
11774
|
},
|
|
11552
|
-
className: "
|
|
11775
|
+
className: "pointer-events-auto -ml-px"
|
|
11553
11776
|
},
|
|
11554
|
-
"
|
|
11555
|
-
|
|
11556
|
-
|
|
11557
|
-
Button$1,
|
|
11777
|
+
/* @__PURE__ */ React__namespace.createElement(BiMenu, { className: "h-6 w-auto text-blue-500" })
|
|
11778
|
+
), /* @__PURE__ */ React__namespace.createElement("div", { className: "flex-1 flex gap-3 items-center shrink min-w-0" }, branchingEnabled && !isLocalMode && /* @__PURE__ */ React__namespace.createElement(BranchButton, null), branchingEnabled && !isLocalMode && previewUrl && /* @__PURE__ */ React__namespace.createElement(
|
|
11779
|
+
"button",
|
|
11558
11780
|
{
|
|
11559
|
-
|
|
11560
|
-
variant: "white",
|
|
11781
|
+
className: "pointer-events-auto flex min-w-0 shrink gap-1 items-center justify-between form-select text-sm h-10 px-4 shadow text-gray-500 hover:text-blue-500 bg-white hover:bg-gray-50 border border-gray-100 transition-color duration-150 ease-out rounded-full focus:outline-none focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out text-[12px] leading-tight min-w-[5rem]",
|
|
11561
11782
|
onClick: () => {
|
|
11562
|
-
|
|
11563
|
-
},
|
|
11564
|
-
className: "whitespace-nowrap"
|
|
11565
|
-
},
|
|
11566
|
-
"New Folder",
|
|
11567
|
-
/* @__PURE__ */ React.createElement(BiFolder, { className: "w-6 h-full ml-2 opacity-70 text-blue-500" })
|
|
11568
|
-
), /* @__PURE__ */ React.createElement(UploadButton, { onClick, uploading }))), /* @__PURE__ */ React.createElement("div", { className: "flex h-full overflow-hidden bg-white" }, /* @__PURE__ */ React.createElement("div", { className: "flex w-full flex-col h-full @container" }, /* @__PURE__ */ React.createElement(
|
|
11569
|
-
"ul",
|
|
11570
|
-
{
|
|
11571
|
-
...rootProps,
|
|
11572
|
-
className: `h-full grow overflow-y-auto transition duration-150 ease-out bg-gradient-to-b from-gray-50/50 to-gray-50 ${list.items.length === 0 || viewMode === "list" && "w-full flex flex-1 flex-col justify-start -mb-px"} ${list.items.length > 0 && viewMode === "grid" && "w-full p-4 gap-4 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 4xl:grid-cols-6 6xl:grid-cols-9 auto-rows-auto content-start justify-start"} ${isDragActive ? `border-2 border-blue-500 rounded-lg` : ``}`
|
|
11573
|
-
},
|
|
11574
|
-
/* @__PURE__ */ React.createElement("input", { ...getInputProps() }),
|
|
11575
|
-
listState === "loaded" && list.items.length === 0 && /* @__PURE__ */ React.createElement(EmptyMediaList, null),
|
|
11576
|
-
viewMode === "list" && list.items.map((item) => /* @__PURE__ */ React.createElement(
|
|
11577
|
-
ListMediaItem,
|
|
11578
|
-
{
|
|
11579
|
-
key: item.id,
|
|
11580
|
-
item,
|
|
11581
|
-
onClick: onClickMediaItem,
|
|
11582
|
-
active: activeItem && activeItem.id === item.id
|
|
11583
|
-
}
|
|
11584
|
-
)),
|
|
11585
|
-
viewMode === "grid" && list.items.map((item) => /* @__PURE__ */ React.createElement(
|
|
11586
|
-
GridMediaItem,
|
|
11587
|
-
{
|
|
11588
|
-
key: item.id,
|
|
11589
|
-
item,
|
|
11590
|
-
onClick: onClickMediaItem,
|
|
11591
|
-
active: activeItem && activeItem.id === item.id
|
|
11592
|
-
}
|
|
11593
|
-
)),
|
|
11594
|
-
!!list.nextOffset && /* @__PURE__ */ React.createElement(LoadingMediaList, { ref: loaderRef })
|
|
11595
|
-
)), /* @__PURE__ */ React.createElement(
|
|
11596
|
-
ActiveItemPreview,
|
|
11597
|
-
{
|
|
11598
|
-
activeItem,
|
|
11599
|
-
close: closePreview,
|
|
11600
|
-
selectMediaItem,
|
|
11601
|
-
allowDelete: cms.media.store.isStatic ? false : allowDelete,
|
|
11602
|
-
deleteMediaItem: () => {
|
|
11603
|
-
setDeleteModalOpen(true);
|
|
11783
|
+
window.open(previewUrl, "_blank");
|
|
11604
11784
|
}
|
|
11605
|
-
}
|
|
11606
|
-
|
|
11607
|
-
|
|
11608
|
-
|
|
11609
|
-
activeItem,
|
|
11610
|
-
close: close2,
|
|
11611
|
-
selectMediaItem,
|
|
11612
|
-
deleteMediaItem,
|
|
11613
|
-
allowDelete
|
|
11614
|
-
}) => {
|
|
11615
|
-
const thumbnail = activeItem ? (activeItem.thumbnails || {})["1000x1000"] : "";
|
|
11616
|
-
return /* @__PURE__ */ React.createElement(
|
|
11785
|
+
},
|
|
11786
|
+
/* @__PURE__ */ React__namespace.createElement(BiLinkExternal, { className: "flex-shrink-0 w-4 h-auto text-blue-500/70 mr-1" }),
|
|
11787
|
+
/* @__PURE__ */ React__namespace.createElement("span", { className: "truncate max-w-full min-w-0 shrink" }, "Preview")
|
|
11788
|
+
)), /* @__PURE__ */ React__namespace.createElement(
|
|
11617
11789
|
"div",
|
|
11618
11790
|
{
|
|
11619
|
-
className:
|
|
11791
|
+
className: "flex items-center pointer-events-auto transition-opacity duration-150 ease-in-out -mr-px"
|
|
11620
11792
|
},
|
|
11621
|
-
|
|
11622
|
-
IconButton,
|
|
11623
|
-
{
|
|
11624
|
-
variant: "ghost",
|
|
11625
|
-
className: "group grow-0 shrink-0",
|
|
11626
|
-
onClick: close2
|
|
11627
|
-
},
|
|
11628
|
-
/* @__PURE__ */ React.createElement(
|
|
11629
|
-
BiX,
|
|
11630
|
-
{
|
|
11631
|
-
className: `w-7 h-auto text-gray-500 opacity-50 group-hover:opacity-100 transition duration-150 ease-out`
|
|
11632
|
-
}
|
|
11633
|
-
)
|
|
11634
|
-
)), isImage(thumbnail) ? /* @__PURE__ */ React.createElement("div", { className: "w-full max-h-[75%]" }, /* @__PURE__ */ React.createElement(
|
|
11635
|
-
"img",
|
|
11636
|
-
{
|
|
11637
|
-
className: "block border border-gray-100 rounded-md overflow-hidden object-center object-contain max-w-full max-h-full m-auto shadow",
|
|
11638
|
-
src: thumbnail,
|
|
11639
|
-
alt: activeItem.filename
|
|
11640
|
-
}
|
|
11641
|
-
)) : /* @__PURE__ */ React.createElement("span", { className: "p-3 border border-gray-100 rounded-md overflow-hidden bg-gray-50 shadow" }, /* @__PURE__ */ React.createElement(BiFile, { className: "w-14 h-auto fill-gray-300" })), /* @__PURE__ */ React.createElement("div", { className: "grow h-full w-full shrink flex flex-col gap-3 items-start justify-start" }, /* @__PURE__ */ React.createElement(CopyField, { value: absoluteImgURL(activeItem.src), label: "URL" })), /* @__PURE__ */ React.createElement("div", { className: "shrink-0 w-full flex flex-col justify-end items-start" }, /* @__PURE__ */ React.createElement("div", { className: "flex w-full gap-3" }, selectMediaItem && /* @__PURE__ */ React.createElement(
|
|
11642
|
-
Button$1,
|
|
11643
|
-
{
|
|
11644
|
-
size: "medium",
|
|
11645
|
-
variant: "primary",
|
|
11646
|
-
className: "grow",
|
|
11647
|
-
onClick: () => selectMediaItem(activeItem)
|
|
11648
|
-
},
|
|
11649
|
-
"Insert",
|
|
11650
|
-
/* @__PURE__ */ React.createElement(BiArrowToBottom, { className: "ml-1 -mr-0.5 w-6 h-auto text-white opacity-70" })
|
|
11651
|
-
), allowDelete && /* @__PURE__ */ React.createElement(
|
|
11793
|
+
/* @__PURE__ */ React__namespace.createElement(
|
|
11652
11794
|
Button$1,
|
|
11653
11795
|
{
|
|
11796
|
+
rounded: "left",
|
|
11654
11797
|
variant: "white",
|
|
11655
|
-
|
|
11656
|
-
|
|
11657
|
-
|
|
11798
|
+
onClick: toggleSidebarOpen,
|
|
11799
|
+
"aria-label": "closes cms sidebar",
|
|
11800
|
+
className: "-mr-px"
|
|
11658
11801
|
},
|
|
11659
|
-
"
|
|
11660
|
-
|
|
11661
|
-
|
|
11662
|
-
|
|
11802
|
+
/* @__PURE__ */ React__namespace.createElement(MdOutlineArrowBackIos, { className: "h-[18px] w-auto -mr-1 text-blue-500" })
|
|
11803
|
+
),
|
|
11804
|
+
/* @__PURE__ */ React__namespace.createElement(Button$1, { rounded: "custom", variant: "white", onClick: toggleFullscreen }, displayState === "fullscreen" ? (
|
|
11805
|
+
// BiCollapseAlt
|
|
11806
|
+
/* @__PURE__ */ React__namespace.createElement(
|
|
11807
|
+
"svg",
|
|
11808
|
+
{
|
|
11809
|
+
className: "h-5 w-auto -mx-1 text-blue-500",
|
|
11810
|
+
stroke: "currentColor",
|
|
11811
|
+
fill: "currentColor",
|
|
11812
|
+
strokeWidth: "0",
|
|
11813
|
+
viewBox: "0 0 24 24",
|
|
11814
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
11815
|
+
},
|
|
11816
|
+
/* @__PURE__ */ React__namespace.createElement("path", { d: "M2 15h7v7h2v-9H2v2zM15 2h-2v9h9V9h-7V2z" })
|
|
11817
|
+
)
|
|
11818
|
+
) : /* @__PURE__ */ React__namespace.createElement(BiExpandAlt, { className: "h-5 -mx-1 w-auto text-blue-500" }))
|
|
11819
|
+
)));
|
|
11663
11820
|
};
|
|
11664
|
-
const
|
|
11665
|
-
|
|
11666
|
-
|
|
11821
|
+
const SidebarSiteLink = ({
|
|
11822
|
+
view,
|
|
11823
|
+
onClick
|
|
11824
|
+
}) => {
|
|
11825
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
11826
|
+
"button",
|
|
11667
11827
|
{
|
|
11668
|
-
|
|
11669
|
-
|
|
11670
|
-
className: "text-sm h-10 px-6",
|
|
11671
|
-
busy: uploading,
|
|
11828
|
+
className: "text-base tracking-wide text-gray-500 hover:text-blue-600 flex items-center opacity-90 hover:opacity-100",
|
|
11829
|
+
value: view.name,
|
|
11672
11830
|
onClick
|
|
11673
11831
|
},
|
|
11674
|
-
|
|
11832
|
+
/* @__PURE__ */ React__namespace.createElement(view.Icon, { className: "mr-2 h-6 opacity-80 w-auto" }),
|
|
11833
|
+
" ",
|
|
11834
|
+
view.name
|
|
11675
11835
|
);
|
|
11676
11836
|
};
|
|
11677
|
-
const
|
|
11678
|
-
(
|
|
11679
|
-
|
|
11680
|
-
return /* @__PURE__ */ React.createElement(
|
|
11681
|
-
"div",
|
|
11682
|
-
{
|
|
11683
|
-
ref,
|
|
11684
|
-
className: "w-full h-full flex flex-col items-center justify-center",
|
|
11685
|
-
...rest
|
|
11686
|
-
},
|
|
11687
|
-
extraText && /* @__PURE__ */ React.createElement("p", null, extraText),
|
|
11688
|
-
/* @__PURE__ */ React.createElement(LoadingDots, { color: "var(--tina-color-primary)" })
|
|
11689
|
-
);
|
|
11690
|
-
}
|
|
11691
|
-
);
|
|
11692
|
-
const MediaPickerWrap = ({ children }) => {
|
|
11693
|
-
return /* @__PURE__ */ React.createElement("div", { className: "h-full flex-1 text-gray-700 flex flex-col relative bg-gray-50 outline-none active:outline-none focus:outline-none" }, children);
|
|
11694
|
-
};
|
|
11695
|
-
const SyncStatusContext = React.createContext(
|
|
11696
|
-
void 0
|
|
11697
|
-
);
|
|
11698
|
-
const SyncStatusContainer = ({ children }) => {
|
|
11699
|
-
var _a, _b, _c;
|
|
11700
|
-
const cms = useCMS();
|
|
11701
|
-
const isLocal = cms.api.tina.isLocalMode;
|
|
11702
|
-
const tinaMedia = (_c = (_b = (_a = cms.api.tina.schema.schema) == null ? void 0 : _a.config) == null ? void 0 : _b.media) == null ? void 0 : _c.tina;
|
|
11703
|
-
const hasTinaMedia = !!((tinaMedia == null ? void 0 : tinaMedia.mediaRoot) || (tinaMedia == null ? void 0 : tinaMedia.publicFolder));
|
|
11704
|
-
const doCheckSyncStatus = hasTinaMedia && !isLocal;
|
|
11705
|
-
const [syncStatus, setSyncStatus] = React.useState(doCheckSyncStatus ? "loading" : "synced");
|
|
11706
|
-
React.useEffect(() => {
|
|
11707
|
-
const checkSyncStatus = async () => {
|
|
11708
|
-
if (doCheckSyncStatus) {
|
|
11709
|
-
const project = await cms.api.tina.getProject();
|
|
11710
|
-
setSyncStatus(project.mediaBranch ? "synced" : "needs-sync");
|
|
11711
|
-
}
|
|
11712
|
-
};
|
|
11713
|
-
if (!cms.media.store.isStatic) {
|
|
11714
|
-
checkSyncStatus();
|
|
11715
|
-
}
|
|
11716
|
-
}, []);
|
|
11717
|
-
return syncStatus == "needs-sync" ? /* @__PURE__ */ React.createElement("div", { className: "h-full flex items-center justify-center p-6 bg-gradient-to-t from-gray-200 to-transparent" }, /* @__PURE__ */ React.createElement("div", { className: "rounded-lg border shadow-sm px-4 lg:px-6 py-3 lg:py-4 bg-gradient-to-r from-yellow-50 to-yellow-100 border-yellow-200 mx-auto mb-12" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-start sm:items-center gap-2" }, /* @__PURE__ */ React.createElement(
|
|
11718
|
-
BiError,
|
|
11719
|
-
{
|
|
11720
|
-
className: `w-7 h-auto flex-shrink-0 text-yellow-400 -mt-px`
|
|
11721
|
-
}
|
|
11722
|
-
), /* @__PURE__ */ React.createElement(
|
|
11723
|
-
"div",
|
|
11724
|
-
{
|
|
11725
|
-
className: `flex-1 flex flex-col items-start gap-0.5 text-base text-yellow-700`
|
|
11726
|
-
},
|
|
11727
|
-
"Media needs to be turned on for this project.",
|
|
11728
|
-
/* @__PURE__ */ React.createElement(
|
|
11837
|
+
const SidebarCloudLink$1 = ({ config }) => {
|
|
11838
|
+
if (config.text) {
|
|
11839
|
+
return /* @__PURE__ */ React__namespace.createElement("span", { className: "text-base tracking-wide text-gray-500 flex items-center opacity-90" }, config.text, " ", /* @__PURE__ */ React__namespace.createElement(
|
|
11729
11840
|
"a",
|
|
11730
11841
|
{
|
|
11731
|
-
className: "transition-all duration-150 ease-out text-blue-500 hover:text-blue-400 hover:underline underline decoration-blue-200 hover:decoration-blue-400 font-medium flex items-center justify-start gap-1",
|
|
11732
11842
|
target: "_blank",
|
|
11733
|
-
|
|
11843
|
+
className: "ml-1 text-blue-600 hover:opacity-60",
|
|
11844
|
+
href: config.link.href
|
|
11734
11845
|
},
|
|
11735
|
-
|
|
11736
|
-
|
|
11737
|
-
)
|
|
11738
|
-
)))) : /* @__PURE__ */ React.createElement(SyncStatusContext.Provider, { value: { syncStatus } }, children);
|
|
11739
|
-
};
|
|
11740
|
-
const useSyncStatus = () => {
|
|
11741
|
-
const context = React.useContext(SyncStatusContext);
|
|
11742
|
-
if (!context) {
|
|
11743
|
-
throw new Error("useSyncStatus must be used within a SyncStatusProvider");
|
|
11846
|
+
config.link.text
|
|
11847
|
+
));
|
|
11744
11848
|
}
|
|
11745
|
-
return
|
|
11746
|
-
};
|
|
11747
|
-
const EmptyMediaList = () => {
|
|
11748
|
-
const { syncStatus } = useSyncStatus();
|
|
11749
|
-
return /* @__PURE__ */ React.createElement("div", { className: `p-12 text-xl opacity-50 text-center` }, syncStatus == "synced" ? "Drag and drop assets here" : "Loading...");
|
|
11849
|
+
return /* @__PURE__ */ React__namespace.createElement("span", { className: "text-base tracking-wide text-gray-500 hover:text-blue-600 flex items-center opacity-90 hover:opacity-100" }, /* @__PURE__ */ React__namespace.createElement(config.Icon, { className: "mr-2 h-6 opacity-80 w-auto" }), /* @__PURE__ */ React__namespace.createElement("a", { target: "_blank", href: config.link.href }, config.link.text));
|
|
11750
11850
|
};
|
|
11751
|
-
const
|
|
11752
|
-
|
|
11851
|
+
const SidebarCollectionLink = ({
|
|
11852
|
+
Icon = ImFilesEmpty,
|
|
11853
|
+
collection,
|
|
11854
|
+
onClick
|
|
11855
|
+
}) => {
|
|
11856
|
+
const cms = useCMS$1();
|
|
11857
|
+
const tinaPreview = cms.flags.get("tina-preview") || false;
|
|
11858
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
11753
11859
|
"a",
|
|
11754
11860
|
{
|
|
11755
|
-
|
|
11756
|
-
|
|
11757
|
-
|
|
11758
|
-
className: "font-bold text-blue-500 hover:text-blue-600 hover:underline transition-all ease-out duration-150"
|
|
11861
|
+
onClick,
|
|
11862
|
+
href: `${tinaPreview ? `/${tinaPreview}/index.html#` : "/admin#"}/collections/${collection.name}/~`,
|
|
11863
|
+
className: "text-base tracking-wide text-gray-500 hover:text-blue-600 flex items-center opacity-90 hover:opacity-100"
|
|
11759
11864
|
},
|
|
11760
|
-
"
|
|
11761
|
-
|
|
11865
|
+
/* @__PURE__ */ React__namespace.createElement(Icon, { className: "mr-2 h-6 opacity-80 w-auto" }),
|
|
11866
|
+
" ",
|
|
11867
|
+
collection.label ? collection.label : collection.name
|
|
11868
|
+
);
|
|
11762
11869
|
};
|
|
11763
|
-
const
|
|
11764
|
-
const
|
|
11765
|
-
|
|
11766
|
-
|
|
11767
|
-
|
|
11768
|
-
|
|
11769
|
-
|
|
11870
|
+
const EditButton = ({}) => {
|
|
11871
|
+
const { displayState, toggleSidebarOpen } = React__namespace.useContext(SidebarContext);
|
|
11872
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
11873
|
+
Button$1,
|
|
11874
|
+
{
|
|
11875
|
+
rounded: "right",
|
|
11876
|
+
variant: "primary",
|
|
11877
|
+
size: "custom",
|
|
11878
|
+
onClick: toggleSidebarOpen,
|
|
11879
|
+
className: `z-chrome absolute top-6 right-0 translate-x-full text-sm h-10 pl-3 pr-4 transition-all duration-300 ${displayState !== "closed" ? "opacity-0 ease-in pointer-events-none" : "ease-out pointer-events-auto"}`,
|
|
11880
|
+
"aria-label": "opens cms sidebar"
|
|
11881
|
+
},
|
|
11882
|
+
/* @__PURE__ */ React__namespace.createElement(BiPencil, { className: "h-6 w-auto" })
|
|
11883
|
+
);
|
|
11884
|
+
};
|
|
11885
|
+
const SidebarWrapper = ({ children }) => {
|
|
11886
|
+
const { displayState, sidebarWidth, resizingSidebar } = React__namespace.useContext(SidebarContext);
|
|
11887
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
11770
11888
|
"div",
|
|
11771
11889
|
{
|
|
11772
|
-
className: `
|
|
11890
|
+
className: `fixed top-0 left-0 h-dvh z-base ${displayState === "closed" ? "pointer-events-none" : ""}`
|
|
11773
11891
|
},
|
|
11774
|
-
/* @__PURE__ */
|
|
11775
|
-
"
|
|
11776
|
-
{
|
|
11777
|
-
className: `${toggleClasses.base} px-2.5 rounded-l-md ${viewMode === "grid" ? toggleClasses.active : toggleClasses.inactive}`,
|
|
11778
|
-
onClick: () => {
|
|
11779
|
-
setViewMode("grid");
|
|
11780
|
-
}
|
|
11781
|
-
},
|
|
11782
|
-
/* @__PURE__ */ React.createElement(BiGridAlt, { className: "w-6 h-full opacity-70" })
|
|
11783
|
-
),
|
|
11784
|
-
/* @__PURE__ */ React.createElement(
|
|
11785
|
-
"button",
|
|
11892
|
+
/* @__PURE__ */ React__namespace.createElement(
|
|
11893
|
+
"div",
|
|
11786
11894
|
{
|
|
11787
|
-
className:
|
|
11788
|
-
|
|
11789
|
-
|
|
11895
|
+
className: `relative h-dvh transform flex ${displayState !== "closed" ? "" : "-translate-x-full"} ${resizingSidebar ? "transition-none" : displayState === "closed" ? "transition-all duration-300 ease-in" : displayState === "fullscreen" ? "transition-all duration-150 ease-out" : "transition-all duration-300 ease-out"}`,
|
|
11896
|
+
style: {
|
|
11897
|
+
width: displayState === "fullscreen" ? "100vw" : `${sidebarWidth}px`,
|
|
11898
|
+
maxWidth: displayState === "fullscreen" ? "100vw" : "calc(100vw - 8px)",
|
|
11899
|
+
minWidth: "360px"
|
|
11790
11900
|
}
|
|
11791
11901
|
},
|
|
11792
|
-
|
|
11902
|
+
children
|
|
11793
11903
|
)
|
|
11794
11904
|
);
|
|
11795
11905
|
};
|
|
11796
|
-
const
|
|
11797
|
-
|
|
11798
|
-
|
|
11799
|
-
Icon: MdOutlinePhotoLibrary,
|
|
11800
|
-
layout: "fullscreen",
|
|
11801
|
-
props: {
|
|
11802
|
-
allowDelete: true
|
|
11803
|
-
}
|
|
11804
|
-
});
|
|
11805
|
-
function UpdatePassword(props) {
|
|
11806
|
-
const cms = useCMS$1();
|
|
11807
|
-
const client = cms.api.tina;
|
|
11808
|
-
const [password, setPassword] = React.useState("");
|
|
11809
|
-
const [confirmPassword, setConfirmPassword] = React.useState("");
|
|
11810
|
-
const [dirty, setDirty] = React.useState(false);
|
|
11811
|
-
const [result, setResult] = React.useState(null);
|
|
11812
|
-
const [formState, setFormState] = React.useState("idle");
|
|
11813
|
-
const [passwordChangeRequired, setPasswordChangeRequired] = React.useState(false);
|
|
11814
|
-
React.useEffect(() => {
|
|
11815
|
-
var _a;
|
|
11816
|
-
(_a = client == null ? void 0 : client.authProvider) == null ? void 0 : _a.getUser().then(
|
|
11817
|
-
(user) => setPasswordChangeRequired((user == null ? void 0 : user.passwordChangeRequired) ?? false)
|
|
11818
|
-
);
|
|
11819
|
-
}, []);
|
|
11820
|
-
let err = null;
|
|
11821
|
-
if (dirty && password !== confirmPassword) {
|
|
11822
|
-
err = "Passwords do not match";
|
|
11823
|
-
}
|
|
11824
|
-
if (dirty && !password) {
|
|
11825
|
-
err = "Please enter a password";
|
|
11826
|
-
}
|
|
11827
|
-
const updatePassword = async () => {
|
|
11828
|
-
var _a;
|
|
11829
|
-
setResult(null);
|
|
11830
|
-
setFormState("busy");
|
|
11831
|
-
const res = await cms.api.tina.request(
|
|
11832
|
-
`mutation($password: String!) { updatePassword(password: $password) }`,
|
|
11833
|
-
{
|
|
11834
|
-
variables: {
|
|
11835
|
-
password
|
|
11836
|
-
}
|
|
11837
|
-
}
|
|
11838
|
-
);
|
|
11839
|
-
if (!(res == null ? void 0 : res.updatePassword)) {
|
|
11840
|
-
setResult("Error updating password");
|
|
11841
|
-
} else {
|
|
11842
|
-
setDirty(false);
|
|
11843
|
-
setPassword("");
|
|
11844
|
-
setConfirmPassword("");
|
|
11845
|
-
setResult("Password updated");
|
|
11846
|
-
setPasswordChangeRequired(false);
|
|
11847
|
-
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
11848
|
-
(_a = client == null ? void 0 : client.authProvider) == null ? void 0 : _a.logout().then(async () => {
|
|
11849
|
-
if (typeof (client == null ? void 0 : client.onLogout) === "function") {
|
|
11850
|
-
await client.onLogout();
|
|
11851
|
-
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
11852
|
-
}
|
|
11853
|
-
window.location.href = new URL(window.location.href).pathname;
|
|
11854
|
-
}).catch((e) => console.error(e));
|
|
11855
|
-
}
|
|
11856
|
-
setFormState("idle");
|
|
11857
|
-
};
|
|
11858
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "flex justify-center items-center h-full" }, /* @__PURE__ */ React.createElement("div", { className: "flex flex-col space-y-8 p-6" }, passwordChangeRequired && /* @__PURE__ */ React.createElement("div", { className: "text-center text-red-500" }, "Your password has expired. Please update your password."), /* @__PURE__ */ React.createElement("label", { className: "block" }, /* @__PURE__ */ React.createElement("span", { className: "text-gray-700" }, "New Password"), /* @__PURE__ */ React.createElement(
|
|
11859
|
-
BaseTextField,
|
|
11860
|
-
{
|
|
11861
|
-
type: "password",
|
|
11862
|
-
name: "password",
|
|
11863
|
-
id: "password",
|
|
11864
|
-
placeholder: "Enter password",
|
|
11865
|
-
className: err ? "border-red-500" : "border-gray-300 focus:ring-indigo-500 focus:border-indigo-500",
|
|
11866
|
-
value: password,
|
|
11867
|
-
onKeyDown: () => {
|
|
11868
|
-
setDirty(true);
|
|
11869
|
-
setResult(null);
|
|
11870
|
-
},
|
|
11871
|
-
onChange: (e) => setPassword(e.target.value),
|
|
11872
|
-
required: true
|
|
11873
|
-
}
|
|
11874
|
-
)), /* @__PURE__ */ React.createElement("label", { className: "block" }, /* @__PURE__ */ React.createElement("span", { className: "text-gray-700" }, "Confirm New Password"), /* @__PURE__ */ React.createElement(
|
|
11875
|
-
BaseTextField,
|
|
11876
|
-
{
|
|
11877
|
-
type: "password",
|
|
11878
|
-
name: "confirmPassword",
|
|
11879
|
-
id: "confirmPassword",
|
|
11880
|
-
placeholder: "Confirm password",
|
|
11881
|
-
className: err ? "border-red-500" : "border-gray-300 focus:ring-indigo-500 focus:border-indigo-500",
|
|
11882
|
-
value: confirmPassword,
|
|
11883
|
-
onKeyDown: () => {
|
|
11884
|
-
setDirty(true);
|
|
11885
|
-
setResult(null);
|
|
11886
|
-
},
|
|
11887
|
-
onChange: (e) => setConfirmPassword(e.target.value),
|
|
11888
|
-
required: true
|
|
11889
|
-
}
|
|
11890
|
-
)), result && /* @__PURE__ */ React.createElement("div", { className: "text-center text-sm text-gray-500" }, result), err && /* @__PURE__ */ React.createElement("div", { className: "text-center text-sm text-red-500" }, err), /* @__PURE__ */ React.createElement(
|
|
11891
|
-
Button$1,
|
|
11906
|
+
const SidebarBody = ({ children }) => {
|
|
11907
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
11908
|
+
"div",
|
|
11892
11909
|
{
|
|
11893
|
-
|
|
11894
|
-
disabled: err,
|
|
11895
|
-
variant: "primary",
|
|
11896
|
-
busy: formState === "busy"
|
|
11910
|
+
className: "relative left-0 w-full h-full flex flex-col items-stretch bg-white border-r border-gray-200 overflow-hidden"
|
|
11897
11911
|
},
|
|
11898
|
-
|
|
11899
|
-
)
|
|
11900
|
-
}
|
|
11901
|
-
const PasswordScreenPlugin = createScreen({
|
|
11902
|
-
name: "Change Password",
|
|
11903
|
-
Component: UpdatePassword,
|
|
11904
|
-
Icon: MdVpnKey,
|
|
11905
|
-
layout: "fullscreen",
|
|
11906
|
-
navCategory: "Account"
|
|
11907
|
-
});
|
|
11908
|
-
function createCloudConfig({
|
|
11909
|
-
...options
|
|
11910
|
-
}) {
|
|
11911
|
-
return {
|
|
11912
|
-
__type: "cloud-config",
|
|
11913
|
-
Icon: MdOutlineCloud,
|
|
11914
|
-
...options
|
|
11915
|
-
};
|
|
11916
|
-
}
|
|
11912
|
+
children
|
|
11913
|
+
);
|
|
11914
|
+
};
|
|
11917
11915
|
const DEFAULT_FIELDS = [
|
|
11918
11916
|
TextFieldPlugin,
|
|
11919
11917
|
TextareaFieldPlugin,
|
|
@@ -12001,7 +11999,7 @@ flowchart TD
|
|
|
12001
11999
|
name: "Support",
|
|
12002
12000
|
link: {
|
|
12003
12001
|
text: "Support",
|
|
12004
|
-
href: "https
|
|
12002
|
+
href: "https://tina.io/docs/support"
|
|
12005
12003
|
},
|
|
12006
12004
|
Icon: MdOutlineHelpOutline
|
|
12007
12005
|
})
|
|
@@ -32299,8 +32297,8 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
32299
32297
|
return client.request(query, { variables });
|
|
32300
32298
|
};
|
|
32301
32299
|
const GetCMS = ({ children }) => {
|
|
32300
|
+
const cms = useCMS$1();
|
|
32302
32301
|
try {
|
|
32303
|
-
const cms = useCMS$1();
|
|
32304
32302
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, children(cms));
|
|
32305
32303
|
} catch (e) {
|
|
32306
32304
|
return null;
|
|
@@ -33708,22 +33706,28 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
33708
33706
|
search
|
|
33709
33707
|
}) => {
|
|
33710
33708
|
const navigate = reactRouterDom.useNavigate();
|
|
33711
|
-
const { collection, loading, error, reFetchCollection, collectionExtra } = search ?
|
|
33712
|
-
|
|
33713
|
-
|
|
33714
|
-
|
|
33715
|
-
|
|
33716
|
-
|
|
33717
|
-
|
|
33718
|
-
|
|
33719
|
-
|
|
33720
|
-
|
|
33721
|
-
|
|
33722
|
-
|
|
33723
|
-
|
|
33724
|
-
|
|
33725
|
-
|
|
33726
|
-
|
|
33709
|
+
const { collection, loading, error, reFetchCollection, collectionExtra } = search ? (
|
|
33710
|
+
// biome-ignore lint/correctness/useHookAtTopLevel: not ready to fix these yet
|
|
33711
|
+
useSearchCollection(
|
|
33712
|
+
cms,
|
|
33713
|
+
collectionName,
|
|
33714
|
+
includeDocuments,
|
|
33715
|
+
folder,
|
|
33716
|
+
startCursor || "",
|
|
33717
|
+
search
|
|
33718
|
+
)
|
|
33719
|
+
) : (
|
|
33720
|
+
// biome-ignore lint/correctness/useHookAtTopLevel: not ready to fix these yet
|
|
33721
|
+
useGetCollection(
|
|
33722
|
+
cms,
|
|
33723
|
+
collectionName,
|
|
33724
|
+
includeDocuments,
|
|
33725
|
+
folder,
|
|
33726
|
+
startCursor || "",
|
|
33727
|
+
sortKey,
|
|
33728
|
+
filterArgs
|
|
33729
|
+
) || {}
|
|
33730
|
+
);
|
|
33727
33731
|
React.useEffect(() => {
|
|
33728
33732
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
33729
33733
|
if (loading)
|
|
@@ -35078,3 +35082,4 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
35078
35082
|
exports2.wrapFieldsWithMeta = wrapFieldsWithMeta;
|
|
35079
35083
|
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
35080
35084
|
});
|
|
35085
|
+
//# sourceMappingURL=index.js.map
|