@burdenoff/microfe-i18n 2026.1129.1 → 2026.1129.2
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/i18n/I18nRoutes.d.ts +3 -3
- package/dist/i18n/I18nRoutes.js +1 -1
- package/dist/i18n/v2/LanguagesPage.js +5 -4
- package/dist/i18n/v2/LanguagesTab.d.ts +3 -1
- package/dist/i18n/v2/LanguagesTab.js +31 -26
- package/dist/i18n/v2/ReviewRows.js +2 -2
- package/dist/i18n/v2/ReviewTab.js +12 -12
- package/dist/i18n/v2/model.d.ts +12 -2
- package/dist/i18n/v2/model.js +17 -14
- package/dist/i18n/v2/reviewMessages.d.ts +1 -1
- package/dist/i18n/v2/useReviewActions.d.ts +3 -1
- package/dist/i18n/v2/useReviewActions.js +24 -24
- package/dist/i18n/v2/useReviewQueue.d.ts +5 -2
- package/dist/i18n/v2/useReviewQueue.js +9 -6
- package/package.json +1 -1
|
@@ -32,9 +32,9 @@ export declare function I18nRoutes({ basePath }: {
|
|
|
32
32
|
/**
|
|
33
33
|
* The route table. With fe-libs' `accountPagesV2` opt-in (BOFF-16785, C5)
|
|
34
34
|
* Languages is one page with tabs: Products, Progress, the review queue and
|
|
35
|
-
* Locales open its tabs
|
|
36
|
-
*
|
|
37
|
-
* element.
|
|
35
|
+
* Locales open its tabs (the review queue opens Languages while the queue is
|
|
36
|
+
* hidden). The language settings, the editor, Import and Export stay today's
|
|
37
|
+
* pages until C5b. With the opt-in off, today's table, element for element.
|
|
38
38
|
*/
|
|
39
39
|
export declare function I18nRouteTable({ basePath, v2, }: {
|
|
40
40
|
basePath: string;
|
package/dist/i18n/I18nRoutes.js
CHANGED
|
@@ -4,7 +4,7 @@ import n from "../../node_modules/lucide-react/dist/esm/icons/upload.js";
|
|
|
4
4
|
import { useTr as r } from "../hooks/useTr.js";
|
|
5
5
|
import { languagesLinks as i } from "./links.js";
|
|
6
6
|
import { LanguagesTab as a } from "./LanguagesTab.js";
|
|
7
|
-
import {
|
|
7
|
+
import { languageProgress as o, readLanguagesTab as s, shownTabs as c, sortLanguages as l } from "./model.js";
|
|
8
8
|
import { ProductsTab as u } from "./ProductsTab.js";
|
|
9
9
|
import { ReviewTab as d } from "./ReviewTab.js";
|
|
10
10
|
import { useLanguagesData as f } from "./useLanguagesData.js";
|
|
@@ -16,7 +16,7 @@ import { Button as y, PageTabs as b } from "@burdenoff/fe-libs/ui";
|
|
|
16
16
|
import { PageHeader as x } from "@burdenoff/fe-libs/chrome";
|
|
17
17
|
// src/i18n/v2/LanguagesPage.tsx
|
|
18
18
|
function S({ basePath: S }) {
|
|
19
|
-
let C = r(), w = h(), [T] = g(), E =
|
|
19
|
+
let C = r(), w = h(), [T] = g(), E = s(T.get("tab")), D = i(S), O = f(), k = p(!1), A = m(() => o(O.coverage.byProduct), [O.coverage.byProduct]), j = m(() => l(O.languages), [O.languages]), M = {
|
|
20
20
|
...O,
|
|
21
21
|
languages: j
|
|
22
22
|
}, N = j.find((e) => e.isDefault)?.name ?? C("i18n.v3.sourceText", "Source text"), P = {
|
|
@@ -57,7 +57,7 @@ function S({ basePath: S }) {
|
|
|
57
57
|
/* @__PURE__ */ _(b, {
|
|
58
58
|
ariaLabel: C("i18n.v3.title", "Languages"),
|
|
59
59
|
activeId: E,
|
|
60
|
-
tabs:
|
|
60
|
+
tabs: c(!1).map((e) => ({
|
|
61
61
|
id: e,
|
|
62
62
|
label: P[e],
|
|
63
63
|
href: D.tab(e),
|
|
@@ -73,7 +73,8 @@ function S({ basePath: S }) {
|
|
|
73
73
|
}) : /* @__PURE__ */ _(a, {
|
|
74
74
|
data: M,
|
|
75
75
|
progress: A,
|
|
76
|
-
links: D
|
|
76
|
+
links: D,
|
|
77
|
+
reviewQueue: !1
|
|
77
78
|
})
|
|
78
79
|
})
|
|
79
80
|
]
|
|
@@ -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
|
|
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:
|
|
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:
|
|
21
|
-
description:
|
|
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: () =>
|
|
24
|
-
children:
|
|
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 ?
|
|
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:
|
|
34
|
+
label: C("i18n.v3.tab.languages", "Languages"),
|
|
35
35
|
loading: y.languagesLoading,
|
|
36
36
|
skeletonRows: 6,
|
|
37
37
|
lead: {
|
|
38
|
-
header:
|
|
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(
|
|
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:
|
|
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:
|
|
56
|
+
children: C("i18n.v3.status.draft", "Draft")
|
|
57
57
|
}) : e.status === a.Deprecated ? /* @__PURE__ */ l(v, {
|
|
58
58
|
status: "paused",
|
|
59
|
-
children:
|
|
59
|
+
children: C("i18n.v3.status.off", "Turned off")
|
|
60
60
|
}) : /* @__PURE__ */ l(s, {
|
|
61
|
-
loading:
|
|
61
|
+
loading: T,
|
|
62
62
|
share: b.get(e.code)?.share ?? null
|
|
63
63
|
})
|
|
64
64
|
}, {
|
|
65
65
|
id: "waiting",
|
|
66
|
-
header:
|
|
66
|
+
header: C("i18n.v3.col.waiting", "Waiting for review"),
|
|
67
67
|
width: "160px",
|
|
68
68
|
cell: (e) => {
|
|
69
|
-
if (
|
|
69
|
+
if (T) return null;
|
|
70
70
|
let t = b.get(e.code)?.waiting ?? 0;
|
|
71
|
-
|
|
71
|
+
if (t === 0) return /* @__PURE__ */ l("span", {
|
|
72
72
|
className: "text-sm text-text-secondary",
|
|
73
73
|
children: "—"
|
|
74
|
-
})
|
|
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: () =>
|
|
79
|
-
children:
|
|
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:
|
|
91
|
+
label: C("i18n.v3.actionsFor", "Actions for {{name}}", { name: t.name }),
|
|
87
92
|
items: [{
|
|
88
93
|
id: "open",
|
|
89
|
-
label:
|
|
94
|
+
label: C("i18n.v3.open", "Open"),
|
|
90
95
|
icon: n,
|
|
91
|
-
onSelect: () =>
|
|
96
|
+
onSelect: () => w(x.language(t.code))
|
|
92
97
|
}, {
|
|
93
98
|
id: "export",
|
|
94
|
-
label:
|
|
99
|
+
label: C("i18n.v3.exportWords", "Export translations"),
|
|
95
100
|
icon: e,
|
|
96
|
-
onSelect: () =>
|
|
101
|
+
onSelect: () => w(x.exportWords)
|
|
97
102
|
}]
|
|
98
103
|
})
|
|
99
104
|
})]
|
|
@@ -55,8 +55,8 @@ function u({ queue: n, actions: u, byCode: d, sourceName: f }) {
|
|
|
55
55
|
onClick: () => void u.approveOne(t),
|
|
56
56
|
disabled: u.bulk || u.busy.has(t.id),
|
|
57
57
|
"aria-busy": u.busy.has(t.id) || void 0,
|
|
58
|
-
"aria-label": p("i18n.v3.
|
|
59
|
-
children: [/* @__PURE__ */ i(e, { "aria-hidden": "true" }), p("i18n.v3.
|
|
58
|
+
"aria-label": p("i18n.v3.approveLiveWhere", "Approve and put live: {{where}}", { where: r(t.key) }),
|
|
59
|
+
children: [/* @__PURE__ */ i(e, { "aria-hidden": "true" }), p("i18n.v3.approveLive", "Approve and put live")]
|
|
60
60
|
}),
|
|
61
61
|
footer: n.hasMore ? /* @__PURE__ */ i(o, {
|
|
62
62
|
variant: "outline",
|
|
@@ -64,22 +64,22 @@ function C({ languageName: t }) {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
function w({ languageCode: e, languages: i, sourceName: c, onReviewed: f }) {
|
|
67
|
-
let m = n(), h = s(e), g =
|
|
67
|
+
let m = n(), h = s(e), g = new Map(i.map((e) => [e.code, e])), _ = e ? g.get(e)?.name ?? e : null, v = o(h, _, f), y = h.rows.length === 0, b = /* @__PURE__ */ l(a, {
|
|
68
68
|
queue: h,
|
|
69
|
-
actions:
|
|
70
|
-
byCode:
|
|
69
|
+
actions: v,
|
|
70
|
+
byCode: g,
|
|
71
71
|
sourceName: c
|
|
72
72
|
});
|
|
73
|
-
return h.error &&
|
|
73
|
+
return h.error && y ? b = /* @__PURE__ */ l(p, {
|
|
74
74
|
what: m("i18n.v3.tab.review", "Review queue"),
|
|
75
75
|
error: h.error,
|
|
76
76
|
onRetry: h.retry
|
|
77
|
-
}) : !h.loading &&
|
|
77
|
+
}) : !h.loading && y && (b = /* @__PURE__ */ l(C, { languageName: _ })), /* @__PURE__ */ u("div", {
|
|
78
78
|
className: "flex flex-col gap-3",
|
|
79
79
|
children: [
|
|
80
80
|
/* @__PURE__ */ l(S, {
|
|
81
81
|
queue: h,
|
|
82
|
-
actions:
|
|
82
|
+
actions: v
|
|
83
83
|
}),
|
|
84
84
|
/* @__PURE__ */ u("div", {
|
|
85
85
|
className: "flex flex-wrap items-center gap-2",
|
|
@@ -94,18 +94,18 @@ function w({ languageCode: e, languages: i, sourceName: c, onReviewed: f }) {
|
|
|
94
94
|
languages: i
|
|
95
95
|
}),
|
|
96
96
|
/* @__PURE__ */ l("span", { className: "flex-1" }),
|
|
97
|
-
|
|
97
|
+
y ? null : /* @__PURE__ */ u(d, {
|
|
98
98
|
variant: "outline",
|
|
99
99
|
size: "sm",
|
|
100
|
-
onClick: () => void
|
|
101
|
-
disabled:
|
|
102
|
-
"aria-busy":
|
|
100
|
+
onClick: () => void v.approveShown(),
|
|
101
|
+
disabled: v.bulk,
|
|
102
|
+
"aria-busy": v.bulk || void 0,
|
|
103
103
|
"data-testid": "review-approve-all",
|
|
104
|
-
children: [/* @__PURE__ */ l(t, { "aria-hidden": "true" }), m("i18n.v3.
|
|
104
|
+
children: [/* @__PURE__ */ l(t, { "aria-hidden": "true" }), m("i18n.v3.approveLiveAll", "Approve and put live ({{count}})", { count: r.format(h.rows.length) })]
|
|
105
105
|
})
|
|
106
106
|
]
|
|
107
107
|
}),
|
|
108
|
-
|
|
108
|
+
b
|
|
109
109
|
]
|
|
110
110
|
});
|
|
111
111
|
}
|
package/dist/i18n/v2/model.d.ts
CHANGED
|
@@ -6,8 +6,18 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const LANGUAGES_TABS: readonly ["languages", "products", "review"];
|
|
8
8
|
export type LanguagesTab = (typeof LANGUAGES_TABS)[number];
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Whether the service can list translations waiting for review. Today
|
|
11
|
+
* `translations` returns only live ones, whatever status is asked for, so the
|
|
12
|
+
* review queue would show live words as waiting (BOFF-16785's backend list).
|
|
13
|
+
* Until it can, the queue, its tab and its links stay hidden; the waiting
|
|
14
|
+
* counts (from `translationCoverage`) still show, as plain text.
|
|
15
|
+
*/
|
|
16
|
+
export declare const REVIEW_QUEUE_LISTS = false;
|
|
17
|
+
/** The tabs shown: the review queue only once the service can list it. */
|
|
18
|
+
export declare function shownTabs(reviewQueue: boolean): LanguagesTab[];
|
|
19
|
+
/** `?tab=`; anything else, or a hidden tab, is the Languages tab. */
|
|
20
|
+
export declare function readLanguagesTab(value: string | null, reviewQueue?: boolean): LanguagesTab;
|
|
11
21
|
/** The review queue's language filter (`?language=`). */
|
|
12
22
|
export declare const LANGUAGE_PARAM = "language";
|
|
13
23
|
/** One language's line of `translationCoverage` for one product. */
|
package/dist/i18n/v2/model.js
CHANGED
|
@@ -5,25 +5,28 @@ var e = [
|
|
|
5
5
|
"review"
|
|
6
6
|
];
|
|
7
7
|
function t(t) {
|
|
8
|
-
return e.
|
|
8
|
+
return e.filter((e) => t || e !== "review");
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
function n(e, n = !1) {
|
|
11
|
+
return t(n).find((t) => t === e) ?? "languages";
|
|
12
|
+
}
|
|
13
|
+
var r = "language", i = {
|
|
11
14
|
translated: 0,
|
|
12
15
|
total: 0,
|
|
13
16
|
waiting: 0,
|
|
14
17
|
missing: 0,
|
|
15
18
|
share: null
|
|
16
19
|
};
|
|
17
|
-
function
|
|
20
|
+
function a(e) {
|
|
18
21
|
return {
|
|
19
22
|
...e,
|
|
20
23
|
share: e.total > 0 ? e.translated / e.total : null
|
|
21
24
|
};
|
|
22
25
|
}
|
|
23
|
-
function
|
|
26
|
+
function o(e) {
|
|
24
27
|
let t = /* @__PURE__ */ new Map();
|
|
25
28
|
for (let n of e.values()) for (let e of n) {
|
|
26
|
-
let n = t.get(e.languageCode) ?? { ...
|
|
29
|
+
let n = t.get(e.languageCode) ?? { ...i };
|
|
27
30
|
t.set(e.languageCode, {
|
|
28
31
|
translated: n.translated + e.translatedKeys,
|
|
29
32
|
total: n.total + e.totalKeys,
|
|
@@ -32,28 +35,28 @@ function a(e) {
|
|
|
32
35
|
});
|
|
33
36
|
}
|
|
34
37
|
let n = /* @__PURE__ */ new Map();
|
|
35
|
-
for (let [e, r] of t) n.set(e,
|
|
38
|
+
for (let [e, r] of t) n.set(e, a(r));
|
|
36
39
|
return n;
|
|
37
40
|
}
|
|
38
|
-
function
|
|
39
|
-
let n = e.reduce((e, t) => Math.max(e, t.totalKeys), 0),
|
|
41
|
+
function s(e, t) {
|
|
42
|
+
let n = e.reduce((e, t) => Math.max(e, t.totalKeys), 0), r = e.filter((e) => e.languageCode !== t);
|
|
40
43
|
return {
|
|
41
|
-
...
|
|
44
|
+
...a((r.length > 0 ? r : e).reduce((e, t) => ({
|
|
42
45
|
translated: e.translated + t.translatedKeys,
|
|
43
46
|
total: e.total + t.totalKeys,
|
|
44
47
|
waiting: e.waiting + t.pendingReviewKeys,
|
|
45
48
|
missing: e.missing + t.missingCount
|
|
46
|
-
}), { ...
|
|
49
|
+
}), { ...i })),
|
|
47
50
|
texts: n
|
|
48
51
|
};
|
|
49
52
|
}
|
|
50
|
-
function
|
|
53
|
+
function c(e) {
|
|
51
54
|
return e.namespace?.displayName || e.product.displayName;
|
|
52
55
|
}
|
|
53
|
-
function
|
|
56
|
+
function l(e) {
|
|
54
57
|
return [...e].sort((e, t) => e.isDefault === t.isDefault ? e.name.localeCompare(t.name) : e.isDefault ? -1 : 1);
|
|
55
58
|
}
|
|
56
|
-
async function
|
|
59
|
+
async function u(e, t, n) {
|
|
57
60
|
let r = Array(e.length), i = 0;
|
|
58
61
|
await Promise.all(Array.from({ length: Math.max(1, Math.min(t, e.length)) }, async () => {
|
|
59
62
|
for (; i < e.length;) {
|
|
@@ -84,4 +87,4 @@ async function l(e, t, n) {
|
|
|
84
87
|
failed: o
|
|
85
88
|
};
|
|
86
89
|
}
|
|
87
|
-
export { e as LANGUAGES_TABS,
|
|
90
|
+
export { e as LANGUAGES_TABS, r as LANGUAGE_PARAM, u as eachLimited, o as languageProgress, s as productProgress, n as readLanguagesTab, t as shownTabs, l as sortLanguages, c as whereItAppears };
|
|
@@ -3,7 +3,7 @@ import { ApproveOutcome } from './useReviewQueue';
|
|
|
3
3
|
export type Tr = (key: string, fallback: string, params?: Record<string, string | number>) => string;
|
|
4
4
|
/** After one Approve. */
|
|
5
5
|
export declare function approvedMessage(tr: Tr, outcome: ApproveOutcome): NotifyOptions;
|
|
6
|
-
/** After
|
|
6
|
+
/** After approving every row shown: how many were approved, and what went wrong. */
|
|
7
7
|
export declare function approvedManyMessage(tr: Tr, outcomes: readonly ApproveOutcome[], failed: number): NotifyOptions;
|
|
8
8
|
/** After Put them live. */
|
|
9
9
|
export declare function liveMessage(tr: Tr, done: number, failed: number): NotifyOptions;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ReviewQueue, ReviewRow } from './useReviewQueue';
|
|
2
|
-
export declare function useReviewActions(queue: ReviewQueue,
|
|
2
|
+
export declare function useReviewActions(queue: ReviewQueue,
|
|
3
|
+
/** The queue's language, for the confirm; null for every language. */
|
|
4
|
+
languageName: string | null, onReviewed: () => void): {
|
|
3
5
|
busy: ReadonlySet<string>;
|
|
4
6
|
bulk: boolean;
|
|
5
7
|
approveOne: (row: ReviewRow) => Promise<void>;
|
|
@@ -6,50 +6,50 @@ import { useState as o } from "react";
|
|
|
6
6
|
import { useConfirm as s, useNotify as c } from "@burdenoff/fe-libs/ui";
|
|
7
7
|
// src/i18n/v2/useReviewActions.ts
|
|
8
8
|
var l = 4;
|
|
9
|
-
function u(u, d) {
|
|
10
|
-
let
|
|
11
|
-
u.refresh(),
|
|
9
|
+
function u(u, d, f) {
|
|
10
|
+
let p = e(), m = c(), h = s(), [g, _] = o(/* @__PURE__ */ new Set()), [v, y] = o(!1), b = () => {
|
|
11
|
+
u.refresh(), f();
|
|
12
12
|
};
|
|
13
13
|
return {
|
|
14
|
-
busy:
|
|
15
|
-
bulk:
|
|
14
|
+
busy: g,
|
|
15
|
+
bulk: v,
|
|
16
16
|
approveOne: async (e) => {
|
|
17
|
-
|
|
17
|
+
_((t) => new Set(t).add(e.id));
|
|
18
18
|
try {
|
|
19
|
-
|
|
19
|
+
m(i(p, await u.approve(e.id))), b();
|
|
20
20
|
} catch {
|
|
21
|
-
|
|
22
|
-
title:
|
|
21
|
+
m({
|
|
22
|
+
title: p("i18n.v3.approveFailed", "Couldn’t approve it. Try again."),
|
|
23
23
|
tone: "error"
|
|
24
24
|
});
|
|
25
25
|
} finally {
|
|
26
|
-
|
|
26
|
+
_((t) => {
|
|
27
27
|
let n = new Set(t);
|
|
28
28
|
return n.delete(e.id), n;
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
approveShown: async () => {
|
|
33
|
-
let e = u.rows;
|
|
34
|
-
if (!await
|
|
35
|
-
title:
|
|
36
|
-
description:
|
|
37
|
-
confirmLabel:
|
|
33
|
+
let e = u.rows, i = t.format(e.length);
|
|
34
|
+
if (!await h({
|
|
35
|
+
title: p("i18n.v3.approveLiveAllTitle", "Approve and put live {{count}} translations?", { count: i }),
|
|
36
|
+
description: d ? p("i18n.v3.approveLiveAllBodyIn", "They go live straight away for everyone using {{name}}.", { name: d }) : p("i18n.v3.approveLiveAllBody", "Each one goes live straight away for everyone using its language."),
|
|
37
|
+
confirmLabel: p("i18n.v3.approveLiveAll", "Approve and put live ({{count}})", { count: i })
|
|
38
38
|
})) return;
|
|
39
|
-
|
|
40
|
-
let { done:
|
|
41
|
-
|
|
39
|
+
y(!0);
|
|
40
|
+
let { done: a, failed: o } = await n(e, l, (e) => u.approve(e.id));
|
|
41
|
+
y(!1), m(r(p, a.map(({ result: e }) => e), o.length)), b();
|
|
42
42
|
},
|
|
43
43
|
putLive: async () => {
|
|
44
44
|
let e = u.notLive;
|
|
45
|
-
if (!await
|
|
46
|
-
title:
|
|
47
|
-
description:
|
|
48
|
-
confirmLabel:
|
|
45
|
+
if (!await h({
|
|
46
|
+
title: p("i18n.v3.putLiveTitle", "Put {{count}} translations live?", { count: t.format(e.length) }),
|
|
47
|
+
description: p("i18n.v3.putLiveBody", "They’re approved already. Every product shows them straight away."),
|
|
48
|
+
confirmLabel: p("i18n.v3.putLive", "Put them live")
|
|
49
49
|
})) return;
|
|
50
|
-
|
|
50
|
+
y(!0);
|
|
51
51
|
let { done: r, failed: i } = await n(e, l, (e) => u.publish(e.id));
|
|
52
|
-
|
|
52
|
+
y(!1), m(a(p, r.length, i.length)), b();
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
}
|
|
@@ -21,8 +21,11 @@ export interface ReviewRow {
|
|
|
21
21
|
export declare const REVIEW_PAGE = 50;
|
|
22
22
|
/** What one approval ended as. */
|
|
23
23
|
export type ApproveOutcome = "live" | "approvedOnly";
|
|
24
|
-
/**
|
|
25
|
-
|
|
24
|
+
/**
|
|
25
|
+
* How many translations wait for review, in every language (the tab's count).
|
|
26
|
+
* Not asked while the review queue is hidden.
|
|
27
|
+
*/
|
|
28
|
+
export declare function useWaitingCount(enabled: boolean): number | undefined;
|
|
26
29
|
export declare function useReviewQueue(languageCode: string | null): {
|
|
27
30
|
rows: ReviewRow[];
|
|
28
31
|
total: any;
|
|
@@ -6,12 +6,15 @@ var s = ["GetI18nTranslationsByStatus"];
|
|
|
6
6
|
function c(e) {
|
|
7
7
|
return e ? { languageCode: e } : {};
|
|
8
8
|
}
|
|
9
|
-
function l() {
|
|
10
|
-
let { data:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
function l(e) {
|
|
10
|
+
let { data: t } = n({
|
|
11
|
+
variables: {
|
|
12
|
+
filter: { status: i.PendingReview },
|
|
13
|
+
limit: 1
|
|
14
|
+
},
|
|
15
|
+
skip: !e
|
|
16
|
+
});
|
|
17
|
+
return t?.translations.total;
|
|
15
18
|
}
|
|
16
19
|
function u(l) {
|
|
17
20
|
let u = e(), [d, f] = o(50), p = n({
|