@ampless/admin 0.2.0-alpha.8 → 1.0.0-alpha.26
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/README.ja.md +73 -0
- package/README.md +3 -0
- package/dist/api/index.d.ts +1 -1
- package/dist/chunk-2ITWLRYF.js +38 -0
- package/dist/chunk-2U3POKAZ.js +198 -0
- package/dist/{chunk-VXEVLHGL.js → chunk-6LQGVDCW.js} +2 -2
- package/dist/chunk-6NPYUTV6.js +250 -0
- package/dist/chunk-6SB7YICQ.js +48 -0
- package/dist/chunk-6W3JIOOR.js +37 -0
- package/dist/chunk-CTGFMK2J.js +335 -0
- package/dist/chunk-G4CF5ZWV.js +1319 -0
- package/dist/chunk-KQOE5CT6.js +21 -0
- package/dist/chunk-MWSCSCCU.js +67 -0
- package/dist/chunk-Q66BLMNJ.js +33 -0
- package/dist/chunk-TZ5F24BG.js +149 -0
- package/dist/chunk-VL6MMF2P.js +21 -0
- package/dist/chunk-VSS5FWSR.js +334 -0
- package/dist/{chunk-KKM2MCM4.js → chunk-WL4IBW2D.js} +121 -43
- package/dist/chunk-YFWHKIVH.js +1187 -0
- package/dist/components/admin-dashboard.d.ts +10 -0
- package/dist/components/admin-dashboard.js +9 -0
- package/dist/components/edit-post-view.d.ts +9 -0
- package/dist/components/edit-post-view.js +12 -0
- package/dist/components/index.d.ts +14 -42
- package/dist/components/index.js +22 -33
- package/dist/components/login-view.d.ts +5 -0
- package/dist/components/login-view.js +9 -0
- package/dist/components/mcp-tokens-view.d.ts +16 -0
- package/dist/components/mcp-tokens-view.js +9 -0
- package/dist/components/media-view.d.ts +5 -0
- package/dist/components/media-view.js +12 -0
- package/dist/components/new-post-view.d.ts +5 -0
- package/dist/components/new-post-view.js +12 -0
- package/dist/components/posts-list-view.d.ts +5 -0
- package/dist/components/posts-list-view.js +9 -0
- package/dist/components/users-list-view.d.ts +7 -0
- package/dist/components/users-list-view.js +9 -0
- package/dist/{i18n-DzXXcIQQ.d.ts → i18n-BhMBRfio.d.ts} +179 -1
- package/dist/index.d.ts +18 -18
- package/dist/index.js +17 -38
- package/dist/lib/theme-actions.d.ts +3 -3
- package/dist/lib/theme-actions.js +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/pages/index.d.ts +35 -16
- package/dist/pages/index.js +90 -257
- package/package.json +19 -8
- package/dist/chunk-QDPB5W35.js +0 -3251
- package/dist/login-view-BKrSZLJu.d.ts +0 -24
package/dist/pages/index.js
CHANGED
|
@@ -1,21 +1,42 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
import {
|
|
3
|
-
|
|
2
|
+
NewPostPage
|
|
3
|
+
} from "../chunk-VL6MMF2P.js";
|
|
4
|
+
import {
|
|
5
|
+
PostsList
|
|
6
|
+
} from "../chunk-MWSCSCCU.js";
|
|
7
|
+
import {
|
|
8
|
+
UsersListView
|
|
9
|
+
} from "../chunk-TZ5F24BG.js";
|
|
10
|
+
import {
|
|
11
|
+
AdminDashboard
|
|
12
|
+
} from "../chunk-6SB7YICQ.js";
|
|
13
|
+
import {
|
|
14
|
+
EditPostPage
|
|
15
|
+
} from "../chunk-6W3JIOOR.js";
|
|
16
|
+
import {
|
|
4
17
|
AdminProviders,
|
|
5
|
-
EditPostPage,
|
|
6
|
-
I18nProvider,
|
|
7
|
-
LoginPage,
|
|
8
|
-
MediaPage,
|
|
9
|
-
NewPostPage,
|
|
10
|
-
PostsList,
|
|
11
18
|
Sidebar,
|
|
12
|
-
SiteSelector,
|
|
13
19
|
SiteSettingsForm,
|
|
14
|
-
ThemeSettingsForm
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import
|
|
20
|
+
ThemeSettingsForm
|
|
21
|
+
} from "../chunk-YFWHKIVH.js";
|
|
22
|
+
import "../chunk-6LQGVDCW.js";
|
|
23
|
+
import "../chunk-G4CF5ZWV.js";
|
|
24
|
+
import {
|
|
25
|
+
LoginPage
|
|
26
|
+
} from "../chunk-2U3POKAZ.js";
|
|
27
|
+
import {
|
|
28
|
+
McpTokensView
|
|
29
|
+
} from "../chunk-VSS5FWSR.js";
|
|
30
|
+
import {
|
|
31
|
+
MediaPage
|
|
32
|
+
} from "../chunk-KQOE5CT6.js";
|
|
33
|
+
import "../chunk-6NPYUTV6.js";
|
|
34
|
+
import "../chunk-CTGFMK2J.js";
|
|
35
|
+
import "../chunk-2ITWLRYF.js";
|
|
36
|
+
import {
|
|
37
|
+
I18nProvider
|
|
38
|
+
} from "../chunk-Q66BLMNJ.js";
|
|
39
|
+
import "../chunk-WL4IBW2D.js";
|
|
19
40
|
|
|
20
41
|
// src/pages/admin-layout.tsx
|
|
21
42
|
import { redirect } from "next/navigation";
|
|
@@ -34,15 +55,11 @@ function createAdminLayout(admin) {
|
|
|
34
55
|
if (!admin.isEditor(session)) {
|
|
35
56
|
redirect("/login");
|
|
36
57
|
}
|
|
37
|
-
const sites = admin.adminSiteOptions();
|
|
38
|
-
const currentSiteId = await admin.currentAdminSiteId();
|
|
39
|
-
const selector = sites.length > 0 ? /* @__PURE__ */ jsx(SiteSelector, { current: currentSiteId, sites }) : null;
|
|
40
58
|
return /* @__PURE__ */ jsx(AdminProviders, { outputs: admin.outputs, cmsConfig: sanitizeCmsConfigForClient(admin.cmsConfig), children: /* @__PURE__ */ jsx(I18nProvider, { locale: admin.locale, dict: admin.dict, children: /* @__PURE__ */ jsxs("div", { className: "flex min-h-screen flex-col md:flex-row", children: [
|
|
41
59
|
/* @__PURE__ */ jsx(
|
|
42
60
|
Sidebar,
|
|
43
61
|
{
|
|
44
62
|
email: session.email,
|
|
45
|
-
siteSelector: selector,
|
|
46
63
|
isAdmin: admin.isAdmin(session)
|
|
47
64
|
}
|
|
48
65
|
),
|
|
@@ -77,68 +94,18 @@ function createMediaPage(_admin) {
|
|
|
77
94
|
return MediaPage;
|
|
78
95
|
}
|
|
79
96
|
|
|
80
|
-
// src/pages/
|
|
97
|
+
// src/pages/site-edit.tsx
|
|
81
98
|
import Link from "next/link";
|
|
82
|
-
import { DEFAULT_SITE_ID, isMultiSite, siteFor } from "ampless";
|
|
83
|
-
import {
|
|
84
|
-
Button,
|
|
85
|
-
Table,
|
|
86
|
-
TableBody,
|
|
87
|
-
TableCell,
|
|
88
|
-
TableHead,
|
|
89
|
-
TableHeader,
|
|
90
|
-
TableRow
|
|
91
|
-
} from "@ampless/runtime/ui";
|
|
92
99
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
93
|
-
function createSitesListPage(admin) {
|
|
94
|
-
const { cmsConfig, t } = admin;
|
|
95
|
-
async function SitesPage() {
|
|
96
|
-
const multi = isMultiSite(cmsConfig);
|
|
97
|
-
const ids = multi ? Object.keys(cmsConfig.sites ?? {}) : [DEFAULT_SITE_ID];
|
|
98
|
-
return /* @__PURE__ */ jsxs2("div", { className: "mx-auto max-w-7xl p-4 md:p-8", children: [
|
|
99
|
-
/* @__PURE__ */ jsx2("div", { className: "mb-6 flex flex-wrap items-center justify-between gap-3 md:mb-8", children: /* @__PURE__ */ jsxs2("div", { children: [
|
|
100
|
-
/* @__PURE__ */ jsx2("h1", { className: "text-2xl font-bold md:text-3xl", children: t("sites.list.title") }),
|
|
101
|
-
/* @__PURE__ */ jsx2("p", { className: "mt-1 text-sm text-muted-foreground", children: t("sites.list.description") })
|
|
102
|
-
] }) }),
|
|
103
|
-
/* @__PURE__ */ jsx2("div", { className: "overflow-x-auto rounded-md border", children: /* @__PURE__ */ jsxs2(Table, { children: [
|
|
104
|
-
/* @__PURE__ */ jsx2(TableHeader, { children: /* @__PURE__ */ jsxs2(TableRow, { children: [
|
|
105
|
-
/* @__PURE__ */ jsx2(TableHead, { children: t("sites.list.columnSiteId") }),
|
|
106
|
-
/* @__PURE__ */ jsx2(TableHead, { children: t("sites.list.columnName") }),
|
|
107
|
-
/* @__PURE__ */ jsx2(TableHead, { children: t("sites.list.columnUrl") }),
|
|
108
|
-
/* @__PURE__ */ jsx2(TableHead, { children: t("sites.list.columnDomains") }),
|
|
109
|
-
/* @__PURE__ */ jsx2(TableHead, {})
|
|
110
|
-
] }) }),
|
|
111
|
-
/* @__PURE__ */ jsx2(TableBody, { children: ids.map((id) => {
|
|
112
|
-
const site = siteFor(id, cmsConfig);
|
|
113
|
-
const domains = cmsConfig.sites?.[id]?.domains ?? [];
|
|
114
|
-
return /* @__PURE__ */ jsxs2(TableRow, { children: [
|
|
115
|
-
/* @__PURE__ */ jsx2(TableCell, { className: "font-mono text-xs", children: id }),
|
|
116
|
-
/* @__PURE__ */ jsx2(TableCell, { className: "font-medium", children: site.name }),
|
|
117
|
-
/* @__PURE__ */ jsx2(TableCell, { className: "text-sm text-muted-foreground", children: site.url }),
|
|
118
|
-
/* @__PURE__ */ jsx2(TableCell, { className: "text-sm text-muted-foreground", children: domains.length > 0 ? domains.join(", ") : "\u2014" }),
|
|
119
|
-
/* @__PURE__ */ jsx2(TableCell, { children: /* @__PURE__ */ jsx2(Button, { asChild: true, variant: "outline", size: "sm", children: /* @__PURE__ */ jsx2(Link, { href: `/admin/sites/${id}`, children: t("sites.list.edit") }) }) })
|
|
120
|
-
] }, id);
|
|
121
|
-
}) })
|
|
122
|
-
] }) })
|
|
123
|
-
] });
|
|
124
|
-
}
|
|
125
|
-
return SitesPage;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// src/pages/site-edit.tsx
|
|
129
|
-
import Link2 from "next/link";
|
|
130
|
-
import { siteFor as siteFor2 } from "ampless";
|
|
131
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
132
100
|
function createSiteEditPage(admin) {
|
|
133
101
|
const { cmsConfig, t, loadSiteSettings } = admin;
|
|
134
102
|
async function EditSitePage({ params }) {
|
|
135
103
|
const { siteId } = await params;
|
|
136
|
-
const settings = await loadSiteSettings(
|
|
137
|
-
const defaults = siteFor2(siteId, cmsConfig);
|
|
104
|
+
const settings = await loadSiteSettings();
|
|
138
105
|
const fallback = {
|
|
139
|
-
"site.name":
|
|
140
|
-
"site.url":
|
|
141
|
-
"site.description":
|
|
106
|
+
"site.name": cmsConfig.site.name,
|
|
107
|
+
"site.url": cmsConfig.site.url,
|
|
108
|
+
"site.description": cmsConfig.site.description,
|
|
142
109
|
"media.imageDisplay": cmsConfig.media?.imageDisplay,
|
|
143
110
|
"media.imageMaxWidth": cmsConfig.media?.imageMaxWidth,
|
|
144
111
|
dateFormat: cmsConfig.dateFormat,
|
|
@@ -153,27 +120,11 @@ function createSiteEditPage(admin) {
|
|
|
153
120
|
dateFormat: settings.dateFormat,
|
|
154
121
|
timezone: settings.timezone
|
|
155
122
|
};
|
|
156
|
-
return /* @__PURE__ */
|
|
157
|
-
/* @__PURE__ */
|
|
158
|
-
/* @__PURE__ */
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
href: "/admin/sites",
|
|
162
|
-
className: "text-sm text-muted-foreground hover:underline",
|
|
163
|
-
children: [
|
|
164
|
-
"\u2190 ",
|
|
165
|
-
t("sidebar.sites")
|
|
166
|
-
]
|
|
167
|
-
}
|
|
168
|
-
),
|
|
169
|
-
/* @__PURE__ */ jsx3("h1", { className: "mt-2 text-2xl font-bold md:text-3xl", children: settings.site.name }),
|
|
170
|
-
/* @__PURE__ */ jsxs3("p", { className: "text-sm text-muted-foreground", children: [
|
|
171
|
-
t("common.siteId"),
|
|
172
|
-
": ",
|
|
173
|
-
/* @__PURE__ */ jsx3("code", { className: "font-mono", children: siteId })
|
|
174
|
-
] }),
|
|
175
|
-
/* @__PURE__ */ jsx3("div", { className: "mt-4", children: /* @__PURE__ */ jsx3(
|
|
176
|
-
Link2,
|
|
123
|
+
return /* @__PURE__ */ jsxs2("div", { className: "mx-auto max-w-7xl p-4 md:p-8", children: [
|
|
124
|
+
/* @__PURE__ */ jsxs2("div", { className: "mb-6 md:mb-8", children: [
|
|
125
|
+
/* @__PURE__ */ jsx2("h1", { className: "mt-2 text-2xl font-bold md:text-3xl", children: settings.site.name }),
|
|
126
|
+
/* @__PURE__ */ jsx2("div", { className: "mt-4", children: /* @__PURE__ */ jsx2(
|
|
127
|
+
Link,
|
|
177
128
|
{
|
|
178
129
|
href: `/admin/sites/${siteId}/theme`,
|
|
179
130
|
className: "text-sm font-medium underline",
|
|
@@ -181,59 +132,58 @@ function createSiteEditPage(admin) {
|
|
|
181
132
|
}
|
|
182
133
|
) })
|
|
183
134
|
] }),
|
|
184
|
-
/* @__PURE__ */
|
|
135
|
+
/* @__PURE__ */ jsx2(SiteSettingsForm, { initial, fallback })
|
|
185
136
|
] });
|
|
186
137
|
}
|
|
187
138
|
return EditSitePage;
|
|
188
139
|
}
|
|
189
140
|
|
|
190
141
|
// src/pages/site-theme.tsx
|
|
191
|
-
import
|
|
192
|
-
import {
|
|
193
|
-
import { jsx as
|
|
142
|
+
import Link2 from "next/link";
|
|
143
|
+
import { resolveLocalized } from "ampless";
|
|
144
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
194
145
|
function createSiteThemePage(admin, themeList) {
|
|
195
146
|
const { cmsConfig, t, locale, loadThemeConfig } = admin;
|
|
196
147
|
async function ThemePage({ params }) {
|
|
197
148
|
const { siteId } = await params;
|
|
198
|
-
const
|
|
199
|
-
const theme = await loadThemeConfig(siteId);
|
|
149
|
+
const theme = await loadThemeConfig();
|
|
200
150
|
const themeOptions = themeList.map((m) => ({
|
|
201
151
|
value: m.name,
|
|
202
152
|
label: m.manifest.label,
|
|
203
153
|
description: m.manifest.description
|
|
204
154
|
}));
|
|
205
|
-
return /* @__PURE__ */
|
|
206
|
-
/* @__PURE__ */
|
|
207
|
-
/* @__PURE__ */
|
|
208
|
-
|
|
155
|
+
return /* @__PURE__ */ jsxs3("div", { className: "mx-auto max-w-7xl p-4 md:p-8", children: [
|
|
156
|
+
/* @__PURE__ */ jsxs3("div", { className: "mb-6 md:mb-8", children: [
|
|
157
|
+
/* @__PURE__ */ jsxs3(
|
|
158
|
+
Link2,
|
|
209
159
|
{
|
|
210
160
|
href: `/admin/sites/${siteId}`,
|
|
211
161
|
className: "text-sm text-muted-foreground hover:underline",
|
|
212
162
|
children: [
|
|
213
163
|
"\u2190 ",
|
|
214
|
-
site.name
|
|
164
|
+
cmsConfig.site.name
|
|
215
165
|
]
|
|
216
166
|
}
|
|
217
167
|
),
|
|
218
|
-
/* @__PURE__ */
|
|
219
|
-
/* @__PURE__ */
|
|
168
|
+
/* @__PURE__ */ jsx3("h1", { className: "mt-2 text-2xl font-bold md:text-3xl", children: t("theme.title") }),
|
|
169
|
+
/* @__PURE__ */ jsxs3("p", { className: "text-sm text-muted-foreground", children: [
|
|
220
170
|
t("common.active"),
|
|
221
171
|
":",
|
|
222
172
|
" ",
|
|
223
|
-
/* @__PURE__ */
|
|
173
|
+
/* @__PURE__ */ jsx3("strong", { children: resolveLocalized(theme.manifest.label, locale) }),
|
|
224
174
|
" (",
|
|
225
175
|
theme.activeTheme,
|
|
226
176
|
")"
|
|
227
177
|
] })
|
|
228
178
|
] }),
|
|
229
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ jsx3(
|
|
230
180
|
ThemeSettingsForm,
|
|
231
181
|
{
|
|
232
|
-
siteId,
|
|
233
182
|
manifest: theme.manifest,
|
|
234
183
|
activeTheme: theme.activeTheme,
|
|
235
184
|
themeOptions,
|
|
236
|
-
initial: theme.values
|
|
185
|
+
initial: theme.values,
|
|
186
|
+
initialColorScheme: theme.colorScheme
|
|
237
187
|
}
|
|
238
188
|
)
|
|
239
189
|
] });
|
|
@@ -243,161 +193,44 @@ function createSiteThemePage(admin, themeList) {
|
|
|
243
193
|
|
|
244
194
|
// src/pages/users-list.tsx
|
|
245
195
|
import { redirect as redirect2 } from "next/navigation";
|
|
246
|
-
|
|
247
|
-
// src/components/users-list-view.tsx
|
|
248
|
-
import { useEffect, useState } from "react";
|
|
249
|
-
import { generateClient } from "aws-amplify/api";
|
|
250
|
-
import {
|
|
251
|
-
Button as Button2,
|
|
252
|
-
Table as Table2,
|
|
253
|
-
TableBody as TableBody2,
|
|
254
|
-
TableCell as TableCell2,
|
|
255
|
-
TableHead as TableHead2,
|
|
256
|
-
TableHeader as TableHeader2,
|
|
257
|
-
TableRow as TableRow2
|
|
258
|
-
} from "@ampless/runtime/ui";
|
|
259
|
-
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
260
|
-
function isAdminRole(value) {
|
|
261
|
-
return value === "admin" || value === "editor" || value === "none";
|
|
262
|
-
}
|
|
263
|
-
function UsersListView({ currentUserId }) {
|
|
264
|
-
const t = useT();
|
|
265
|
-
const [users, setUsers] = useState(null);
|
|
266
|
-
const [loading, setLoading] = useState(true);
|
|
267
|
-
const [loadError, setLoadError] = useState(null);
|
|
268
|
-
const [rows, setRows] = useState({});
|
|
269
|
-
useEffect(() => {
|
|
270
|
-
const client = generateClient();
|
|
271
|
-
client.queries.listAdminUsers().then(({ data, errors }) => {
|
|
272
|
-
if (errors && errors.length > 0) {
|
|
273
|
-
const msg = errors[0]?.message ?? "listAdminUsers failed";
|
|
274
|
-
console.error("[users-list-view] listAdminUsers errors:", errors);
|
|
275
|
-
setLoadError(msg);
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
const list = data ?? [];
|
|
279
|
-
setUsers(list);
|
|
280
|
-
setRows(
|
|
281
|
-
Object.fromEntries(
|
|
282
|
-
list.map((u) => [u.userId, { selected: u.role, saving: false, error: null }])
|
|
283
|
-
)
|
|
284
|
-
);
|
|
285
|
-
}).catch((err) => {
|
|
286
|
-
console.error("[users-list-view] listAdminUsers threw:", err);
|
|
287
|
-
setLoadError(err instanceof Error ? err.message : String(err));
|
|
288
|
-
}).finally(() => setLoading(false));
|
|
289
|
-
}, []);
|
|
290
|
-
function updateRow(userId, patch) {
|
|
291
|
-
setRows((prev) => ({
|
|
292
|
-
...prev,
|
|
293
|
-
[userId]: { ...prev[userId], ...patch }
|
|
294
|
-
}));
|
|
295
|
-
}
|
|
296
|
-
async function save(userId) {
|
|
297
|
-
const row = rows[userId];
|
|
298
|
-
if (!row) return;
|
|
299
|
-
updateRow(userId, { saving: true, error: null });
|
|
300
|
-
try {
|
|
301
|
-
const client = generateClient();
|
|
302
|
-
const { data, errors } = await client.mutations.setAdminUserRole({
|
|
303
|
-
userId,
|
|
304
|
-
role: row.selected
|
|
305
|
-
});
|
|
306
|
-
if (errors && errors.length > 0) {
|
|
307
|
-
const msg = errors[0]?.message ?? "setAdminUserRole failed";
|
|
308
|
-
console.error("[users-list-view] setAdminUserRole errors:", errors);
|
|
309
|
-
updateRow(userId, { saving: false, error: msg });
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
if (data) {
|
|
313
|
-
setUsers(
|
|
314
|
-
(prev) => (prev ?? []).map((u) => u.userId === userId ? data : u)
|
|
315
|
-
);
|
|
316
|
-
updateRow(userId, { saving: false, selected: data.role, error: null });
|
|
317
|
-
} else {
|
|
318
|
-
updateRow(userId, { saving: false });
|
|
319
|
-
}
|
|
320
|
-
} catch (err) {
|
|
321
|
-
console.error("[users-list-view] setAdminUserRole threw:", err);
|
|
322
|
-
updateRow(userId, {
|
|
323
|
-
saving: false,
|
|
324
|
-
error: err instanceof Error ? err.message : String(err)
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
return /* @__PURE__ */ jsxs5("div", { className: "mx-auto max-w-7xl p-4 md:p-8", children: [
|
|
329
|
-
/* @__PURE__ */ jsxs5("div", { className: "mb-6 md:mb-8", children: [
|
|
330
|
-
/* @__PURE__ */ jsx5("h1", { className: "text-2xl font-bold md:text-3xl", children: t("users.list.title") }),
|
|
331
|
-
/* @__PURE__ */ jsx5("p", { className: "mt-1 text-sm text-muted-foreground", children: t("users.list.description") })
|
|
332
|
-
] }),
|
|
333
|
-
loading ? /* @__PURE__ */ jsx5("p", { className: "text-muted-foreground", children: t("users.list.loading") }) : loadError ? /* @__PURE__ */ jsxs5("p", { className: "text-sm text-destructive", children: [
|
|
334
|
-
t("users.list.error"),
|
|
335
|
-
": ",
|
|
336
|
-
loadError
|
|
337
|
-
] }) : !users || users.length === 0 ? /* @__PURE__ */ jsx5("p", { className: "text-muted-foreground", children: t("users.list.empty") }) : /* @__PURE__ */ jsx5("div", { className: "overflow-x-auto rounded-md border", children: /* @__PURE__ */ jsxs5(Table2, { children: [
|
|
338
|
-
/* @__PURE__ */ jsx5(TableHeader2, { children: /* @__PURE__ */ jsxs5(TableRow2, { children: [
|
|
339
|
-
/* @__PURE__ */ jsx5(TableHead2, { children: t("users.list.columnEmail") }),
|
|
340
|
-
/* @__PURE__ */ jsx5(TableHead2, { children: t("users.list.columnRole") }),
|
|
341
|
-
/* @__PURE__ */ jsx5(TableHead2, { className: "w-[1%] whitespace-nowrap", children: t("users.list.columnActions") })
|
|
342
|
-
] }) }),
|
|
343
|
-
/* @__PURE__ */ jsx5(TableBody2, { children: users.map((u) => {
|
|
344
|
-
const row = rows[u.userId];
|
|
345
|
-
if (!row) return null;
|
|
346
|
-
const isSelf = u.userId === currentUserId;
|
|
347
|
-
const dirty = row.selected !== u.role;
|
|
348
|
-
return /* @__PURE__ */ jsxs5(TableRow2, { children: [
|
|
349
|
-
/* @__PURE__ */ jsx5(TableCell2, { className: "font-medium", children: u.email || u.userId }),
|
|
350
|
-
/* @__PURE__ */ jsxs5(TableCell2, { children: [
|
|
351
|
-
/* @__PURE__ */ jsxs5(
|
|
352
|
-
"select",
|
|
353
|
-
{
|
|
354
|
-
className: "rounded-md border bg-background px-2 py-1.5 text-sm disabled:cursor-not-allowed disabled:opacity-60",
|
|
355
|
-
value: row.selected,
|
|
356
|
-
disabled: isSelf || row.saving,
|
|
357
|
-
onChange: (e) => {
|
|
358
|
-
const next = e.target.value;
|
|
359
|
-
if (isAdminRole(next)) {
|
|
360
|
-
updateRow(u.userId, { selected: next });
|
|
361
|
-
}
|
|
362
|
-
},
|
|
363
|
-
children: [
|
|
364
|
-
/* @__PURE__ */ jsx5("option", { value: "admin", children: t("users.list.roleAdmin") }),
|
|
365
|
-
/* @__PURE__ */ jsx5("option", { value: "editor", children: t("users.list.roleEditor") }),
|
|
366
|
-
/* @__PURE__ */ jsx5("option", { value: "none", children: t("users.list.roleNone") })
|
|
367
|
-
]
|
|
368
|
-
}
|
|
369
|
-
),
|
|
370
|
-
isSelf && /* @__PURE__ */ jsx5("p", { className: "mt-1 text-xs text-muted-foreground", children: t("users.list.cannotEditSelf") }),
|
|
371
|
-
row.error && /* @__PURE__ */ jsx5("p", { className: "mt-1 text-xs text-destructive", children: row.error })
|
|
372
|
-
] }),
|
|
373
|
-
/* @__PURE__ */ jsx5(TableCell2, { children: /* @__PURE__ */ jsx5(
|
|
374
|
-
Button2,
|
|
375
|
-
{
|
|
376
|
-
size: "sm",
|
|
377
|
-
disabled: isSelf || row.saving || !dirty,
|
|
378
|
-
onClick: () => save(u.userId),
|
|
379
|
-
children: row.saving ? t("users.list.saving") : t("users.list.save")
|
|
380
|
-
}
|
|
381
|
-
) })
|
|
382
|
-
] }, u.userId);
|
|
383
|
-
}) })
|
|
384
|
-
] }) })
|
|
385
|
-
] });
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
// src/pages/users-list.tsx
|
|
389
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
196
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
390
197
|
function createUsersListPage(admin) {
|
|
391
198
|
async function UsersPage() {
|
|
392
199
|
const session = await admin.getServerSession();
|
|
393
200
|
if (!admin.isAdmin(session)) {
|
|
394
201
|
redirect2("/admin");
|
|
395
202
|
}
|
|
396
|
-
return /* @__PURE__ */
|
|
203
|
+
return /* @__PURE__ */ jsx4(UsersListView, { currentUserId: session.userId });
|
|
397
204
|
}
|
|
398
205
|
return UsersPage;
|
|
399
206
|
}
|
|
400
207
|
|
|
208
|
+
// src/pages/mcp-tokens.tsx
|
|
209
|
+
import { redirect as redirect3 } from "next/navigation";
|
|
210
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
211
|
+
function createMcpTokensPage(admin) {
|
|
212
|
+
async function McpTokensPage() {
|
|
213
|
+
const session = await admin.getServerSession();
|
|
214
|
+
if (!admin.isAdmin(session)) {
|
|
215
|
+
redirect3("/admin");
|
|
216
|
+
}
|
|
217
|
+
const mcpEndpoint = extractMcpEndpoint(admin.outputs);
|
|
218
|
+
return /* @__PURE__ */ jsx5(
|
|
219
|
+
McpTokensView,
|
|
220
|
+
{
|
|
221
|
+
currentUserId: session.userId,
|
|
222
|
+
currentUserEmail: session.email,
|
|
223
|
+
mcpEndpoint
|
|
224
|
+
}
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
return McpTokensPage;
|
|
228
|
+
}
|
|
229
|
+
function extractMcpEndpoint(outputs) {
|
|
230
|
+
const custom = outputs.custom;
|
|
231
|
+
return custom?.mcp?.endpoint ?? null;
|
|
232
|
+
}
|
|
233
|
+
|
|
401
234
|
// src/pages/login.tsx
|
|
402
235
|
function createLoginPage(_admin) {
|
|
403
236
|
return LoginPage;
|
|
@@ -407,11 +240,11 @@ export {
|
|
|
407
240
|
createAdminLayout,
|
|
408
241
|
createEditPostPage,
|
|
409
242
|
createLoginPage,
|
|
243
|
+
createMcpTokensPage,
|
|
410
244
|
createMediaPage,
|
|
411
245
|
createNewPostPage,
|
|
412
246
|
createPostsListPage,
|
|
413
247
|
createSiteEditPage,
|
|
414
248
|
createSiteThemePage,
|
|
415
|
-
createSitesListPage,
|
|
416
249
|
createUsersListPage
|
|
417
250
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ampless/admin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha.26",
|
|
4
4
|
"description": "Admin UI for ampless: post editor, media manager, site/theme settings",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -40,19 +40,30 @@
|
|
|
40
40
|
"@radix-ui/react-dialog": "^1.1.4",
|
|
41
41
|
"@radix-ui/react-label": "^2.1.1",
|
|
42
42
|
"@radix-ui/react-slot": "^1.1.1",
|
|
43
|
-
"@tiptap/extension-
|
|
44
|
-
"@tiptap/extension-
|
|
45
|
-
"@tiptap/
|
|
46
|
-
"@tiptap/
|
|
47
|
-
"@tiptap/
|
|
43
|
+
"@tiptap/extension-highlight": "^3.23.6",
|
|
44
|
+
"@tiptap/extension-image": "^3.23.6",
|
|
45
|
+
"@tiptap/extension-link": "^3.23.6",
|
|
46
|
+
"@tiptap/extension-table": "^3.23.6",
|
|
47
|
+
"@tiptap/extension-table-cell": "^3.23.6",
|
|
48
|
+
"@tiptap/extension-table-header": "^3.23.6",
|
|
49
|
+
"@tiptap/extension-table-row": "^3.23.6",
|
|
50
|
+
"@tiptap/extension-task-item": "^3.23.6",
|
|
51
|
+
"@tiptap/extension-task-list": "^3.23.6",
|
|
52
|
+
"@tiptap/extension-text-align": "^3.23.6",
|
|
53
|
+
"@tiptap/extension-underline": "^3.23.6",
|
|
54
|
+
"@tiptap/pm": "^3.23.6",
|
|
55
|
+
"@tiptap/react": "^3.23.6",
|
|
56
|
+
"@tiptap/starter-kit": "^3.23.6",
|
|
57
|
+
"amazon-cognito-identity-js": "^6.3.12",
|
|
48
58
|
"class-variance-authority": "^0.7.1",
|
|
49
59
|
"clsx": "^2.1.1",
|
|
50
60
|
"jszip": "^3.10.1",
|
|
51
61
|
"lucide-react": "^1.16.0",
|
|
52
62
|
"react-image-crop": "^11.0.7",
|
|
53
63
|
"tailwind-merge": "^3.6.0",
|
|
54
|
-
"@ampless/
|
|
55
|
-
"ampless": "0.
|
|
64
|
+
"@ampless/mcp-server": "1.0.0-alpha.10",
|
|
65
|
+
"@ampless/runtime": "1.0.0-alpha.13",
|
|
66
|
+
"ampless": "1.0.0-alpha.9"
|
|
56
67
|
},
|
|
57
68
|
"peerDependencies": {
|
|
58
69
|
"@aws-amplify/adapter-nextjs": "^1",
|