@burdenoff/microfe-i18n 2026.1129.1 → 2026.1129.3

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.
Files changed (46) hide show
  1. package/dist/generated/global-operations.d.ts +292 -0
  2. package/dist/generated/global-operations.js +143 -15
  3. package/dist/generated/global-types.js +3 -1
  4. package/dist/i18n/I18nRoutes.d.ts +5 -3
  5. package/dist/i18n/I18nRoutes.js +48 -47
  6. package/dist/i18n/v2/LanguageDialog.d.ts +17 -0
  7. package/dist/i18n/v2/LanguageDialog.js +193 -0
  8. package/dist/i18n/v2/LanguagesPage.js +82 -53
  9. package/dist/i18n/v2/LanguagesTab.d.ts +3 -1
  10. package/dist/i18n/v2/LanguagesTab.js +31 -26
  11. package/dist/i18n/v2/ReviewRows.js +2 -2
  12. package/dist/i18n/v2/ReviewTab.d.ts +3 -1
  13. package/dist/i18n/v2/ReviewTab.js +27 -26
  14. package/dist/i18n/v2/TabRedirect.d.ts +8 -0
  15. package/dist/i18n/v2/TabRedirect.js +26 -9
  16. package/dist/i18n/v2/language/FormatsTab.d.ts +6 -0
  17. package/dist/i18n/v2/language/FormatsTab.js +93 -0
  18. package/dist/i18n/v2/language/LanguagePage.d.ts +3 -0
  19. package/dist/i18n/v2/language/LanguagePage.js +245 -0
  20. package/dist/i18n/v2/language/TranslateDialog.d.ts +18 -0
  21. package/dist/i18n/v2/language/TranslateDialog.js +101 -0
  22. package/dist/i18n/v2/language/WordsTab.d.ts +11 -0
  23. package/dist/i18n/v2/language/WordsTab.js +190 -0
  24. package/dist/i18n/v2/language/useLanguage.d.ts +23 -0
  25. package/dist/i18n/v2/language/useLanguage.js +22 -0
  26. package/dist/i18n/v2/language/useWords.d.ts +31 -0
  27. package/dist/i18n/v2/language/useWords.js +51 -0
  28. package/dist/i18n/v2/languageModel.d.ts +61 -0
  29. package/dist/i18n/v2/languageModel.js +120 -0
  30. package/dist/i18n/v2/links.d.ts +4 -1
  31. package/dist/i18n/v2/links.js +11 -10
  32. package/dist/i18n/v2/model.d.ts +12 -2
  33. package/dist/i18n/v2/model.js +17 -14
  34. package/dist/i18n/v2/reviewMessages.d.ts +1 -1
  35. package/dist/i18n/v2/useAddLanguage.d.ts +10 -0
  36. package/dist/i18n/v2/useAddLanguage.js +30 -0
  37. package/dist/i18n/v2/useDebouncedValue.d.ts +1 -0
  38. package/dist/i18n/v2/useDebouncedValue.js +10 -0
  39. package/dist/i18n/v2/useReviewActions.d.ts +3 -1
  40. package/dist/i18n/v2/useReviewActions.js +24 -24
  41. package/dist/i18n/v2/useReviewQueue.d.ts +5 -2
  42. package/dist/i18n/v2/useReviewQueue.js +9 -6
  43. package/dist/node_modules/lucide-react/dist/esm/icons/calendar-days.js +49 -0
  44. package/dist/node_modules/lucide-react/dist/esm/icons/eye-off.js +21 -0
  45. package/dist/node_modules/lucide-react/dist/esm/icons/eye.js +12 -0
  46. package/package.json +1 -1
@@ -7,97 +7,98 @@ import { ImportExportPage as a } from "./pages/ImportExportPage.js";
7
7
  import { LocaleConfigPage as o } from "./pages/LocaleConfigPage.js";
8
8
  import { joinPath as s } from "./utils/paths.js";
9
9
  import { LanguagesPage as c } from "./v2/LanguagesPage.js";
10
- import { TabRedirect as l } from "./v2/TabRedirect.js";
11
- import { Navigate as u, Route as d, Routes as f } from "react-router";
12
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
13
- import { useAccountPagesV2 as h } from "@burdenoff/fe-libs/ui/account-pages-v2";
10
+ import { LanguagePage as l } from "./v2/language/LanguagePage.js";
11
+ import { AddLanguageRedirect as u, LanguageRedirect as d, TabRedirect as f } from "./v2/TabRedirect.js";
12
+ import { Navigate as p, Route as m, Routes as h } from "react-router";
13
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
14
+ import { useAccountPagesV2 as v } from "@burdenoff/fe-libs/ui/account-pages-v2";
14
15
  // src/i18n/I18nRoutes.tsx
15
- function g({ basePath: e = "/" }) {
16
- let t = h();
17
- return /* @__PURE__ */ p(_, {
16
+ function y({ basePath: e = "/" }) {
17
+ let t = v();
18
+ return /* @__PURE__ */ g(b, {
18
19
  basePath: e,
19
20
  v2: t
20
21
  });
21
22
  }
22
- function _({ basePath: h, v2: g }) {
23
- let _ = s(h, "languages"), v = s(h, "products"), y = (e) => /* @__PURE__ */ p(l, {
24
- basePath: h,
23
+ function b({ basePath: v, v2: y }) {
24
+ let b = s(v, "languages"), x = s(v, "products"), S = (e) => /* @__PURE__ */ g(f, {
25
+ basePath: v,
25
26
  tab: e
26
27
  });
27
- return /* @__PURE__ */ m(f, { children: [
28
- /* @__PURE__ */ p(d, {
28
+ return /* @__PURE__ */ _(h, { children: [
29
+ /* @__PURE__ */ g(m, {
29
30
  index: !0,
30
- element: /* @__PURE__ */ p(u, {
31
- to: _,
31
+ element: /* @__PURE__ */ g(p, {
32
+ to: b,
32
33
  replace: !0
33
34
  })
34
35
  }),
35
- /* @__PURE__ */ p(d, {
36
+ /* @__PURE__ */ g(m, {
36
37
  path: "languages",
37
- element: g ? /* @__PURE__ */ p(c, { basePath: h }) : /* @__PURE__ */ p(e, {})
38
+ element: y ? /* @__PURE__ */ g(c, { basePath: v }) : /* @__PURE__ */ g(e, {})
38
39
  }),
39
- /* @__PURE__ */ p(d, {
40
+ /* @__PURE__ */ g(m, {
40
41
  path: "languages/new",
41
- element: /* @__PURE__ */ p(o, {})
42
+ element: y ? /* @__PURE__ */ g(u, { basePath: v }) : /* @__PURE__ */ g(o, {})
42
43
  }),
43
- /* @__PURE__ */ p(d, {
44
+ /* @__PURE__ */ g(m, {
44
45
  path: "languages/:code",
45
- element: /* @__PURE__ */ p(o, {})
46
+ element: y ? /* @__PURE__ */ g(l, { basePath: v }) : /* @__PURE__ */ g(o, {})
46
47
  }),
47
- /* @__PURE__ */ p(d, {
48
+ /* @__PURE__ */ g(m, {
48
49
  path: "products",
49
- element: g ? y("products") : /* @__PURE__ */ p(t, {})
50
+ element: y ? S("products") : /* @__PURE__ */ g(t, {})
50
51
  }),
51
- /* @__PURE__ */ p(d, {
52
+ /* @__PURE__ */ g(m, {
52
53
  path: "products/*",
53
- element: g ? y("products") : /* @__PURE__ */ p(u, {
54
- to: v,
54
+ element: y ? S("products") : /* @__PURE__ */ g(p, {
55
+ to: x,
55
56
  replace: !0
56
57
  })
57
58
  }),
58
- /* @__PURE__ */ p(d, {
59
+ /* @__PURE__ */ g(m, {
59
60
  path: "editor",
60
- element: /* @__PURE__ */ p(n, {})
61
+ element: /* @__PURE__ */ g(n, {})
61
62
  }),
62
- /* @__PURE__ */ p(d, {
63
+ /* @__PURE__ */ g(m, {
63
64
  path: "editor/:keyId",
64
- element: /* @__PURE__ */ p(n, {})
65
+ element: /* @__PURE__ */ g(n, {})
65
66
  }),
66
- /* @__PURE__ */ p(d, {
67
+ /* @__PURE__ */ g(m, {
67
68
  path: "editor/:keyId/:languageCode",
68
- element: /* @__PURE__ */ p(n, {})
69
+ element: /* @__PURE__ */ g(n, {})
69
70
  }),
70
- /* @__PURE__ */ p(d, {
71
+ /* @__PURE__ */ g(m, {
71
72
  path: "progress",
72
- element: g ? y("languages") : /* @__PURE__ */ p(r, {})
73
+ element: y ? S("languages") : /* @__PURE__ */ g(r, {})
73
74
  }),
74
- /* @__PURE__ */ p(d, {
75
+ /* @__PURE__ */ g(m, {
75
76
  path: "review",
76
- element: g ? y("review") : /* @__PURE__ */ p(i, {})
77
+ element: y ? S("languages") : /* @__PURE__ */ g(i, {})
77
78
  }),
78
- /* @__PURE__ */ p(d, {
79
+ /* @__PURE__ */ g(m, {
79
80
  path: "import",
80
- element: /* @__PURE__ */ p(a, { mode: "import" })
81
+ element: /* @__PURE__ */ g(a, { mode: "import" })
81
82
  }),
82
- /* @__PURE__ */ p(d, {
83
+ /* @__PURE__ */ g(m, {
83
84
  path: "export",
84
- element: /* @__PURE__ */ p(a, { mode: "export" })
85
+ element: /* @__PURE__ */ g(a, { mode: "export" })
85
86
  }),
86
- /* @__PURE__ */ p(d, {
87
+ /* @__PURE__ */ g(m, {
87
88
  path: "locales",
88
- element: g ? y("languages") : /* @__PURE__ */ p(e, {})
89
+ element: y ? S("languages") : /* @__PURE__ */ g(e, {})
89
90
  }),
90
- /* @__PURE__ */ p(d, {
91
+ /* @__PURE__ */ g(m, {
91
92
  path: "locales/:code",
92
- element: /* @__PURE__ */ p(o, {})
93
+ element: y ? /* @__PURE__ */ g(d, { basePath: v }) : /* @__PURE__ */ g(o, {})
93
94
  }),
94
- /* @__PURE__ */ p(d, {
95
+ /* @__PURE__ */ g(m, {
95
96
  path: "*",
96
- element: /* @__PURE__ */ p(u, {
97
- to: _,
97
+ element: /* @__PURE__ */ g(p, {
98
+ to: b,
98
99
  replace: !0
99
100
  })
100
101
  })
101
102
  ] });
102
103
  }
103
- export { _ as I18nRouteTable, g as I18nRoutes };
104
+ export { b as I18nRouteTable, y as I18nRoutes };
@@ -0,0 +1,17 @@
1
+ import { LanguageDirection } from '../../generated/global-types';
2
+ /** What the dialog saves: a new language, or new names for one. */
3
+ export interface LanguageFields {
4
+ code: string;
5
+ name: string;
6
+ nativeName: string;
7
+ direction: LanguageDirection;
8
+ }
9
+ type SaveResult = "saved" | "taken" | "failed";
10
+ export declare function LanguageDialog({ open, editing, onSave, onClose, }: {
11
+ open: boolean;
12
+ /** The language whose names change; null to add one. */
13
+ editing: LanguageFields | null;
14
+ onSave: (fields: LanguageFields) => Promise<SaveResult>;
15
+ onClose: () => void;
16
+ }): import('react').JSX.Element;
17
+ export {};
@@ -0,0 +1,193 @@
1
+ import { useTr as e } from "../hooks/useTr.js";
2
+ import { LanguageDirection as t } from "../../generated/global-types.js";
3
+ import { canSaveLanguage as n, codeProblem as r, factsForCode as i } from "./languageModel.js";
4
+ import { useId as a, useRef as o, useState as s } from "react";
5
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
6
+ import { Button as d, Input as f, Label as p, ResponsiveDialog as m, ResponsiveDialogContent as h, ResponsiveDialogDescription as g, ResponsiveDialogFooter as _, ResponsiveDialogHeader as v, ResponsiveDialogTitle as y, Segmented as b } from "@burdenoff/fe-libs/ui";
7
+ // src/i18n/v2/LanguageDialog.tsx
8
+ function x({ id: e, label: t, hint: n, children: r }) {
9
+ return /* @__PURE__ */ u("div", {
10
+ className: "flex flex-col gap-1.5",
11
+ children: [
12
+ /* @__PURE__ */ l(p, {
13
+ htmlFor: e,
14
+ children: t
15
+ }),
16
+ r,
17
+ n ? /* @__PURE__ */ l("p", {
18
+ id: `${e}-hint`,
19
+ className: "m-0 text-xs text-text-secondary",
20
+ children: n
21
+ }) : null
22
+ ]
23
+ });
24
+ }
25
+ function S({ id: t, value: n, problem: r, onChange: i }) {
26
+ let a = e();
27
+ return /* @__PURE__ */ l(x, {
28
+ id: t,
29
+ label: a("i18n.v3.add.code", "Language code"),
30
+ hint: r ?? a("i18n.v3.add.codeHint", "For example es, pt-BR or zh-Hans. It can’t be changed later."),
31
+ children: /* @__PURE__ */ l(f, {
32
+ id: t,
33
+ value: n,
34
+ onChange: (e) => i(e.target.value),
35
+ "aria-describedby": `${t}-hint`,
36
+ "aria-invalid": r ? !0 : void 0,
37
+ autoComplete: "off",
38
+ spellCheck: !1,
39
+ "data-testid": "language-code"
40
+ })
41
+ });
42
+ }
43
+ function C({ id: n, value: r, onChange: i }) {
44
+ let a = e();
45
+ return /* @__PURE__ */ u("div", {
46
+ className: "flex flex-col gap-1.5",
47
+ children: [/* @__PURE__ */ l("span", {
48
+ id: n,
49
+ className: "text-sm font-medium",
50
+ children: a("i18n.v3.lang.reads", "Reads")
51
+ }), /* @__PURE__ */ l(b, {
52
+ "aria-labelledby": n,
53
+ value: r,
54
+ onValueChange: i,
55
+ options: [{
56
+ value: t.Ltr,
57
+ label: a("i18n.v3.lang.ltr", "Left to right")
58
+ }, {
59
+ value: t.Rtl,
60
+ label: a("i18n.v3.lang.rtl", "Right to left")
61
+ }]
62
+ })]
63
+ });
64
+ }
65
+ function w({ editing: t }) {
66
+ let n = e();
67
+ return /* @__PURE__ */ u(v, { children: [/* @__PURE__ */ l(y, { children: t ? n("i18n.v3.edit.title", "Change {{name}}’s names", { name: t.name }) : n("i18n.v3.add.title", "Add a language") }), /* @__PURE__ */ l(g, { children: t ? n("i18n.v3.edit.body", "How the language is named here, and to people who speak it.") : n("i18n.v3.add.body", "It is offered as soon as it is added; its words start untranslated.") })] });
68
+ }
69
+ function T({ id: t, name: n, nativeName: r, onName: i, onNativeName: a }) {
70
+ let o = e();
71
+ return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(x, {
72
+ id: `${t}-name`,
73
+ label: o("i18n.v3.add.name", "Name"),
74
+ children: /* @__PURE__ */ l(f, {
75
+ id: `${t}-name`,
76
+ value: n,
77
+ onChange: (e) => i(e.target.value),
78
+ "data-testid": "language-name"
79
+ })
80
+ }), /* @__PURE__ */ l(x, {
81
+ id: `${t}-native`,
82
+ label: o("i18n.v3.add.nativeName", "Its own name"),
83
+ hint: o("i18n.v3.add.nativeHint", "What people who speak it call it, as the language menu shows it."),
84
+ children: /* @__PURE__ */ l(f, {
85
+ id: `${t}-native`,
86
+ value: r,
87
+ onChange: (e) => a(e.target.value),
88
+ "aria-describedby": `${t}-native-hint`,
89
+ dir: "auto",
90
+ "data-testid": "language-native"
91
+ })
92
+ })] });
93
+ }
94
+ function E({ editing: c, onSave: f, onClose: p }) {
95
+ let m = e(), g = a(), v = c === null, [y, b] = s(c ?? {
96
+ code: "",
97
+ name: "",
98
+ nativeName: "",
99
+ direction: t.Ltr
100
+ }), x = o({
101
+ name: !1,
102
+ nativeName: !1
103
+ }), [E, D] = s(!1), [O, k] = s(!1), A = v ? i(y.code) : null, j = v ? r(y.code, E) : null, M = {
104
+ taken: m("i18n.v3.add.taken", "There’s a language with this code already."),
105
+ badCode: m("i18n.v3.add.badCode", "Use a language code such as es, pt-BR or zh-Hans.")
106
+ }, N = (e) => {
107
+ D(!1);
108
+ let n = i(e);
109
+ b((r) => n ? {
110
+ code: e,
111
+ name: x.current.name ? r.name : n.name,
112
+ nativeName: x.current.nativeName ? r.nativeName : n.nativeName,
113
+ direction: n.rtl ? t.Rtl : t.Ltr
114
+ } : {
115
+ ...r,
116
+ code: e
117
+ });
118
+ }, P = (e, t) => {
119
+ x.current[e] = !0, b((n) => ({
120
+ ...n,
121
+ [e]: t
122
+ }));
123
+ }, F = async () => {
124
+ k(!0);
125
+ let e = "failed";
126
+ try {
127
+ e = await f({
128
+ code: A?.code ?? y.code.trim(),
129
+ name: y.name.trim(),
130
+ nativeName: y.nativeName.trim(),
131
+ direction: y.direction
132
+ });
133
+ } finally {
134
+ k(!1);
135
+ }
136
+ e === "saved" && p(), D(e === "taken");
137
+ };
138
+ return /* @__PURE__ */ u(h, {
139
+ "data-testid": "language-dialog",
140
+ children: [
141
+ /* @__PURE__ */ l(w, { editing: c }),
142
+ /* @__PURE__ */ u("div", {
143
+ className: "flex flex-col gap-4",
144
+ children: [
145
+ v ? /* @__PURE__ */ l(S, {
146
+ id: `${g}-code`,
147
+ value: y.code,
148
+ problem: j ? M[j] : null,
149
+ onChange: N
150
+ }) : null,
151
+ /* @__PURE__ */ l(T, {
152
+ id: g,
153
+ name: y.name,
154
+ nativeName: y.nativeName,
155
+ onName: (e) => P("name", e),
156
+ onNativeName: (e) => P("nativeName", e)
157
+ }),
158
+ v ? /* @__PURE__ */ l(C, {
159
+ id: `${g}-reads`,
160
+ value: y.direction,
161
+ onChange: (e) => b((t) => ({
162
+ ...t,
163
+ direction: e
164
+ }))
165
+ }) : null
166
+ ]
167
+ }),
168
+ /* @__PURE__ */ u(_, { children: [/* @__PURE__ */ l(d, {
169
+ variant: "ghost",
170
+ onClick: p,
171
+ children: m("i18n.v3.cancel", "Cancel")
172
+ }), /* @__PURE__ */ l(d, {
173
+ busy: O,
174
+ disabled: !n(y, A, v),
175
+ onClick: () => void F(),
176
+ "data-testid": "language-save",
177
+ children: v ? m("i18n.v3.addLanguage", "Add language") : m("i18n.v3.edit.save", "Save names")
178
+ })] })
179
+ ]
180
+ });
181
+ }
182
+ function D({ open: e, editing: t, onSave: n, onClose: r }) {
183
+ return /* @__PURE__ */ l(m, {
184
+ open: e,
185
+ onOpenChange: (e) => e ? void 0 : r(),
186
+ children: e ? /* @__PURE__ */ l(E, {
187
+ editing: t,
188
+ onSave: n,
189
+ onClose: r
190
+ }) : null
191
+ });
192
+ }
193
+ export { D as LanguageDialog };
@@ -2,81 +2,110 @@ import e from "../../node_modules/lucide-react/dist/esm/icons/download.js";
2
2
  import t from "../../node_modules/lucide-react/dist/esm/icons/plus.js";
3
3
  import n from "../../node_modules/lucide-react/dist/esm/icons/upload.js";
4
4
  import { useTr as r } from "../hooks/useTr.js";
5
- import { languagesLinks as i } from "./links.js";
6
- import { LanguagesTab as a } from "./LanguagesTab.js";
7
- import { LANGUAGES_TABS as o, languageProgress as s, readLanguagesTab as c, sortLanguages as l } from "./model.js";
8
- import { ProductsTab as u } from "./ProductsTab.js";
9
- import { ReviewTab as d } from "./ReviewTab.js";
10
- import { useLanguagesData as f } from "./useLanguagesData.js";
11
- import { useWaitingCount as p } from "./useReviewQueue.js";
12
- import { useMemo as m } from "react";
13
- import { useNavigate as h, useSearchParams as g } from "react-router";
14
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
15
- import { Button as y, PageTabs as b } from "@burdenoff/fe-libs/ui";
16
- import { PageHeader as x } from "@burdenoff/fe-libs/chrome";
5
+ import { LanguageDialog as i } from "./LanguageDialog.js";
6
+ import { ADD_LANGUAGE_DIALOG as a, languagesLinks as o } from "./links.js";
7
+ import { LanguagesTab as s } from "./LanguagesTab.js";
8
+ import { languageProgress as c, readLanguagesTab as l, shownTabs as u, sortLanguages as d } from "./model.js";
9
+ import { ProductsTab as f } from "./ProductsTab.js";
10
+ import { ReviewTab as p } from "./ReviewTab.js";
11
+ import { useAddLanguage as m } from "./useAddLanguage.js";
12
+ import { useLanguagesData as h } from "./useLanguagesData.js";
13
+ import { useWaitingCount as g } from "./useReviewQueue.js";
14
+ import { useMemo as _, useRef as v } from "react";
15
+ import { useNavigate as y, useSearchParams as b } from "react-router";
16
+ import { jsx as x, jsxs as S } from "react/jsx-runtime";
17
+ import { Button as C, PageTabs as w, useNotify as T } from "@burdenoff/fe-libs/ui";
18
+ import { PageHeader as E } from "@burdenoff/fe-libs/chrome";
17
19
  // src/i18n/v2/LanguagesPage.tsx
18
- function S({ basePath: S }) {
19
- let C = r(), w = h(), [T] = g(), E = c(T.get("tab")), D = i(S), O = f(), k = p(), A = m(() => s(O.coverage.byProduct), [O.coverage.byProduct]), j = m(() => l(O.languages), [O.languages]), M = {
20
- ...O,
21
- languages: j
22
- }, N = j.find((e) => e.isDefault)?.name ?? C("i18n.v3.sourceText", "Source text"), P = {
23
- languages: C("i18n.v3.tab.languages", "Languages"),
24
- products: C("i18n.v3.tab.products", "Products"),
25
- review: C("i18n.v3.tab.review", "Review queue")
26
- }, F = {
27
- languages: O.languagesLoading ? void 0 : O.languages.length,
28
- products: O.productsLoading ? void 0 : O.products.length,
29
- review: k
20
+ function D({ basePath: D }) {
21
+ let O = r(), k = y(), A = T(), [j, M] = b(), N = l(j.get("tab")), P = o(D), F = h(), I = m(), L = j.get("dialog") === a, R = v(null), z = () => {
22
+ let e = R.current;
23
+ if (R.current = null, e) {
24
+ k(P.language(e), { replace: !0 });
25
+ return;
26
+ }
27
+ let t = new URLSearchParams(j);
28
+ t.delete("dialog"), M(t, { replace: !0 });
29
+ }, B = g(!1), V = _(() => c(F.coverage.byProduct), [F.coverage.byProduct]), H = _(() => d(F.languages), [F.languages]), U = {
30
+ ...F,
31
+ languages: H
32
+ }, W = H.find((e) => e.isDefault)?.name ?? O("i18n.v3.sourceText", "Source text"), G = {
33
+ languages: O("i18n.v3.tab.languages", "Languages"),
34
+ products: O("i18n.v3.tab.products", "Products"),
35
+ review: O("i18n.v3.tab.review", "Review queue")
36
+ }, K = {
37
+ languages: F.languagesLoading ? void 0 : F.languages.length,
38
+ products: F.productsLoading ? void 0 : F.products.length,
39
+ review: B
30
40
  };
31
- return /* @__PURE__ */ v("div", {
41
+ return /* @__PURE__ */ S("div", {
32
42
  "data-account-pages-v2": "languages",
33
43
  className: "flex w-full min-w-0 flex-col",
34
44
  children: [
35
- /* @__PURE__ */ _(x, {
45
+ /* @__PURE__ */ x(E, {
36
46
  variant: "compact",
37
- title: C("i18n.v3.title", "Languages"),
38
- description: C("i18n.v3.purpose", "Translations for every product, and what’s waiting for review."),
39
- primary: /* @__PURE__ */ v(y, {
40
- onClick: () => w(D.addLanguage),
47
+ title: O("i18n.v3.title", "Languages"),
48
+ description: O("i18n.v3.purpose", "Translations for every product, and what’s waiting for review."),
49
+ primary: /* @__PURE__ */ S(C, {
50
+ onClick: () => {
51
+ let e = new URLSearchParams(j);
52
+ e.set("dialog", a), M(e);
53
+ },
41
54
  "data-testid": "languages-add",
42
- children: [/* @__PURE__ */ _(t, { "aria-hidden": "true" }), C("i18n.v3.addLanguage", "Add language")]
55
+ children: [/* @__PURE__ */ x(t, { "aria-hidden": "true" }), O("i18n.v3.addLanguage", "Add language")]
43
56
  }),
44
57
  more: [{
45
58
  id: "import",
46
- label: C("i18n.v3.importWords", "Import translations"),
59
+ label: O("i18n.v3.importWords", "Import translations"),
47
60
  icon: n,
48
- onSelect: () => w(D.importWords)
61
+ onSelect: () => k(P.importWords)
49
62
  }, {
50
63
  id: "export",
51
- label: C("i18n.v3.exportWords", "Export translations"),
64
+ label: O("i18n.v3.exportWords", "Export translations"),
52
65
  icon: e,
53
- onSelect: () => w(D.exportWords)
66
+ onSelect: () => k(P.exportWords)
54
67
  }],
55
- moreLabel: C("i18n.v3.more", "More for languages")
68
+ moreLabel: O("i18n.v3.more", "More for languages")
56
69
  }),
57
- /* @__PURE__ */ _(b, {
58
- ariaLabel: C("i18n.v3.title", "Languages"),
59
- activeId: E,
60
- tabs: o.map((e) => ({
70
+ /* @__PURE__ */ x(w, {
71
+ ariaLabel: O("i18n.v3.title", "Languages"),
72
+ activeId: N,
73
+ tabs: u(!1).map((e) => ({
61
74
  id: e,
62
- label: P[e],
63
- href: D.tab(e),
64
- badge: F[e]
75
+ label: G[e],
76
+ href: P.tab(e),
77
+ badge: K[e]
65
78
  }))
66
79
  }),
67
- /* @__PURE__ */ _("div", {
80
+ /* @__PURE__ */ x("div", {
68
81
  className: "pt-4",
69
- children: E === "products" ? /* @__PURE__ */ _(u, { data: M }) : E === "review" ? /* @__PURE__ */ _(d, {
70
- languages: j,
71
- sourceName: N,
72
- onReviewed: O.coverage.reload
73
- }) : /* @__PURE__ */ _(a, {
74
- data: M,
75
- progress: A,
76
- links: D
82
+ children: N === "products" ? /* @__PURE__ */ x(f, { data: U }) : N === "review" ? /* @__PURE__ */ x(p, {
83
+ languages: H,
84
+ sourceName: W,
85
+ onReviewed: F.coverage.reload
86
+ }) : /* @__PURE__ */ x(s, {
87
+ data: U,
88
+ progress: V,
89
+ links: P,
90
+ reviewQueue: !1
77
91
  })
92
+ }),
93
+ /* @__PURE__ */ x(i, {
94
+ open: L,
95
+ editing: null,
96
+ onClose: z,
97
+ onSave: async (e) => {
98
+ let t = await I(e);
99
+ return t.outcome === "saved" ? (A({
100
+ title: O("i18n.v3.add.added", "Added {{name}}", { name: e.name }),
101
+ tone: "success"
102
+ }), R.current = t.code, "saved") : (t.outcome === "failed" && A({
103
+ title: O("i18n.v3.add.failed", "Couldn’t add it. Try again."),
104
+ tone: "error"
105
+ }), t.outcome);
106
+ }
78
107
  })
79
108
  ]
80
109
  });
81
110
  }
82
- export { S as LanguagesPage };
111
+ export { D as LanguagesPage };
@@ -1,8 +1,10 @@
1
1
  import { LanguagesLinks } from './links';
2
2
  import { Progress } from './model';
3
3
  import { LanguagesData } from './useLanguagesData';
4
- export declare function LanguagesTab({ data, progress, links, }: {
4
+ export declare function LanguagesTab({ data, progress, links, reviewQueue, }: {
5
5
  data: LanguagesData;
6
6
  progress: ReadonlyMap<string, Progress>;
7
7
  links: LanguagesLinks;
8
+ /** "N to check" opens the review queue; while it is hidden, plain text. */
9
+ reviewQueue: boolean;
8
10
  }): import('react').JSX.Element;
@@ -9,33 +9,33 @@ import { useNavigate as c } from "react-router";
9
9
  import { jsx as l, jsxs as u } from "react/jsx-runtime";
10
10
  import { ActionMenu as d, Button as f, DataRows as p, EmptyState as m, IconTile as h, LoadError as g, Notice as _, StatusChip as v } from "@burdenoff/fe-libs/ui";
11
11
  // src/i18n/v2/LanguagesTab.tsx
12
- function y({ data: y, progress: b, links: x }) {
13
- let S = r(), C = c(), w = y.productsLoading || y.coverage.loading;
12
+ function y({ data: y, progress: b, links: x, reviewQueue: S }) {
13
+ let C = r(), w = c(), T = y.productsLoading || y.coverage.loading;
14
14
  return y.languagesError && y.languages.length === 0 ? /* @__PURE__ */ l(g, {
15
- what: S("i18n.v3.tab.languages", "Languages"),
15
+ what: C("i18n.v3.tab.languages", "Languages"),
16
16
  error: y.languagesError,
17
17
  onRetry: y.retry
18
18
  }) : !y.languagesLoading && y.languages.length === 0 ? /* @__PURE__ */ l(m, {
19
19
  icon: /* @__PURE__ */ l(t, { "aria-hidden": "true" }),
20
- title: S("i18n.v3.noLanguages", "No languages yet"),
21
- description: S("i18n.v3.noLanguagesBody", "Add a language to start translating your products into it."),
20
+ title: C("i18n.v3.noLanguages", "No languages yet"),
21
+ description: C("i18n.v3.noLanguagesBody", "Add a language to start translating your products into it."),
22
22
  action: /* @__PURE__ */ l(f, {
23
- onClick: () => C(x.addLanguage),
24
- children: S("i18n.v3.addLanguage", "Add language")
23
+ onClick: () => w(x.addLanguage),
24
+ children: C("i18n.v3.addLanguage", "Add language")
25
25
  })
26
26
  }) : /* @__PURE__ */ u("div", {
27
27
  className: "flex flex-col gap-3",
28
28
  children: [y.coverage.failed.length > 0 ? /* @__PURE__ */ l(_, {
29
29
  tone: "warn",
30
- children: y.coverage.failed.length === 1 ? S("i18n.v3.oneNotCounted", "One product couldn’t be counted, so these numbers leave it out.") : S("i18n.v3.someNotCounted", "{{count}} products couldn’t be counted, so these numbers leave them out.", { count: o.format(y.coverage.failed.length) })
30
+ children: y.coverage.failed.length === 1 ? C("i18n.v3.oneNotCounted", "One product couldn’t be counted, so these numbers leave it out.") : C("i18n.v3.someNotCounted", "{{count}} products couldn’t be counted, so these numbers leave them out.", { count: o.format(y.coverage.failed.length) })
31
31
  }) : null, /* @__PURE__ */ l(p, {
32
32
  items: y.languages,
33
33
  getId: (e) => e.id,
34
- label: S("i18n.v3.tab.languages", "Languages"),
34
+ label: C("i18n.v3.tab.languages", "Languages"),
35
35
  loading: y.languagesLoading,
36
36
  skeletonRows: 6,
37
37
  lead: {
38
- header: S("i18n.v3.col.language", "Language"),
38
+ header: C("i18n.v3.col.language", "Language"),
39
39
  media: () => /* @__PURE__ */ l(h, {
40
40
  size: "sm",
41
41
  children: /* @__PURE__ */ l(t, { "aria-hidden": "true" })
@@ -43,57 +43,62 @@ function y({ data: y, progress: b, links: x }) {
43
43
  title: (e) => e.name,
44
44
  subtitle: (e) => {
45
45
  let t = [e.nativeName === e.name ? "" : e.nativeName, e.code];
46
- return e.direction === i.Rtl && t.push(S("i18n.v3.rightToLeft", "right to left")), e.isDefault && t.push(S("i18n.v3.source", "Source")), t.filter(Boolean).join(" · ");
46
+ return e.direction === i.Rtl && t.push(C("i18n.v3.rightToLeft", "right to left")), e.isDefault && t.push(C("i18n.v3.source", "Source")), t.filter(Boolean).join(" · ");
47
47
  },
48
48
  href: (e) => x.language(e.code)
49
49
  },
50
50
  columns: [{
51
51
  id: "translated",
52
- header: S("i18n.v3.col.translated", "Translated"),
52
+ header: C("i18n.v3.col.translated", "Translated"),
53
53
  width: "220px",
54
54
  cell: (e) => e.status === a.Draft ? /* @__PURE__ */ l(v, {
55
55
  status: "waiting",
56
- children: S("i18n.v3.status.draft", "Draft")
56
+ children: C("i18n.v3.status.draft", "Draft")
57
57
  }) : e.status === a.Deprecated ? /* @__PURE__ */ l(v, {
58
58
  status: "paused",
59
- children: S("i18n.v3.status.off", "Turned off")
59
+ children: C("i18n.v3.status.off", "Turned off")
60
60
  }) : /* @__PURE__ */ l(s, {
61
- loading: w,
61
+ loading: T,
62
62
  share: b.get(e.code)?.share ?? null
63
63
  })
64
64
  }, {
65
65
  id: "waiting",
66
- header: S("i18n.v3.col.waiting", "Waiting for review"),
66
+ header: C("i18n.v3.col.waiting", "Waiting for review"),
67
67
  width: "160px",
68
68
  cell: (e) => {
69
- if (w) return null;
69
+ if (T) return null;
70
70
  let t = b.get(e.code)?.waiting ?? 0;
71
- return t === 0 ? /* @__PURE__ */ l("span", {
71
+ if (t === 0) return /* @__PURE__ */ l("span", {
72
72
  className: "text-sm text-text-secondary",
73
73
  children: "—"
74
- }) : /* @__PURE__ */ l(f, {
74
+ });
75
+ let n = C("i18n.v3.toCheck", "{{count}} to check", { count: o.format(t) });
76
+ return S ? /* @__PURE__ */ l(f, {
75
77
  variant: "link",
76
78
  size: "sm",
77
79
  className: "h-auto p-0",
78
- onClick: () => C(x.review(e.code)),
79
- children: S("i18n.v3.toCheck", "{{count}} to check", { count: o.format(t) })
80
+ onClick: () => w(x.review(e.code)),
81
+ children: n
82
+ }) : /* @__PURE__ */ l("span", {
83
+ className: "text-sm text-text-primary",
84
+ children: n
80
85
  });
81
86
  },
82
87
  phone: (e) => (b.get(e.code)?.waiting ?? 0) > 0 ? "label" : "hide"
83
88
  }],
84
89
  actions: (t) => /* @__PURE__ */ l(d, {
85
90
  placement: "row",
86
- label: S("i18n.v3.actionsFor", "Actions for {{name}}", { name: t.name }),
91
+ label: C("i18n.v3.actionsFor", "Actions for {{name}}", { name: t.name }),
87
92
  items: [{
88
93
  id: "open",
89
- label: S("i18n.v3.open", "Open"),
94
+ label: C("i18n.v3.open", "Open"),
90
95
  icon: n,
91
- onSelect: () => C(x.language(t.code))
96
+ onSelect: () => w(x.language(t.code))
92
97
  }, {
93
98
  id: "export",
94
- label: S("i18n.v3.exportWords", "Export translations"),
99
+ label: C("i18n.v3.exportWords", "Export translations"),
95
100
  icon: e,
96
- onSelect: () => C(x.exportWords)
101
+ onSelect: () => w(x.exportWords)
97
102
  }]
98
103
  })
99
104
  })]