@ampless/admin 1.0.0-alpha.81 → 1.0.0-alpha.83
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/api/index.d.ts +1 -1
- package/dist/{chunk-4QTNVVKD.js → chunk-3KDJTNCS.js} +2 -2
- package/dist/chunk-4KUKZ2Y5.js +228 -0
- package/dist/{chunk-TBNETGQL.js → chunk-7NQERXNY.js} +1 -1
- package/dist/{chunk-7AGYC7JB.js → chunk-BAZ6YAPS.js} +2 -2
- package/dist/{chunk-MPZ3GVZC.js → chunk-CFIOUXVE.js} +16 -6
- package/dist/{chunk-IR4EB5C3.js → chunk-GGHN2RKQ.js} +1 -1
- package/dist/{chunk-DDAGBC4N.js → chunk-HN3UFHP7.js} +1 -1
- package/dist/{chunk-DUSEHGSV.js → chunk-K44QF3MV.js} +1 -1
- package/dist/{chunk-HOJJIABL.js → chunk-MKWYNK4J.js} +2 -2
- package/dist/{chunk-7TAT4AHW.js → chunk-OFPNBZKP.js} +36 -2
- package/dist/{chunk-AB2VWBDC.js → chunk-RTNDMAFN.js} +45 -3
- package/dist/{chunk-PHV2FQFV.js → chunk-SMI7Y77B.js} +1 -1
- package/dist/{chunk-DSCNWIBN.js → chunk-SQ6LFPXH.js} +2 -2
- package/dist/{chunk-OJTHDE7F.js → chunk-TJTIKTUV.js} +2 -2
- package/dist/{chunk-NI4JSVXL.js → chunk-W4VHP2JW.js} +1 -1
- package/dist/components/admin-dashboard.js +3 -3
- package/dist/components/edit-post-view.js +5 -5
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +6 -6
- package/dist/components/login-view.js +3 -3
- package/dist/components/mcp-tokens-view.js +3 -3
- package/dist/components/media-view.js +5 -5
- package/dist/components/new-post-view.js +5 -5
- package/dist/components/plugin-settings-form.js +3 -3
- package/dist/components/posts-list-view.js +3 -3
- package/dist/components/users-list-view.js +3 -3
- package/dist/editor.d.ts +15 -6
- package/dist/{i18n-DBNV_Fgf.d.ts → i18n-DA-aakRX.d.ts} +52 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/pages/index.d.ts +1 -1
- package/dist/pages/index.js +15 -15
- package/package.json +4 -4
- package/dist/chunk-LNX3I35F.js +0 -67
package/dist/api/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
PostForm
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BAZ6YAPS.js";
|
|
5
5
|
import {
|
|
6
6
|
useT
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-K44QF3MV.js";
|
|
8
8
|
|
|
9
9
|
// src/components/edit-post-view.tsx
|
|
10
10
|
import { useEffect, useState, use } from "react";
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
useT
|
|
4
|
+
} from "./chunk-K44QF3MV.js";
|
|
5
|
+
|
|
6
|
+
// src/components/posts-list-view.tsx
|
|
7
|
+
import { useEffect, useMemo, useState } from "react";
|
|
8
|
+
import Link from "next/link";
|
|
9
|
+
import { formatDate, listPostSummaries } from "ampless";
|
|
10
|
+
import {
|
|
11
|
+
Button,
|
|
12
|
+
Input,
|
|
13
|
+
Table,
|
|
14
|
+
TableBody,
|
|
15
|
+
TableCell,
|
|
16
|
+
TableHead,
|
|
17
|
+
TableHeader,
|
|
18
|
+
TableRow
|
|
19
|
+
} from "@ampless/runtime/ui";
|
|
20
|
+
|
|
21
|
+
// src/lib/post-list-filter.ts
|
|
22
|
+
function filterSortPostSummaries(rows, options = {}) {
|
|
23
|
+
const query = options.query?.trim().toLowerCase() ?? "";
|
|
24
|
+
const status = options.status ?? "all";
|
|
25
|
+
const tag = options.tag ?? "";
|
|
26
|
+
const sort = options.sort ?? "updated-desc";
|
|
27
|
+
return rows.filter((row) => {
|
|
28
|
+
if (status !== "all" && row.status !== status) return false;
|
|
29
|
+
if (tag && !row.tags.includes(tag)) return false;
|
|
30
|
+
if (!query) return true;
|
|
31
|
+
return row.title.toLowerCase().includes(query) || row.slug.toLowerCase().includes(query) || row.tags.some((t) => t.toLowerCase().includes(query));
|
|
32
|
+
}).sort((a, b) => compareRows(a, b, sort));
|
|
33
|
+
}
|
|
34
|
+
function collectTags(rows) {
|
|
35
|
+
const counts = /* @__PURE__ */ new Map();
|
|
36
|
+
for (const row of rows) {
|
|
37
|
+
for (const tag of row.tags) {
|
|
38
|
+
const trimmed = tag.trim();
|
|
39
|
+
if (!trimmed) continue;
|
|
40
|
+
counts.set(trimmed, (counts.get(trimmed) ?? 0) + 1);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return new Map([...counts.entries()].sort(([a], [b]) => a.localeCompare(b)));
|
|
44
|
+
}
|
|
45
|
+
function compareRows(a, b, sort) {
|
|
46
|
+
switch (sort) {
|
|
47
|
+
case "updated-asc":
|
|
48
|
+
return compareOptionalIso(a.updatedAt, b.updatedAt, "asc");
|
|
49
|
+
case "updated-desc":
|
|
50
|
+
return compareOptionalIso(a.updatedAt, b.updatedAt, "desc");
|
|
51
|
+
case "published-asc":
|
|
52
|
+
return compareOptionalIso(a.publishedAt, b.publishedAt, "asc");
|
|
53
|
+
case "published-desc":
|
|
54
|
+
return compareOptionalIso(a.publishedAt, b.publishedAt, "desc");
|
|
55
|
+
case "title-desc":
|
|
56
|
+
return b.title.localeCompare(a.title);
|
|
57
|
+
case "title-asc":
|
|
58
|
+
return a.title.localeCompare(b.title);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function compareOptionalIso(a, b, direction) {
|
|
62
|
+
if (!a && !b) return 0;
|
|
63
|
+
if (!a) return 1;
|
|
64
|
+
if (!b) return -1;
|
|
65
|
+
return direction === "asc" ? a.localeCompare(b) : b.localeCompare(a);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// src/components/posts-list-view.tsx
|
|
69
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
70
|
+
var PAGE_SIZE = 100;
|
|
71
|
+
function PostsList() {
|
|
72
|
+
const t = useT();
|
|
73
|
+
const [posts, setPosts] = useState([]);
|
|
74
|
+
const [loading, setLoading] = useState(true);
|
|
75
|
+
const [loadError, setLoadError] = useState(null);
|
|
76
|
+
const [query, setQuery] = useState("");
|
|
77
|
+
const [statusFilter, setStatusFilter] = useState("all");
|
|
78
|
+
const [tagFilter, setTagFilter] = useState("");
|
|
79
|
+
const [sort, setSort] = useState("updated-desc");
|
|
80
|
+
const [visibleCount, setVisibleCount] = useState(PAGE_SIZE);
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
listPostSummaries({ status: "all" }).then(setPosts).catch((err) => {
|
|
83
|
+
console.error("[posts-list-view] listPostSummaries failed:", err);
|
|
84
|
+
setLoadError(err instanceof Error ? err.message : String(err));
|
|
85
|
+
}).finally(() => setLoading(false));
|
|
86
|
+
}, []);
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
setVisibleCount(PAGE_SIZE);
|
|
89
|
+
}, [query, statusFilter, tagFilter, sort]);
|
|
90
|
+
const tagCounts = useMemo(() => collectTags(posts), [posts]);
|
|
91
|
+
const filteredPosts = useMemo(
|
|
92
|
+
() => filterSortPostSummaries(posts, {
|
|
93
|
+
query,
|
|
94
|
+
status: statusFilter,
|
|
95
|
+
tag: tagFilter,
|
|
96
|
+
sort
|
|
97
|
+
}),
|
|
98
|
+
[posts, query, statusFilter, tagFilter, sort]
|
|
99
|
+
);
|
|
100
|
+
const visiblePosts = filteredPosts.slice(0, visibleCount);
|
|
101
|
+
const hasMore = visibleCount < filteredPosts.length;
|
|
102
|
+
return /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-7xl p-4 md:p-8", children: [
|
|
103
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-6 flex flex-wrap items-center justify-between gap-3 md:mb-8", children: [
|
|
104
|
+
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold md:text-3xl", children: t("posts.list.title") }),
|
|
105
|
+
/* @__PURE__ */ jsx(Button, { asChild: true, children: /* @__PURE__ */ jsx(Link, { href: "/admin/posts/new", children: t("posts.list.newButton") }) })
|
|
106
|
+
] }),
|
|
107
|
+
loading ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: t("common.loading") }) : loadError ? /* @__PURE__ */ jsxs("p", { className: "text-sm text-destructive", children: [
|
|
108
|
+
t("posts.list.loadError"),
|
|
109
|
+
": ",
|
|
110
|
+
loadError
|
|
111
|
+
] }) : posts.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "rounded-md border p-12 text-center", children: [
|
|
112
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: t("posts.list.empty") }),
|
|
113
|
+
/* @__PURE__ */ jsx(Button, { asChild: true, className: "mt-4", children: /* @__PURE__ */ jsx(Link, { href: "/admin/posts/new", children: t("posts.list.createFirst") }) })
|
|
114
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
115
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
116
|
+
/* @__PURE__ */ jsx(
|
|
117
|
+
Input,
|
|
118
|
+
{
|
|
119
|
+
className: "min-w-56 max-w-sm",
|
|
120
|
+
value: query,
|
|
121
|
+
onChange: (e) => setQuery(e.target.value),
|
|
122
|
+
placeholder: t("posts.list.searchPlaceholder")
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
/* @__PURE__ */ jsxs(
|
|
126
|
+
"select",
|
|
127
|
+
{
|
|
128
|
+
className: "h-9 rounded-md border bg-background px-2 py-1.5 text-sm",
|
|
129
|
+
value: statusFilter,
|
|
130
|
+
"aria-label": t("common.status"),
|
|
131
|
+
onChange: (e) => setStatusFilter(e.target.value),
|
|
132
|
+
children: [
|
|
133
|
+
/* @__PURE__ */ jsx("option", { value: "all", children: t("posts.list.filterAll") }),
|
|
134
|
+
/* @__PURE__ */ jsx("option", { value: "published", children: t("posts.list.filterPublished") }),
|
|
135
|
+
/* @__PURE__ */ jsx("option", { value: "draft", children: t("posts.list.filterDraft") })
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
/* @__PURE__ */ jsxs(
|
|
140
|
+
"select",
|
|
141
|
+
{
|
|
142
|
+
className: "h-9 rounded-md border bg-background px-2 py-1.5 text-sm",
|
|
143
|
+
value: tagFilter,
|
|
144
|
+
"aria-label": t("common.tags"),
|
|
145
|
+
onChange: (e) => setTagFilter(e.target.value),
|
|
146
|
+
children: [
|
|
147
|
+
/* @__PURE__ */ jsx("option", { value: "", children: t("posts.list.filterAllTags") }),
|
|
148
|
+
[...tagCounts.entries()].map(([tag, count]) => /* @__PURE__ */ jsxs("option", { value: tag, children: [
|
|
149
|
+
tag,
|
|
150
|
+
" (",
|
|
151
|
+
count,
|
|
152
|
+
")"
|
|
153
|
+
] }, tag))
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
),
|
|
157
|
+
/* @__PURE__ */ jsxs(
|
|
158
|
+
"select",
|
|
159
|
+
{
|
|
160
|
+
className: "h-9 rounded-md border bg-background px-2 py-1.5 text-sm",
|
|
161
|
+
value: sort,
|
|
162
|
+
"aria-label": t("posts.list.sortLabel"),
|
|
163
|
+
onChange: (e) => setSort(e.target.value),
|
|
164
|
+
children: [
|
|
165
|
+
/* @__PURE__ */ jsx("option", { value: "updated-desc", children: t("posts.list.sortUpdatedDesc") }),
|
|
166
|
+
/* @__PURE__ */ jsx("option", { value: "updated-asc", children: t("posts.list.sortUpdatedAsc") }),
|
|
167
|
+
/* @__PURE__ */ jsx("option", { value: "published-desc", children: t("posts.list.sortPublishedDesc") }),
|
|
168
|
+
/* @__PURE__ */ jsx("option", { value: "published-asc", children: t("posts.list.sortPublishedAsc") }),
|
|
169
|
+
/* @__PURE__ */ jsx("option", { value: "title-asc", children: t("posts.list.sortTitleAsc") }),
|
|
170
|
+
/* @__PURE__ */ jsx("option", { value: "title-desc", children: t("posts.list.sortTitleDesc") })
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: t("posts.list.resultCount", {
|
|
175
|
+
shown: filteredPosts.length,
|
|
176
|
+
total: posts.length
|
|
177
|
+
}) })
|
|
178
|
+
] }),
|
|
179
|
+
filteredPosts.length === 0 ? /* @__PURE__ */ jsx("p", { className: "rounded-md border p-8 text-center text-muted-foreground", children: t("posts.list.noMatches") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
180
|
+
/* @__PURE__ */ jsx("div", { className: "overflow-x-auto rounded-md border", children: /* @__PURE__ */ jsxs(Table, { children: [
|
|
181
|
+
/* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
|
|
182
|
+
/* @__PURE__ */ jsx(TableHead, { children: t("posts.list.columnTitle") }),
|
|
183
|
+
/* @__PURE__ */ jsx(TableHead, { children: t("posts.list.columnStatus") }),
|
|
184
|
+
/* @__PURE__ */ jsx(TableHead, { children: t("posts.list.columnSlug") }),
|
|
185
|
+
/* @__PURE__ */ jsx(TableHead, { children: t("posts.list.columnPublished") }),
|
|
186
|
+
/* @__PURE__ */ jsx(TableHead, { children: t("posts.list.columnUpdated") })
|
|
187
|
+
] }) }),
|
|
188
|
+
/* @__PURE__ */ jsx(TableBody, { children: visiblePosts.map((post) => /* @__PURE__ */ jsxs(TableRow, { children: [
|
|
189
|
+
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(
|
|
190
|
+
Link,
|
|
191
|
+
{
|
|
192
|
+
href: `/admin/posts/${post.postId}`,
|
|
193
|
+
className: "font-medium hover:underline",
|
|
194
|
+
children: post.title
|
|
195
|
+
}
|
|
196
|
+
) }),
|
|
197
|
+
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(
|
|
198
|
+
"span",
|
|
199
|
+
{
|
|
200
|
+
className: post.status === "published" ? "inline-block rounded-full bg-green-100 px-2 py-0.5 text-xs text-green-700" : "inline-block rounded-full bg-gray-100 px-2 py-0.5 text-xs text-gray-700",
|
|
201
|
+
children: t(`common.${post.status}`)
|
|
202
|
+
}
|
|
203
|
+
) }),
|
|
204
|
+
/* @__PURE__ */ jsx(TableCell, { className: "font-mono text-xs text-muted-foreground", children: post.slug }),
|
|
205
|
+
/* @__PURE__ */ jsx(TableCell, { className: "whitespace-nowrap text-sm text-muted-foreground", children: formatPostDate(post.publishedAt) }),
|
|
206
|
+
/* @__PURE__ */ jsx(TableCell, { className: "whitespace-nowrap text-sm text-muted-foreground", children: formatPostDate(post.updatedAt) })
|
|
207
|
+
] }, post.postId)) })
|
|
208
|
+
] }) }),
|
|
209
|
+
hasMore && /* @__PURE__ */ jsx(
|
|
210
|
+
Button,
|
|
211
|
+
{
|
|
212
|
+
type: "button",
|
|
213
|
+
variant: "outline",
|
|
214
|
+
onClick: () => setVisibleCount((n) => n + PAGE_SIZE),
|
|
215
|
+
children: t("posts.list.showMore")
|
|
216
|
+
}
|
|
217
|
+
)
|
|
218
|
+
] })
|
|
219
|
+
] })
|
|
220
|
+
] });
|
|
221
|
+
}
|
|
222
|
+
function formatPostDate(value) {
|
|
223
|
+
return value ? formatDate(value) || "-" : "-";
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export {
|
|
227
|
+
PostsList
|
|
228
|
+
};
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
getAdminCmsConfig,
|
|
5
5
|
getMediaProcessingDefaults,
|
|
6
6
|
uploadProcessedImage
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HN3UFHP7.js";
|
|
8
8
|
import {
|
|
9
9
|
getAdminEditorExtensions,
|
|
10
10
|
getAdminTiptapNodeHtml,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./chunk-2ITWLRYF.js";
|
|
16
16
|
import {
|
|
17
17
|
useT
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-K44QF3MV.js";
|
|
19
19
|
|
|
20
20
|
// src/components/media-picker.tsx
|
|
21
21
|
import { useEffect, useRef, useState } from "react";
|
|
@@ -1,43 +1,53 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
useT
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-K44QF3MV.js";
|
|
5
5
|
|
|
6
6
|
// src/components/admin-dashboard.tsx
|
|
7
7
|
import { useEffect, useState } from "react";
|
|
8
8
|
import Link from "next/link";
|
|
9
|
-
import {
|
|
9
|
+
import { listPostSummaries } from "ampless";
|
|
10
10
|
import { Button, Card, CardContent, CardHeader, CardTitle } from "@ampless/runtime/ui";
|
|
11
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
function AdminDashboard() {
|
|
13
13
|
const t = useT();
|
|
14
14
|
const [posts, setPosts] = useState([]);
|
|
15
15
|
const [loading, setLoading] = useState(true);
|
|
16
|
+
const [loadError, setLoadError] = useState(null);
|
|
16
17
|
useEffect(() => {
|
|
17
|
-
|
|
18
|
+
listPostSummaries({ status: "all" }).then(setPosts).catch((err) => {
|
|
19
|
+
console.error("[admin-dashboard] listPostSummaries failed:", err);
|
|
20
|
+
setLoadError(err instanceof Error ? err.message : String(err));
|
|
21
|
+
}).finally(() => setLoading(false));
|
|
18
22
|
}, []);
|
|
19
23
|
const published = posts.filter((p) => p.status === "published").length;
|
|
20
24
|
const drafts = posts.filter((p) => p.status === "draft").length;
|
|
25
|
+
const countPending = loading || Boolean(loadError);
|
|
21
26
|
return /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-7xl p-4 md:p-8", children: [
|
|
22
27
|
/* @__PURE__ */ jsxs("div", { className: "mb-6 flex flex-wrap items-center justify-between gap-3 md:mb-8", children: [
|
|
23
28
|
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold md:text-3xl", children: t("dashboard.title") }),
|
|
24
29
|
/* @__PURE__ */ jsx(Button, { asChild: true, children: /* @__PURE__ */ jsx(Link, { href: "/admin/posts/new", children: t("dashboard.newPost") }) })
|
|
25
30
|
] }),
|
|
31
|
+
loadError && /* @__PURE__ */ jsxs("p", { className: "mb-4 text-sm text-destructive", children: [
|
|
32
|
+
t("posts.list.loadError"),
|
|
33
|
+
": ",
|
|
34
|
+
loadError
|
|
35
|
+
] }),
|
|
26
36
|
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3", children: [
|
|
27
37
|
/* @__PURE__ */ jsxs(Card, { children: [
|
|
28
38
|
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { children: t("dashboard.totalPosts") }) }),
|
|
29
39
|
/* @__PURE__ */ jsxs(CardContent, { children: [
|
|
30
|
-
/* @__PURE__ */ jsx("p", { className: "text-3xl font-bold", children:
|
|
40
|
+
/* @__PURE__ */ jsx("p", { className: "text-3xl font-bold", children: countPending ? "-" : posts.length }),
|
|
31
41
|
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("dashboard.totalLabel") })
|
|
32
42
|
] })
|
|
33
43
|
] }),
|
|
34
44
|
/* @__PURE__ */ jsxs(Card, { children: [
|
|
35
45
|
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { children: t("dashboard.published") }) }),
|
|
36
|
-
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("p", { className: "text-3xl font-bold", children:
|
|
46
|
+
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("p", { className: "text-3xl font-bold", children: countPending ? "-" : published }) })
|
|
37
47
|
] }),
|
|
38
48
|
/* @__PURE__ */ jsxs(Card, { children: [
|
|
39
49
|
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { children: t("dashboard.drafts") }) }),
|
|
40
|
-
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("p", { className: "text-3xl font-bold", children:
|
|
50
|
+
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("p", { className: "text-3xl font-bold", children: countPending ? "-" : drafts }) })
|
|
41
51
|
] })
|
|
42
52
|
] })
|
|
43
53
|
] });
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
MediaUploader
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SQ6LFPXH.js";
|
|
5
5
|
import {
|
|
6
6
|
useT
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-K44QF3MV.js";
|
|
8
8
|
|
|
9
9
|
// src/components/media-view.tsx
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -60,7 +60,24 @@ var en_default = {
|
|
|
60
60
|
columnTitle: "Title",
|
|
61
61
|
columnStatus: "Status",
|
|
62
62
|
columnSlug: "Slug",
|
|
63
|
-
|
|
63
|
+
columnPublished: "Published",
|
|
64
|
+
columnUpdated: "Updated",
|
|
65
|
+
searchPlaceholder: "Search title, slug, or tags",
|
|
66
|
+
filterAll: "All statuses",
|
|
67
|
+
filterPublished: "Published",
|
|
68
|
+
filterDraft: "Draft",
|
|
69
|
+
filterAllTags: "All tags",
|
|
70
|
+
sortLabel: "Sort",
|
|
71
|
+
sortUpdatedDesc: "Updated newest",
|
|
72
|
+
sortUpdatedAsc: "Updated oldest",
|
|
73
|
+
sortPublishedDesc: "Published newest",
|
|
74
|
+
sortPublishedAsc: "Published oldest",
|
|
75
|
+
sortTitleAsc: "Title A-Z",
|
|
76
|
+
sortTitleDesc: "Title Z-A",
|
|
77
|
+
showMore: "Show more",
|
|
78
|
+
resultCount: "{shown} / {total}",
|
|
79
|
+
noMatches: "No posts match the current filters.",
|
|
80
|
+
loadError: "Failed to load posts"
|
|
64
81
|
},
|
|
65
82
|
form: {
|
|
66
83
|
newTitle: "New post",
|
|
@@ -432,7 +449,24 @@ var ja_default = {
|
|
|
432
449
|
columnTitle: "\u30BF\u30A4\u30C8\u30EB",
|
|
433
450
|
columnStatus: "\u30B9\u30C6\u30FC\u30BF\u30B9",
|
|
434
451
|
columnSlug: "\u30B9\u30E9\u30C3\u30B0",
|
|
435
|
-
|
|
452
|
+
columnPublished: "\u516C\u958B\u65E5",
|
|
453
|
+
columnUpdated: "\u66F4\u65B0\u65E5",
|
|
454
|
+
searchPlaceholder: "\u30BF\u30A4\u30C8\u30EB\u3001\u30B9\u30E9\u30C3\u30B0\u3001\u30BF\u30B0\u3092\u691C\u7D22",
|
|
455
|
+
filterAll: "\u3059\u3079\u3066\u306E\u30B9\u30C6\u30FC\u30BF\u30B9",
|
|
456
|
+
filterPublished: "\u516C\u958B\u6E08",
|
|
457
|
+
filterDraft: "\u4E0B\u66F8\u304D",
|
|
458
|
+
filterAllTags: "\u3059\u3079\u3066\u306E\u30BF\u30B0",
|
|
459
|
+
sortLabel: "\u4E26\u3073\u66FF\u3048",
|
|
460
|
+
sortUpdatedDesc: "\u66F4\u65B0\u65E5 \u65B0\u3057\u3044\u9806",
|
|
461
|
+
sortUpdatedAsc: "\u66F4\u65B0\u65E5 \u53E4\u3044\u9806",
|
|
462
|
+
sortPublishedDesc: "\u516C\u958B\u65E5 \u65B0\u3057\u3044\u9806",
|
|
463
|
+
sortPublishedAsc: "\u516C\u958B\u65E5 \u53E4\u3044\u9806",
|
|
464
|
+
sortTitleAsc: "\u30BF\u30A4\u30C8\u30EB A-Z",
|
|
465
|
+
sortTitleDesc: "\u30BF\u30A4\u30C8\u30EB Z-A",
|
|
466
|
+
showMore: "\u3055\u3089\u306B\u8868\u793A",
|
|
467
|
+
resultCount: "{shown} / {total}",
|
|
468
|
+
noMatches: "\u6761\u4EF6\u306B\u4E00\u81F4\u3059\u308B\u8A18\u4E8B\u304C\u3042\u308A\u307E\u305B\u3093\u3002",
|
|
469
|
+
loadError: "\u8A18\u4E8B\u306E\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F"
|
|
436
470
|
},
|
|
437
471
|
form: {
|
|
438
472
|
newTitle: "\u65B0\u898F\u8A18\u4E8B",
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
} from "./chunk-D72XF3Q3.js";
|
|
5
5
|
import {
|
|
6
6
|
clearAllDrafts
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-BAZ6YAPS.js";
|
|
8
8
|
import {
|
|
9
9
|
setAdminCmsConfigClient
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-HN3UFHP7.js";
|
|
11
11
|
import {
|
|
12
12
|
setAdminMediaContext
|
|
13
13
|
} from "./chunk-2ITWLRYF.js";
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
useLocale,
|
|
19
19
|
useT
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-K44QF3MV.js";
|
|
21
21
|
|
|
22
22
|
// src/lib/amplify-client.ts
|
|
23
23
|
import { Amplify } from "aws-amplify";
|
|
@@ -55,6 +55,18 @@ function toCorePost(p) {
|
|
|
55
55
|
updatedAt: p.updatedAt ?? void 0
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
+
function toSummary(p) {
|
|
59
|
+
return {
|
|
60
|
+
postId: p.postId,
|
|
61
|
+
slug: p.slug,
|
|
62
|
+
title: p.title,
|
|
63
|
+
excerpt: p.excerpt ?? void 0,
|
|
64
|
+
status: p.status ?? "draft",
|
|
65
|
+
publishedAt: p.publishedAt ?? void 0,
|
|
66
|
+
updatedAt: p.updatedAt ?? void 0,
|
|
67
|
+
tags: (p.tags ?? []).filter((t) => typeof t === "string")
|
|
68
|
+
};
|
|
69
|
+
}
|
|
58
70
|
function toCoreRevision(r) {
|
|
59
71
|
return {
|
|
60
72
|
postHistoryId: r.postHistoryId,
|
|
@@ -88,6 +100,36 @@ function installAdminPostsProvider() {
|
|
|
88
100
|
});
|
|
89
101
|
return data.map(toCorePost);
|
|
90
102
|
},
|
|
103
|
+
async listSummaries(opts = {}) {
|
|
104
|
+
const status = opts.status ?? "all";
|
|
105
|
+
const filter = status !== "all" ? { status: { eq: status } } : void 0;
|
|
106
|
+
const out = [];
|
|
107
|
+
let nextToken = void 0;
|
|
108
|
+
do {
|
|
109
|
+
const { data, errors, nextToken: nt } = await client.models.Post.list({
|
|
110
|
+
filter,
|
|
111
|
+
limit: 200,
|
|
112
|
+
nextToken,
|
|
113
|
+
selectionSet: [
|
|
114
|
+
"postId",
|
|
115
|
+
"slug",
|
|
116
|
+
"title",
|
|
117
|
+
"excerpt",
|
|
118
|
+
"status",
|
|
119
|
+
"publishedAt",
|
|
120
|
+
"updatedAt",
|
|
121
|
+
"tags"
|
|
122
|
+
]
|
|
123
|
+
});
|
|
124
|
+
if (errors && errors.length > 0) {
|
|
125
|
+
console.error("[ampless admin] Post.list page failed:", errors);
|
|
126
|
+
throw new Error(errors[0]?.message ?? "Post.list failed");
|
|
127
|
+
}
|
|
128
|
+
out.push(...data.map(toSummary));
|
|
129
|
+
nextToken = nt;
|
|
130
|
+
} while (nextToken);
|
|
131
|
+
return out;
|
|
132
|
+
},
|
|
91
133
|
async get(slug) {
|
|
92
134
|
const { data } = await client.models.Post.list({
|
|
93
135
|
filter: { slug: { eq: slug } },
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
ImageUploadDialog,
|
|
4
4
|
createMediaRow,
|
|
5
5
|
getMediaProcessingDefaults
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HN3UFHP7.js";
|
|
7
7
|
import {
|
|
8
8
|
publicMediaUrl
|
|
9
9
|
} from "./chunk-2ITWLRYF.js";
|
|
10
10
|
import {
|
|
11
11
|
useT
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-K44QF3MV.js";
|
|
13
13
|
|
|
14
14
|
// src/components/media-uploader.tsx
|
|
15
15
|
import { useState, useEffect, useCallback, useRef } from "react";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
PostForm
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BAZ6YAPS.js";
|
|
5
5
|
import {
|
|
6
6
|
useT
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-K44QF3MV.js";
|
|
8
8
|
|
|
9
9
|
// src/components/new-post-view.tsx
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
AdminDashboard
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-CFIOUXVE.js";
|
|
5
|
+
import "../chunk-K44QF3MV.js";
|
|
6
|
+
import "../chunk-OFPNBZKP.js";
|
|
7
7
|
export {
|
|
8
8
|
AdminDashboard
|
|
9
9
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
EditPostPage
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-3KDJTNCS.js";
|
|
5
|
+
import "../chunk-BAZ6YAPS.js";
|
|
6
|
+
import "../chunk-HN3UFHP7.js";
|
|
7
7
|
import "../chunk-PCPXAEBG.js";
|
|
8
8
|
import "../chunk-2ITWLRYF.js";
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-K44QF3MV.js";
|
|
10
|
+
import "../chunk-OFPNBZKP.js";
|
|
11
11
|
export {
|
|
12
12
|
EditPostPage
|
|
13
13
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { L as Locale, D as Dictionary } from '../i18n-
|
|
2
|
+
import { L as Locale, D as Dictionary } from '../i18n-DA-aakRX.js';
|
|
3
3
|
import { Config, Post, ThemeManifest, LocalizedString, MediaProcessingDefaults } from 'ampless';
|
|
4
4
|
import { AmplessOutputs, ColorScheme } from '@ampless/runtime';
|
|
5
5
|
import { ProcessOptions } from 'ampless/media';
|
package/dist/components/index.js
CHANGED
|
@@ -4,22 +4,22 @@ import {
|
|
|
4
4
|
Sidebar,
|
|
5
5
|
SiteSettingsForm,
|
|
6
6
|
ThemeSettingsForm
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-RTNDMAFN.js";
|
|
8
8
|
import {
|
|
9
9
|
MediaUploader
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-SQ6LFPXH.js";
|
|
11
11
|
import {
|
|
12
12
|
invalidateSiteSettingsCache
|
|
13
13
|
} from "../chunk-D72XF3Q3.js";
|
|
14
14
|
import {
|
|
15
15
|
MediaPicker,
|
|
16
16
|
PostForm
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-BAZ6YAPS.js";
|
|
18
18
|
import {
|
|
19
19
|
ImageUploadDialog,
|
|
20
20
|
sanitizeName,
|
|
21
21
|
uploadProcessedImage
|
|
22
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-HN3UFHP7.js";
|
|
23
23
|
import "../chunk-PCPXAEBG.js";
|
|
24
24
|
import {
|
|
25
25
|
publicMediaUrl,
|
|
@@ -30,8 +30,8 @@ import {
|
|
|
30
30
|
I18nProvider,
|
|
31
31
|
useLocale,
|
|
32
32
|
useT
|
|
33
|
-
} from "../chunk-
|
|
34
|
-
import "../chunk-
|
|
33
|
+
} from "../chunk-K44QF3MV.js";
|
|
34
|
+
import "../chunk-OFPNBZKP.js";
|
|
35
35
|
export {
|
|
36
36
|
AdminProviders,
|
|
37
37
|
I18nProvider,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
LoginPage
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-GGHN2RKQ.js";
|
|
5
|
+
import "../chunk-K44QF3MV.js";
|
|
6
|
+
import "../chunk-OFPNBZKP.js";
|
|
7
7
|
export {
|
|
8
8
|
LoginPage
|
|
9
9
|
};
|