@acmekit/dashboard 2.13.7 → 2.13.9
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/api-key-management-create-VWUERPPB.mjs +170 -0
- package/dist/api-key-management-detail-V4ENQHYY.mjs +306 -0
- package/dist/api-key-management-edit-R44OHS7B.mjs +106 -0
- package/dist/api-key-management-list-K2XPKF5E.mjs +400 -0
- package/dist/app.js +16765 -1370
- package/dist/app.mjs +786 -1030
- package/dist/chunk-22YYMH6M.mjs +382 -0
- package/dist/chunk-2U3RK3JG.mjs +474 -0
- package/dist/chunk-535OVBXR.mjs +226 -0
- package/dist/chunk-774WSTCC.mjs +19 -0
- package/dist/chunk-C76H5USB.mjs +16 -0
- package/dist/chunk-DFFLVEZ5.mjs +40 -0
- package/dist/chunk-DN3MIYQH.mjs +140 -0
- package/dist/chunk-DQCEH3X2.mjs +28 -0
- package/dist/chunk-DTY37DDZ.mjs +20 -0
- package/dist/chunk-EFRMWHRX.mjs +84 -0
- package/dist/chunk-FXYH54JP.mjs +16 -0
- package/dist/chunk-G22WWLPG.mjs +44 -0
- package/dist/chunk-G2VJOHHV.mjs +32 -0
- package/dist/chunk-GBFVWROS.mjs +58 -0
- package/dist/chunk-ITNQKZQQ.mjs +142 -0
- package/dist/chunk-IUCDCPJU.mjs +0 -0
- package/dist/chunk-LKWTBYYC.mjs +35 -0
- package/dist/{chunk-4VYJHIB3.mjs → chunk-ND3ODI36.mjs} +0 -72
- package/dist/chunk-OAHCJFG3.mjs +17 -0
- package/dist/chunk-RPAL6FHW.mjs +73 -0
- package/dist/{chunk-JSJZMTQG.mjs → chunk-RREPQMYC.mjs} +14 -41
- package/dist/chunk-S3REQHPQ.mjs +86 -0
- package/dist/chunk-S4DMV3ZT.mjs +35 -0
- package/dist/chunk-ST2YB7JN.mjs +74 -0
- package/dist/chunk-TCNCAWYD.mjs +9 -0
- package/dist/chunk-ULSPL3DR.mjs +126 -0
- package/dist/chunk-WILMJYUB.mjs +35 -0
- package/dist/chunk-XIM7X4FB.mjs +83 -0
- package/dist/chunk-YLPAZ2DP.mjs +1837 -0
- package/dist/chunk-YRWSG3YM.mjs +80 -0
- package/dist/{invite-S5USGDOZ.mjs → invite-XGPZZBUP.mjs} +15 -7
- package/dist/{login-AIMR26AL.mjs → login-GNP3QIPI.mjs} +25 -12
- package/dist/profile-detail-YX27F7N6.mjs +96 -0
- package/dist/profile-edit-2VRDU75O.mjs +173 -0
- package/dist/{reset-password-UQPRHMB3.mjs → reset-password-TWRNZO6Z.mjs} +7 -3
- package/dist/settings-3XWLL5LG.mjs +545 -0
- package/dist/translation-list-CCEQJNED.mjs +581 -0
- package/dist/translations-edit-E57GVUFV.mjs +5376 -0
- package/dist/user-detail-KUSRRVNX.mjs +169 -0
- package/dist/user-edit-HTN3ZGCL.mjs +114 -0
- package/dist/user-invite-E3FAAU3V.mjs +361 -0
- package/dist/user-list-KNJ5S3IM.mjs +1116 -0
- package/dist/user-metadata-5GQK75DT.mjs +425 -0
- package/dist/workflow-execution-detail-LZXCRVNC.mjs +819 -0
- package/dist/workflow-execution-list-HQ3V6TML.mjs +175 -0
- package/package.json +9 -9
- package/src/components/layout/settings-layout/settings-layout.tsx +8 -2
- package/src/dashboard-app/routes/get-route.map.tsx +1 -14
- package/src/hooks/api/api-keys.tsx +0 -49
- package/src/hooks/api/index.ts +0 -1
- package/src/providers/keybind-provider/hooks.tsx +0 -145
- package/src/routes/translations/translation-list/translation-list.tsx +10 -21
- package/src/routes/translations/translations-edit/translations-edit.tsx +14 -11
- package/src/vite-env.d.ts +3 -1
- package/dist/chunk-FBTP4AJM.mjs +0 -221
- package/dist/chunk-QYOO4QR6.mjs +0 -73
- package/src/components/data-table/helpers/sales-channels/index.ts +0 -4
- package/src/components/data-table/helpers/sales-channels/use-sales-channel-table-columns.tsx +0 -61
- package/src/components/data-table/helpers/sales-channels/use-sales-channel-table-empty-state.tsx +0 -22
- package/src/components/data-table/helpers/sales-channels/use-sales-channel-table-filters.tsx +0 -33
- package/src/components/data-table/helpers/sales-channels/use-sales-channel-table-query.tsx +0 -30
- package/src/routes/api-key-management/api-key-management-detail/components/api-key-sales-channel-section/api-key-sales-channel-section.tsx +0 -206
- package/src/routes/api-key-management/api-key-management-detail/components/api-key-sales-channel-section/index.ts +0 -1
- package/src/routes/store/common/hooks/use-currencies-table-columns.tsx +0 -29
- package/src/routes/store/common/hooks/use-currencies-table-query.tsx +0 -21
- package/src/routes/store/common/hooks/use-locales-table-columns.tsx +0 -29
- package/src/routes/store/common/hooks/use-locales-table-query.tsx +0 -21
- package/src/routes/store/store-detail/components/store-general-section/index.ts +0 -1
- package/src/routes/store/store-detail/components/store-general-section/store-general-section.tsx +0 -48
- package/src/routes/store/store-detail/index.ts +0 -2
- package/src/routes/store/store-detail/loader.ts +0 -18
- package/src/routes/store/store-detail/store-detail.tsx +0 -42
- package/src/routes/store/store-edit/components/edit-store-form/edit-store-form.tsx +0 -83
- package/src/routes/store/store-edit/index.ts +0 -1
- package/src/routes/store/store-edit/store-edit.tsx +0 -25
- package/src/routes/store/store-metadata/index.ts +0 -1
- package/src/routes/store/store-metadata/store-metadata.tsx +0 -24
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IconAvatar
|
|
3
|
+
} from "./chunk-G2VJOHHV.mjs";
|
|
4
|
+
import {
|
|
5
|
+
TwoColumnPage
|
|
6
|
+
} from "./chunk-22YYMH6M.mjs";
|
|
7
|
+
import {
|
|
8
|
+
useLocales
|
|
9
|
+
} from "./chunk-ST2YB7JN.mjs";
|
|
10
|
+
import "./chunk-GBFVWROS.mjs";
|
|
11
|
+
import "./chunk-EFRMWHRX.mjs";
|
|
12
|
+
import "./chunk-LKWTBYYC.mjs";
|
|
13
|
+
import {
|
|
14
|
+
useTranslationSettings,
|
|
15
|
+
useTranslationStatistics
|
|
16
|
+
} from "./chunk-ULSPL3DR.mjs";
|
|
17
|
+
import "./chunk-DN3MIYQH.mjs";
|
|
18
|
+
import "./chunk-XIM7X4FB.mjs";
|
|
19
|
+
import {
|
|
20
|
+
TwoColumnPageSkeleton
|
|
21
|
+
} from "./chunk-ITNQKZQQ.mjs";
|
|
22
|
+
import "./chunk-YRWSG3YM.mjs";
|
|
23
|
+
import "./chunk-FXYH54JP.mjs";
|
|
24
|
+
import "./chunk-774WSTCC.mjs";
|
|
25
|
+
import "./chunk-DTY37DDZ.mjs";
|
|
26
|
+
import "./chunk-QZ7TP4HQ.mjs";
|
|
27
|
+
|
|
28
|
+
// src/routes/translations/translation-list/translation-list.tsx
|
|
29
|
+
import { Alert, Button as Button2, Container as Container4, Heading as Heading3, Text as Text4 } from "@acmekit/ui";
|
|
30
|
+
import { useCallback as useCallback2, useMemo as useMemo2 } from "react";
|
|
31
|
+
import { useTranslation as useTranslation4 } from "react-i18next";
|
|
32
|
+
import { useNavigate } from "react-router-dom";
|
|
33
|
+
|
|
34
|
+
// src/routes/translations/translation-list/components/active-locales-section/active-locales-section.tsx
|
|
35
|
+
import { Language } from "@acmekit/icons";
|
|
36
|
+
import { Container, Heading, Text, Tooltip } from "@acmekit/ui";
|
|
37
|
+
import { useCallback, useState } from "react";
|
|
38
|
+
import { useTranslation } from "react-i18next";
|
|
39
|
+
|
|
40
|
+
// src/components/common/link-button/link-button.tsx
|
|
41
|
+
import { clx } from "@acmekit/ui";
|
|
42
|
+
import { Link } from "react-router-dom";
|
|
43
|
+
import { jsx } from "react/jsx-runtime";
|
|
44
|
+
var LinkButton = ({
|
|
45
|
+
className,
|
|
46
|
+
variant = "interactive",
|
|
47
|
+
...props
|
|
48
|
+
}) => {
|
|
49
|
+
return /* @__PURE__ */ jsx(
|
|
50
|
+
Link,
|
|
51
|
+
{
|
|
52
|
+
className: clx(
|
|
53
|
+
"transition-fg txt-compact-small-plus rounded-[4px] outline-none",
|
|
54
|
+
"focus-visible:shadow-borders-focus",
|
|
55
|
+
{
|
|
56
|
+
"text-ui-fg-interactive hover:text-ui-fg-interactive-hover": variant === "interactive",
|
|
57
|
+
"text-ui-fg-base hover:text-ui-fg-subtle": variant === "primary"
|
|
58
|
+
},
|
|
59
|
+
className
|
|
60
|
+
),
|
|
61
|
+
...props
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// src/routes/translations/translation-list/components/active-locales-section/active-locales-section.tsx
|
|
67
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
68
|
+
var ActiveLocalesSection = ({
|
|
69
|
+
locales
|
|
70
|
+
}) => {
|
|
71
|
+
const { t } = useTranslation();
|
|
72
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
73
|
+
const renderLocales = useCallback(() => {
|
|
74
|
+
const maxLocalesToDetail = 2;
|
|
75
|
+
if (locales.length <= maxLocalesToDetail) {
|
|
76
|
+
return locales.map((locale) => locale.name).join(", ");
|
|
77
|
+
}
|
|
78
|
+
return `${locales.slice(0, maxLocalesToDetail).map((locale) => locale.name).join(", ")} + ${locales.length - maxLocalesToDetail}`;
|
|
79
|
+
}, [locales]);
|
|
80
|
+
const hasLocales = locales.length > 0;
|
|
81
|
+
return /* @__PURE__ */ jsxs(Container, { className: "flex flex-col p-0", children: [
|
|
82
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-4", children: [
|
|
83
|
+
/* @__PURE__ */ jsx2(Heading, { level: "h2", children: t("translations.activeLocales.heading") }),
|
|
84
|
+
/* @__PURE__ */ jsx2(
|
|
85
|
+
LinkButton,
|
|
86
|
+
{
|
|
87
|
+
variant: "interactive",
|
|
88
|
+
className: "text-ui-fg-subtle hover:text-ui-fg-subtle-hover",
|
|
89
|
+
to: "/settings/translations/add-locales",
|
|
90
|
+
children: t("translations.activeLocales.noLocalesTipConfigureAction")
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
] }),
|
|
94
|
+
hasLocales && /* @__PURE__ */ jsx2("div", { className: "px-1 pb-1", children: /* @__PURE__ */ jsx2(
|
|
95
|
+
Tooltip,
|
|
96
|
+
{
|
|
97
|
+
open: isHovered,
|
|
98
|
+
content: /* @__PURE__ */ jsx2("div", { className: "flex flex-col gap-y-1 p-1", children: locales.map((locale) => /* @__PURE__ */ jsx2(
|
|
99
|
+
Text,
|
|
100
|
+
{
|
|
101
|
+
size: "base",
|
|
102
|
+
className: "text-ui-fg-subtle",
|
|
103
|
+
children: locale.name
|
|
104
|
+
},
|
|
105
|
+
locale.code
|
|
106
|
+
)) }),
|
|
107
|
+
children: /* @__PURE__ */ jsxs(
|
|
108
|
+
Container,
|
|
109
|
+
{
|
|
110
|
+
className: "bg-ui-bg-component border-r-1 flex items-center gap-x-4 px-[19px] py-2",
|
|
111
|
+
onMouseEnter: () => setIsHovered(true),
|
|
112
|
+
onMouseLeave: () => setIsHovered(false),
|
|
113
|
+
children: [
|
|
114
|
+
/* @__PURE__ */ jsx2(IconAvatar, { className: "border-ui-border-base border", children: /* @__PURE__ */ jsx2(Language, {}) }),
|
|
115
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
116
|
+
/* @__PURE__ */ jsx2(Text, { size: "small", weight: "plus", children: t("translations.activeLocales.subtitle") }),
|
|
117
|
+
/* @__PURE__ */ jsx2(Text, { className: "text-ui-fg-subtle", size: "small", children: renderLocales() })
|
|
118
|
+
] })
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
) })
|
|
124
|
+
] });
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// src/routes/translations/translation-list/components/translation-list-section/translation-list-section.tsx
|
|
128
|
+
import { Button, Container as Container2, Text as Text2 } from "@acmekit/ui";
|
|
129
|
+
import { Link as Link2 } from "react-router-dom";
|
|
130
|
+
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
131
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
132
|
+
var TranslationListSection = ({
|
|
133
|
+
entities,
|
|
134
|
+
hasLocales = false
|
|
135
|
+
}) => {
|
|
136
|
+
const { t } = useTranslation2();
|
|
137
|
+
return /* @__PURE__ */ jsx3(Container2, { className: "divide-y p-0", children: entities.map((entity) => /* @__PURE__ */ jsxs2(
|
|
138
|
+
"div",
|
|
139
|
+
{
|
|
140
|
+
className: "grid grid-cols-[250px_1fr_auto] items-center gap-x-4 px-6 py-4",
|
|
141
|
+
children: [
|
|
142
|
+
/* @__PURE__ */ jsx3(Text2, { size: "small", weight: "plus", children: entity.label }),
|
|
143
|
+
/* @__PURE__ */ jsx3(Text2, { size: "small", className: "text-ui-fg-subtle", children: t("translations.list.metrics", {
|
|
144
|
+
translated: (entity.translatedCount ?? 0).toLocaleString(),
|
|
145
|
+
total: (entity.totalCount ?? 0).toLocaleString()
|
|
146
|
+
}) }),
|
|
147
|
+
/* @__PURE__ */ jsx3(
|
|
148
|
+
Link2,
|
|
149
|
+
{
|
|
150
|
+
to: `/settings/translations/edit?reference=${entity.reference}`,
|
|
151
|
+
children: /* @__PURE__ */ jsx3(
|
|
152
|
+
Button,
|
|
153
|
+
{
|
|
154
|
+
variant: "secondary",
|
|
155
|
+
size: "small",
|
|
156
|
+
disabled: !hasLocales || !entity.totalCount,
|
|
157
|
+
children: "Edit"
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
)
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
entity.reference
|
|
165
|
+
)) });
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// src/routes/translations/translation-list/components/translations-completion-section/translations-completion-section.tsx
|
|
169
|
+
import { Container as Container3, Divider, Heading as Heading2, Text as Text3, Tooltip as Tooltip2 } from "@acmekit/ui";
|
|
170
|
+
import { useMemo, useState as useState2 } from "react";
|
|
171
|
+
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
172
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
173
|
+
var TranslationsCompletionSection = ({
|
|
174
|
+
statistics,
|
|
175
|
+
locales
|
|
176
|
+
}) => {
|
|
177
|
+
const { t } = useTranslation3();
|
|
178
|
+
const [hoveredLocale, setHoveredLocale] = useState2(null);
|
|
179
|
+
const { translatedCount, totalCount } = Object.values(statistics).reduce(
|
|
180
|
+
(acc, curr) => ({
|
|
181
|
+
translatedCount: acc.translatedCount + curr.translated,
|
|
182
|
+
totalCount: acc.totalCount + curr.expected
|
|
183
|
+
}),
|
|
184
|
+
{ totalCount: 0, translatedCount: 0 }
|
|
185
|
+
);
|
|
186
|
+
const percentage = totalCount > 0 ? translatedCount / totalCount * 100 : 0;
|
|
187
|
+
const remaining = Math.max(0, totalCount - translatedCount);
|
|
188
|
+
const localeStats = useMemo(() => {
|
|
189
|
+
const localeMap = /* @__PURE__ */ new Map();
|
|
190
|
+
locales.forEach((locale) => {
|
|
191
|
+
localeMap.set(locale.code, { translated: 0, expected: 0 });
|
|
192
|
+
});
|
|
193
|
+
Object.values(statistics).forEach((entityStats) => {
|
|
194
|
+
if (entityStats.by_locale) {
|
|
195
|
+
Object.entries(entityStats.by_locale).forEach(
|
|
196
|
+
([localeCode, localeData]) => {
|
|
197
|
+
const existing = localeMap.get(localeCode);
|
|
198
|
+
if (existing) {
|
|
199
|
+
existing.translated += localeData.translated;
|
|
200
|
+
existing.expected += localeData.expected;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
return locales.map((locale) => {
|
|
207
|
+
const stats = localeMap.get(locale.code) || { translated: 0, expected: 0 };
|
|
208
|
+
return {
|
|
209
|
+
code: locale.code,
|
|
210
|
+
name: locale.name,
|
|
211
|
+
translated: stats.translated,
|
|
212
|
+
toTranslate: Math.max(0, stats.expected - stats.translated),
|
|
213
|
+
total: stats.expected
|
|
214
|
+
};
|
|
215
|
+
});
|
|
216
|
+
}, [statistics, locales]);
|
|
217
|
+
const maxTotal = useMemo(
|
|
218
|
+
() => Math.max(...localeStats.map((s) => s.total), 1),
|
|
219
|
+
[localeStats]
|
|
220
|
+
);
|
|
221
|
+
const localeStatsCount = useMemo(() => localeStats.length, [localeStats]);
|
|
222
|
+
return /* @__PURE__ */ jsxs3(Container3, { className: "p-0", children: [
|
|
223
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-y-4 px-6 py-4", children: [
|
|
224
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between", children: [
|
|
225
|
+
/* @__PURE__ */ jsx4(Heading2, { level: "h2", children: t("translations.completion.heading") }),
|
|
226
|
+
/* @__PURE__ */ jsxs3(Text3, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: [
|
|
227
|
+
translatedCount.toLocaleString(),
|
|
228
|
+
" ",
|
|
229
|
+
t("general.of"),
|
|
230
|
+
" ",
|
|
231
|
+
totalCount.toLocaleString()
|
|
232
|
+
] })
|
|
233
|
+
] }),
|
|
234
|
+
/* @__PURE__ */ jsx4("div", { className: "flex h-3 w-full overflow-hidden", children: percentage > 0 ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
235
|
+
/* @__PURE__ */ jsx4(
|
|
236
|
+
"div",
|
|
237
|
+
{
|
|
238
|
+
className: "mr-0.5 h-full rounded-sm transition-all",
|
|
239
|
+
style: {
|
|
240
|
+
width: `${percentage}%`,
|
|
241
|
+
backgroundColor: "var(--tag-blue-icon)",
|
|
242
|
+
boxShadow: "inset 0 0 0 0.5px var(--alpha-250)"
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
),
|
|
246
|
+
/* @__PURE__ */ jsx4(
|
|
247
|
+
"div",
|
|
248
|
+
{
|
|
249
|
+
className: "h-full flex-1 rounded-sm",
|
|
250
|
+
style: {
|
|
251
|
+
backgroundColor: "var(--tag-blue-border)",
|
|
252
|
+
boxShadow: "inset 0 0 0 0.5px var(--alpha-250)"
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
)
|
|
256
|
+
] }) : /* @__PURE__ */ jsx4(
|
|
257
|
+
"div",
|
|
258
|
+
{
|
|
259
|
+
className: "h-full w-full rounded-sm",
|
|
260
|
+
style: {
|
|
261
|
+
backgroundColor: "var(--tag-blue-border)",
|
|
262
|
+
boxShadow: "inset 0 0 0 0.5px var(--alpha-250)"
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
) }),
|
|
266
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between", children: [
|
|
267
|
+
/* @__PURE__ */ jsxs3(Text3, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: [
|
|
268
|
+
percentage.toFixed(1),
|
|
269
|
+
"%"
|
|
270
|
+
] }),
|
|
271
|
+
/* @__PURE__ */ jsxs3(Text3, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: [
|
|
272
|
+
remaining.toLocaleString(),
|
|
273
|
+
" ",
|
|
274
|
+
t("general.remaining").toLowerCase()
|
|
275
|
+
] })
|
|
276
|
+
] })
|
|
277
|
+
] }),
|
|
278
|
+
localeStats.length > 0 && /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
279
|
+
/* @__PURE__ */ jsx4(Divider, { variant: "dashed" }),
|
|
280
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-y-3 px-6 pb-6 pt-4", children: [
|
|
281
|
+
/* @__PURE__ */ jsx4("div", { className: "flex h-32 w-full items-end gap-1", children: localeStats.map((locale) => {
|
|
282
|
+
const heightPercent = locale.total / maxTotal * 100;
|
|
283
|
+
const translatedPercent = locale.total > 0 ? locale.translated / locale.total * 100 : 0;
|
|
284
|
+
return /* @__PURE__ */ jsx4(
|
|
285
|
+
Tooltip2,
|
|
286
|
+
{
|
|
287
|
+
open: hoveredLocale === locale.code,
|
|
288
|
+
content: /* @__PURE__ */ jsxs3("div", { className: "flex min-w-[150px] flex-col gap-y-1 p-1", children: [
|
|
289
|
+
/* @__PURE__ */ jsx4(Text3, { size: "small", weight: "plus", children: locale.name }),
|
|
290
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between", children: [
|
|
291
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-x-2", children: [
|
|
292
|
+
/* @__PURE__ */ jsx4(
|
|
293
|
+
"div",
|
|
294
|
+
{
|
|
295
|
+
className: "h-2 w-2 rounded-full",
|
|
296
|
+
style: {
|
|
297
|
+
backgroundColor: "var(--tag-blue-icon)",
|
|
298
|
+
boxShadow: "inset 0 0 0 0.5px var(--alpha-250)"
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
),
|
|
302
|
+
/* @__PURE__ */ jsx4(
|
|
303
|
+
Text3,
|
|
304
|
+
{
|
|
305
|
+
size: "small",
|
|
306
|
+
weight: "plus",
|
|
307
|
+
className: "text-ui-fg-base",
|
|
308
|
+
children: t("translations.completion.translated")
|
|
309
|
+
}
|
|
310
|
+
)
|
|
311
|
+
] }),
|
|
312
|
+
/* @__PURE__ */ jsx4(
|
|
313
|
+
Text3,
|
|
314
|
+
{
|
|
315
|
+
size: "small",
|
|
316
|
+
weight: "plus",
|
|
317
|
+
className: "text-ui-fg-base",
|
|
318
|
+
children: locale.translated
|
|
319
|
+
}
|
|
320
|
+
)
|
|
321
|
+
] }),
|
|
322
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between", children: [
|
|
323
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-x-2", children: [
|
|
324
|
+
/* @__PURE__ */ jsx4(
|
|
325
|
+
"div",
|
|
326
|
+
{
|
|
327
|
+
className: "h-2 w-2 rounded-full",
|
|
328
|
+
style: {
|
|
329
|
+
backgroundColor: "var(--tag-blue-border)",
|
|
330
|
+
boxShadow: "inset 0 0 0 0.5px var(--alpha-250)"
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
),
|
|
334
|
+
/* @__PURE__ */ jsx4(
|
|
335
|
+
Text3,
|
|
336
|
+
{
|
|
337
|
+
size: "small",
|
|
338
|
+
weight: "plus",
|
|
339
|
+
className: "text-ui-fg-base",
|
|
340
|
+
children: t("translations.completion.toTranslate")
|
|
341
|
+
}
|
|
342
|
+
)
|
|
343
|
+
] }),
|
|
344
|
+
/* @__PURE__ */ jsx4(
|
|
345
|
+
Text3,
|
|
346
|
+
{
|
|
347
|
+
size: "small",
|
|
348
|
+
weight: "plus",
|
|
349
|
+
className: "text-ui-fg-base",
|
|
350
|
+
children: locale.toTranslate
|
|
351
|
+
}
|
|
352
|
+
)
|
|
353
|
+
] })
|
|
354
|
+
] }),
|
|
355
|
+
children: /* @__PURE__ */ jsx4("div", { className: "flex h-full flex-1 items-end justify-center", children: /* @__PURE__ */ jsx4(
|
|
356
|
+
"div",
|
|
357
|
+
{
|
|
358
|
+
className: "flex w-full min-w-2 max-w-[96px] flex-col justify-end overflow-hidden rounded-t-sm transition-opacity",
|
|
359
|
+
style: { height: `${heightPercent}%` },
|
|
360
|
+
onMouseEnter: () => setHoveredLocale(locale.code),
|
|
361
|
+
onMouseLeave: () => setHoveredLocale(null),
|
|
362
|
+
children: translatedPercent === 0 ? /* @__PURE__ */ jsx4(
|
|
363
|
+
"div",
|
|
364
|
+
{
|
|
365
|
+
className: "w-full rounded-sm",
|
|
366
|
+
style: {
|
|
367
|
+
height: "100%",
|
|
368
|
+
backgroundColor: "var(--tag-neutral-bg)",
|
|
369
|
+
boxShadow: "inset 0 0 0 0.5px var(--alpha-250)"
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
) : /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
373
|
+
/* @__PURE__ */ jsx4(
|
|
374
|
+
"div",
|
|
375
|
+
{
|
|
376
|
+
className: "w-full rounded-sm",
|
|
377
|
+
style: {
|
|
378
|
+
height: `${100 - translatedPercent}%`,
|
|
379
|
+
backgroundColor: "var(--tag-blue-border)",
|
|
380
|
+
boxShadow: "inset 0 0 0 0.5px var(--alpha-250)",
|
|
381
|
+
minHeight: locale.toTranslate > 0 ? "2px" : "0"
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
),
|
|
385
|
+
translatedPercent > 0 && /* @__PURE__ */ jsx4(
|
|
386
|
+
"div",
|
|
387
|
+
{
|
|
388
|
+
className: "mt-0.5 w-full rounded-sm",
|
|
389
|
+
style: {
|
|
390
|
+
height: `${translatedPercent}%`,
|
|
391
|
+
backgroundColor: "var(--tag-blue-icon)",
|
|
392
|
+
boxShadow: "inset 0 0 0 0.5px var(--alpha-250)",
|
|
393
|
+
minHeight: locale.translated > 0 ? "2px" : "0"
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
)
|
|
397
|
+
] })
|
|
398
|
+
}
|
|
399
|
+
) })
|
|
400
|
+
},
|
|
401
|
+
locale.code
|
|
402
|
+
);
|
|
403
|
+
}) }),
|
|
404
|
+
localeStatsCount < 9 && /* @__PURE__ */ jsx4("div", { className: "flex w-full gap-1", children: localeStats.map((locale) => /* @__PURE__ */ jsx4(
|
|
405
|
+
"div",
|
|
406
|
+
{
|
|
407
|
+
className: "flex flex-1 items-center justify-center",
|
|
408
|
+
children: /* @__PURE__ */ jsx4(
|
|
409
|
+
Text3,
|
|
410
|
+
{
|
|
411
|
+
size: "xsmall",
|
|
412
|
+
weight: "plus",
|
|
413
|
+
className: "text-ui-fg-subtle min-w-2 whitespace-normal break-words text-center leading-tight",
|
|
414
|
+
children: localeStatsCount < 6 ? locale.name : locale.code
|
|
415
|
+
}
|
|
416
|
+
)
|
|
417
|
+
},
|
|
418
|
+
locale.code
|
|
419
|
+
)) }),
|
|
420
|
+
localeStatsCount > 9 && /* @__PURE__ */ jsx4(
|
|
421
|
+
Text3,
|
|
422
|
+
{
|
|
423
|
+
weight: "plus",
|
|
424
|
+
size: "xsmall",
|
|
425
|
+
className: "text-ui-fg-subtle text-center",
|
|
426
|
+
children: t("translations.completion.footer")
|
|
427
|
+
}
|
|
428
|
+
)
|
|
429
|
+
] })
|
|
430
|
+
] })
|
|
431
|
+
] });
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
// src/routes/translations/translation-list/translation-list.tsx
|
|
435
|
+
import { ListCheckbox } from "@acmekit/icons";
|
|
436
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
437
|
+
var TranslationList = () => {
|
|
438
|
+
const { t } = useTranslation4();
|
|
439
|
+
const navigate = useNavigate();
|
|
440
|
+
const { locales: localesList, isPending, isError, error } = useLocales();
|
|
441
|
+
const supportedLocales = localesList?.map((l) => ({ locale_code: l.code, locale: l.code })) ?? [];
|
|
442
|
+
const {
|
|
443
|
+
translation_settings,
|
|
444
|
+
isPending: isTranslationSettingsPending,
|
|
445
|
+
isError: isTranslationSettingsError,
|
|
446
|
+
error: translationSettingsError
|
|
447
|
+
} = useTranslationSettings({
|
|
448
|
+
is_active: true
|
|
449
|
+
});
|
|
450
|
+
const {
|
|
451
|
+
statistics,
|
|
452
|
+
isPending: isTranslationStatisticsPending,
|
|
453
|
+
isError: isTranslationStatisticsError,
|
|
454
|
+
error: translationStatisticsError
|
|
455
|
+
} = useTranslationStatistics(
|
|
456
|
+
{
|
|
457
|
+
locales: supportedLocales.map((l) => l.locale_code),
|
|
458
|
+
entity_types: Object.keys(translation_settings ?? {})
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
enabled: !!translation_settings && supportedLocales.length > 0
|
|
462
|
+
}
|
|
463
|
+
);
|
|
464
|
+
if (isError || isTranslationSettingsError || isTranslationStatisticsError) {
|
|
465
|
+
throw error || translationSettingsError || translationStatisticsError;
|
|
466
|
+
}
|
|
467
|
+
const hasLocales = supportedLocales.length > 0;
|
|
468
|
+
const translatableEntities = useMemo2(() => {
|
|
469
|
+
if (!translation_settings) {
|
|
470
|
+
return [];
|
|
471
|
+
}
|
|
472
|
+
return Object.entries(translation_settings).filter(
|
|
473
|
+
([entity]) => !["product_option", "product_option_value"].includes(entity)
|
|
474
|
+
).map(([entity, setting]) => {
|
|
475
|
+
const entityStatistics = statistics?.[entity] ?? {
|
|
476
|
+
translated: 0,
|
|
477
|
+
expected: 0
|
|
478
|
+
};
|
|
479
|
+
return {
|
|
480
|
+
label: entity.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" "),
|
|
481
|
+
reference: entity,
|
|
482
|
+
translatableFields: setting.fields,
|
|
483
|
+
translatedCount: entityStatistics.translated,
|
|
484
|
+
totalCount: entityStatistics.expected
|
|
485
|
+
};
|
|
486
|
+
}).sort((a, b) => a.label.localeCompare(b.label));
|
|
487
|
+
}, [translation_settings, statistics]);
|
|
488
|
+
const handleManageLocales = useCallback2(() => {
|
|
489
|
+
navigate("/settings/translations/add-locales");
|
|
490
|
+
}, [navigate]);
|
|
491
|
+
const handleManageEntities = useCallback2(() => {
|
|
492
|
+
navigate("/settings/translations/settings");
|
|
493
|
+
}, [navigate]);
|
|
494
|
+
const isReady = !!localesList && !isPending && !isTranslationSettingsPending && !!translation_settings && (!!statistics && !isTranslationStatisticsPending || !hasLocales);
|
|
495
|
+
if (!isReady) {
|
|
496
|
+
return /* @__PURE__ */ jsx5(TwoColumnPageSkeleton, { sidebarSections: 2 });
|
|
497
|
+
}
|
|
498
|
+
return /* @__PURE__ */ jsxs4(
|
|
499
|
+
TwoColumnPage,
|
|
500
|
+
{
|
|
501
|
+
widgets: {
|
|
502
|
+
before: [],
|
|
503
|
+
after: [],
|
|
504
|
+
sideBefore: [],
|
|
505
|
+
sideAfter: []
|
|
506
|
+
},
|
|
507
|
+
children: [
|
|
508
|
+
/* @__PURE__ */ jsxs4(TwoColumnPage.Main, { children: [
|
|
509
|
+
/* @__PURE__ */ jsxs4(Container4, { className: "flex items-center justify-between px-6 py-4", children: [
|
|
510
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col", children: [
|
|
511
|
+
/* @__PURE__ */ jsxs4(Heading3, { children: [
|
|
512
|
+
"Manage ",
|
|
513
|
+
t("translations.domain")
|
|
514
|
+
] }),
|
|
515
|
+
/* @__PURE__ */ jsx5(Text4, { className: "text-ui-fg-subtle", size: "small", children: t("translations.subtitle") })
|
|
516
|
+
] }),
|
|
517
|
+
/* @__PURE__ */ jsxs4(
|
|
518
|
+
Button2,
|
|
519
|
+
{
|
|
520
|
+
size: "small",
|
|
521
|
+
variant: "secondary",
|
|
522
|
+
onClick: handleManageEntities,
|
|
523
|
+
children: [
|
|
524
|
+
/* @__PURE__ */ jsx5(ListCheckbox, { className: "text-ui-fg-subtle" }),
|
|
525
|
+
/* @__PURE__ */ jsx5(Text4, { className: "txt-compact-small-plus text-ui-fg-base", children: t("translations.actions.manageEntities") })
|
|
526
|
+
]
|
|
527
|
+
}
|
|
528
|
+
)
|
|
529
|
+
] }),
|
|
530
|
+
!hasLocales && /* @__PURE__ */ jsx5(
|
|
531
|
+
Alert,
|
|
532
|
+
{
|
|
533
|
+
variant: "info",
|
|
534
|
+
className: "bg-ui-bg-base flex items-center px-6 py-4",
|
|
535
|
+
children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-x-2", children: [
|
|
536
|
+
/* @__PURE__ */ jsxs4("p", { children: [
|
|
537
|
+
t("translations.activeLocales.noLocalesTip"),
|
|
538
|
+
"."
|
|
539
|
+
] }),
|
|
540
|
+
/* @__PURE__ */ jsx5(
|
|
541
|
+
Button2,
|
|
542
|
+
{
|
|
543
|
+
onClick: handleManageLocales,
|
|
544
|
+
size: "small",
|
|
545
|
+
variant: "secondary",
|
|
546
|
+
children: t("translations.activeLocales.noLocalesTipConfigureAction")
|
|
547
|
+
}
|
|
548
|
+
)
|
|
549
|
+
] })
|
|
550
|
+
}
|
|
551
|
+
),
|
|
552
|
+
/* @__PURE__ */ jsx5(
|
|
553
|
+
TranslationListSection,
|
|
554
|
+
{
|
|
555
|
+
entities: translatableEntities,
|
|
556
|
+
hasLocales
|
|
557
|
+
}
|
|
558
|
+
)
|
|
559
|
+
] }),
|
|
560
|
+
/* @__PURE__ */ jsxs4(TwoColumnPage.Sidebar, { children: [
|
|
561
|
+
/* @__PURE__ */ jsx5(
|
|
562
|
+
ActiveLocalesSection,
|
|
563
|
+
{
|
|
564
|
+
locales: supportedLocales.map((l) => l.locale)
|
|
565
|
+
}
|
|
566
|
+
),
|
|
567
|
+
/* @__PURE__ */ jsx5(
|
|
568
|
+
TranslationsCompletionSection,
|
|
569
|
+
{
|
|
570
|
+
statistics: statistics ?? {},
|
|
571
|
+
locales: supportedLocales.map((l) => l.locale)
|
|
572
|
+
}
|
|
573
|
+
)
|
|
574
|
+
] })
|
|
575
|
+
]
|
|
576
|
+
}
|
|
577
|
+
);
|
|
578
|
+
};
|
|
579
|
+
export {
|
|
580
|
+
TranslationList as Component
|
|
581
|
+
};
|