@conloca/cms-spa 0.1.4 → 0.1.5
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/main.mjs +17 -2
- package/dist/main.mjs.map +1 -1
- package/dist/spa/main.css +23 -0
- package/package.json +1 -1
package/dist/main.mjs
CHANGED
|
@@ -3,8 +3,8 @@ import { r as useDataSchemas } from "./data-schemas-BfLnirHs.mjs";
|
|
|
3
3
|
import { r as usePageSchemas } from "./page-schemas-CyCRM6JQ.mjs";
|
|
4
4
|
import { r as usePuckConfig } from "./puck-config-DEUM5skt.mjs";
|
|
5
5
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
6
|
-
import { AlertCircle, AlertTriangle, ArrowRight, Check, ChevronDown, Clock, Code, Code2, Database, Edit, Edit2, ExternalLink, Eye, FileEdit, FileJson, FileText, Folder, FolderInput, FolderOpen, GitBranch, Image, ImageIcon, LayoutDashboard, Loader2, Monitor, MoreVertical, Package, Plus, Save, Settings, Smartphone, Tablet, Trash2, Upload, User, X } from "lucide-react";
|
|
7
|
-
import { ContentAPIClient, getContentAPIClient, localesOf, setContentAPIClient, useBlocks, useCommitChanges, useCreateContent, useCurrentUser, useData, useDataCollections, useDeleteContent, useFolderTree, useGitStatus, useLocalizedContent, usePushChanges, useSitePages, useSitesConfig, useUpdateLocalized } from "@conloca/content-api-client";
|
|
6
|
+
import { AlertCircle, AlertTriangle, ArrowDownToLine, ArrowRight, Check, ChevronDown, Clock, Code, Code2, Database, Edit, Edit2, ExternalLink, Eye, FileEdit, FileJson, FileText, Folder, FolderInput, FolderOpen, GitBranch, Image, ImageIcon, LayoutDashboard, Loader2, Monitor, MoreVertical, Package, Plus, Save, Settings, Smartphone, Tablet, Trash2, Upload, User, X } from "lucide-react";
|
|
7
|
+
import { ContentAPIClient, getContentAPIClient, localesOf, setContentAPIClient, useBlocks, useCommitChanges, useCreateContent, useCurrentUser, useData, useDataCollections, useDeleteContent, useFolderTree, useGitStatus, useLocalizedContent, usePullChanges, usePushChanges, useSitePages, useSitesConfig, useUpdateLocalized } from "@conloca/content-api-client";
|
|
8
8
|
import cn from "clsx";
|
|
9
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { QueryClient, QueryClientProvider, useQuery } from "@tanstack/react-query";
|
|
@@ -140,6 +140,7 @@ function CMSDashboard() {
|
|
|
140
140
|
function GitStatusPanel() {
|
|
141
141
|
const { data: status, isLoading, error } = useGitStatus();
|
|
142
142
|
const commitMutation = useCommitChanges();
|
|
143
|
+
const pullMutation = usePullChanges();
|
|
143
144
|
const pushMutation = usePushChanges();
|
|
144
145
|
const handleCommit = () => {
|
|
145
146
|
if (status?.hasChanges) commitMutation.mutate(void 0);
|
|
@@ -147,6 +148,9 @@ function GitStatusPanel() {
|
|
|
147
148
|
const handlePush = () => {
|
|
148
149
|
if (status && status.ahead > 0) pushMutation.mutate();
|
|
149
150
|
};
|
|
151
|
+
const handlePull = () => {
|
|
152
|
+
if (status?.isRepo) pullMutation.mutate();
|
|
153
|
+
};
|
|
150
154
|
if (status && !status.isRepo) return /* @__PURE__ */ jsxs("div", {
|
|
151
155
|
className: "flex items-center gap-2 text-gray-400 text-sm",
|
|
152
156
|
children: [/* @__PURE__ */ jsx(GitBranch, { className: "h-4 w-4" }), /* @__PURE__ */ jsx("span", { children: "Not a git repo" })]
|
|
@@ -166,6 +170,13 @@ function GitStatusPanel() {
|
|
|
166
170
|
className: "flex items-center gap-1.5 text-gray-500 text-sm",
|
|
167
171
|
children: [/* @__PURE__ */ jsx(GitBranch, { className: "h-4 w-4" }), /* @__PURE__ */ jsx("span", { children: status?.branch || "unknown" })]
|
|
168
172
|
}),
|
|
173
|
+
/* @__PURE__ */ jsxs("button", {
|
|
174
|
+
type: "button",
|
|
175
|
+
onClick: handlePull,
|
|
176
|
+
disabled: !status?.isRepo || pullMutation.isPending,
|
|
177
|
+
className: cn$1("flex items-center gap-1.5 px-3 py-1.5 rounded text-sm font-medium transition-colors", status?.isRepo ? status.behind > 0 ? "bg-amber-500 text-white hover:bg-amber-600" : "bg-sky-500 text-white hover:bg-sky-600" : "bg-gray-100 text-gray-400 cursor-not-allowed"),
|
|
178
|
+
children: [pullMutation.isPending ? /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx(ArrowDownToLine, { className: "h-4 w-4" }), /* @__PURE__ */ jsx("span", { children: "Pull" })]
|
|
179
|
+
}),
|
|
169
180
|
/* @__PURE__ */ jsxs("button", {
|
|
170
181
|
type: "button",
|
|
171
182
|
onClick: handleCommit,
|
|
@@ -205,6 +216,10 @@ function GitStatusPanel() {
|
|
|
205
216
|
pushMutation.isError ? /* @__PURE__ */ jsx("span", {
|
|
206
217
|
className: "text-red-500 text-sm",
|
|
207
218
|
children: "Push failed"
|
|
219
|
+
}) : null,
|
|
220
|
+
pullMutation.isError ? /* @__PURE__ */ jsx("span", {
|
|
221
|
+
className: "text-red-500 text-sm",
|
|
222
|
+
children: "Pull failed"
|
|
208
223
|
}) : null
|
|
209
224
|
]
|
|
210
225
|
});
|