@fonderie/react-admin-screens 0.7.0 → 1.0.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.
- package/dist/index.cjs +117 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +117 -60
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,20 +4,49 @@ import { TemplateEditorScreen, TemplateListScreen } from "@fonderie/react-courie
|
|
|
4
4
|
import { useState as useState5 } from "react";
|
|
5
5
|
|
|
6
6
|
// src/styles.ts
|
|
7
|
+
var t = {
|
|
8
|
+
text: "var(--fonderie-text,#171717)",
|
|
9
|
+
muted: "var(--fonderie-text-muted,#5c5c5c)",
|
|
10
|
+
bg: "var(--fonderie-bg,#fafafa)",
|
|
11
|
+
surface: "var(--fonderie-surface,#fff)",
|
|
12
|
+
surfaceAlt: "var(--fonderie-surface-alt,#fafafa)",
|
|
13
|
+
border: "var(--fonderie-border,#e0e0e0)",
|
|
14
|
+
borderLight: "var(--fonderie-border-light,#f5f5f5)",
|
|
15
|
+
accent: "var(--fonderie-accent,#00d294)",
|
|
16
|
+
accentStrong: "var(--fonderie-accent-strong,#009767)",
|
|
17
|
+
warning: "var(--fonderie-warning,#f5a623)",
|
|
18
|
+
danger: "var(--fonderie-danger,#e00)",
|
|
19
|
+
font: 'var(--fonderie-font,Inter,"Inter Fallback",-apple-system,BlinkMacSystemFont,"Helvetica Neue",system-ui,sans-serif)',
|
|
20
|
+
mono: 'var(--fonderie-mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace)',
|
|
21
|
+
radius: "var(--fonderie-radius,4px)",
|
|
22
|
+
radiusLg: "var(--fonderie-radius-lg,8px)",
|
|
23
|
+
trackingDisplay: "var(--fonderie-tracking-display,-0.05em)",
|
|
24
|
+
shadowCard: "var(--fonderie-shadow-card,0 2px 3px 0 rgba(0,0,0,.05))"
|
|
25
|
+
};
|
|
7
26
|
var styles = {
|
|
8
27
|
shell: {
|
|
9
28
|
display: "flex",
|
|
10
29
|
minHeight: "100vh",
|
|
11
|
-
fontFamily:
|
|
12
|
-
color:
|
|
30
|
+
fontFamily: t.font,
|
|
31
|
+
color: t.text,
|
|
32
|
+
background: t.bg
|
|
33
|
+
},
|
|
34
|
+
// The sidebar sits on the raised surface against the page canvas, which is
|
|
35
|
+
// what separates the two without a heavy rule between them.
|
|
36
|
+
nav: {
|
|
37
|
+
width: 220,
|
|
38
|
+
borderRight: `1px solid ${t.border}`,
|
|
39
|
+
padding: 16,
|
|
40
|
+
flexShrink: 0,
|
|
41
|
+
background: t.surface
|
|
13
42
|
},
|
|
14
|
-
nav: { width: 220, borderRight: "1px solid #eee", padding: 16, flexShrink: 0 },
|
|
15
43
|
navGroup: {
|
|
16
44
|
fontSize: 11,
|
|
17
45
|
textTransform: "uppercase",
|
|
18
46
|
letterSpacing: 0.6,
|
|
19
|
-
color:
|
|
20
|
-
margin: "16px 0 6px"
|
|
47
|
+
color: t.muted,
|
|
48
|
+
margin: "16px 0 6px",
|
|
49
|
+
fontWeight: 600
|
|
21
50
|
},
|
|
22
51
|
navItem: {
|
|
23
52
|
display: "block",
|
|
@@ -25,51 +54,79 @@ var styles = {
|
|
|
25
54
|
textAlign: "left",
|
|
26
55
|
background: "none",
|
|
27
56
|
border: "none",
|
|
28
|
-
borderRadius:
|
|
57
|
+
borderRadius: t.radius,
|
|
29
58
|
padding: "6px 8px",
|
|
30
59
|
cursor: "pointer",
|
|
31
60
|
fontSize: 14,
|
|
32
|
-
color:
|
|
61
|
+
color: t.text,
|
|
62
|
+
fontFamily: "inherit"
|
|
33
63
|
},
|
|
34
|
-
navItemActive: { background:
|
|
64
|
+
navItemActive: { background: t.surfaceAlt, fontWeight: 600, color: t.accentStrong },
|
|
35
65
|
main: { flex: 1, padding: 24, maxWidth: 960 },
|
|
36
66
|
container: { padding: 24, maxWidth: 960 },
|
|
37
|
-
title: {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
67
|
+
title: {
|
|
68
|
+
fontSize: 20,
|
|
69
|
+
fontWeight: 600,
|
|
70
|
+
marginTop: 0,
|
|
71
|
+
marginBottom: 12,
|
|
72
|
+
letterSpacing: t.trackingDisplay
|
|
73
|
+
},
|
|
74
|
+
subtitle: {
|
|
75
|
+
fontSize: 15,
|
|
76
|
+
fontWeight: 600,
|
|
77
|
+
marginTop: 24,
|
|
78
|
+
marginBottom: 8,
|
|
79
|
+
letterSpacing: t.trackingDisplay
|
|
80
|
+
},
|
|
81
|
+
status: { padding: 12, color: t.muted },
|
|
82
|
+
error: { color: t.danger, marginBottom: 12, fontSize: 14 },
|
|
83
|
+
ok: { color: t.accentStrong, fontWeight: 600 },
|
|
84
|
+
bad: { color: t.danger, fontWeight: 600 },
|
|
85
|
+
advice: { color: t.warning },
|
|
86
|
+
muted: { color: t.muted, fontSize: 13 },
|
|
87
|
+
mono: { fontFamily: t.mono, fontSize: 13 },
|
|
46
88
|
table: { width: "100%", borderCollapse: "collapse", fontSize: 14 },
|
|
47
89
|
th: {
|
|
48
90
|
textAlign: "left",
|
|
49
|
-
borderBottom:
|
|
91
|
+
borderBottom: `1px solid ${t.border}`,
|
|
50
92
|
padding: "6px 8px",
|
|
51
93
|
fontWeight: 600,
|
|
52
|
-
color:
|
|
94
|
+
color: t.muted
|
|
53
95
|
},
|
|
54
|
-
td: { borderBottom:
|
|
96
|
+
td: { borderBottom: `1px solid ${t.borderLight}`, padding: "6px 8px", verticalAlign: "top" },
|
|
55
97
|
list: { listStyle: "none", padding: 0, margin: 0 },
|
|
56
|
-
row: { borderBottom:
|
|
98
|
+
row: { borderBottom: `1px solid ${t.borderLight}`, padding: "8px 0" },
|
|
57
99
|
badge: {
|
|
58
100
|
display: "inline-block",
|
|
59
101
|
borderRadius: 999,
|
|
60
102
|
padding: "1px 8px",
|
|
61
103
|
fontSize: 12,
|
|
62
|
-
background:
|
|
104
|
+
background: t.surfaceAlt,
|
|
105
|
+
border: `1px solid ${t.border}`,
|
|
106
|
+
color: t.muted
|
|
63
107
|
},
|
|
64
108
|
button: {
|
|
65
|
-
background:
|
|
66
|
-
border:
|
|
67
|
-
borderRadius:
|
|
109
|
+
background: t.surface,
|
|
110
|
+
border: `1px solid ${t.border}`,
|
|
111
|
+
borderRadius: t.radius,
|
|
68
112
|
padding: "4px 10px",
|
|
69
113
|
cursor: "pointer",
|
|
70
|
-
fontSize: 13
|
|
114
|
+
fontSize: 13,
|
|
115
|
+
color: t.text,
|
|
116
|
+
fontFamily: "inherit",
|
|
117
|
+
boxShadow: t.shadowCard
|
|
118
|
+
},
|
|
119
|
+
toolbar: { display: "flex", gap: 8, alignItems: "center", marginBottom: 12 },
|
|
120
|
+
// Surfaces the screens compose themselves, kept here so a card looks the
|
|
121
|
+
// same on every page rather than being re-invented per screen.
|
|
122
|
+
card: {
|
|
123
|
+
background: t.surface,
|
|
124
|
+
border: `1px solid ${t.border}`,
|
|
125
|
+
borderRadius: t.radiusLg,
|
|
126
|
+
padding: 16,
|
|
127
|
+
boxShadow: t.shadowCard
|
|
71
128
|
},
|
|
72
|
-
|
|
129
|
+
accent: { color: t.accent }
|
|
73
130
|
};
|
|
74
131
|
|
|
75
132
|
// src/screens/AdminLogScreen.tsx
|
|
@@ -168,11 +225,11 @@ function AttentionScreen({ client }) {
|
|
|
168
225
|
] });
|
|
169
226
|
}
|
|
170
227
|
|
|
171
|
-
// src/screens/
|
|
172
|
-
import {
|
|
228
|
+
// src/screens/EnvironmentScreen.tsx
|
|
229
|
+
import { useAdminEnvironment } from "@fonderie/react-admin";
|
|
173
230
|
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
174
|
-
function
|
|
175
|
-
const { report, isLoading, error } =
|
|
231
|
+
function EnvironmentScreen({ client }) {
|
|
232
|
+
const { report, isLoading, error } = useAdminEnvironment(client);
|
|
176
233
|
return /* @__PURE__ */ jsxs3("div", { style: styles.container, children: [
|
|
177
234
|
/* @__PURE__ */ jsx3("h1", { style: styles.title, children: "Configuration" }),
|
|
178
235
|
isLoading ? /* @__PURE__ */ jsx3("p", { style: styles.status, children: "Loading\u2026" }) : error ? /* @__PURE__ */ jsx3("p", { style: styles.error, role: "alert", children: error.explanation }) : report ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
@@ -412,8 +469,8 @@ function TokensScreen({ client }) {
|
|
|
412
469
|
name: name.trim(),
|
|
413
470
|
scopes,
|
|
414
471
|
...days && Number.isInteger(d) && d > 0 ? { expiresInDays: d } : {}
|
|
415
|
-
}).then((
|
|
416
|
-
setMinted({ name:
|
|
472
|
+
}).then((t2) => {
|
|
473
|
+
setMinted({ name: t2.name, token: t2.token });
|
|
417
474
|
setName("");
|
|
418
475
|
setDays("");
|
|
419
476
|
}).catch(() => {
|
|
@@ -466,35 +523,35 @@ function TokensScreen({ client }) {
|
|
|
466
523
|
/* @__PURE__ */ jsx8("th", { style: styles.th, children: "Last used" }),
|
|
467
524
|
/* @__PURE__ */ jsx8("th", { style: styles.th })
|
|
468
525
|
] }) }),
|
|
469
|
-
/* @__PURE__ */ jsx8("tbody", { children: report.issued.map((
|
|
526
|
+
/* @__PURE__ */ jsx8("tbody", { children: report.issued.map((t2) => /* @__PURE__ */ jsxs8("tr", { children: [
|
|
470
527
|
/* @__PURE__ */ jsxs8("td", { style: styles.td, children: [
|
|
471
|
-
|
|
472
|
-
|
|
528
|
+
t2.name,
|
|
529
|
+
t2.revokedAt ? /* @__PURE__ */ jsx8("span", { style: styles.badge, children: " revoked" }) : null
|
|
473
530
|
] }),
|
|
474
|
-
/* @__PURE__ */ jsx8("td", { style: { ...styles.td, ...styles.mono }, children:
|
|
531
|
+
/* @__PURE__ */ jsx8("td", { style: { ...styles.td, ...styles.mono }, children: t2.scopes.join(", ") }),
|
|
475
532
|
/* @__PURE__ */ jsxs8("td", { style: { ...styles.td, ...styles.muted }, children: [
|
|
476
|
-
new Date(
|
|
533
|
+
new Date(t2.createdAt).toLocaleDateString(),
|
|
477
534
|
" \xB7 ",
|
|
478
|
-
|
|
535
|
+
t2.createdBy
|
|
479
536
|
] }),
|
|
480
|
-
/* @__PURE__ */ jsx8("td", { style: { ...styles.td, ...styles.muted }, children:
|
|
481
|
-
/* @__PURE__ */ jsx8("td", { style: { ...styles.td, ...styles.muted }, children:
|
|
482
|
-
/* @__PURE__ */ jsx8("td", { style: styles.td, children:
|
|
537
|
+
/* @__PURE__ */ jsx8("td", { style: { ...styles.td, ...styles.muted }, children: t2.expiresAt ? new Date(t2.expiresAt).toLocaleDateString() : "never" }),
|
|
538
|
+
/* @__PURE__ */ jsx8("td", { style: { ...styles.td, ...styles.muted }, children: t2.lastUsedAt ? new Date(t2.lastUsedAt).toLocaleString() : "never" }),
|
|
539
|
+
/* @__PURE__ */ jsx8("td", { style: styles.td, children: t2.revokedAt ? null : /* @__PURE__ */ jsx8(
|
|
483
540
|
"button",
|
|
484
541
|
{
|
|
485
542
|
type: "button",
|
|
486
543
|
style: styles.button,
|
|
487
544
|
onClick: () => {
|
|
488
545
|
if (window.confirm(
|
|
489
|
-
`Revoke "${
|
|
546
|
+
`Revoke "${t2.name}"? Anything using it stops working immediately.`
|
|
490
547
|
))
|
|
491
|
-
void revoke(
|
|
548
|
+
void revoke(t2.id).catch(() => {
|
|
492
549
|
});
|
|
493
550
|
},
|
|
494
551
|
children: "Revoke"
|
|
495
552
|
}
|
|
496
553
|
) })
|
|
497
|
-
] },
|
|
554
|
+
] }, t2.id)) })
|
|
498
555
|
] }) : /* @__PURE__ */ jsx8("p", { style: styles.muted, children: "None issued." })
|
|
499
556
|
] }),
|
|
500
557
|
/* @__PURE__ */ jsx8("h2", { style: styles.subtitle, children: "Legacy per-brick tokens" }),
|
|
@@ -735,7 +792,7 @@ function CatalogScreen({ client }) {
|
|
|
735
792
|
isLoading && !catalog ? /* @__PURE__ */ jsx10("p", { style: styles.status, children: "Loading\u2026" }) : null,
|
|
736
793
|
catalog ? /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
737
794
|
/* @__PURE__ */ jsx10("h2", { style: styles.subtitle, children: "Configured (code)" }),
|
|
738
|
-
/* @__PURE__ */ jsx10("pre", { style: { ...styles.mono, background: "
|
|
795
|
+
/* @__PURE__ */ jsx10("pre", { style: { ...styles.mono, background: "var(--fonderie-surface-alt,#fafafa)", padding: 12, overflowX: "auto" }, children: JSON.stringify(catalog.configured, null, 2) }),
|
|
739
796
|
/* @__PURE__ */ jsx10("h2", { style: styles.subtitle, children: "Stored (database)" }),
|
|
740
797
|
catalog.stored.length === 0 ? /* @__PURE__ */ jsx10("p", { style: styles.muted, children: "No stored plans." }) : /* @__PURE__ */ jsxs10("table", { style: styles.table, children: [
|
|
741
798
|
/* @__PURE__ */ jsx10("thead", { children: /* @__PURE__ */ jsxs10("tr", { children: [
|
|
@@ -793,11 +850,11 @@ function SubscriberScreen({ client, pageSize = 50 }) {
|
|
|
793
850
|
const [amount, setAmount] = useState3("");
|
|
794
851
|
const [note, setNote] = useState3("");
|
|
795
852
|
const [granted, setGranted] = useState3(null);
|
|
796
|
-
const open = (
|
|
853
|
+
const open = (t2, id) => {
|
|
797
854
|
setGranted(null);
|
|
798
|
-
setType(
|
|
855
|
+
setType(t2);
|
|
799
856
|
setIdInput(id);
|
|
800
|
-
setSubscriber({ type:
|
|
857
|
+
setSubscriber({ type: t2, id });
|
|
801
858
|
};
|
|
802
859
|
return /* @__PURE__ */ jsxs11("div", { style: styles.container, children: [
|
|
803
860
|
/* @__PURE__ */ jsx11("h1", { style: styles.title, children: "Subscriber" }),
|
|
@@ -1008,12 +1065,12 @@ function SubscriberScreen({ client, pageSize = 50 }) {
|
|
|
1008
1065
|
/* @__PURE__ */ jsx11("th", { style: styles.th, children: "Amount" }),
|
|
1009
1066
|
/* @__PURE__ */ jsx11("th", { style: styles.th, children: "Note" })
|
|
1010
1067
|
] }) }),
|
|
1011
|
-
/* @__PURE__ */ jsx11("tbody", { children: ledger.map((
|
|
1012
|
-
/* @__PURE__ */ jsx11("td", { style: { ...styles.td, ...styles.muted }, children: new Date(
|
|
1013
|
-
/* @__PURE__ */ jsx11("td", { style: styles.td, children:
|
|
1014
|
-
/* @__PURE__ */ jsx11("td", { style: { ...styles.td, ...styles.mono }, children:
|
|
1015
|
-
/* @__PURE__ */ jsx11("td", { style: { ...styles.td, ...styles.muted }, children:
|
|
1016
|
-
] },
|
|
1068
|
+
/* @__PURE__ */ jsx11("tbody", { children: ledger.map((t2) => /* @__PURE__ */ jsxs11("tr", { children: [
|
|
1069
|
+
/* @__PURE__ */ jsx11("td", { style: { ...styles.td, ...styles.muted }, children: new Date(t2.createdAt).toLocaleString() }),
|
|
1070
|
+
/* @__PURE__ */ jsx11("td", { style: styles.td, children: t2.type }),
|
|
1071
|
+
/* @__PURE__ */ jsx11("td", { style: { ...styles.td, ...styles.mono }, children: t2.amount }),
|
|
1072
|
+
/* @__PURE__ */ jsx11("td", { style: { ...styles.td, ...styles.muted }, children: t2.description ?? "" })
|
|
1073
|
+
] }, t2.id)) })
|
|
1017
1074
|
] }),
|
|
1018
1075
|
hasMoreLedger ? /* @__PURE__ */ jsx11(
|
|
1019
1076
|
"button",
|
|
@@ -1122,7 +1179,7 @@ var NAV = [
|
|
|
1122
1179
|
group: "System",
|
|
1123
1180
|
items: [
|
|
1124
1181
|
{ page: "modules", label: "Modules" },
|
|
1125
|
-
{ page: "
|
|
1182
|
+
{ page: "environment", label: "Environment" },
|
|
1126
1183
|
{ page: "doctor", label: "Doctor" },
|
|
1127
1184
|
{ page: "routes", label: "Routes" }
|
|
1128
1185
|
]
|
|
@@ -1183,8 +1240,8 @@ function AdminShell({
|
|
|
1183
1240
|
case "doctor":
|
|
1184
1241
|
body = /* @__PURE__ */ jsx13(DoctorScreen, { client });
|
|
1185
1242
|
break;
|
|
1186
|
-
case "
|
|
1187
|
-
body = /* @__PURE__ */ jsx13(
|
|
1243
|
+
case "environment":
|
|
1244
|
+
body = /* @__PURE__ */ jsx13(EnvironmentScreen, { client });
|
|
1188
1245
|
break;
|
|
1189
1246
|
case "routes":
|
|
1190
1247
|
body = /* @__PURE__ */ jsx13(RoutesScreen, { client });
|
|
@@ -1248,7 +1305,7 @@ function AdminShell({
|
|
|
1248
1305
|
TemplateListScreen,
|
|
1249
1306
|
{
|
|
1250
1307
|
client: courierClient,
|
|
1251
|
-
onSelectTemplate: (
|
|
1308
|
+
onSelectTemplate: (t2) => setEditing({ kind: "template", type: t2.type })
|
|
1252
1309
|
}
|
|
1253
1310
|
);
|
|
1254
1311
|
break;
|
|
@@ -1284,8 +1341,8 @@ export {
|
|
|
1284
1341
|
AttentionScreen,
|
|
1285
1342
|
AuditScreen,
|
|
1286
1343
|
CatalogScreen,
|
|
1287
|
-
ConfigScreen,
|
|
1288
1344
|
DoctorScreen,
|
|
1345
|
+
EnvironmentScreen,
|
|
1289
1346
|
MigrationsScreen,
|
|
1290
1347
|
ModulesScreen,
|
|
1291
1348
|
RoutesScreen,
|