@conloca/cms-spa 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -3,7 +3,7 @@ import "@mdxeditor/editor";
3
3
  import React from "react";
4
4
  import "@mdxeditor/editor/style.css";
5
5
  import { AssetEntry, AssetUsage, FolderListing, FolderTreeNode, LocalizedEntry } from "@conloca/content-api-client";
6
- import * as react_jsx_runtime0 from "react/jsx-runtime";
6
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
7
7
  import { QueryClientConfig, QueryClientConfig as QueryClientConfig$1 } from "@tanstack/react-query";
8
8
 
9
9
  //#region src/components/editor/CMSMDXEditor.d.ts
@@ -34,7 +34,7 @@ declare function FolderTreeSidebar({
34
34
  currentFolder,
35
35
  onFolderSelect,
36
36
  dropTargetFolder
37
- }: FolderTreeSidebarProps): react_jsx_runtime0.JSX.Element;
37
+ }: FolderTreeSidebarProps): react_jsx_runtime1.JSX.Element;
38
38
  //#endregion
39
39
  //#region src/components/media/MediaToolbar.d.ts
40
40
  type FileTypeFilter = 'all' | 'images' | 'svg';
@@ -86,7 +86,7 @@ declare function MediaLibrary({
86
86
  search: externalSearch,
87
87
  fileType: externalFileType,
88
88
  sort: externalSort
89
- }: MediaLibraryProps): react_jsx_runtime0.JSX.Element;
89
+ }: MediaLibraryProps): react_jsx_runtime1.JSX.Element;
90
90
  //#endregion
91
91
  //#region src/components/media/UploadModal.d.ts
92
92
  interface UploadModalProps {
@@ -100,7 +100,7 @@ declare function UploadModal({
100
100
  onClose,
101
101
  folder,
102
102
  onUploadComplete
103
- }: UploadModalProps): react_jsx_runtime0.JSX.Element | null;
103
+ }: UploadModalProps): react_jsx_runtime1.JSX.Element | null;
104
104
  //#endregion
105
105
  //#region src/components/puck/MDXContent.d.ts
106
106
  interface MDXContentProps {
@@ -109,7 +109,7 @@ interface MDXContentProps {
109
109
  /**
110
110
  * MDXContent component wrapped with error boundary.
111
111
  */
112
- declare function MDXContent(props: MDXContentProps): react_jsx_runtime0.JSX.Element;
112
+ declare function MDXContent(props: MDXContentProps): react_jsx_runtime1.JSX.Element;
113
113
  //#endregion
114
114
  //#region src/ui-config.d.ts
115
115
  interface TemplateConfig {
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
  });