@burdenoff/microfe-notification 2026.1202.1 → 2026.1203.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.
@@ -1,16 +1,17 @@
1
1
  import { useTr as e } from "../../shared/hooks/useTr.js";
2
- import { templateSlug as t } from "./templateText.js";
3
- import { ChoiceSelect as n } from "./ChoiceSelect.js";
4
- import { TEMPLATE_KINDS as r, isKind as i, kindWord as a } from "./words.js";
5
- import { useId as o, useState as s } from "react";
6
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
- import { Button as u, Input as d, Label as f, Notice as p, ResponsiveDialog as m, ResponsiveDialogContent as h, ResponsiveDialogDescription as g, ResponsiveDialogFooter as _, ResponsiveDialogHeader as v, ResponsiveDialogTitle as y, useNotify as b } from "@burdenoff/fe-libs/ui";
2
+ import { useNeedsConnection as t, waitingButton as n } from "../useNeedsConnection.js";
3
+ import { templateSlug as r } from "./templateText.js";
4
+ import { ChoiceSelect as i } from "./ChoiceSelect.js";
5
+ import { TEMPLATE_KINDS as a, isKind as o, kindWord as s } from "./words.js";
6
+ import { useId as c, useState as l } from "react";
7
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
8
+ import { Button as f, Input as p, Label as m, Notice as h, ResponsiveDialog as g, ResponsiveDialogContent as _, ResponsiveDialogDescription as v, ResponsiveDialogFooter as y, ResponsiveDialogHeader as b, ResponsiveDialogTitle as x, useNotify as S } from "@burdenoff/fe-libs/ui";
8
9
  // src/v2/admin/TopicDialog.tsx
9
- function x({ open: e, topic: t, onClose: n, onCreate: r, onUpdate: i }) {
10
- return /* @__PURE__ */ c(m, {
10
+ function C({ open: e, topic: t, onClose: n, onCreate: r, onUpdate: i }) {
11
+ return /* @__PURE__ */ u(g, {
11
12
  open: e,
12
13
  onOpenChange: (e) => e ? void 0 : n(),
13
- children: e ? /* @__PURE__ */ c(S, {
14
+ children: e ? /* @__PURE__ */ u(w, {
14
15
  topic: t,
15
16
  onClose: n,
16
17
  onCreate: r,
@@ -18,96 +19,96 @@ function x({ open: e, topic: t, onClose: n, onCreate: r, onUpdate: i }) {
18
19
  }, t?.id ?? "new") : null
19
20
  });
20
21
  }
21
- function S({ topic: m, onClose: x, onCreate: S, onUpdate: C }) {
22
- let w = e(), T = o(), E = b(), [D, O] = s(m?.name ?? ""), [k, A] = s(m?.description ?? ""), [j, M] = s(m && i(m.type) ? m.type : "MARKETING"), [N, P] = s(!1), [F, I] = s(!1), L = () => m ? C(m.id, {
23
- name: D.trim(),
24
- description: k.trim() || void 0
25
- }) : S({
26
- name: D.trim(),
27
- slug: t(D),
28
- description: k.trim() || void 0,
29
- type: j,
22
+ function w({ topic: g, onClose: C, onCreate: w, onUpdate: T }) {
23
+ let E = e(), D = t(), O = c(), k = S(), [A, j] = l(g?.name ?? ""), [M, N] = l(g?.description ?? ""), [P, F] = l(g && o(g.type) ? g.type : "MARKETING"), [I, L] = l(!1), [R, z] = l(!1), B = () => g ? T(g.id, {
24
+ name: A.trim(),
25
+ description: M.trim() || void 0
26
+ }) : w({
27
+ name: A.trim(),
28
+ slug: r(A),
29
+ description: M.trim() || void 0,
30
+ type: P,
30
31
  isActive: !0
31
- }), R = async () => {
32
- P(!0), I(!1);
32
+ }), V = async () => {
33
+ L(!0), z(!1);
33
34
  let e = null;
34
35
  try {
35
- e = await L();
36
+ e = await B();
36
37
  } catch {
37
38
  e = null;
38
39
  } finally {
39
- P(!1);
40
+ L(!1);
40
41
  }
41
- e ? (E({
42
- title: m ? w("notifications.v3.topics.saved", "Saved {{name}}", { name: e.name }) : w("notifications.v3.topics.created", "{{name}} is ready", { name: e.name }),
42
+ e ? (k({
43
+ title: g ? E("notifications.v3.topics.saved", "Saved {{name}}", { name: e.name }) : E("notifications.v3.topics.created", "{{name}} is ready", { name: e.name }),
43
44
  tone: "success"
44
- }), x()) : I(!0);
45
+ }), C()) : z(!0);
45
46
  };
46
- return /* @__PURE__ */ l(h, { children: [/* @__PURE__ */ l(v, { children: [/* @__PURE__ */ c(y, { children: m ? w("notifications.v3.topics.editTitle", "Edit topic") : w("notifications.v3.topics.new", "New topic") }), /* @__PURE__ */ c(g, { children: w("notifications.v3.topics.dialogHelp", "People see its name and line in their notification settings.") })] }), /* @__PURE__ */ l("form", {
47
+ return /* @__PURE__ */ d(_, { children: [/* @__PURE__ */ d(b, { children: [/* @__PURE__ */ u(x, { children: g ? E("notifications.v3.topics.editTitle", "Edit topic") : E("notifications.v3.topics.new", "New topic") }), /* @__PURE__ */ u(v, { children: E("notifications.v3.topics.dialogHelp", "People see its name and line in their notification settings.") })] }), /* @__PURE__ */ d("form", {
47
48
  className: "flex flex-col gap-4",
48
49
  onSubmit: (e) => {
49
- e.preventDefault(), D.trim().length > 1 && !N && R();
50
+ e.preventDefault(), A.trim().length > 1 && !I && V();
50
51
  },
51
52
  children: [
52
- /* @__PURE__ */ l("div", {
53
+ /* @__PURE__ */ d("div", {
53
54
  className: "flex flex-col gap-1.5",
54
- children: [/* @__PURE__ */ c(f, {
55
- htmlFor: `${T}-name`,
56
- children: w("notifications.v3.template.name", "Name")
57
- }), /* @__PURE__ */ c(d, {
58
- id: `${T}-name`,
55
+ children: [/* @__PURE__ */ u(m, {
56
+ htmlFor: `${O}-name`,
57
+ children: E("notifications.v3.template.name", "Name")
58
+ }), /* @__PURE__ */ u(p, {
59
+ id: `${O}-name`,
59
60
  autoFocus: !0,
60
- value: D,
61
- placeholder: w("notifications.v3.topics.namePlaceholder", "For example: Product news"),
62
- onChange: (e) => O(e.target.value),
61
+ value: A,
62
+ placeholder: E("notifications.v3.topics.namePlaceholder", "For example: Product news"),
63
+ onChange: (e) => j(e.target.value),
63
64
  "data-testid": "topic-name"
64
65
  })]
65
66
  }),
66
- /* @__PURE__ */ l("div", {
67
+ /* @__PURE__ */ d("div", {
67
68
  className: "flex flex-col gap-1.5",
68
- children: [/* @__PURE__ */ c(f, {
69
- htmlFor: `${T}-about`,
70
- children: w("notifications.v3.topics.about", "One line about it (optional)")
71
- }), /* @__PURE__ */ c(d, {
72
- id: `${T}-about`,
73
- value: k,
74
- onChange: (e) => A(e.target.value)
69
+ children: [/* @__PURE__ */ u(m, {
70
+ htmlFor: `${O}-about`,
71
+ children: E("notifications.v3.topics.about", "One line about it (optional)")
72
+ }), /* @__PURE__ */ u(p, {
73
+ id: `${O}-about`,
74
+ value: M,
75
+ onChange: (e) => N(e.target.value)
75
76
  })]
76
77
  }),
77
- /* @__PURE__ */ l("div", {
78
+ /* @__PURE__ */ d("div", {
78
79
  className: "flex flex-col gap-1.5",
79
- children: [/* @__PURE__ */ c(f, {
80
- htmlFor: `${T}-kind`,
81
- children: w("notifications.v3.template.kind", "About")
82
- }), /* @__PURE__ */ c(n, {
83
- id: `${T}-kind`,
84
- value: j,
85
- options: r,
86
- word: (e) => a(e, w),
87
- onChange: M,
88
- disabled: !!m
80
+ children: [/* @__PURE__ */ u(m, {
81
+ htmlFor: `${O}-kind`,
82
+ children: E("notifications.v3.template.kind", "About")
83
+ }), /* @__PURE__ */ u(i, {
84
+ id: `${O}-kind`,
85
+ value: P,
86
+ options: a,
87
+ word: (e) => s(e, E),
88
+ onChange: F,
89
+ disabled: !!g
89
90
  })]
90
91
  }),
91
- F ? /* @__PURE__ */ c(p, {
92
+ R ? /* @__PURE__ */ u(h, {
92
93
  tone: "bad",
93
94
  role: "alert",
94
- children: w("notifications.v3.templates.saveFailed", "Couldn’t save. Try again.")
95
+ children: E("notifications.v3.templates.saveFailed", "Couldn’t save. Try again.")
95
96
  }) : null,
96
- /* @__PURE__ */ l(_, { children: [/* @__PURE__ */ c(u, {
97
+ /* @__PURE__ */ d(y, { children: [/* @__PURE__ */ u(f, {
97
98
  type: "button",
98
99
  variant: "ghost",
99
- onClick: x,
100
- children: w("notifications.v3.cancel", "Cancel")
101
- }), /* @__PURE__ */ c(u, {
100
+ onClick: C,
101
+ children: E("notifications.v3.cancel", "Cancel")
102
+ }), /* @__PURE__ */ u(f, {
102
103
  type: "submit",
103
- busy: N,
104
- disabled: D.trim().length < 2,
104
+ busy: I,
105
+ ...n(D, A.trim().length < 2),
105
106
  "data-testid": "topic-save",
106
- children: m ? w("notifications.v3.template.save", "Save") : w("notifications.v3.topics.create", "Create topic")
107
+ children: g ? E("notifications.v3.template.save", "Save") : E("notifications.v3.topics.create", "Create topic")
107
108
  })] })
108
109
  ]
109
110
  })] });
110
111
  }
111
- export { x as TopicDialog };
112
+ export { C as TopicDialog };
112
113
 
113
114
  //# sourceMappingURL=TopicDialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TopicDialog.js","names":["TopicDialog","ResponsiveDialog","next","onClose","open","TopicForm","topic","tr","useTr","id","useId","notify","useNotify","name","setName","useState","description","setDescription","kind","setKind","isKind","busy","setBusy","failed","setFailed","send","onUpdate","onCreate","templateSlug","save","result","ResponsiveDialogContent","ResponsiveDialogHeader","ResponsiveDialogTitle","ResponsiveDialogDescription","event","Label","Input","ChoiceSelect","TEMPLATE_KINDS","kindWord","option","Notice","ResponsiveDialogFooter","Button"],"sources":["../../../src/v2/admin/TopicDialog.tsx"],"sourcesContent":["/**\n * New topic or Edit topic (BOFF-16785, C2): its name, one line about it, and what kind of\n * notifications it groups (set when it's made).\n */\nimport { useId, useState } from 'react';\nimport {\n Button,\n Input,\n Label,\n Notice,\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n useNotify,\n} from '@burdenoff/fe-libs/ui';\nimport type { NotificationTopic } from '../../types';\nimport type { useNotificationTopics } from '../../hooks/useNotificationTopics';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { templateSlug } from './templateText';\nimport { ChoiceSelect } from './ChoiceSelect';\nimport { isKind, kindWord, TEMPLATE_KINDS, type TemplateKind } from './words';\n\ntype Topics = ReturnType<typeof useNotificationTopics>;\n\nexport function TopicDialog({\n open,\n topic,\n onClose,\n onCreate,\n onUpdate,\n}: {\n open: boolean;\n topic: NotificationTopic | null;\n onClose: () => void;\n onCreate: Topics['createTopic'];\n onUpdate: Topics['updateTopic'];\n}) {\n return (\n <ResponsiveDialog open={open} onOpenChange={(next) => (next ? undefined : onClose())}>\n {open ? (\n <TopicForm\n key={topic?.id ?? 'new'}\n topic={topic}\n onClose={onClose}\n onCreate={onCreate}\n onUpdate={onUpdate}\n />\n ) : null}\n </ResponsiveDialog>\n );\n}\n\nfunction TopicForm({\n topic,\n onClose,\n onCreate,\n onUpdate,\n}: {\n topic: NotificationTopic | null;\n onClose: () => void;\n onCreate: Topics['createTopic'];\n onUpdate: Topics['updateTopic'];\n}) {\n const tr = useTr();\n const id = useId();\n const notify = useNotify();\n const [name, setName] = useState(topic?.name ?? '');\n const [description, setDescription] = useState(topic?.description ?? '');\n const [kind, setKind] = useState<TemplateKind>(\n topic && isKind(topic.type) ? topic.type : 'MARKETING'\n );\n const [busy, setBusy] = useState(false);\n const [failed, setFailed] = useState(false);\n\n const send = () =>\n topic\n ? onUpdate(topic.id, {\n name: name.trim(),\n description: description.trim() || undefined,\n })\n : onCreate({\n name: name.trim(),\n slug: templateSlug(name),\n description: description.trim() || undefined,\n type: kind,\n isActive: true,\n });\n\n const save = async () => {\n setBusy(true);\n setFailed(false);\n let result: NotificationTopic | null = null;\n try {\n result = await send();\n } catch {\n result = null;\n } finally {\n setBusy(false);\n }\n if (!result) {\n setFailed(true);\n return;\n }\n notify({\n title: topic\n ? tr('notifications.v3.topics.saved', 'Saved {{name}}', { name: result.name })\n : tr('notifications.v3.topics.created', '{{name}} is ready', { name: result.name }),\n tone: 'success',\n });\n onClose();\n };\n\n return (\n <ResponsiveDialogContent>\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>\n {topic\n ? tr('notifications.v3.topics.editTitle', 'Edit topic')\n : tr('notifications.v3.topics.new', 'New topic')}\n </ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n {tr(\n 'notifications.v3.topics.dialogHelp',\n 'People see its name and line in their notification settings.'\n )}\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n <form\n className=\"flex flex-col gap-4\"\n onSubmit={(event) => {\n event.preventDefault();\n if (name.trim().length > 1 && !busy) void save();\n }}\n >\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor={`${id}-name`}>{tr('notifications.v3.template.name', 'Name')}</Label>\n <Input\n id={`${id}-name`}\n autoFocus\n value={name}\n placeholder={tr('notifications.v3.topics.namePlaceholder', 'For example: Product news')}\n onChange={(event) => setName(event.target.value)}\n data-testid=\"topic-name\"\n />\n </div>\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor={`${id}-about`}>\n {tr('notifications.v3.topics.about', 'One line about it (optional)')}\n </Label>\n <Input\n id={`${id}-about`}\n value={description}\n onChange={(event) => setDescription(event.target.value)}\n />\n </div>\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor={`${id}-kind`}>{tr('notifications.v3.template.kind', 'About')}</Label>\n <ChoiceSelect\n id={`${id}-kind`}\n value={kind}\n options={TEMPLATE_KINDS}\n word={(option) => kindWord(option, tr)}\n onChange={setKind}\n disabled={Boolean(topic)}\n />\n </div>\n {failed ? (\n <Notice tone=\"bad\" role=\"alert\">\n {tr('notifications.v3.templates.saveFailed', 'Couldn’t save. Try again.')}\n </Notice>\n ) : null}\n <ResponsiveDialogFooter>\n <Button type=\"button\" variant=\"ghost\" onClick={onClose}>\n {tr('notifications.v3.cancel', 'Cancel')}\n </Button>\n <Button\n type=\"submit\"\n busy={busy}\n disabled={name.trim().length < 2}\n data-testid=\"topic-save\"\n >\n {topic\n ? tr('notifications.v3.template.save', 'Save')\n : tr('notifications.v3.topics.create', 'Create topic')}\n </Button>\n </ResponsiveDialogFooter>\n </form>\n </ResponsiveDialogContent>\n );\n}\n"],"mappings":";;;;;;;;AA2BA,SAAgBA,EAAY,EAC1B,SACA,UACA,YACA,aACA,eAOC;CACD,OACE,kBAACC,GAAD;EAAwB;EAAM,eAAe,MAAUC,IAAO,KAAA,IAAYC,EAAQ;EAC/E,UAAA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,2BAA2B;GAClE,CAAA,IACN;GACJ,kBAACoC,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD;IAAQ,MAAK;IAAS,SAAQ;IAAQ,SAASzC;IAC5C,UAAAI,EAAG,2BAA2B,QAAQ;GACjC,CAAA,GACR,kBAACqC,GAAD;IACE,MAAK;IACC;IACN,UAAU/B,EAAK,KAAK,CAAC,CAAC,SAAS;IAC/B,eAAY;IAEX,UAAAP,IACGC,EAAG,kCAAkC,MAAM,IAC3CA,EAAG,kCAAkC,cAAc;GACjD,CAAA,CACc,EAAA,CAAA;EACpB;CACiB,CAAA,CAAA,EAAA,CAAA;AAE7B"}
1
+ {"version":3,"file":"TopicDialog.js","names":["TopicDialog","ResponsiveDialog","next","onClose","open","TopicForm","topic","tr","useTr","connection","useNeedsConnection","id","useId","notify","useNotify","name","setName","useState","description","setDescription","kind","setKind","isKind","busy","setBusy","failed","setFailed","send","onUpdate","onCreate","templateSlug","save","result","ResponsiveDialogContent","ResponsiveDialogHeader","ResponsiveDialogTitle","ResponsiveDialogDescription","event","Label","Input","ChoiceSelect","TEMPLATE_KINDS","kindWord","option","Notice","ResponsiveDialogFooter","Button","waitingButton"],"sources":["../../../src/v2/admin/TopicDialog.tsx"],"sourcesContent":["/**\n * New topic or Edit topic (BOFF-16785, C2): its name, one line about it, and what kind of\n * notifications it groups (set when it's made).\n */\nimport { useId, useState } from 'react';\nimport {\n Button,\n Input,\n Label,\n Notice,\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n useNotify,\n} from '@burdenoff/fe-libs/ui';\nimport type { NotificationTopic } from '../../types';\nimport type { useNotificationTopics } from '../../hooks/useNotificationTopics';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { useNeedsConnection, waitingButton } from '../useNeedsConnection';\nimport { templateSlug } from './templateText';\nimport { ChoiceSelect } from './ChoiceSelect';\nimport { isKind, kindWord, TEMPLATE_KINDS, type TemplateKind } from './words';\n\ntype Topics = ReturnType<typeof useNotificationTopics>;\n\nexport function TopicDialog({\n open,\n topic,\n onClose,\n onCreate,\n onUpdate,\n}: {\n open: boolean;\n topic: NotificationTopic | null;\n onClose: () => void;\n onCreate: Topics['createTopic'];\n onUpdate: Topics['updateTopic'];\n}) {\n return (\n <ResponsiveDialog open={open} onOpenChange={(next) => (next ? undefined : onClose())}>\n {open ? (\n <TopicForm\n key={topic?.id ?? 'new'}\n topic={topic}\n onClose={onClose}\n onCreate={onCreate}\n onUpdate={onUpdate}\n />\n ) : null}\n </ResponsiveDialog>\n );\n}\n\nfunction TopicForm({\n topic,\n onClose,\n onCreate,\n onUpdate,\n}: {\n topic: NotificationTopic | null;\n onClose: () => void;\n onCreate: Topics['createTopic'];\n onUpdate: Topics['updateTopic'];\n}) {\n const tr = useTr();\n const connection = useNeedsConnection();\n const id = useId();\n const notify = useNotify();\n const [name, setName] = useState(topic?.name ?? '');\n const [description, setDescription] = useState(topic?.description ?? '');\n const [kind, setKind] = useState<TemplateKind>(\n topic && isKind(topic.type) ? topic.type : 'MARKETING'\n );\n const [busy, setBusy] = useState(false);\n const [failed, setFailed] = useState(false);\n\n const send = () =>\n topic\n ? onUpdate(topic.id, {\n name: name.trim(),\n description: description.trim() || undefined,\n })\n : onCreate({\n name: name.trim(),\n slug: templateSlug(name),\n description: description.trim() || undefined,\n type: kind,\n isActive: true,\n });\n\n const save = async () => {\n setBusy(true);\n setFailed(false);\n let result: NotificationTopic | null = null;\n try {\n result = await send();\n } catch {\n result = null;\n } finally {\n setBusy(false);\n }\n if (!result) {\n setFailed(true);\n return;\n }\n notify({\n title: topic\n ? tr('notifications.v3.topics.saved', 'Saved {{name}}', { name: result.name })\n : tr('notifications.v3.topics.created', '{{name}} is ready', { name: result.name }),\n tone: 'success',\n });\n onClose();\n };\n\n return (\n <ResponsiveDialogContent>\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>\n {topic\n ? tr('notifications.v3.topics.editTitle', 'Edit topic')\n : tr('notifications.v3.topics.new', 'New topic')}\n </ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n {tr(\n 'notifications.v3.topics.dialogHelp',\n 'People see its name and line in their notification settings.'\n )}\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n <form\n className=\"flex flex-col gap-4\"\n onSubmit={(event) => {\n event.preventDefault();\n if (name.trim().length > 1 && !busy) void save();\n }}\n >\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor={`${id}-name`}>{tr('notifications.v3.template.name', 'Name')}</Label>\n <Input\n id={`${id}-name`}\n autoFocus\n value={name}\n placeholder={tr('notifications.v3.topics.namePlaceholder', 'For example: Product news')}\n onChange={(event) => setName(event.target.value)}\n data-testid=\"topic-name\"\n />\n </div>\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor={`${id}-about`}>\n {tr('notifications.v3.topics.about', 'One line about it (optional)')}\n </Label>\n <Input\n id={`${id}-about`}\n value={description}\n onChange={(event) => setDescription(event.target.value)}\n />\n </div>\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor={`${id}-kind`}>{tr('notifications.v3.template.kind', 'About')}</Label>\n <ChoiceSelect\n id={`${id}-kind`}\n value={kind}\n options={TEMPLATE_KINDS}\n word={(option) => kindWord(option, tr)}\n onChange={setKind}\n disabled={Boolean(topic)}\n />\n </div>\n {failed ? (\n <Notice tone=\"bad\" role=\"alert\">\n {tr('notifications.v3.templates.saveFailed', 'Couldn’t save. Try again.')}\n </Notice>\n ) : null}\n <ResponsiveDialogFooter>\n <Button type=\"button\" variant=\"ghost\" onClick={onClose}>\n {tr('notifications.v3.cancel', 'Cancel')}\n </Button>\n <Button\n type=\"submit\"\n busy={busy}\n {...waitingButton(connection, name.trim().length < 2)}\n data-testid=\"topic-save\"\n >\n {topic\n ? tr('notifications.v3.template.save', 'Save')\n : tr('notifications.v3.topics.create', 'Create topic')}\n </Button>\n </ResponsiveDialogFooter>\n </form>\n </ResponsiveDial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7B,EAAG;KACV,OAAOS;KACP,SAASqB;KACT,OAAO,MAAWC,EAASC,GAAQpC,CAAE;KACrC,UAAUc;KACV,UAAU,EAAQf;IACnB,CAAA,CACE;;GACJmB,IACC,kBAACmB,GAAD;IAAQ,MAAK;IAAM,MAAK;IACrB,UAAArC,EAAG,yCAAyC,2BAA2B;GAClE,CAAA,IACN;GACJ,kBAACsC,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD;IAAQ,MAAK;IAAS,SAAQ;IAAQ,SAAS3C;IAC5C,UAAAI,EAAG,2BAA2B,QAAQ;GACjC,CAAA,GACR,kBAACuC,GAAD;IACE,MAAK;IACC;IACN,GAAIC,EAActC,GAAYM,EAAK,KAAK,CAAC,CAAC,SAAS,CAAC;IACpD,eAAY;IAEX,UAAAT,IACGC,EAAG,kCAAkC,MAAM,IAC3CA,EAAG,kCAAkC,cAAc;GACjD,CAAA,CACc,EAAA,CAAA;EACpB;CACiB,CAAA,CAAA,EAAA,CAAA;AAE7B"}
@@ -1,150 +1,153 @@
1
1
  import { useNotificationTopics as e } from "../../hooks/useNotificationTopics.js";
2
2
  import { useTr as t } from "../../shared/hooks/useTr.js";
3
- import { useNotificationPaths as n } from "../../navigation-v2/paths.js";
4
- import { AdminPageV2 as r } from "../../navigation-v2/AdminPageV2.js";
5
- import { kindWord as i } from "./words.js";
6
- import { TopicDialog as a } from "./TopicDialog.js";
7
- import { StaleHint as o } from "../StaleHint.js";
8
- import { useState as s } from "react";
9
- import { Plus as c, Tag as l } from "lucide-react";
10
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
11
- import { PageHeader as f } from "@burdenoff/fe-libs/chrome";
12
- import { ActionMenu as p, Button as m, DataRows as h, EmptyState as g, IconTile as _, LoadError as v, StatusChip as y, WorkspacePage as b, useConfirm as x, useNotify as S } from "@burdenoff/fe-libs/ui";
3
+ import { useConnectionGate as n, useNeedsConnection as r, waitingItem as i } from "../useNeedsConnection.js";
4
+ import { useNotificationPaths as a } from "../../navigation-v2/paths.js";
5
+ import { AdminPageV2 as o } from "../../navigation-v2/AdminPageV2.js";
6
+ import { kindWord as s } from "./words.js";
7
+ import { TopicDialog as c } from "./TopicDialog.js";
8
+ import { StaleHint as l } from "../StaleHint.js";
9
+ import { useState as u } from "react";
10
+ import { Plus as d, Tag as f } from "lucide-react";
11
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
12
+ import { PageHeader as h } from "@burdenoff/fe-libs/chrome";
13
+ import { ActionMenu as g, Button as _, DataRows as v, EmptyState as y, IconTile as b, LoadError as x, StatusChip as S, WorkspacePage as C, useConfirm as w, useNotify as T } from "@burdenoff/fe-libs/ui";
13
14
  // src/v2/admin/TopicsPage.tsx
14
- var C = new Intl.NumberFormat();
15
- function w() {
16
- return /* @__PURE__ */ u(r, {
15
+ var E = new Intl.NumberFormat();
16
+ function D() {
17
+ return /* @__PURE__ */ p(o, {
17
18
  tool: "topics",
18
19
  back: !1,
19
- children: /* @__PURE__ */ u(T, {})
20
+ children: /* @__PURE__ */ p(O, {})
20
21
  });
21
22
  }
22
- function T() {
23
- let r = t(), w = n(), T = x(), E = S(), D = e(), [O, k] = s(null), A = async (e) => {
24
- let t = await D.updateTopic(e.id, { isActive: !e.isActive });
25
- E(t ? {
26
- title: e.isActive ? r("notifications.v3.topics.turnedOff", "{{name}} is off", { name: e.name }) : r("notifications.v3.topics.turnedOn", "{{name}} is on", { name: e.name }),
23
+ function O() {
24
+ let o = t(), D = r(), O = a(), k = w(), A = n(), j = T(), M = e(), [N, P] = u(null), F = async (e) => {
25
+ let t = await M.updateTopic(e.id, { isActive: !e.isActive });
26
+ j(t ? {
27
+ title: e.isActive ? o("notifications.v3.topics.turnedOff", "{{name}} is off", { name: e.name }) : o("notifications.v3.topics.turnedOn", "{{name}} is on", { name: e.name }),
27
28
  tone: "success"
28
29
  } : {
29
- title: r("notifications.v3.templates.saveFailed", "Couldn’t save. Try again."),
30
+ title: o("notifications.v3.templates.saveFailed", "Couldn’t save. Try again."),
30
31
  tone: "error"
31
32
  });
32
- }, j = async (e) => {
33
- if (!await T({
34
- title: r("notifications.v3.topics.deleteTitle", "Delete {{name}}?", { name: e.name }),
35
- description: r("notifications.v3.topics.deleteBody", "People stop being able to choose it in their settings."),
36
- confirmLabel: r("notifications.v3.templates.delete", "Delete"),
33
+ }, I = async (e) => {
34
+ if (!await k({
35
+ title: o("notifications.v3.topics.deleteTitle", "Delete {{name}}?", { name: e.name }),
36
+ description: o("notifications.v3.topics.deleteBody", "People stop being able to choose it in their settings."),
37
+ confirmLabel: o("notifications.v3.templates.delete", "Delete"),
37
38
  tone: "danger",
38
39
  typeToConfirm: e.name
39
- })) return;
40
- let t = await D.deleteTopic(e.id);
41
- E(t ? {
42
- title: r("notifications.v3.templates.deleted", "Deleted {{name}}", { name: e.name }),
40
+ }) || A()) return;
41
+ let t = await M.deleteTopic(e.id);
42
+ j(t ? {
43
+ title: o("notifications.v3.templates.deleted", "Deleted {{name}}", { name: e.name }),
43
44
  tone: "success"
44
45
  } : {
45
- title: r("notifications.v3.templates.deleteFailed", "Couldn’t delete it. Try again."),
46
+ title: o("notifications.v3.templates.deleteFailed", "Couldn’t delete it. Try again."),
46
47
  tone: "error"
47
48
  });
48
49
  };
49
- return /* @__PURE__ */ d(b, { children: [
50
- /* @__PURE__ */ u(f, {
50
+ return /* @__PURE__ */ m(C, { children: [
51
+ /* @__PURE__ */ p(h, {
51
52
  variant: "compact",
52
- title: r("notifications.v3.topics.title", "Topics"),
53
- description: r("notifications.v3.topics.purpose", "Groups of notifications people can turn on or off."),
53
+ title: o("notifications.v3.topics.title", "Topics"),
54
+ description: o("notifications.v3.topics.purpose", "Groups of notifications people can turn on or off."),
54
55
  back: {
55
- label: r("notifications.v3.title", "Notifications"),
56
- to: w.inbox
56
+ label: o("notifications.v3.title", "Notifications"),
57
+ to: O.inbox
57
58
  },
58
- primary: /* @__PURE__ */ d(m, {
59
- onClick: () => k("new"),
59
+ primary: /* @__PURE__ */ m(_, {
60
+ onClick: () => P("new"),
60
61
  "data-testid": "topics-new",
61
- children: [/* @__PURE__ */ u(c, { "aria-hidden": "true" }), r("notifications.v3.topics.new", "New topic")]
62
+ children: [/* @__PURE__ */ p(d, { "aria-hidden": "true" }), o("notifications.v3.topics.new", "New topic")]
62
63
  })
63
64
  }),
64
- /* @__PURE__ */ u(o, { loadedAt: D.dataUpdatedAt }),
65
- D.error && D.topics.length === 0 ? /* @__PURE__ */ u(v, {
66
- what: r("notifications.v3.topics.title", "Topics"),
67
- error: D.error,
68
- onRetry: () => void D.refetch()
69
- }) : !D.isLoading && D.topics.length === 0 ? /* @__PURE__ */ u(g, {
65
+ /* @__PURE__ */ p(l, { loadedAt: M.dataUpdatedAt }),
66
+ M.error && M.topics.length === 0 ? /* @__PURE__ */ p(x, {
67
+ what: o("notifications.v3.topics.title", "Topics"),
68
+ error: M.error,
69
+ onRetry: () => void M.refetch()
70
+ }) : !M.isLoading && M.topics.length === 0 ? /* @__PURE__ */ p(y, {
70
71
  kind: "first-use",
71
- title: r("notifications.v3.topics.emptyTitle", "No topics yet"),
72
- description: r("notifications.v3.topics.emptyBody", "Topics let people choose what they hear about, like “Billing” or “Product news”."),
73
- action: /* @__PURE__ */ u(m, {
74
- onClick: () => k("new"),
75
- children: r("notifications.v3.topics.new", "New topic")
72
+ title: o("notifications.v3.topics.emptyTitle", "No topics yet"),
73
+ description: o("notifications.v3.topics.emptyBody", "Topics let people choose what they hear about, like “Billing” or “Product news”."),
74
+ action: /* @__PURE__ */ p(_, {
75
+ onClick: () => P("new"),
76
+ children: o("notifications.v3.topics.new", "New topic")
76
77
  })
77
- }) : /* @__PURE__ */ u(h, {
78
- items: D.topics,
79
- loading: D.isLoading && D.topics.length === 0,
78
+ }) : /* @__PURE__ */ p(v, {
79
+ items: M.topics,
80
+ loading: M.isLoading && M.topics.length === 0,
80
81
  skeletonRows: 4,
81
82
  getId: (e) => e.id,
82
- label: r("notifications.v3.topics.title", "Topics"),
83
+ label: o("notifications.v3.topics.title", "Topics"),
83
84
  lead: {
84
- header: r("notifications.v3.topics.topic", "Topic"),
85
- media: () => /* @__PURE__ */ u(_, {
85
+ header: o("notifications.v3.topics.topic", "Topic"),
86
+ media: () => /* @__PURE__ */ p(b, {
86
87
  size: "sm",
87
- children: /* @__PURE__ */ u(l, { "aria-hidden": "true" })
88
+ children: /* @__PURE__ */ p(f, { "aria-hidden": "true" })
88
89
  }),
89
90
  title: (e) => e.name,
90
91
  subtitle: (e) => e.description || void 0,
91
- onOpen: (e) => k(e)
92
+ onOpen: (e) => P(e)
92
93
  },
93
94
  columns: [
94
95
  {
95
96
  id: "people",
96
- header: r("notifications.v3.topics.people", "Following"),
97
- cell: (e) => C.format(e.subscriberCount ?? 0)
97
+ header: o("notifications.v3.topics.people", "Following"),
98
+ cell: (e) => E.format(e.subscriberCount ?? 0)
98
99
  },
99
100
  {
100
101
  id: "kind",
101
- header: r("notifications.v3.templates.kind", "About"),
102
- cell: (e) => i(e.type, r)
102
+ header: o("notifications.v3.templates.kind", "About"),
103
+ cell: (e) => s(e.type, o)
103
104
  },
104
105
  {
105
106
  id: "status",
106
- header: r("notifications.v3.templates.status", "Status"),
107
- cell: (e) => e.isActive ? /* @__PURE__ */ u(y, {
107
+ header: o("notifications.v3.templates.status", "Status"),
108
+ cell: (e) => e.isActive ? /* @__PURE__ */ p(S, {
108
109
  status: "ok",
109
- children: r("notifications.v3.on", "On")
110
- }) : /* @__PURE__ */ u(y, {
110
+ children: o("notifications.v3.on", "On")
111
+ }) : /* @__PURE__ */ p(S, {
111
112
  status: "paused",
112
- children: r("notifications.v3.off", "Off")
113
+ children: o("notifications.v3.off", "Off")
113
114
  })
114
115
  }
115
116
  ],
116
- actions: (e) => /* @__PURE__ */ u(p, {
117
+ actions: (e) => /* @__PURE__ */ p(g, {
117
118
  placement: "row",
118
- label: r("notifications.v3.templates.actionsFor", "Actions for {{name}}", { name: e.name }),
119
+ label: o("notifications.v3.templates.actionsFor", "Actions for {{name}}", { name: e.name }),
119
120
  items: [
120
121
  {
121
122
  id: "edit",
122
- label: r("notifications.v3.topics.edit", "Edit"),
123
- onSelect: () => k(e)
123
+ label: o("notifications.v3.topics.edit", "Edit"),
124
+ onSelect: () => P(e)
124
125
  },
125
126
  {
126
127
  id: "toggle",
127
- label: e.isActive ? r("notifications.v3.templates.turnOff", "Turn off") : r("notifications.v3.templates.turnOn", "Turn on"),
128
- onSelect: () => void A(e)
128
+ label: e.isActive ? o("notifications.v3.templates.turnOff", "Turn off") : o("notifications.v3.templates.turnOn", "Turn on"),
129
+ ...i(D),
130
+ onSelect: () => void F(e)
129
131
  },
130
132
  {
131
133
  id: "delete",
132
- label: r("notifications.v3.templates.delete", "Delete"),
134
+ label: o("notifications.v3.templates.delete", "Delete"),
133
135
  danger: !0,
134
- onSelect: () => void j(e)
136
+ ...i(D),
137
+ onSelect: () => void I(e)
135
138
  }
136
139
  ]
137
140
  })
138
141
  }),
139
- /* @__PURE__ */ u(a, {
140
- open: O !== null,
141
- topic: O === "new" ? null : O,
142
- onClose: () => k(null),
143
- onCreate: D.createTopic,
144
- onUpdate: D.updateTopic
142
+ /* @__PURE__ */ p(c, {
143
+ open: N !== null,
144
+ topic: N === "new" ? null : N,
145
+ onClose: () => P(null),
146
+ onCreate: M.createTopic,
147
+ onUpdate: M.updateTopic
145
148
  })
146
149
  ] });
147
150
  }
148
- export { w as TopicsPage };
151
+ export { D as TopicsPage };
149
152
 
150
153
  //# sourceMappingURL=TopicsPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TopicsPage.js","names":["COUNT","TopicsPage","AdminPageV2","TopicsList","tr","useTr","paths","useNotificationPaths","confirm","useConfirm","notify","useNotify","topics","useNotificationTopics","editing","setEditing","useState","toggle","result","topic","remove","done","WorkspacePage","PageHeader","Button","Plus","StaleHint","LoadError","EmptyState","DataRows","IconTile","Tag","kindWord","StatusChip","ActionMenu","TopicDialog"],"sources":["../../../src/v2/admin/TopicsPage.tsx"],"sourcesContent":["/**\n * Topics (BOFF-16785, C2; the mockup's `ntopics`), under fe-libs' `accountPagesV2`: the groups of\n * notifications people can turn on or off. A row each (who follows it, what it's about, on or off),\n * New topic and Edit in a short dialog, and ⋯ (turn off or on, delete). Admins only\n * (`AdminPageV2`). Today's hook and storage.\n */\nimport { useState } from 'react';\nimport { Plus, Tag } from 'lucide-react';\nimport { PageHeader } from '@burdenoff/fe-libs/chrome';\nimport {\n ActionMenu,\n Button,\n DataRows,\n EmptyState,\n IconTile,\n LoadError,\n StatusChip,\n WorkspacePage,\n useConfirm,\n useNotify,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotificationTopics } from '../../hooks';\nimport type { NotificationTopic } from '../../types';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { useNotificationPaths } from '../../navigation-v2/paths';\nimport { AdminPageV2 } from '../../navigation-v2/AdminPageV2';\nimport { kindWord } from './words';\nimport { TopicDialog } from './TopicDialog';\nimport { StaleHint } from '../StaleHint';\n\nconst COUNT = new Intl.NumberFormat();\n\nexport function TopicsPage() {\n return (\n <AdminPageV2 tool=\"topics\" back={false}>\n <TopicsList />\n </AdminPageV2>\n );\n}\n\nfunction TopicsList() {\n const tr = useTr();\n const paths = useNotificationPaths();\n const confirm = useConfirm();\n const notify = useNotify();\n const topics = useNotificationTopics();\n const [editing, setEditing] = useState<NotificationTopic | 'new' | null>(null);\n\n const toggle = async (topic: NotificationTopic) => {\n const result = await topics.updateTopic(topic.id, { isActive: !topic.isActive });\n notify(\n result\n ? {\n title: topic.isActive\n ? tr('notifications.v3.topics.turnedOff', '{{name}} is off', { name: topic.name })\n : tr('notifications.v3.topics.turnedOn', '{{name}} is on', { name: topic.name }),\n tone: 'success',\n }\n : {\n title: tr('notifications.v3.templates.saveFailed', 'Couldn’t save. Try again.'),\n tone: 'error',\n }\n );\n };\n\n const remove = async (topic: NotificationTopic) => {\n const yes = await confirm({\n title: tr('notifications.v3.topics.deleteTitle', 'Delete {{name}}?', { name: topic.name }),\n description: tr(\n 'notifications.v3.topics.deleteBody',\n 'People stop being able to choose it in their settings.'\n ),\n confirmLabel: tr('notifications.v3.templates.delete', 'Delete'),\n tone: 'danger',\n typeToConfirm: topic.name,\n });\n if (!yes) return;\n const done = await topics.deleteTopic(topic.id);\n notify(\n done\n ? {\n title: tr('notifications.v3.templates.deleted', 'Deleted {{name}}', {\n name: topic.name,\n }),\n tone: 'success',\n }\n : {\n title: tr('notifications.v3.templates.deleteFailed', 'Couldn’t delete it. Try again.'),\n tone: 'error',\n }\n );\n };\n\n return (\n <WorkspacePage>\n <PageHeader\n variant=\"compact\"\n title={tr('notifications.v3.topics.title', 'Topics')}\n description={tr(\n 'notifications.v3.topics.purpose',\n 'Groups of notifications people can turn on or off.'\n )}\n back={{ label: tr('notifications.v3.title', 'Notifications'), to: paths.inbox }}\n primary={\n <Button onClick={() => setEditing('new')} data-testid=\"topics-new\">\n <Plus aria-hidden=\"true\" />\n {tr('notifications.v3.topics.new', 'New topic')}\n </Button>\n }\n />\n <StaleHint loadedAt={topics.dataUpdatedAt} />\n {topics.error && topics.topics.length === 0 ? (\n <LoadError\n what={tr('notifications.v3.topics.title', 'Topics')}\n error={topics.error}\n onRetry={() => void topics.refetch()}\n />\n ) : !topics.isLoading && topics.topics.length === 0 ? (\n <EmptyState\n kind=\"first-use\"\n title={tr('notifications.v3.topics.emptyTitle', 'No topics yet')}\n description={tr(\n 'notifications.v3.topics.emptyBody',\n 'Topics let people choose what they hear about, like “Billing” or “Product news”.'\n )}\n action={\n <Button onClick={() => setEditing('new')}>\n {tr('notifications.v3.topics.new', 'New topic')}\n </Button>\n }\n />\n ) : (\n <DataRows\n items={topics.topics}\n loading={topics.isLoading && topics.topics.length === 0}\n skeletonRows={4}\n getId={(topic) => topic.id}\n label={tr('notifications.v3.topics.title', 'Topics')}\n lead={{\n header: tr('notifications.v3.topics.topic', 'Topic'),\n media: () => (\n <IconTile size=\"sm\">\n <Tag aria-hidden=\"true\" />\n </IconTile>\n ),\n title: (topic) => topic.name,\n subtitle: (topic) => topic.description || undefined,\n onOpen: (topic) => setEditing(topic),\n }}\n columns={[\n {\n id: 'people',\n header: tr('notifications.v3.topics.people', 'Following'),\n cell: (topic) => COUNT.format(topic.subscriberCount ?? 0),\n },\n {\n id: 'kind',\n header: tr('notifications.v3.templates.kind', 'About'),\n cell: (topic) => kindWord(topic.type, tr),\n },\n {\n id: 'status',\n header: tr('notifications.v3.templates.status', 'Status'),\n cell: (topic) =>\n topic.isActive ? (\n <StatusChip status=\"ok\">{tr('notifications.v3.on', 'On')}</StatusChip>\n ) : (\n <StatusChip status=\"paused\">{tr('notifications.v3.off', 'Off')}</StatusChip>\n ),\n },\n ]}\n actions={(topic) => (\n <ActionMenu\n placement=\"row\"\n label={tr('notifications.v3.templates.actionsFor', 'Actions for {{name}}', {\n name: topic.name,\n })}\n items={[\n {\n id: 'edit',\n label: tr('notifications.v3.topics.edit', 'Edit'),\n onSelect: () => setEditing(topic),\n },\n {\n id: 'toggle',\n label: topic.isActive\n ? tr('notifications.v3.templates.turnOff', 'Turn off')\n : tr('notifications.v3.templates.turnOn', 'Turn on'),\n onSelect: () => void toggle(topic),\n },\n {\n id: 'delete',\n label: tr('notifications.v3.templates.delete', 'Delete'),\n danger: true,\n onSelect: () => void remove(topic),\n },\n ]}\n />\n )}\n />\n )}\n <TopicDialog\n open={editing !== null}\n topic={editing === 'new' ? null : editing}\n onClose={() => setEditing(null)}\n onCreate={topics.createTopic}\n onUpdate={topics.updateTopic}\n />\n </WorkspacePage>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA8BA,IAAMA,IAAQ,IAAI,KAAK,aAAa;AAEpC,SAAgBC,IAAa;CAC3B,OACE,kBAACC,GAAD;EAAa,MAAK;EAAS,MAAM;EAC/B,UAAA,kBAACC,GAAD,CAAa,CAAA;CACF,CAAA;AAEjB;AAEA,SAASA,IAAa;CACpB,IAAMC,IAAKC,EAAM,GACXC,IAAQC,EAAqB,GAC7BC,IAAUC,EAAW,GACrBC,IAASC,EAAU,GACnBC,IAASC,EAAsB,GA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AErE,kBAAC6B,GAAD;MAAY,QAAO;MAAU,UAAA7B,EAAG,wBAAwB,KAAK;KAAc,CAAA;IAEjF;GACF;GACA,UAAU,MACR,kBAAC8B,GAAD;IACE,WAAU;IACV,OAAO9B,EAAG,yCAAyC,wBAAwB,EACzE,MAAMe,EAAM,KACd,CAAC;IACD,OAAO;KACL;MACE,IAAI;MACJ,OAAOf,EAAG,gCAAgC,MAAM;MAChD,gBAAgBW,EAAWI,CAAK;KAClC;KACA;MACE,IAAI;MACJ,OAAOA,EAAM,WACTf,EAAG,sCAAsC,UAAU,IACnDA,EAAG,qCAAqC,SAAS;MACrD,gBAAgB,KAAKa,EAAOE,CAAK;KACnC;KACA;MACE,IAAI;MACJ,OAAOf,EAAG,qCAAqC,QAAQ;MACvD,QAAQ;MACR,gBAAgB,KAAKgB,EAAOD,CAAK;KACnC;IACF;GACD,CAAA;EAEJ,CAAA;EAEH,kBAACgB,GAAD;GACE,MAAMrB,MAAY;GAClB,OAAOA,MAAY,QAAQ,OAAOA;GAClC,eAAeC,EAAW,IAAI;GAC9B,UAAUH,EAAO;GACjB,UAAUA,EAAO;EAClB,CAAA;CACY,EAAA,CAAA;AAEnB"}
1
+ {"version":3,"file":"TopicsPage.js","names":["COUNT","TopicsPage","AdminPageV2","TopicsList","tr","useTr","connection","useNeedsConnection","paths","useNotificationPaths","confirm","useConfirm","gate","useConnectionGate","notify","useNotify","topics","useNotificationTopics","editing","setEditing","useState","toggle","result","topic","remove","done","WorkspacePage","PageHeader","Button","Plus","StaleHint","LoadError","EmptyState","DataRows","IconTile","Tag","kindWord","StatusChip","ActionMenu","waitingItem","TopicDialog"],"sources":["../../../src/v2/admin/TopicsPage.tsx"],"sourcesContent":["/**\n * Topics (BOFF-16785, C2; the mockup's `ntopics`), under fe-libs' `accountPagesV2`: the groups of\n * notifications people can turn on or off. A row each (who follows it, what it's about, on or off),\n * New topic and Edit in a short dialog, and ⋯ (turn off or on, delete). Admins only\n * (`AdminPageV2`). Today's hook and storage.\n */\nimport { useState } from 'react';\nimport { Plus, Tag } from 'lucide-react';\nimport { PageHeader } from '@burdenoff/fe-libs/chrome';\nimport {\n ActionMenu,\n Button,\n DataRows,\n EmptyState,\n IconTile,\n LoadError,\n StatusChip,\n WorkspacePage,\n useConfirm,\n useNotify,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotificationTopics } from '../../hooks';\nimport type { NotificationTopic } from '../../types';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { useConnectionGate, useNeedsConnection, waitingItem } from '../useNeedsConnection';\nimport { useNotificationPaths } from '../../navigation-v2/paths';\nimport { AdminPageV2 } from '../../navigation-v2/AdminPageV2';\nimport { kindWord } from './words';\nimport { TopicDialog } from './TopicDialog';\nimport { StaleHint } from '../StaleHint';\n\nconst COUNT = new Intl.NumberFormat();\n\nexport function TopicsPage() {\n return (\n <AdminPageV2 tool=\"topics\" back={false}>\n <TopicsList />\n </AdminPageV2>\n );\n}\n\nfunction TopicsList() {\n const tr = useTr();\n const connection = useNeedsConnection();\n const paths = useNotificationPaths();\n const confirm = useConfirm();\n const gate = useConnectionGate();\n const notify = useNotify();\n const topics = useNotificationTopics();\n const [editing, setEditing] = useState<NotificationTopic | 'new' | null>(null);\n\n const toggle = async (topic: NotificationTopic) => {\n const result = await topics.updateTopic(topic.id, { isActive: !topic.isActive });\n notify(\n result\n ? {\n title: topic.isActive\n ? tr('notifications.v3.topics.turnedOff', '{{name}} is off', { name: topic.name })\n : tr('notifications.v3.topics.turnedOn', '{{name}} is on', { name: topic.name }),\n tone: 'success',\n }\n : {\n title: tr('notifications.v3.templates.saveFailed', 'Couldn’t save. Try again.'),\n tone: 'error',\n }\n );\n };\n\n const remove = async (topic: NotificationTopic) => {\n const yes = await confirm({\n title: tr('notifications.v3.topics.deleteTitle', 'Delete {{name}}?', { name: topic.name }),\n description: tr(\n 'notifications.v3.topics.deleteBody',\n 'People stop being able to choose it in their settings.'\n ),\n confirmLabel: tr('notifications.v3.templates.delete', 'Delete'),\n tone: 'danger',\n typeToConfirm: topic.name,\n });\n // The connection may have dropped while the question was open (BOFF-18043).\n if (!yes || gate()) return;\n const done = await topics.deleteTopic(topic.id);\n notify(\n done\n ? {\n title: tr('notifications.v3.templates.deleted', 'Deleted {{name}}', {\n name: topic.name,\n }),\n tone: 'success',\n }\n : {\n title: tr('notifications.v3.templates.deleteFailed', 'Couldn’t delete it. Try again.'),\n tone: 'error',\n }\n );\n };\n\n return (\n <WorkspacePage>\n <PageHeader\n variant=\"compact\"\n title={tr('notifications.v3.topics.title', 'Topics')}\n description={tr(\n 'notifications.v3.topics.purpose',\n 'Groups of notifications people can turn on or off.'\n )}\n back={{ label: tr('notifications.v3.title', 'Notifications'), to: paths.inbox }}\n primary={\n <Button onClick={() => setEditing('new')} data-testid=\"topics-new\">\n <Plus aria-hidden=\"true\" />\n {tr('notifications.v3.topics.new', 'New topic')}\n </Button>\n }\n />\n <StaleHint loadedAt={topics.dataUpdatedAt} />\n {topics.error && topics.topics.length === 0 ? (\n <LoadError\n what={tr('notifications.v3.topics.title', 'Topics')}\n error={topics.error}\n onRetry={() => void topics.refetch()}\n />\n ) : !topics.isLoading && topics.topics.length === 0 ? (\n <EmptyState\n kind=\"first-use\"\n title={tr('notifications.v3.topics.emptyTitle', 'No topics yet')}\n description={tr(\n 'notifications.v3.topics.emptyBody',\n 'Topics let people choose what they hear about, like “Billing” or “Product news”.'\n )}\n action={\n <Button onClick={() => setEditing('new')}>\n {tr('notifications.v3.topics.new', 'New topic')}\n </Button>\n }\n />\n ) : (\n <DataRows\n items={topics.topics}\n loading={topics.isLoading && topics.topics.length === 0}\n skeletonRows={4}\n getId={(topic) => topic.id}\n label={tr('notifications.v3.topics.title', 'Topics')}\n lead={{\n header: tr('notifications.v3.topics.topic', 'Topic'),\n media: () => (\n <IconTile size=\"sm\">\n <Tag aria-hidden=\"true\" />\n </IconTile>\n ),\n title: (topic) => topic.name,\n subtitle: (topic) => topic.description || undefined,\n onOpen: (topic) => setEditing(topic),\n }}\n columns={[\n {\n id: 'people',\n header: tr('notifications.v3.topics.people', 'Following'),\n cell: (topic) => COUNT.format(topic.subscriberCount ?? 0),\n },\n {\n id: 'kind',\n header: tr('notifications.v3.templates.kind', 'About'),\n cell: (topic) => kindWord(topic.type, tr),\n },\n {\n id: 'status',\n header: tr('notifications.v3.templates.status', 'Status'),\n cell: (topic) =>\n topic.isActive ? (\n <StatusChip status=\"ok\">{tr('notifications.v3.on', 'On')}</StatusChip>\n ) : (\n <StatusChip status=\"paused\">{tr('notifications.v3.off', 'Off')}</StatusChip>\n ),\n },\n ]}\n actions={(topic) => (\n <ActionMenu\n placement=\"row\"\n label={tr('notifications.v3.templates.actionsFor', 'Actions for {{name}}', {\n name: topic.name,\n })}\n items={[\n {\n id: 'edit',\n label: tr('notifications.v3.topics.edit', 'Edit'),\n onSelect: () => setEditing(topic),\n },\n {\n id: 'toggle',\n label: topic.isActive\n ? tr('notifications.v3.templates.turnOff', 'Turn off')\n : tr('notifications.v3.templates.turnOn', 'Turn on'),\n ...waitingItem(connection),\n onSelect: () => void toggle(topic),\n },\n {\n id: 'delete',\n label: tr('notifications.v3.templates.delete', 'Delete'),\n danger: true,\n ...waitingItem(connection),\n onSelect: () => void remove(topic),\n },\n ]}\n />\n )}\n />\n )}\n <TopicDialog\n open={editing !== null}\n topic={editing === 'new' ? null : editing}\n onClose={() => setEditing(null)}\n onCreate={topics.createTopic}\n onUpdate={topics.updateTopic}\n />\n </WorkspacePage>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA+BA,IAAMA,IAAQ,IAAI,KAAK,aAAa;AAEpC,SAAgBC,IAAa;CAC3B,OACE,kBAACC,GAAD;EAAa,MAAK;EAAS,MAAM;EAC/B,UAAA,kBAACC,GAAD,CAAa,CAAA;CACF,CAAA;AAEjB;AAEA,SAASA,IAAa;CACpB,IAAMC,IAAKC,EAAM,GACXC,IAAaC,EAAmB,GAChCC,IAAQC,EAAqB,GAC7BC,IAAUC,EAAW,GACrBC,IAAOC,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