@basicbenframework/cms 0.6.1 → 0.7.0

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.
@@ -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: [_jsxs("header", { className: "admin-header", children: [title && _jsx("h1", { className: "admin-page-title", children: title }), _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') })] })] }), _jsx("main", { className: "admin-content", children: 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: #fafafa;
144
+ --bg: #f7f6f2;
145
+ --sidebar: #efeee9;
145
146
  --surface: #ffffff;
146
- --surface-hover: #f4f4f5;
147
- --surface-active: #ededee;
148
- --border: #e7e7e9;
149
- --border-strong: #d4d4d8;
150
- --fg: #09090b;
151
- --fg-muted: #64646b;
152
- --fg-subtle: #909099;
153
- --accent: #09090b;
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
- --focus: #0070f3;
156
- --danger: #e5484d;
157
+ --link: #2b6fd6;
158
+ --focus: #2b6fd6;
159
+ --danger: #d4483f;
157
160
  --danger-fg: #ffffff;
158
- --success: #1a7f45;
159
- --warning: #9a6700;
160
- --info: #0060df;
161
- --tint-success: #e8f5ec;
162
- --tint-warning: #fdf5e3;
163
- --tint-info: #e8f1fd;
164
- --tint-danger: #fdeaea;
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: 12px;
167
- --sidebar-w: 232px;
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: #0a0a0a;
184
- --surface: #111113;
185
- --surface-hover: #18181b;
186
- --surface-active: #202024;
187
- --border: #232327;
188
- --border-strong: #333338;
189
- --fg: #ededef;
190
- --fg-muted: #a1a1a8;
191
- --fg-subtle: #70707a;
192
- --accent: #ededef;
193
- --accent-fg: #09090b;
194
- --focus: #3b82f6;
195
- --danger: #f2555a;
196
- --danger-fg: #0a0a0a;
197
- --success: #3dd68c;
198
- --warning: #f5b544;
199
- --info: #6aa6ff;
200
- --tint-success: #10261a;
201
- --tint-warning: #2a2011;
202
- --tint-info: #11213a;
203
- --tint-danger: #2c1315;
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: #0a0a0a;
209
- --surface: #111113;
210
- --surface-hover: #18181b;
211
- --surface-active: #202024;
212
- --border: #232327;
213
- --border-strong: #333338;
214
- --fg: #ededef;
215
- --fg-muted: #a1a1a8;
216
- --fg-subtle: #70707a;
217
- --accent: #ededef;
218
- --accent-fg: #09090b;
219
- --focus: #3b82f6;
220
- --danger: #f2555a;
221
- --danger-fg: #0a0a0a;
222
- --success: #3dd68c;
223
- --warning: #f5b544;
224
- --info: #6aa6ff;
225
- --tint-success: #10261a;
226
- --tint-warning: #2a2011;
227
- --tint-info: #11213a;
228
- --tint-danger: #2c1315;
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(--surface);
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: 56px;
257
- padding: 0 12px;
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: 6px;
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: 8px;
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: 7px 8px;
331
- border-radius: var(--radius);
342
+ padding: 8px 10px;
343
+ border-radius: 10px;
332
344
  color: var(--fg-muted);
333
345
  text-decoration: none;
334
- font-size: 13.5px;
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: 8px;
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 24px;
388
- background: color-mix(in srgb, var(--surface) 80%, transparent);
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-size: 15px;
398
- font-weight: 550;
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: 24px; max-width: 1400px; }
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: 20px;
446
- margin-bottom: 20px;
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: 14px;
459
- font-weight: 550;
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: 18px 20px;
506
+ padding: 20px 24px 22px;
474
507
  }
475
508
 
476
- /* The label sits *under* the value in the markup, so its bottom margin was
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-muted);
481
- font-size: 12.5px;
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: 26px;
487
- font-weight: 600;
517
+ font-size: 30px;
518
+ font-weight: 500;
488
519
  letter-spacing: -0.02em;
489
- margin: 0 0 4px;
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: 16px; margin-bottom: 20px; }
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: 32px;
524
- padding: 0 12px;
525
- border-radius: var(--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: 13px;
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: 500;
973
- font-size: 12px;
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: 11px 12px;
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: 20px;
995
- padding: 0 8px;
1083
+ height: 22px;
1084
+ padding: 0 10px;
996
1085
  border-radius: 999px;
997
- font-size: 11.5px;
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
  `;
@@ -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
- return (_jsxs(AdminLayout, { title: t('Dashboard'), 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-value", children: card.value }), _jsx("div", { className: "admin-stat-label", children: card.label })] }, card.label))) })), _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/new", className: "admin-btn admin-btn-primary", children: t('New Post') })] }), recentPosts.length === 0 ? (_jsx("p", { style: { color: 'var(--fg-muted)' }, children: t('No posts yet. Create your first post!') })) : (_jsxs("table", { className: "admin-table", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: t('Title') }), _jsx("th", { children: t('Status') }), _jsx("th", { children: t('Date') }), _jsx("th", { children: t('Actions') })] }) }), _jsx("tbody", { children: recentPosts.map(post => (_jsxs("tr", { children: [_jsx("td", { children: post.title }), _jsx("td", { children: _jsx("span", { className: `admin-badge ${post.published ? 'admin-badge-success' : 'admin-badge-warning'}`, children: post.published ? t('Published') : t('Draft') }) }), _jsx("td", { children: new Date(post.created_at).toLocaleDateString(locale) }), _jsx("td", { children: _jsx(Link, { href: `/admin/posts/${post.id}/edit`, className: "admin-btn admin-btn-secondary", children: t('Edit') }) })] }, post.id))) })] }))] }), _jsxs("div", { className: "admin-grid admin-grid-3", children: [_jsxs("div", { className: "admin-card", children: [_jsx("h3", { className: "admin-card-title", children: t('Content') }), _jsxs("div", { className: "admin-stack", children: [_jsx(Link, { href: "/admin/posts/new", className: "admin-btn admin-btn-secondary", children: t('New Post') }), _jsx(Link, { href: "/admin/pages/new", className: "admin-btn admin-btn-secondary", children: t('New Page') }), _jsx(Link, { href: "/admin/media", className: "admin-btn admin-btn-secondary", children: t('Upload Media') })] })] }), _jsxs("div", { className: "admin-card", children: [_jsx("h3", { className: "admin-card-title", children: t('Extend') }), _jsx("div", { className: "admin-stack", children: _jsx(Link, { href: "/admin/settings", className: "admin-btn admin-btn-secondary", children: t('Settings') }) })] }), _jsxs("div", { className: "admin-card", children: [_jsx("h3", { className: "admin-card-title", children: t('Help') }), _jsxs("div", { className: "admin-stack", children: [_jsx(Link, { href: "https://basicben.com/docs", target: "_blank", rel: "noopener noreferrer", className: "admin-btn admin-btn-secondary", children: t('Documentation') }), _jsx(Link, { href: "/", className: "admin-btn admin-btn-secondary", children: t('View Site') })] })] })] })] }));
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basicbenframework/cms",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "description": "The BasicBen CMS. Posts, pages, media, an admin UI, and a headless content API.",
6
6
  "license": "MIT",