@basicbenframework/cms 0.6.1 → 0.7.1
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/lib/client/i18n/locales/es/content.js +0 -1
- package/lib/client/i18n/locales/es/people.js +1 -0
- package/lib/client/i18n/locales/es/site.js +7 -2
- package/lib/client/layouts/AdminLayout.d.ts +5 -1
- package/lib/client/layouts/AdminLayout.js +204 -110
- package/lib/client/pages/admin/Comments.js +2 -2
- package/lib/client/pages/admin/ContentTypes.js +1 -1
- package/lib/client/pages/admin/Dashboard.js +10 -2
- package/lib/client/pages/admin/Pages.js +1 -1
- package/lib/client/pages/admin/Posts.js +1 -1
- package/lib/client/pages/admin/Taxonomies.js +5 -5
- package/lib/client/pages/admin/Users.js +1 -1
- package/package.json +1 -1
|
@@ -66,7 +66,6 @@ const strings = {
|
|
|
66
66
|
// Pages
|
|
67
67
|
'Are you sure you want to delete this page?': '¿Seguro que quieres eliminar esta página?',
|
|
68
68
|
'Failed to delete page': 'No se pudo eliminar la página',
|
|
69
|
-
'All Pages': 'Todas las páginas',
|
|
70
69
|
'+ New Page': '+ Nueva página',
|
|
71
70
|
'No pages yet. Create your first page!': 'Aún no hay páginas. ¡Crea tu primera página!',
|
|
72
71
|
'Template': 'Plantilla',
|
|
@@ -73,6 +73,7 @@ const strings = {
|
|
|
73
73
|
'Enable': 'Activar',
|
|
74
74
|
'Disable': 'Desactivar',
|
|
75
75
|
'users': 'usuarios',
|
|
76
|
+
'{count} account|{count} accounts': { one: '{count} cuenta', other: '{count} cuentas' },
|
|
76
77
|
'Invite someone': 'Invitar a alguien',
|
|
77
78
|
'Name (optional)': 'Nombre (opcional)',
|
|
78
79
|
'Filled in on their sign-up form; they can change it': 'Se rellena en su formulario de registro; puede cambiarlo',
|
|
@@ -7,10 +7,15 @@ const strings = {
|
|
|
7
7
|
'New Post': 'Nueva entrada',
|
|
8
8
|
'New Page': 'Nueva página',
|
|
9
9
|
'Upload Media': 'Subir medios',
|
|
10
|
-
'Extend': 'Ampliar',
|
|
11
|
-
'Help': 'Ayuda',
|
|
12
10
|
'Documentation': 'Documentación',
|
|
13
11
|
'View Site': 'Ver sitio',
|
|
12
|
+
'How the site is doing, and what changed recently.': 'Cómo va el sitio y qué ha cambiado últimamente.',
|
|
13
|
+
'View all': 'Ver todo',
|
|
14
|
+
'Shortcuts': 'Atajos',
|
|
15
|
+
'A page outside the post stream': 'Una página fuera del listado de entradas',
|
|
16
|
+
'Images and files for posts and pages': 'Imágenes y archivos para entradas y páginas',
|
|
17
|
+
'Site name, reading and comments': 'Nombre del sitio, lectura y comentarios',
|
|
18
|
+
'Open the public site': 'Abrir el sitio público',
|
|
14
19
|
// Settings
|
|
15
20
|
'Settings saved successfully!': '¡Ajustes guardados correctamente!',
|
|
16
21
|
'Failed to save settings: {error}': 'No se pudieron guardar los ajustes: {error}',
|
|
@@ -2,6 +2,10 @@ import React from 'react';
|
|
|
2
2
|
interface AdminLayoutProps {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
title?: string;
|
|
5
|
+
/** A line under the title saying what the page is for. */
|
|
6
|
+
description?: string;
|
|
7
|
+
/** Buttons beside the title: the page's main action. */
|
|
8
|
+
actions?: React.ReactNode;
|
|
5
9
|
}
|
|
6
|
-
export default function AdminLayout({ children, title }: AdminLayoutProps): React.JSX.Element;
|
|
10
|
+
export default function AdminLayout({ children, title, description, actions }: AdminLayoutProps): React.JSX.Element;
|
|
7
11
|
export {};
|
|
@@ -85,7 +85,7 @@ function storedAppearance() {
|
|
|
85
85
|
const value = localStorage.getItem(THEME_KEY);
|
|
86
86
|
return value === 'light' || value === 'dark' ? value : 'system';
|
|
87
87
|
}
|
|
88
|
-
export default function AdminLayout({ children, title }) {
|
|
88
|
+
export default function AdminLayout({ children, title, description, actions }) {
|
|
89
89
|
const { user, logout } = useAuth();
|
|
90
90
|
const navigate = useNavigate();
|
|
91
91
|
const currentPath = usePath();
|
|
@@ -129,7 +129,7 @@ export default function AdminLayout({ children, title }) {
|
|
|
129
129
|
}, []);
|
|
130
130
|
// 'system' sets no attribute, which is what lets the media query decide.
|
|
131
131
|
const themeAttr = appearance === 'system' ? undefined : appearance;
|
|
132
|
-
return (_jsxs("div", { className: "admin-layout", "data-theme": themeAttr, children: [_jsx("style", { children: adminStyles }), _jsxs("aside", { className: `admin-sidebar ${sidebarOpen ? 'open' : 'closed'}`, children: [_jsx("div", { className: "admin-sidebar-header", children: _jsxs(Link, { href: "/", className: "admin-logo", title: "BasicBen", children: [_jsx("span", { className: "admin-logo-mark", children: "B" }), sidebarOpen && _jsx("span", { className: "admin-logo-text", children: "BasicBen" })] }) }), _jsx("nav", { className: "admin-nav", children: bySection(menuItems.filter(item => !item.capability || can(user, item.capability))).map(group => (_jsxs("div", { className: "admin-nav-group", children: [group.title && (_jsx("div", { className: "admin-nav-section", children: _jsx("span", { className: "admin-nav-section-label", children: t(group.title) }) })), group.items.map(item => (_jsxs(Link, { href: item.path, className: `admin-nav-item ${currentPath === item.path ? 'active' : ''}`, title: sidebarOpen ? undefined : t(item.label), children: [_jsx(AdminIcon, { path: item.path, fallback: item.icon, iconPath: iconPaths.get(item.path) }), sidebarOpen && _jsx("span", { className: "admin-nav-label", children: t(item.label) })] }, item.path)))] }, group.title ?? 'top'))) }), _jsxs("div", { className: "admin-sidebar-footer", children: [!__DISABLE_PUBLIC_SITE__ && (_jsxs(Link, { href: "/", className: "admin-nav-item", title: sidebarOpen ? undefined : t('View site'), children: [_jsx(AdminIcon, { name: "site" }), sidebarOpen && _jsx("span", { className: "admin-nav-label", children: t('View site') })] })), _jsxs("button", { className: "admin-nav-item admin-collapse", onClick: () => setSidebarOpen(!sidebarOpen), title: sidebarOpen ? t('Collapse sidebar') : t('Expand sidebar'), "aria-label": sidebarOpen ? t('Collapse sidebar') : t('Expand sidebar'), children: [_jsx("svg", { className: "admin-nav-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", style: { transform: sidebarOpen ? 'none' : 'rotate(180deg)' }, children: _jsx("path", { d: "M15 6l-6 6 6 6" }) }), sidebarOpen && _jsx("span", { className: "admin-nav-label", children: t('Collapse') })] })] })] }), _jsxs("div", { className: `admin-main ${sidebarOpen ? '' : 'expanded'}`, children: [
|
|
132
|
+
return (_jsxs("div", { className: "admin-layout", "data-theme": themeAttr, children: [_jsx("style", { children: adminStyles }), _jsxs("aside", { className: `admin-sidebar ${sidebarOpen ? 'open' : 'closed'}`, children: [_jsx("div", { className: "admin-sidebar-header", children: _jsxs(Link, { href: "/", className: "admin-logo", title: "BasicBen", children: [_jsx("span", { className: "admin-logo-mark", children: "B" }), sidebarOpen && _jsx("span", { className: "admin-logo-text", children: "BasicBen" })] }) }), _jsx("nav", { className: "admin-nav", children: bySection(menuItems.filter(item => !item.capability || can(user, item.capability))).map(group => (_jsxs("div", { className: "admin-nav-group", children: [group.title && (_jsx("div", { className: "admin-nav-section", children: _jsx("span", { className: "admin-nav-section-label", children: t(group.title) }) })), group.items.map(item => (_jsxs(Link, { href: item.path, className: `admin-nav-item ${currentPath === item.path ? 'active' : ''}`, title: sidebarOpen ? undefined : t(item.label), children: [_jsx(AdminIcon, { path: item.path, fallback: item.icon, iconPath: iconPaths.get(item.path) }), sidebarOpen && _jsx("span", { className: "admin-nav-label", children: t(item.label) })] }, item.path)))] }, group.title ?? 'top'))) }), _jsxs("div", { className: "admin-sidebar-footer", children: [!__DISABLE_PUBLIC_SITE__ && (_jsxs(Link, { href: "/", className: "admin-nav-item", title: sidebarOpen ? undefined : t('View site'), children: [_jsx(AdminIcon, { name: "site" }), sidebarOpen && _jsx("span", { className: "admin-nav-label", children: t('View site') })] })), _jsxs("button", { className: "admin-nav-item admin-collapse", onClick: () => setSidebarOpen(!sidebarOpen), title: sidebarOpen ? t('Collapse sidebar') : t('Expand sidebar'), "aria-label": sidebarOpen ? t('Collapse sidebar') : t('Expand sidebar'), children: [_jsx("svg", { className: "admin-nav-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", style: { transform: sidebarOpen ? 'none' : 'rotate(180deg)' }, children: _jsx("path", { d: "M15 6l-6 6 6 6" }) }), sidebarOpen && _jsx("span", { className: "admin-nav-label", children: t('Collapse') })] })] })] }), _jsxs("div", { className: `admin-main ${sidebarOpen ? '' : 'expanded'}`, children: [_jsx("header", { className: "admin-header", children: _jsxs("div", { className: "admin-header-right", children: [_jsx("div", { className: "admin-appearance", role: "group", "aria-label": t('Appearance'), children: ['system', 'light', 'dark'].map(option => (_jsx("button", { type: "button", className: `admin-appearance-option ${appearance === option ? 'active' : ''}`, onClick: () => setAppearance(option), title: option === 'system' ? t('System theme') : option === 'light' ? t('Light theme') : t('Dark theme'), "aria-pressed": appearance === option, children: option === 'system' ? '◐' : option === 'light' ? '☀' : '☾' }, option))) }), _jsx("span", { className: "admin-user", children: user?.name || t('Admin') }), _jsx("button", { className: "admin-btn admin-btn-secondary", onClick: handleLogout, children: t('Log out') })] }) }), _jsxs("main", { className: "admin-content", children: [title && (_jsxs("div", { className: "admin-page-head", children: [_jsxs("div", { children: [_jsx("h1", { className: "admin-page-title", children: title }), description && _jsx("p", { className: "admin-page-description", children: description })] }), actions && _jsx("div", { className: "admin-page-actions", children: actions })] })), children] })] })] }));
|
|
133
133
|
}
|
|
134
134
|
/*
|
|
135
135
|
One token set, themed three ways.
|
|
@@ -141,30 +141,35 @@ export default function AdminLayout({ children, title }) {
|
|
|
141
141
|
*/
|
|
142
142
|
const adminStyles = `
|
|
143
143
|
.admin-layout {
|
|
144
|
-
--bg: #
|
|
144
|
+
--bg: #f7f6f2;
|
|
145
|
+
--sidebar: #efeee9;
|
|
145
146
|
--surface: #ffffff;
|
|
146
|
-
--surface-hover: #
|
|
147
|
-
--surface-active: #
|
|
148
|
-
--border: #
|
|
149
|
-
--border-strong: #
|
|
150
|
-
--
|
|
151
|
-
--fg
|
|
152
|
-
--fg-
|
|
153
|
-
--
|
|
147
|
+
--surface-hover: #ecebe5;
|
|
148
|
+
--surface-active: #e3e2db;
|
|
149
|
+
--border: #e4e2da;
|
|
150
|
+
--border-strong: #cfccc2;
|
|
151
|
+
--card-border: #e9e7e0;
|
|
152
|
+
--fg: #1d1c1a;
|
|
153
|
+
--fg-muted: #6b6961;
|
|
154
|
+
--fg-subtle: #9a978d;
|
|
155
|
+
--accent: #1d1c1a;
|
|
154
156
|
--accent-fg: #ffffff;
|
|
155
|
-
--
|
|
156
|
-
--
|
|
157
|
+
--link: #2b6fd6;
|
|
158
|
+
--focus: #2b6fd6;
|
|
159
|
+
--danger: #d4483f;
|
|
157
160
|
--danger-fg: #ffffff;
|
|
158
|
-
--success: #
|
|
159
|
-
--warning: #
|
|
160
|
-
--info: #
|
|
161
|
-
--tint-success: #
|
|
162
|
-
--tint-warning: #
|
|
163
|
-
--tint-info: #
|
|
164
|
-
--tint-danger: #
|
|
161
|
+
--success: #1f7a44;
|
|
162
|
+
--warning: #946200;
|
|
163
|
+
--info: #2b6fd6;
|
|
164
|
+
--tint-success: #e5f2e8;
|
|
165
|
+
--tint-warning: #fbf2dc;
|
|
166
|
+
--tint-info: #e6eefb;
|
|
167
|
+
--tint-danger: #fbe8e6;
|
|
165
168
|
--radius: 8px;
|
|
166
|
-
--radius-lg:
|
|
167
|
-
--
|
|
169
|
+
--radius-lg: 16px;
|
|
170
|
+
--font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Charter,
|
|
171
|
+
"Bitstream Charter", Georgia, serif;
|
|
172
|
+
--sidebar-w: 248px;
|
|
168
173
|
--sidebar-w-closed: 60px;
|
|
169
174
|
|
|
170
175
|
display: flex;
|
|
@@ -180,52 +185,58 @@ const adminStyles = `
|
|
|
180
185
|
|
|
181
186
|
@media (prefers-color-scheme: dark) {
|
|
182
187
|
.admin-layout:not([data-theme="light"]) {
|
|
183
|
-
--bg: #
|
|
184
|
-
--
|
|
185
|
-
--surface
|
|
186
|
-
--surface-
|
|
187
|
-
--
|
|
188
|
-
--border
|
|
189
|
-
--
|
|
190
|
-
--
|
|
191
|
-
--fg
|
|
192
|
-
--
|
|
193
|
-
--
|
|
194
|
-
--
|
|
195
|
-
--
|
|
196
|
-
--
|
|
197
|
-
--
|
|
198
|
-
--
|
|
199
|
-
--
|
|
200
|
-
--
|
|
201
|
-
--
|
|
202
|
-
--
|
|
203
|
-
--tint-
|
|
188
|
+
--bg: #1c1c1b;
|
|
189
|
+
--sidebar: #191918;
|
|
190
|
+
--surface: #252524;
|
|
191
|
+
--surface-hover: #2c2c2a;
|
|
192
|
+
--surface-active: #343432;
|
|
193
|
+
--border: #30302e;
|
|
194
|
+
--border-strong: #42423f;
|
|
195
|
+
--card-border: transparent;
|
|
196
|
+
--fg: #ecebe6;
|
|
197
|
+
--fg-muted: #a5a39b;
|
|
198
|
+
--fg-subtle: #75736c;
|
|
199
|
+
--accent: #f4f3ee;
|
|
200
|
+
--accent-fg: #1c1c1b;
|
|
201
|
+
--link: #6aa5ff;
|
|
202
|
+
--focus: #4b8ef5;
|
|
203
|
+
--danger: #f0645c;
|
|
204
|
+
--danger-fg: #1c1c1b;
|
|
205
|
+
--success: #5fcf86;
|
|
206
|
+
--warning: #f0b44c;
|
|
207
|
+
--info: #6aa5ff;
|
|
208
|
+
--tint-success: #1e3326;
|
|
209
|
+
--tint-warning: #3a2f1a;
|
|
210
|
+
--tint-info: #1c2c45;
|
|
211
|
+
--tint-danger: #3d2120;
|
|
204
212
|
}
|
|
205
213
|
}
|
|
206
214
|
|
|
207
215
|
.admin-layout[data-theme="dark"] {
|
|
208
|
-
--bg: #
|
|
209
|
-
--
|
|
210
|
-
--surface
|
|
211
|
-
--surface-
|
|
212
|
-
--
|
|
213
|
-
--border
|
|
214
|
-
--
|
|
215
|
-
--
|
|
216
|
-
--fg
|
|
217
|
-
--
|
|
218
|
-
--
|
|
219
|
-
--
|
|
220
|
-
--
|
|
221
|
-
--
|
|
222
|
-
--
|
|
223
|
-
--
|
|
224
|
-
--
|
|
225
|
-
--
|
|
226
|
-
--
|
|
227
|
-
--
|
|
228
|
-
--tint-
|
|
216
|
+
--bg: #1c1c1b;
|
|
217
|
+
--sidebar: #191918;
|
|
218
|
+
--surface: #252524;
|
|
219
|
+
--surface-hover: #2c2c2a;
|
|
220
|
+
--surface-active: #343432;
|
|
221
|
+
--border: #30302e;
|
|
222
|
+
--border-strong: #42423f;
|
|
223
|
+
--card-border: transparent;
|
|
224
|
+
--fg: #ecebe6;
|
|
225
|
+
--fg-muted: #a5a39b;
|
|
226
|
+
--fg-subtle: #75736c;
|
|
227
|
+
--accent: #f4f3ee;
|
|
228
|
+
--accent-fg: #1c1c1b;
|
|
229
|
+
--link: #6aa5ff;
|
|
230
|
+
--focus: #4b8ef5;
|
|
231
|
+
--danger: #f0645c;
|
|
232
|
+
--danger-fg: #1c1c1b;
|
|
233
|
+
--success: #5fcf86;
|
|
234
|
+
--warning: #f0b44c;
|
|
235
|
+
--info: #6aa5ff;
|
|
236
|
+
--tint-success: #1e3326;
|
|
237
|
+
--tint-warning: #3a2f1a;
|
|
238
|
+
--tint-info: #1c2c45;
|
|
239
|
+
--tint-danger: #3d2120;
|
|
229
240
|
}
|
|
230
241
|
|
|
231
242
|
.admin-layout *,
|
|
@@ -236,7 +247,7 @@ const adminStyles = `
|
|
|
236
247
|
|
|
237
248
|
.admin-sidebar {
|
|
238
249
|
width: var(--sidebar-w);
|
|
239
|
-
background: var(--
|
|
250
|
+
background: var(--sidebar);
|
|
240
251
|
border-right: 1px solid var(--border);
|
|
241
252
|
display: flex;
|
|
242
253
|
flex-direction: column;
|
|
@@ -253,9 +264,8 @@ const adminStyles = `
|
|
|
253
264
|
.admin-sidebar-header {
|
|
254
265
|
display: flex;
|
|
255
266
|
align-items: center;
|
|
256
|
-
height:
|
|
257
|
-
padding: 0
|
|
258
|
-
border-bottom: 1px solid var(--border);
|
|
267
|
+
height: 64px;
|
|
268
|
+
padding: 0 14px;
|
|
259
269
|
}
|
|
260
270
|
|
|
261
271
|
.admin-logo {
|
|
@@ -278,7 +288,7 @@ const adminStyles = `
|
|
|
278
288
|
width: 24px;
|
|
279
289
|
height: 24px;
|
|
280
290
|
flex-shrink: 0;
|
|
281
|
-
border-radius:
|
|
291
|
+
border-radius: 7px;
|
|
282
292
|
background: var(--accent);
|
|
283
293
|
color: var(--accent-fg);
|
|
284
294
|
font-size: 13px;
|
|
@@ -287,11 +297,13 @@ const adminStyles = `
|
|
|
287
297
|
|
|
288
298
|
.admin-nav {
|
|
289
299
|
flex: 1;
|
|
290
|
-
padding:
|
|
300
|
+
padding: 4px 12px 12px;
|
|
291
301
|
overflow-y: auto;
|
|
292
302
|
display: flex;
|
|
293
303
|
flex-direction: column;
|
|
294
304
|
gap: 1px;
|
|
305
|
+
scrollbar-width: thin;
|
|
306
|
+
scrollbar-color: var(--border-strong) transparent;
|
|
295
307
|
}
|
|
296
308
|
|
|
297
309
|
.admin-nav-group {
|
|
@@ -327,11 +339,11 @@ const adminStyles = `
|
|
|
327
339
|
display: flex;
|
|
328
340
|
align-items: center;
|
|
329
341
|
gap: 10px;
|
|
330
|
-
padding:
|
|
331
|
-
border-radius:
|
|
342
|
+
padding: 8px 10px;
|
|
343
|
+
border-radius: 10px;
|
|
332
344
|
color: var(--fg-muted);
|
|
333
345
|
text-decoration: none;
|
|
334
|
-
font-size:
|
|
346
|
+
font-size: 14px;
|
|
335
347
|
font-weight: 450;
|
|
336
348
|
white-space: nowrap;
|
|
337
349
|
border: none;
|
|
@@ -360,7 +372,7 @@ const adminStyles = `
|
|
|
360
372
|
}
|
|
361
373
|
|
|
362
374
|
.admin-sidebar-footer {
|
|
363
|
-
padding:
|
|
375
|
+
padding: 10px 12px;
|
|
364
376
|
border-top: 1px solid var(--border);
|
|
365
377
|
display: flex;
|
|
366
378
|
flex-direction: column;
|
|
@@ -384,22 +396,41 @@ const adminStyles = `
|
|
|
384
396
|
justify-content: space-between;
|
|
385
397
|
gap: 16px;
|
|
386
398
|
height: 56px;
|
|
387
|
-
padding: 0
|
|
388
|
-
background: color-mix(in srgb, var(--
|
|
399
|
+
padding: 0 40px;
|
|
400
|
+
background: color-mix(in srgb, var(--bg) 85%, transparent);
|
|
389
401
|
backdrop-filter: blur(8px);
|
|
390
|
-
border-bottom: 1px solid var(--border);
|
|
391
402
|
position: sticky;
|
|
392
403
|
top: 0;
|
|
393
404
|
z-index: 50;
|
|
394
405
|
}
|
|
395
406
|
|
|
407
|
+
/* The page's name, in the content rather than the bar: a serif at display
|
|
408
|
+
size, with an optional line under it and the page's main action beside. */
|
|
409
|
+
.admin-page-head {
|
|
410
|
+
display: flex;
|
|
411
|
+
align-items: flex-start;
|
|
412
|
+
justify-content: space-between;
|
|
413
|
+
gap: 16px;
|
|
414
|
+
margin: 4px 0 28px;
|
|
415
|
+
}
|
|
416
|
+
|
|
396
417
|
.admin-page-title {
|
|
397
|
-
font-
|
|
398
|
-
font-
|
|
418
|
+
font-family: var(--font-display);
|
|
419
|
+
font-size: 30px;
|
|
420
|
+
font-weight: 500;
|
|
421
|
+
line-height: 1.2;
|
|
399
422
|
letter-spacing: -0.01em;
|
|
400
423
|
margin: 0;
|
|
401
424
|
}
|
|
402
425
|
|
|
426
|
+
.admin-page-description {
|
|
427
|
+
margin: 6px 0 0;
|
|
428
|
+
color: var(--fg-muted);
|
|
429
|
+
font-size: 15px;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
.admin-page-actions { display: flex; gap: 8px; flex-shrink: 0; }
|
|
433
|
+
|
|
403
434
|
.admin-header-right {
|
|
404
435
|
display: flex;
|
|
405
436
|
align-items: center;
|
|
@@ -434,16 +465,18 @@ const adminStyles = `
|
|
|
434
465
|
.admin-appearance-option:hover { color: var(--fg); background: var(--surface-hover); }
|
|
435
466
|
.admin-appearance-option.active { color: var(--fg); background: var(--surface-active); }
|
|
436
467
|
|
|
437
|
-
.admin-content { padding:
|
|
468
|
+
.admin-content { padding: 8px 40px 48px; max-width: 1320px; }
|
|
438
469
|
|
|
439
470
|
/* --- Cards ------------------------------------------------------------- */
|
|
440
471
|
|
|
472
|
+
/* Filled rather than outlined: on the dark palette the border is
|
|
473
|
+
transparent and the step in surface colour is the edge. */
|
|
441
474
|
.admin-card {
|
|
442
475
|
background: var(--surface);
|
|
443
|
-
border: 1px solid var(--border);
|
|
476
|
+
border: 1px solid var(--card-border);
|
|
444
477
|
border-radius: var(--radius-lg);
|
|
445
|
-
padding:
|
|
446
|
-
margin-bottom:
|
|
478
|
+
padding: 22px 24px;
|
|
479
|
+
margin-bottom: 24px;
|
|
447
480
|
}
|
|
448
481
|
|
|
449
482
|
.admin-card-header {
|
|
@@ -455,8 +488,8 @@ const adminStyles = `
|
|
|
455
488
|
}
|
|
456
489
|
|
|
457
490
|
.admin-card-title {
|
|
458
|
-
font-size:
|
|
459
|
-
font-weight:
|
|
491
|
+
font-size: 16px;
|
|
492
|
+
font-weight: 500;
|
|
460
493
|
letter-spacing: -0.01em;
|
|
461
494
|
margin: 0;
|
|
462
495
|
}
|
|
@@ -468,28 +501,86 @@ const adminStyles = `
|
|
|
468
501
|
|
|
469
502
|
.admin-stat-card {
|
|
470
503
|
background: var(--surface);
|
|
471
|
-
border: 1px solid var(--border);
|
|
504
|
+
border: 1px solid var(--card-border);
|
|
472
505
|
border-radius: var(--radius-lg);
|
|
473
|
-
padding:
|
|
506
|
+
padding: 20px 24px 22px;
|
|
474
507
|
}
|
|
475
508
|
|
|
476
|
-
/* The
|
|
477
|
-
padding the card rather than separating the two — the number and its name
|
|
478
|
-
were tight against each other and the card was bottom-heavy. */
|
|
509
|
+
/* The name above the number, then an optional line under it. */
|
|
479
510
|
.admin-stat-label {
|
|
480
|
-
color: var(--fg
|
|
481
|
-
font-size:
|
|
482
|
-
margin: 0;
|
|
511
|
+
color: var(--fg);
|
|
512
|
+
font-size: 15px;
|
|
513
|
+
margin: 0 0 14px;
|
|
483
514
|
}
|
|
484
515
|
|
|
485
516
|
.admin-stat-value {
|
|
486
|
-
font-size:
|
|
487
|
-
font-weight:
|
|
517
|
+
font-size: 30px;
|
|
518
|
+
font-weight: 500;
|
|
488
519
|
letter-spacing: -0.02em;
|
|
489
|
-
|
|
520
|
+
line-height: 1.1;
|
|
521
|
+
margin: 0;
|
|
490
522
|
font-variant-numeric: tabular-nums;
|
|
491
523
|
}
|
|
492
524
|
|
|
525
|
+
.admin-stat-note {
|
|
526
|
+
color: var(--fg-muted);
|
|
527
|
+
font-size: 13.5px;
|
|
528
|
+
margin: 6px 0 0;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
/* A heading between groups of cards, like "Spend breakdown". */
|
|
532
|
+
.admin-section-title {
|
|
533
|
+
font-size: 17px;
|
|
534
|
+
font-weight: 500;
|
|
535
|
+
margin: 8px 0 14px;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/* A link that is the way into more, in a card's header. Coloured, unlike
|
|
539
|
+
links in tables, because it is the one action the card offers. */
|
|
540
|
+
.admin-link {
|
|
541
|
+
color: var(--link);
|
|
542
|
+
font-size: 14px;
|
|
543
|
+
text-decoration: underline;
|
|
544
|
+
text-underline-offset: 3px;
|
|
545
|
+
text-decoration-thickness: 1px;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/* Rows of a short list inside a card: a title, a line under it, and
|
|
549
|
+
something on the right. */
|
|
550
|
+
.admin-list { list-style: none; margin: 0 -24px -22px; padding: 0; }
|
|
551
|
+
.admin-list-row {
|
|
552
|
+
display: flex;
|
|
553
|
+
align-items: center;
|
|
554
|
+
gap: 16px;
|
|
555
|
+
padding: 14px 24px;
|
|
556
|
+
border-top: 1px solid var(--border);
|
|
557
|
+
}
|
|
558
|
+
.admin-list-main { flex: 1; min-width: 0; }
|
|
559
|
+
.admin-list-title {
|
|
560
|
+
display: block;
|
|
561
|
+
color: var(--fg);
|
|
562
|
+
font-size: 15px;
|
|
563
|
+
overflow: hidden;
|
|
564
|
+
text-overflow: ellipsis;
|
|
565
|
+
white-space: nowrap;
|
|
566
|
+
}
|
|
567
|
+
.admin-list-sub { display: block; color: var(--fg-muted); font-size: 13.5px; }
|
|
568
|
+
.admin-list-end { display: flex; align-items: center; gap: 12px; flex-shrink: 0; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
|
|
569
|
+
|
|
570
|
+
/* A bar for a share of something: a stat against its limit. */
|
|
571
|
+
.admin-meter {
|
|
572
|
+
height: 8px;
|
|
573
|
+
border-radius: 999px;
|
|
574
|
+
background: var(--surface-active);
|
|
575
|
+
overflow: hidden;
|
|
576
|
+
}
|
|
577
|
+
.admin-meter > span {
|
|
578
|
+
display: block;
|
|
579
|
+
height: 100%;
|
|
580
|
+
border-radius: inherit;
|
|
581
|
+
background: var(--link);
|
|
582
|
+
}
|
|
583
|
+
|
|
493
584
|
/* --- Grid -------------------------------------------------------------- */
|
|
494
585
|
|
|
495
586
|
/* A grid is a section like a card is, so it carries the same space beneath
|
|
@@ -499,7 +590,7 @@ const adminStyles = `
|
|
|
499
590
|
Cards *inside* a grid are spaced by the gap, so their own margin would add
|
|
500
591
|
a second, uneven one. Only direct children are reset — a column of stacked
|
|
501
592
|
cards, which is what the editor's sidebar is, still needs its margins. */
|
|
502
|
-
.admin-grid { display: grid; gap:
|
|
593
|
+
.admin-grid { display: grid; gap: 20px; margin-bottom: 24px; }
|
|
503
594
|
.admin-grid > .admin-card { margin-bottom: 0; }
|
|
504
595
|
.admin-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
505
596
|
.admin-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
@@ -520,14 +611,14 @@ const adminStyles = `
|
|
|
520
611
|
align-items: center;
|
|
521
612
|
justify-content: center;
|
|
522
613
|
gap: 6px;
|
|
523
|
-
height:
|
|
524
|
-
padding: 0
|
|
525
|
-
border-radius:
|
|
614
|
+
height: 36px;
|
|
615
|
+
padding: 0 14px;
|
|
616
|
+
border-radius: 10px;
|
|
526
617
|
border: 1px solid var(--border-strong);
|
|
527
618
|
background: var(--surface);
|
|
528
619
|
color: var(--fg);
|
|
529
620
|
font-family: inherit;
|
|
530
|
-
font-size:
|
|
621
|
+
font-size: 14px;
|
|
531
622
|
font-weight: 500;
|
|
532
623
|
line-height: 1;
|
|
533
624
|
cursor: pointer;
|
|
@@ -969,16 +1060,14 @@ const adminStyles = `
|
|
|
969
1060
|
text-align: left;
|
|
970
1061
|
padding: 8px 12px;
|
|
971
1062
|
color: var(--fg-muted);
|
|
972
|
-
font-weight:
|
|
973
|
-
font-size:
|
|
974
|
-
text-transform: uppercase;
|
|
975
|
-
letter-spacing: 0.04em;
|
|
1063
|
+
font-weight: 450;
|
|
1064
|
+
font-size: 13px;
|
|
976
1065
|
border-bottom: 1px solid var(--border);
|
|
977
1066
|
white-space: nowrap;
|
|
978
1067
|
}
|
|
979
1068
|
|
|
980
1069
|
.admin-table td {
|
|
981
|
-
padding:
|
|
1070
|
+
padding: 13px 12px;
|
|
982
1071
|
border-bottom: 1px solid var(--border);
|
|
983
1072
|
vertical-align: middle;
|
|
984
1073
|
}
|
|
@@ -991,10 +1080,10 @@ const adminStyles = `
|
|
|
991
1080
|
.admin-badge {
|
|
992
1081
|
display: inline-flex;
|
|
993
1082
|
align-items: center;
|
|
994
|
-
height:
|
|
995
|
-
padding: 0
|
|
1083
|
+
height: 22px;
|
|
1084
|
+
padding: 0 10px;
|
|
996
1085
|
border-radius: 999px;
|
|
997
|
-
font-size:
|
|
1086
|
+
font-size: 12.5px;
|
|
998
1087
|
font-weight: 500;
|
|
999
1088
|
background: var(--surface-active);
|
|
1000
1089
|
color: var(--fg-muted);
|
|
@@ -1028,6 +1117,9 @@ const adminStyles = `
|
|
|
1028
1117
|
underline on hover is what marks them as links. */
|
|
1029
1118
|
.admin-content a:not([class*="admin-btn"]):hover { text-decoration: underline; }
|
|
1030
1119
|
|
|
1120
|
+
/* After the two rules above, which would otherwise take its colour. */
|
|
1121
|
+
.admin-layout a.admin-link { color: var(--link); text-decoration: underline; }
|
|
1122
|
+
|
|
1031
1123
|
@media (max-width: 700px) {
|
|
1032
1124
|
.admin-sidebar { width: var(--sidebar-w-closed); }
|
|
1033
1125
|
.admin-sidebar .admin-nav-label,
|
|
@@ -1040,7 +1132,9 @@ const adminStyles = `
|
|
|
1040
1132
|
border-top: 1px solid var(--border);
|
|
1041
1133
|
}
|
|
1042
1134
|
.admin-main { margin-left: var(--sidebar-w-closed); }
|
|
1043
|
-
.admin-content { padding: 16px; }
|
|
1135
|
+
.admin-content { padding: 4px 16px 32px; }
|
|
1044
1136
|
.admin-header { padding: 0 16px; }
|
|
1137
|
+
.admin-page-head { flex-direction: column; }
|
|
1138
|
+
.admin-page-title { font-size: 26px; }
|
|
1045
1139
|
}
|
|
1046
1140
|
`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from 'react';
|
|
3
3
|
import { api } from "../../../helpers/api.js";
|
|
4
4
|
import AdminLayout from "../../layouts/AdminLayout.js";
|
|
@@ -142,7 +142,7 @@ export default function AdminComments() {
|
|
|
142
142
|
setSelected(next);
|
|
143
143
|
};
|
|
144
144
|
const allChecked = comments.length > 0 && comments.every(c => selected.has(c.id));
|
|
145
|
-
return (_jsx(AdminLayout, { title: t('Comments'), children: _jsxs("div", { className: "admin-card", children: [
|
|
145
|
+
return (_jsx(AdminLayout, { title: t('Comments'), children: _jsxs("div", { className: "admin-card", children: [_jsx("div", { className: "admin-card-header", style: { flexWrap: 'wrap', gap: '0.5rem' }, children: _jsxs("div", { style: { display: 'flex', gap: '0.5rem', flexWrap: 'wrap' }, children: [TABS.map(({ key }) => (_jsxs("button", { onClick: () => switchTab(key), className: `admin-btn ${tab === key ? 'admin-btn-primary' : 'admin-btn-secondary'}`, children: [tabLabel(key), counts ? ` (${counts[key]})` : ''] }, key))), _jsx("button", { onClick: () => setShowSettings(!showSettings), className: "admin-btn admin-btn-secondary", children: showSettings ? t('Hide settings') : t('Spam settings') })] }) }), showSettings && _jsx(SettingsPanel, {}), _jsxs("div", { style: { display: 'flex', gap: '0.5rem', flexWrap: 'wrap', alignItems: 'center', padding: '0.75rem 1rem', borderBottom: '1px solid var(--border)' }, children: [_jsxs("label", { style: { display: 'flex', gap: '0.5rem', alignItems: 'center' }, children: [_jsx("input", { type: "checkbox", checked: allChecked, onChange: () => setSelected(allChecked ? new Set() : new Set(comments.map(c => c.id))), "aria-label": t('Select all on this page') }), _jsx("span", { style: { color: 'var(--fg-muted)', fontSize: '0.875rem' }, children: tn('{count} selected', '{count} selected', selected.size) })] }), tab !== 'approved' && tab !== 'trash' && _jsx(BulkButton, { label: t('Approve'), onClick: () => bulk('approve'), disabled: !selected.size }), (tab === 'all' || tab === 'approved') && _jsx(BulkButton, { label: t('Unapprove'), onClick: () => bulk('pending'), disabled: !selected.size }), tab !== 'spam' && _jsx(BulkButton, { label: t('Mark spam'), onClick: () => bulk('spam'), disabled: !selected.size }), tab === 'spam' && _jsx(BulkButton, { label: t('Not spam'), onClick: () => bulk('pending'), disabled: !selected.size }), tab === 'trash' && _jsx(BulkButton, { label: t('Restore'), onClick: () => bulk('pending'), disabled: !selected.size }), tab !== 'trash' && tab !== 'spam' && _jsx(BulkButton, { label: t('Trash'), onClick: () => bulk('trash'), disabled: !selected.size }), (tab === 'trash' || tab === 'spam') && _jsx(BulkButton, { label: t('Delete permanently'), danger: true, onClick: () => bulk('delete'), disabled: !selected.size }), (tab === 'spam' || tab === 'trash') && (counts?.[tab] ?? 0) > 0 && (_jsx("button", { onClick: () => empty(tab), className: "admin-btn admin-btn-danger", style: { marginLeft: 'auto' }, children: tab === 'spam' ? t('Empty spam') : t('Empty trash') }))] }), loading ? (_jsx("div", { className: "admin-loading", children: t('Loading...') })) : comments.length === 0 ? (_jsx("p", { style: { color: 'var(--fg-muted)', textAlign: 'center', padding: '2rem' }, children: {
|
|
146
146
|
all: t('No comments.'),
|
|
147
147
|
pending: t('No pending comments.'),
|
|
148
148
|
approved: t('No approved comments.'),
|
|
@@ -151,7 +151,7 @@ export default function AdminContentTypes() {
|
|
|
151
151
|
if (loading) {
|
|
152
152
|
return (_jsx(AdminLayout, { title: t('Content types'), children: _jsx("div", { className: "admin-loading", children: t('Loading...') }) }));
|
|
153
153
|
}
|
|
154
|
-
return (_jsxs(AdminLayout, { title: t('Content types'),
|
|
154
|
+
return (_jsxs(AdminLayout, { title: t('Content types'), actions: _jsx("button", { type: "button", className: "admin-btn admin-btn-primary", onClick: startNew, children: t('+ New type') }), children: [message && _jsx("div", { className: "admin-card", role: "status", children: message }), _jsxs("div", { className: "admin-card", children: [_jsxs("p", { style: { color: 'var(--fg-muted)', marginTop: 0 }, children: [t('Each type is written in the same editor as posts and gets its own address on the public site.'), ' ', slots(t('Types listed here appear in the content API as {code}.'), { code: _jsx("code", { children: "/api/v1/posts?type=key" }) })] }), _jsxs("table", { className: "admin-table", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: t('Name') }), _jsx("th", { children: t('Key') }), _jsx("th", { children: t('Lives at') }), _jsx("th", { children: t('Fields') }), _jsx("th", { children: t('Actions') })] }) }), _jsx("tbody", { children: types.map(type => (_jsxs("tr", { children: [_jsxs("td", { children: [type.plural_label, type.builtin && _jsx("span", { className: "admin-badge admin-badge-info", style: { marginLeft: '0.5rem' }, children: t('Built in') }), !type.public && _jsx("span", { className: "admin-badge admin-badge-warning", style: { marginLeft: '0.5rem' }, children: t('Private') })] }), _jsx("td", { children: _jsx("code", { children: type.key }) }), _jsx("td", { children: _jsxs("code", { children: [type.route_base, "/\u2026"] }) }), _jsx("td", { children: type.supports.custom_fields ? type.fields.length : '—' }), _jsx("td", { children: _jsxs("div", { style: { display: 'flex', gap: '0.5rem' }, children: [_jsx("button", { type: "button", className: "admin-btn admin-btn-secondary", onClick: () => startEdit(type), children: t('Edit') }), !type.builtin && (_jsx("button", { type: "button", className: "admin-btn admin-btn-danger", onClick: () => remove(type), children: t('Delete') }))] }) })] }, type.id))) })] })] }), showForm && (_jsxs("form", { className: "admin-card", onSubmit: save, children: [_jsx("h3", { className: "admin-card-title", children: editing ? t('Edit {name}', { name: editing.plural_label }) : t('New content type') }), _jsxs("div", { className: "admin-grid admin-grid-2", children: [_jsxs("div", { className: "admin-form-group", children: [_jsx("label", { className: "admin-label", htmlFor: "ct-singular", children: t('Singular label') }), _jsx("input", { id: "ct-singular", className: "admin-input", required: true, value: form.singular_label, onChange: e => setForm({ ...form, singular_label: e.target.value }), placeholder: t('Recipe') })] }), _jsxs("div", { className: "admin-form-group", children: [_jsx("label", { className: "admin-label", htmlFor: "ct-plural", children: t('Plural label') }), _jsx("input", { id: "ct-plural", className: "admin-input", required: true, value: form.plural_label, onChange: e => setForm({ ...form, plural_label: e.target.value }), placeholder: t('Recipes') })] }), _jsxs("div", { className: "admin-form-group", children: [_jsx("label", { className: "admin-label", htmlFor: "ct-key", children: t('Key') }), _jsx("input", { id: "ct-key", className: "admin-input", required: true, disabled: Boolean(editing), value: form.key, onChange: e => setForm({ ...form, key: e.target.value.toLowerCase().replace(/[^a-z0-9_]/g, '_') }), placeholder: t('recipe') }), _jsx("small", { style: { color: 'var(--fg-muted)' }, children: t('What the API calls it. Fixed once created.') })] }), _jsxs("div", { className: "admin-form-group", children: [_jsx("label", { className: "admin-label", htmlFor: "ct-route", children: t('Route base') }), _jsx("input", { id: "ct-route", className: "admin-input", disabled: Boolean(editing?.builtin), value: form.route_base, onChange: e => setForm({ ...form, route_base: e.target.value }), placeholder: `/${form.key.replace(/_/g, '-') || t('recipes')}` }), _jsx("small", { style: { color: 'var(--fg-muted)' }, children: slots(t('Entries live at {code}.'), { code: _jsxs("code", { children: [form.route_base || `/${form.key.replace(/_/g, '-')}`, "/slug"] }) }) })] })] }), _jsxs("div", { className: "admin-form-group", children: [_jsx("label", { className: "admin-label", htmlFor: "ct-description", children: t('Description') }), _jsx("textarea", { id: "ct-description", className: "admin-textarea", value: form.description, onChange: e => setForm({ ...form, description: e.target.value }), style: { minHeight: '60px' } })] }), !editing?.builtin && (_jsx("div", { className: "admin-form-group", children: _jsxs("label", { style: { display: 'flex', gap: '0.5rem', alignItems: 'center' }, children: [_jsx("input", { type: "checkbox", checked: form.public, onChange: e => setForm({ ...form, public: e.target.checked }) }), t('Public — listed in the content API, the sitemap and the public site')] }) })), _jsxs("fieldset", { className: "admin-form-group", style: { border: 'none', padding: 0 }, children: [_jsx("legend", { className: "admin-label", children: t('Editor panels') }), _jsx("div", { style: { display: 'flex', flexWrap: 'wrap', gap: '1rem' }, children: SUPPORT_KEYS.map(key => (_jsxs("label", { style: { display: 'flex', gap: '0.4rem', alignItems: 'center' }, children: [_jsx("input", { type: "checkbox", checked: form.supports[key], onChange: e => setForm({ ...form, supports: { ...form.supports, [key]: e.target.checked } }) }), supportLabels[key]] }, key))) })] }), form.supports.custom_fields && (_jsxs("div", { className: "admin-form-group", children: [_jsxs("div", { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' }, children: [_jsx("span", { className: "admin-label", children: t('Custom fields') }), _jsx("button", { type: "button", className: "admin-btn admin-btn-secondary", onClick: addField, children: t('+ Add field') })] }), form.fields.length === 0 && _jsx("p", { style: { color: 'var(--fg-muted)' }, children: t('No custom fields yet.') }), form.fields.map((field, index) => (_jsxs("div", { style: { border: '1px solid var(--border)', borderRadius: '0.5rem', padding: '0.75rem', marginTop: '0.5rem' }, children: [_jsxs("div", { style: { display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(10rem, 1fr))', gap: '0.5rem' }, children: [_jsx("input", { className: "admin-input", "aria-label": t('Field label'), placeholder: t('Label'), value: field.label, required: true, onChange: e => updateField(index, {
|
|
155
155
|
label: e.target.value,
|
|
156
156
|
// A new field takes its key from its label until the
|
|
157
157
|
// key is typed into directly.
|
|
@@ -59,8 +59,16 @@ export default function AdminDashboard() {
|
|
|
59
59
|
{ label: t('Pending Comments'), value: stats?.pendingComments },
|
|
60
60
|
{ label: t('Media Files'), value: stats?.media }
|
|
61
61
|
].filter((card) => typeof card.value === 'number');
|
|
62
|
+
const newPost = (_jsx(Link, { href: "/admin/posts/new", className: "admin-btn admin-btn-primary", children: t('New Post') }));
|
|
62
63
|
if (loading) {
|
|
63
|
-
return (_jsx(AdminLayout, { title: t('Dashboard'), children: _jsx("div", { className: "admin-loading", children: t('Loading...') }) }));
|
|
64
|
+
return (_jsx(AdminLayout, { title: t('Dashboard'), description: t('How the site is doing, and what changed recently.'), children: _jsx("div", { className: "admin-loading", children: t('Loading...') }) }));
|
|
64
65
|
}
|
|
65
|
-
|
|
66
|
+
const shortcuts = [
|
|
67
|
+
{ href: '/admin/pages/new', label: t('New Page'), sub: t('A page outside the post stream') },
|
|
68
|
+
{ href: '/admin/media', label: t('Upload Media'), sub: t('Images and files for posts and pages') },
|
|
69
|
+
{ href: '/admin/settings', label: t('Settings'), sub: t('Site name, reading and comments') },
|
|
70
|
+
{ href: 'https://basicben.com/docs', label: t('Documentation'), sub: 'basicben.com/docs', external: true },
|
|
71
|
+
{ href: '/', label: t('View Site'), sub: t('Open the public site') }
|
|
72
|
+
];
|
|
73
|
+
return (_jsxs(AdminLayout, { title: t('Dashboard'), description: t('How the site is doing, and what changed recently.'), actions: newPost, children: [cards.length > 0 && (_jsx("div", { className: `admin-grid admin-grid-${Math.min(4, Math.max(2, cards.length))}`, children: cards.map(card => (_jsxs("div", { className: "admin-stat-card", children: [_jsx("div", { className: "admin-stat-label", children: card.label }), _jsx("div", { className: "admin-stat-value", children: card.value.toLocaleString(locale) })] }, card.label))) })), _jsxs("div", { className: "admin-grid admin-grid-2", children: [_jsxs("div", { className: "admin-card", children: [_jsxs("div", { className: "admin-card-header", children: [_jsx("h2", { className: "admin-card-title", children: t('Recent Posts') }), _jsx(Link, { href: "/admin/posts", className: "admin-link", children: t('View all') })] }), recentPosts.length === 0 ? (_jsx("p", { style: { color: 'var(--fg-muted)', margin: 0 }, children: t('No posts yet. Create your first post!') })) : (_jsx("ul", { className: "admin-list", children: recentPosts.map(post => (_jsxs("li", { className: "admin-list-row", children: [_jsxs("div", { className: "admin-list-main", children: [_jsx(Link, { href: `/admin/posts/${post.id}/edit`, className: "admin-list-title", children: post.title }), _jsx("span", { className: "admin-list-sub", children: new Date(post.created_at).toLocaleDateString(locale, { dateStyle: 'medium' }) })] }), _jsx("div", { className: "admin-list-end", children: _jsx("span", { className: `admin-badge ${post.published ? 'admin-badge-success' : 'admin-badge-warning'}`, children: post.published ? t('Published') : t('Draft') }) })] }, post.id))) }))] }), _jsxs("div", { className: "admin-card", children: [_jsx("div", { className: "admin-card-header", children: _jsx("h2", { className: "admin-card-title", children: t('Shortcuts') }) }), _jsx("ul", { className: "admin-list", children: shortcuts.map(item => (_jsxs("li", { className: "admin-list-row", children: [_jsxs("div", { className: "admin-list-main", children: [_jsx(Link, { href: item.href, className: "admin-list-title", ...(item.external ? { target: '_blank', rel: 'noopener noreferrer' } : {}), children: item.label }), _jsx("span", { className: "admin-list-sub", children: item.sub })] }), _jsx("span", { className: "admin-list-end", "aria-hidden": "true", children: item.external ? '↗' : '→' })] }, item.href))) })] })] })] }));
|
|
66
74
|
}
|
|
@@ -49,5 +49,5 @@ export default function AdminPages() {
|
|
|
49
49
|
if (loading) {
|
|
50
50
|
return (_jsx(AdminLayout, { title: t('Pages'), children: _jsx("div", { className: "admin-loading", children: t('Loading...') }) }));
|
|
51
51
|
}
|
|
52
|
-
return (_jsx(AdminLayout, { title: t('Pages'),
|
|
52
|
+
return (_jsx(AdminLayout, { title: t('Pages'), actions: _jsx(Link, { href: "/admin/pages/new", className: "admin-btn admin-btn-primary", children: t('+ New Page') }), children: _jsxs("div", { className: "admin-card", children: [pages.length === 0 ? (_jsx("p", { style: { color: 'var(--fg-muted)', textAlign: 'center', padding: '2rem' }, children: t('No pages yet. Create your first page!') })) : (_jsxs("table", { className: "admin-table", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: t('Title') }), _jsx("th", { children: t('Slug') }), _jsx("th", { children: t('Template') }), _jsx("th", { children: t('Status') }), _jsx("th", { children: t('Actions') })] }) }), _jsx("tbody", { children: pages.map(page => (_jsxs("tr", { children: [_jsx("td", { children: _jsx(Link, { href: `/admin/pages/${page.id}/edit`, style: { color: 'var(--accent)', fontWeight: 500 }, children: page.title }) }), _jsx("td", { children: _jsxs("code", { children: ["/", page.slug] }) }), _jsx("td", { children: page.template }), _jsx("td", { children: _jsx("span", { className: `admin-badge ${page.published ? 'admin-badge-success' : 'admin-badge-warning'}`, children: page.published ? t('Published') : t('Draft') }) }), _jsx("td", { children: _jsxs("div", { style: { display: 'flex', gap: '0.5rem' }, children: [_jsx(Link, { href: `/admin/pages/${page.id}/edit`, className: "admin-btn admin-btn-secondary", children: t('Edit') }), _jsx("button", { onClick: () => handleDelete(page.id), className: "admin-btn admin-btn-danger", children: t('Delete') })] }) })] }, page.id))) })] })), meta && _jsx(Pagination, { meta: meta, onChange: setPage, noun: t('pages') })] }) }));
|
|
53
53
|
}
|
|
@@ -136,7 +136,7 @@ export default function AdminPosts() {
|
|
|
136
136
|
const toggle = (id) => setSelected(prev => (prev.includes(id) ? prev.filter(x => x !== id) : [...prev, id]));
|
|
137
137
|
const allSelected = posts.length > 0 && selected.length === posts.length;
|
|
138
138
|
const inTrash = filter === 'trash';
|
|
139
|
-
return (_jsx(AdminLayout, { title: plural,
|
|
139
|
+
return (_jsx(AdminLayout, { title: plural, actions: type === 'post' ? (_jsx(Link, { href: "/admin/posts/new", className: "admin-btn admin-btn-primary", children: t('+ New Post') })) : (_jsx("button", { type: "button", className: "admin-btn admin-btn-primary", onClick: () => navigateWithType(navigate, '/admin/posts/new', type), children: current?.singular_label ? t('+ New {name}', { name: current.singular_label }) : t('+ New entry') })), children: _jsxs("div", { className: "admin-card", children: [types.length > 1 && (_jsx("nav", { "aria-label": t('Content type'), style: { display: 'flex', flexWrap: 'wrap', gap: '0.25rem', marginBottom: '0.75rem' }, children: types.map(ct => (_jsx("button", { type: "button", onClick: () => changeType(ct.key), "aria-pressed": type === ct.key, className: `admin-btn ${type === ct.key ? 'admin-btn-primary' : 'admin-btn-secondary'}`, children: ct.plural_label }, ct.key))) })), _jsxs("div", { style: { display: 'flex', flexWrap: 'wrap', gap: '0.5rem', alignItems: 'center', justifyContent: 'space-between', marginBottom: '1rem' }, children: [_jsx("nav", { "aria-label": t('Filter posts by status'), style: { display: 'flex', flexWrap: 'wrap', gap: '0.25rem' }, children: TABS.map(tab => (_jsxs("button", { type: "button", onClick: () => changeFilter(tab), className: `admin-btn ${filter === tab ? 'admin-btn-primary' : 'admin-btn-secondary'}`, "aria-pressed": filter === tab, children: [tabLabels[tab], counts[tab] !== undefined ? ` (${counts[tab]})` : ''] }, tab))) }), _jsxs("form", { onSubmit: submitSearch, role: "search", style: { display: 'flex', gap: '0.25rem' }, children: [_jsx("input", { type: "search", value: search, onChange: e => setSearch(e.target.value), placeholder: t('Search posts'), className: "admin-input", "aria-label": t('Search posts') }), _jsx("button", { type: "submit", className: "admin-btn admin-btn-secondary", children: t('Search') })] })] }), selected.length > 0 && (_jsxs("div", { style: { display: 'flex', gap: '0.5rem', alignItems: 'center', marginBottom: '0.75rem' }, children: [_jsx("span", { children: tn('{count} selected', '{count} selected', selected.length) }), inTrash ? (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "admin-btn admin-btn-secondary", onClick: () => runBulk('restore', selected), children: t('Restore') }), _jsx("button", { type: "button", className: "admin-btn admin-btn-danger", onClick: () => runBulk('delete', selected), children: t('Delete permanently') })] })) : (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "admin-btn admin-btn-secondary", onClick: () => runBulk('publish', selected), children: t('Publish') }), _jsx("button", { type: "button", className: "admin-btn admin-btn-secondary", onClick: () => runBulk('draft', selected), children: t('Unpublish') }), _jsx("button", { type: "button", className: "admin-btn admin-btn-danger", onClick: () => runBulk('trash', selected), children: t('Move to trash') })] }))] })), loading ? (_jsx("div", { className: "admin-loading", children: t('Loading...') })) : posts.length === 0 ? (_jsx("p", { style: { color: 'var(--fg-muted)', textAlign: 'center', padding: '2rem' }, children: query
|
|
140
140
|
? t('No posts match “{query}”.', { query })
|
|
141
141
|
: inTrash
|
|
142
142
|
? t('The trash is empty.')
|
|
@@ -115,11 +115,11 @@ export default function AdminTaxonomies() {
|
|
|
115
115
|
if (loading) {
|
|
116
116
|
return (_jsx(AdminLayout, { title: t('Taxonomies'), children: _jsx("div", { className: "admin-loading", children: t('Loading...') }) }));
|
|
117
117
|
}
|
|
118
|
-
return (_jsx(AdminLayout, { title: t('Taxonomies'),
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
118
|
+
return (_jsx(AdminLayout, { title: t('Taxonomies'), actions: _jsx("button", { type: "button", className: "admin-btn admin-btn-primary", onClick: () => {
|
|
119
|
+
setEditingTaxonomy(null);
|
|
120
|
+
setTaxonomyForm(EMPTY_TAXONOMY);
|
|
121
|
+
setShowTaxonomyForm(true);
|
|
122
|
+
}, children: t('+ New taxonomy') }), children: _jsxs("div", { className: "admin-grid admin-grid-2", children: [_jsxs("div", { children: [_jsxs("div", { className: "admin-card", children: [_jsx("p", { style: { color: 'var(--fg-muted)', marginTop: 0 }, children: t('Categories and tags are built in. Add others — a cuisine, a season — and choose which content types use them.') }), taxonomies.length === 0 ? (_jsx("p", { style: { color: 'var(--fg-muted)' }, children: t('No custom taxonomies yet.') })) : (_jsx("ul", { style: { listStyle: 'none', padding: 0, margin: 0, display: 'grid', gap: '0.5rem' }, children: taxonomies.map(taxonomy => (_jsxs("li", { style: { display: 'flex', gap: '0.5rem', alignItems: 'center', justifyContent: 'space-between' }, children: [_jsx("button", { type: "button", className: `admin-btn ${selected?.id === taxonomy.id ? 'admin-btn-primary' : 'admin-btn-secondary'}`, onClick: () => setSelected(taxonomy), "aria-pressed": selected?.id === taxonomy.id, children: taxonomy.plural_label }), _jsxs("small", { style: { color: 'var(--fg-muted)', marginRight: 'auto' }, children: [_jsx("code", { children: taxonomy.key }), " \u00B7 ", taxonomy.content_types.join(', ') || t('no types')] }), _jsx("button", { type: "button", className: "admin-btn admin-btn-secondary", onClick: () => {
|
|
123
123
|
setEditingTaxonomy(taxonomy);
|
|
124
124
|
setTaxonomyForm({ ...taxonomy, description: taxonomy.description ?? '' });
|
|
125
125
|
setShowTaxonomyForm(true);
|
|
@@ -198,7 +198,7 @@ export default function AdminUsers() {
|
|
|
198
198
|
if (loading) {
|
|
199
199
|
return (_jsx(AdminLayout, { title: t('Users'), children: _jsx("div", { className: "admin-loading", children: t('Loading…') }) }));
|
|
200
200
|
}
|
|
201
|
-
return (_jsxs(AdminLayout, { title: t('Users'), children: [_jsx("style", { children: userStyles }), notice && (_jsx("div", { className: `users-notice users-notice-${notice.tone}`, role: "status", children: notice.text })), deleting && (_jsxs("form", { className: "users-reassign", onSubmit: confirmDelete, children: [_jsx("p", { className: "users-reassign-title", children: t('Delete {name}?', { name: deleting.name }) }), _jsxs("p", { className: "users-hint", children: [tn('They have written {count} post.', 'They have written {count} posts.', deleting.post_count), ' ', t('Choose who they should belong to — nothing is deleted with the account. This cannot be undone.')] }), _jsxs("div", { className: "users-row", children: [_jsxs("select", { className: "admin-select", value: reassignTo, onChange: e => setReassignTo(e.target.value), required: true, "aria-label": t('Reassign posts to'), children: [_jsx("option", { value: "", children: t('Reassign posts to…') }), candidates.map(candidate => (_jsxs("option", { value: candidate.id, children: [candidate.name, " (", candidate.email, ")"] }, candidate.id)))] }), _jsx("button", { type: "submit", className: "admin-btn admin-btn-danger", disabled: !reassignTo, children: t('Reassign and delete') }), _jsx("button", { type: "button", className: "admin-btn admin-btn-secondary", onClick: () => setDeleting(null), children: t('Cancel') })] })] })), _jsxs("div", { className: "admin-card", children: [_jsxs("
|
|
201
|
+
return (_jsxs(AdminLayout, { title: t('Users'), description: meta ? tn('{count} account', '{count} accounts', meta.total) : undefined, children: [_jsx("style", { children: userStyles }), notice && (_jsx("div", { className: `users-notice users-notice-${notice.tone}`, role: "status", children: notice.text })), deleting && (_jsxs("form", { className: "users-reassign", onSubmit: confirmDelete, children: [_jsx("p", { className: "users-reassign-title", children: t('Delete {name}?', { name: deleting.name }) }), _jsxs("p", { className: "users-hint", children: [tn('They have written {count} post.', 'They have written {count} posts.', deleting.post_count), ' ', t('Choose who they should belong to — nothing is deleted with the account. This cannot be undone.')] }), _jsxs("div", { className: "users-row", children: [_jsxs("select", { className: "admin-select", value: reassignTo, onChange: e => setReassignTo(e.target.value), required: true, "aria-label": t('Reassign posts to'), children: [_jsx("option", { value: "", children: t('Reassign posts to…') }), candidates.map(candidate => (_jsxs("option", { value: candidate.id, children: [candidate.name, " (", candidate.email, ")"] }, candidate.id)))] }), _jsx("button", { type: "submit", className: "admin-btn admin-btn-danger", disabled: !reassignTo, children: t('Reassign and delete') }), _jsx("button", { type: "button", className: "admin-btn admin-btn-secondary", onClick: () => setDeleting(null), children: t('Cancel') })] })] })), _jsxs("div", { className: "admin-card", children: [_jsxs("form", { className: "users-row users-filters", onSubmit: handleSearch, children: [_jsx("input", { className: "admin-input", type: "search", value: search, onChange: e => setSearch(e.target.value), placeholder: t('Search by name or email'), "aria-label": t('Search users') }), _jsxs("select", { className: "admin-select", value: roleFilter, onChange: e => { setPage(1); setRoleFilter(e.target.value); }, "aria-label": t('Filter by role'), children: [_jsx("option", { value: "", children: t('All roles') }), roles.map(role => _jsx("option", { value: role, children: roleLabel(role) }, role))] }), _jsx("button", { type: "submit", className: "admin-btn admin-btn-secondary", children: t('Search') })] }), users.length === 0 ? (_jsx("div", { className: "users-empty", children: _jsx("p", { children: query || roleFilter ? t('Nobody matches that search.') : t('No users yet.') }) })) : (_jsxs("table", { className: "admin-table", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: t('Name') }), _jsx("th", { children: t('Role') }), _jsx("th", { children: t('Posts') }), _jsx("th", { children: t('Status') }), _jsx("th", { children: t('Joined') }), _jsx("th", { children: t('Actions') })] }) }), _jsx("tbody", { children: users.map(row => {
|
|
202
202
|
// Your own role, status and account are off limits here — the
|
|
203
203
|
// server refuses them, so offering them would only invite an
|
|
204
204
|
// error. Another admin can make those changes for you.
|