@fonderie/react-admin-screens 0.7.0 → 0.8.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.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: "system-ui, sans-serif",
12
- color: "#111"
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: "#888",
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: 6,
57
+ borderRadius: t.radius,
29
58
  padding: "6px 8px",
30
59
  cursor: "pointer",
31
60
  fontSize: 14,
32
- color: "#111"
61
+ color: t.text,
62
+ fontFamily: "inherit"
33
63
  },
34
- navItemActive: { background: "#f3f4f6", fontWeight: 600 },
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: { fontSize: 20, fontWeight: 700, marginTop: 0, marginBottom: 12 },
38
- subtitle: { fontSize: 15, fontWeight: 600, marginTop: 24, marginBottom: 8 },
39
- status: { padding: 12, color: "#666" },
40
- error: { color: "#e11d48", marginBottom: 12, fontSize: 14 },
41
- ok: { color: "#15803d", fontWeight: 600 },
42
- bad: { color: "#e11d48", fontWeight: 600 },
43
- advice: { color: "#b45309" },
44
- muted: { color: "#666", fontSize: 13 },
45
- mono: { fontFamily: "ui-monospace, monospace", fontSize: 13 },
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: "1px solid #ddd",
91
+ borderBottom: `1px solid ${t.border}`,
50
92
  padding: "6px 8px",
51
93
  fontWeight: 600,
52
- color: "#444"
94
+ color: t.muted
53
95
  },
54
- td: { borderBottom: "1px solid #eee", padding: "6px 8px", verticalAlign: "top" },
96
+ td: { borderBottom: `1px solid ${t.borderLight}`, padding: "6px 8px", verticalAlign: "top" },
55
97
  list: { listStyle: "none", padding: 0, margin: 0 },
56
- row: { borderBottom: "1px solid #eee", padding: "8px 0" },
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: "#f3f4f6"
104
+ background: t.surfaceAlt,
105
+ border: `1px solid ${t.border}`,
106
+ color: t.muted
63
107
  },
64
108
  button: {
65
- background: "none",
66
- border: "1px solid #ddd",
67
- borderRadius: 8,
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
- toolbar: { display: "flex", gap: 8, alignItems: "center", marginBottom: 12 }
129
+ accent: { color: t.accent }
73
130
  };
74
131
 
75
132
  // src/screens/AdminLogScreen.tsx
@@ -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((t) => {
416
- setMinted({ name: t.name, token: t.token });
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((t) => /* @__PURE__ */ jsxs8("tr", { children: [
526
+ /* @__PURE__ */ jsx8("tbody", { children: report.issued.map((t2) => /* @__PURE__ */ jsxs8("tr", { children: [
470
527
  /* @__PURE__ */ jsxs8("td", { style: styles.td, children: [
471
- t.name,
472
- t.revokedAt ? /* @__PURE__ */ jsx8("span", { style: styles.badge, children: " revoked" }) : null
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: t.scopes.join(", ") }),
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(t.createdAt).toLocaleDateString(),
533
+ new Date(t2.createdAt).toLocaleDateString(),
477
534
  " \xB7 ",
478
- t.createdBy
535
+ t2.createdBy
479
536
  ] }),
480
- /* @__PURE__ */ jsx8("td", { style: { ...styles.td, ...styles.muted }, children: t.expiresAt ? new Date(t.expiresAt).toLocaleDateString() : "never" }),
481
- /* @__PURE__ */ jsx8("td", { style: { ...styles.td, ...styles.muted }, children: t.lastUsedAt ? new Date(t.lastUsedAt).toLocaleString() : "never" }),
482
- /* @__PURE__ */ jsx8("td", { style: styles.td, children: t.revokedAt ? null : /* @__PURE__ */ jsx8(
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 "${t.name}"? Anything using it stops working immediately.`
546
+ `Revoke "${t2.name}"? Anything using it stops working immediately.`
490
547
  ))
491
- void revoke(t.id).catch(() => {
548
+ void revoke(t2.id).catch(() => {
492
549
  });
493
550
  },
494
551
  children: "Revoke"
495
552
  }
496
553
  ) })
497
- ] }, t.id)) })
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: "#f9fafb", padding: 12, overflowX: "auto" }, children: JSON.stringify(catalog.configured, null, 2) }),
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 = (t, id) => {
853
+ const open = (t2, id) => {
797
854
  setGranted(null);
798
- setType(t);
855
+ setType(t2);
799
856
  setIdInput(id);
800
- setSubscriber({ type: t, id });
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((t) => /* @__PURE__ */ jsxs11("tr", { children: [
1012
- /* @__PURE__ */ jsx11("td", { style: { ...styles.td, ...styles.muted }, children: new Date(t.createdAt).toLocaleString() }),
1013
- /* @__PURE__ */ jsx11("td", { style: styles.td, children: t.type }),
1014
- /* @__PURE__ */ jsx11("td", { style: { ...styles.td, ...styles.mono }, children: t.amount }),
1015
- /* @__PURE__ */ jsx11("td", { style: { ...styles.td, ...styles.muted }, children: t.description ?? "" })
1016
- ] }, t.id)) })
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",
@@ -1248,7 +1305,7 @@ function AdminShell({
1248
1305
  TemplateListScreen,
1249
1306
  {
1250
1307
  client: courierClient,
1251
- onSelectTemplate: (t) => setEditing({ kind: "template", type: t.type })
1308
+ onSelectTemplate: (t2) => setEditing({ kind: "template", type: t2.type })
1252
1309
  }
1253
1310
  );
1254
1311
  break;