@taskon/widget-react 0.0.1-beta.5 → 0.0.1-beta.6
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/README.md +13 -4
- package/dist/CommunityTaskList.css +9 -1
- package/dist/EligibilityInfo.css +46 -42
- package/dist/LeaderboardWidget.css +73 -71
- package/dist/PageBuilder.css +5 -0
- package/dist/Quest.css +18 -14
- package/dist/TaskOnProvider.css +2 -0
- package/dist/UserCenterWidget.css +6 -6
- package/dist/UserCenterWidget2.css +1626 -1601
- package/dist/{dynamic-import-helper.css → WidgetShell.css} +2 -2
- package/dist/chunks/{CommunityTaskList-CrMvOB8w.js → CommunityTaskList-Hde2OKHH.js} +360 -154
- package/dist/chunks/{EligibilityInfo-Beww12QX.js → EligibilityInfo-BV0Z2TgY.js} +533 -561
- package/dist/chunks/{LeaderboardWidget-DwuSpVl0.js → LeaderboardWidget-BNGRD5Bu.js} +270 -249
- package/dist/chunks/{PageBuilder-DsX6Tv0N.js → PageBuilder-C5DSHiW9.js} +5 -5
- package/dist/chunks/{Quest-CuD2LElS.js → Quest-DG9zfXJo.js} +72 -50
- package/dist/chunks/{TaskOnProvider-xUeP2Nro.js → TaskOnProvider-BhamHIyY.js} +34 -17
- package/dist/chunks/{ThemeProvider-Bt4UZ33y.js → ThemeProvider-mXLdLSkq.js} +81 -18
- package/dist/chunks/{UserCenterWidget-CvU6K4AC.js → UserCenterWidget-D5ttw4hO.js} +1328 -1337
- package/dist/chunks/{UserCenterWidget-CB0hnj-L.js → UserCenterWidget-jDO5zTN1.js} +298 -231
- package/dist/chunks/{dynamic-import-helper-WmIF58Sb.js → WidgetShell-D7yC894Y.js} +447 -457
- package/dist/chunks/communitytask-es-CBNnS4o2.js +521 -0
- package/dist/chunks/communitytask-ja-GRf9cbdx.js +521 -0
- package/dist/chunks/communitytask-ko-Bf24PQKI.js +521 -0
- package/dist/chunks/{communitytask-ru-DhySaZL8.js → communitytask-ru-CZm2CPoV.js} +211 -1
- package/dist/chunks/leaderboardwidget-es-vKjrjQaz.js +146 -0
- package/dist/chunks/leaderboardwidget-ja-Q6u0HxKG.js +146 -0
- package/dist/chunks/leaderboardwidget-ko-CG6SWgxf.js +146 -0
- package/dist/chunks/leaderboardwidget-ru-DCcHcJGz.js +146 -0
- package/dist/chunks/{quest-es-D-b5xcme.js → quest-es-Dyyy0zaw.js} +8 -93
- package/dist/chunks/{quest-ja-Dxd2vqBF.js → quest-ja-Depog33y.js} +8 -93
- package/dist/chunks/{quest-ko-CSmRWgK_.js → quest-ko-BMu3uRQJ.js} +8 -93
- package/dist/chunks/{quest-ru-CkEKv1_F.js → quest-ru-xne814Rw.js} +8 -93
- package/dist/chunks/usercenter-es-Dz3Wp2vV.js +512 -0
- package/dist/chunks/usercenter-ja-CKE4DJC6.js +512 -0
- package/dist/chunks/usercenter-ko-Dtpkn2qb.js +512 -0
- package/dist/chunks/usercenter-ru-DnBGee45.js +512 -0
- package/dist/community-task.d.ts +0 -390
- package/dist/community-task.js +2 -7
- package/dist/core.d.ts +29 -5
- package/dist/core.js +8 -9
- package/dist/index.d.ts +29 -701
- package/dist/index.js +18 -29
- package/dist/leaderboard.d.ts +0 -498
- package/dist/leaderboard.js +2 -16
- package/dist/page-builder.js +1 -1
- package/dist/quest.d.ts +0 -971
- package/dist/quest.js +2 -7
- package/dist/user-center.d.ts +0 -1610
- package/dist/user-center.js +2 -494
- package/package.json +2 -2
- package/dist/chunks/communitytask-es-1zawvXEX.js +0 -311
- package/dist/chunks/communitytask-ja-CmW6nP-L.js +0 -311
- package/dist/chunks/communitytask-ko-BD0hzQSi.js +0 -311
- package/dist/chunks/createLocaleLoader-BameiEhU.js +0 -65
- package/dist/chunks/leaderboardwidget-ja-Bj6gz6y1.js +0 -119
- package/dist/chunks/leaderboardwidget-ko-f1cLO9ic.js +0 -119
- package/dist/chunks/usercenter-ja-B2465c1O.js +0 -326
- package/dist/chunks/usercenter-ko-xAEYxqLg.js +0 -326
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { T as Table, u as usePagination, D as Dialog, B as Button, a as useResolvedWidgetConfig, W as WidgetShell, _ as __variableDynamicImportRuntimeHelper } from "./dynamic-import-helper-WmIF58Sb.js";
|
|
2
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
3
2
|
import { useState, useRef, useCallback, useLayoutEffect, useMemo, useEffect } from "react";
|
|
4
3
|
import { UserCenterRewardCardType, USER_CENTER_PAGE_SIZE, createUserCenterApi, SnsType, createUserApi, VerifyCodeType, getChainName, truncateAddress, filterEnabledAccounts, filterEnabledWallets, USER_CENTER_REWARD_CARD_TYPES, RewardType, toWei, LockedType, filterEnabledTabs, UserCenterTabType } from "@taskon/core";
|
|
5
|
-
import {
|
|
6
|
-
import { L as LoadingState, E as EmptyState, P as Pagination,
|
|
4
|
+
import { h as useTaskOnContext } from "./ThemeProvider-mXLdLSkq.js";
|
|
5
|
+
import { u as useUserCenterLocale, L as LoadingState, E as EmptyState, P as Pagination, f as formatDateTime, A as AssetImage, b as buildRewardCards, a as useBindSocialAccount, I as Input, c as useTokenAssets, d as useRewardDetails, e as usePointsHistory, W as WithdrawForm, g as PointsList, N as NftRewardContent, T as TokenRewardContent } from "./UserCenterWidget-D5ttw4hO.js";
|
|
6
|
+
import { T as Table, a as usePagination, D as Dialog, B as Button, u as useResolvedWidgetConfig, W as WidgetShell } from "./WidgetShell-D7yC894Y.js";
|
|
7
7
|
import { u as useWallet, d as useToast } from "./useToast-CaRkylKe.js";
|
|
8
8
|
import '../UserCenterWidget.css';function Tabs({
|
|
9
9
|
items,
|
|
@@ -90,16 +90,16 @@ function ActivityHistoryList({
|
|
|
90
90
|
loading,
|
|
91
91
|
error,
|
|
92
92
|
pagination,
|
|
93
|
-
messages,
|
|
94
93
|
mode = "pagination",
|
|
95
94
|
onItemClick,
|
|
96
95
|
onRetry
|
|
97
96
|
}) {
|
|
97
|
+
const { messages } = useUserCenterLocale();
|
|
98
98
|
const columns = useMemo(
|
|
99
99
|
() => [
|
|
100
100
|
{
|
|
101
101
|
key: "campaign_name",
|
|
102
|
-
title: messages.
|
|
102
|
+
title: messages.activity_name,
|
|
103
103
|
cellClassName: "taskon-activity-history__cell--name",
|
|
104
104
|
render: (_value, row) => /* @__PURE__ */ jsxs("div", { className: "taskon-activity-history__name-cell", children: [
|
|
105
105
|
/* @__PURE__ */ jsx("span", { className: "taskon-activity-history__campaign-name", children: row.campaign_name }),
|
|
@@ -108,14 +108,14 @@ function ActivityHistoryList({
|
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
110
|
key: "time",
|
|
111
|
-
title: messages.
|
|
111
|
+
title: messages.activity_time,
|
|
112
112
|
width: "380px",
|
|
113
113
|
align: "right",
|
|
114
114
|
cellClassName: "taskon-activity-history__cell--time",
|
|
115
115
|
render: (_value, row) => formatTimeRange(row.start_time, row.end_time)
|
|
116
116
|
}
|
|
117
117
|
],
|
|
118
|
-
[messages.
|
|
118
|
+
[messages.activity_name, messages.activity_time]
|
|
119
119
|
);
|
|
120
120
|
const rowConfig = useMemo(
|
|
121
121
|
() => ({
|
|
@@ -142,7 +142,7 @@ function ActivityHistoryList({
|
|
|
142
142
|
] });
|
|
143
143
|
}
|
|
144
144
|
if (!loading && data.length === 0) {
|
|
145
|
-
return /* @__PURE__ */ jsx(EmptyState, { message: messages.
|
|
145
|
+
return /* @__PURE__ */ jsx(EmptyState, { message: messages.empty_activity_history });
|
|
146
146
|
}
|
|
147
147
|
return /* @__PURE__ */ jsxs("div", { className: "taskon-activity-history", children: [
|
|
148
148
|
/* @__PURE__ */ jsx(
|
|
@@ -165,8 +165,7 @@ function ActivityHistoryList({
|
|
|
165
165
|
onPrevious: pagination.goToPrevious,
|
|
166
166
|
onNext: pagination.goToNext,
|
|
167
167
|
hasPrevious: pagination.hasPrevious,
|
|
168
|
-
hasNext: pagination.hasNext
|
|
169
|
-
messages
|
|
168
|
+
hasNext: pagination.hasNext
|
|
170
169
|
}
|
|
171
170
|
) : pagination.hasMore && /* @__PURE__ */ jsx("div", { className: "taskon-activity-history__load-more", children: /* @__PURE__ */ jsx(
|
|
172
171
|
"button",
|
|
@@ -175,7 +174,7 @@ function ActivityHistoryList({
|
|
|
175
174
|
className: "taskon-activity-history__load-more-btn",
|
|
176
175
|
onClick: pagination.loadMore,
|
|
177
176
|
disabled: loading,
|
|
178
|
-
children: loading ? messages.loading : messages.
|
|
177
|
+
children: loading ? messages.loading : messages.load_more
|
|
179
178
|
}
|
|
180
179
|
) })
|
|
181
180
|
] });
|
|
@@ -184,21 +183,21 @@ function getCardTitle(type, messages, pointsData, xpLevelData) {
|
|
|
184
183
|
var _a;
|
|
185
184
|
switch (type) {
|
|
186
185
|
case UserCenterRewardCardType.Token:
|
|
187
|
-
return messages.
|
|
186
|
+
return messages.reward_token;
|
|
188
187
|
case UserCenterRewardCardType.Nft:
|
|
189
|
-
return messages.
|
|
188
|
+
return messages.reward_nft;
|
|
190
189
|
case UserCenterRewardCardType.Whitelist:
|
|
191
|
-
return messages.
|
|
190
|
+
return messages.reward_whitelist;
|
|
192
191
|
case UserCenterRewardCardType.DiscordRole:
|
|
193
|
-
return messages.
|
|
192
|
+
return messages.reward_discord_role;
|
|
194
193
|
case UserCenterRewardCardType.Points:
|
|
195
|
-
return (pointsData == null ? void 0 : pointsData.points_name) ?? messages.
|
|
194
|
+
return (pointsData == null ? void 0 : pointsData.points_name) ?? messages.reward_points;
|
|
196
195
|
case UserCenterRewardCardType.XpLevel: {
|
|
197
196
|
const xpPointsName = (_a = xpLevelData == null ? void 0 : xpLevelData.xpPointsName) == null ? void 0 : _a.trim();
|
|
198
197
|
if (xpPointsName) {
|
|
199
198
|
return `${xpPointsName} & ${messages.level}`;
|
|
200
199
|
}
|
|
201
|
-
return messages.
|
|
200
|
+
return messages.reward_xp_level;
|
|
202
201
|
}
|
|
203
202
|
default:
|
|
204
203
|
return type;
|
|
@@ -215,24 +214,75 @@ function TokenIcon() {
|
|
|
215
214
|
/* @__PURE__ */ jsx("path", { d: "M12.5 2L3 10H22L12.5 2Z", fill: "url(#token-gem-top)" }),
|
|
216
215
|
/* @__PURE__ */ jsx("path", { d: "M3 10L12.5 26L12.5 10H3Z", fill: "url(#token-gem-left)" }),
|
|
217
216
|
/* @__PURE__ */ jsx("path", { d: "M22 10L12.5 26L12.5 10H22Z", fill: "url(#token-gem-right)" }),
|
|
218
|
-
/* @__PURE__ */ jsx(
|
|
217
|
+
/* @__PURE__ */ jsx(
|
|
218
|
+
"path",
|
|
219
|
+
{
|
|
220
|
+
d: "M12.5 2L8 10H17L12.5 2Z",
|
|
221
|
+
fill: "url(#token-gem-highlight)",
|
|
222
|
+
fillOpacity: "0.6"
|
|
223
|
+
}
|
|
224
|
+
),
|
|
219
225
|
/* @__PURE__ */ jsxs("defs", { children: [
|
|
220
|
-
/* @__PURE__ */ jsxs(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
226
|
+
/* @__PURE__ */ jsxs(
|
|
227
|
+
"linearGradient",
|
|
228
|
+
{
|
|
229
|
+
id: "token-gem-top",
|
|
230
|
+
x1: "12.5",
|
|
231
|
+
y1: "2",
|
|
232
|
+
x2: "12.5",
|
|
233
|
+
y2: "10",
|
|
234
|
+
gradientUnits: "userSpaceOnUse",
|
|
235
|
+
children: [
|
|
236
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#81D4FA" }),
|
|
237
|
+
/* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "#4FC3F7" })
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
),
|
|
241
|
+
/* @__PURE__ */ jsxs(
|
|
242
|
+
"linearGradient",
|
|
243
|
+
{
|
|
244
|
+
id: "token-gem-left",
|
|
245
|
+
x1: "3",
|
|
246
|
+
y1: "10",
|
|
247
|
+
x2: "12.5",
|
|
248
|
+
y2: "26",
|
|
249
|
+
gradientUnits: "userSpaceOnUse",
|
|
250
|
+
children: [
|
|
251
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#4FC3F7" }),
|
|
252
|
+
/* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "#0288D1" })
|
|
253
|
+
]
|
|
254
|
+
}
|
|
255
|
+
),
|
|
256
|
+
/* @__PURE__ */ jsxs(
|
|
257
|
+
"linearGradient",
|
|
258
|
+
{
|
|
259
|
+
id: "token-gem-right",
|
|
260
|
+
x1: "22",
|
|
261
|
+
y1: "10",
|
|
262
|
+
x2: "12.5",
|
|
263
|
+
y2: "26",
|
|
264
|
+
gradientUnits: "userSpaceOnUse",
|
|
265
|
+
children: [
|
|
266
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#29B6F6" }),
|
|
267
|
+
/* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "#0277BD" })
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
),
|
|
271
|
+
/* @__PURE__ */ jsxs(
|
|
272
|
+
"linearGradient",
|
|
273
|
+
{
|
|
274
|
+
id: "token-gem-highlight",
|
|
275
|
+
x1: "12.5",
|
|
276
|
+
y1: "2",
|
|
277
|
+
x2: "12.5",
|
|
278
|
+
y2: "10",
|
|
279
|
+
gradientUnits: "userSpaceOnUse",
|
|
280
|
+
children: [
|
|
281
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#E1F5FE" }),
|
|
282
|
+
/* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "#81D4FA" })
|
|
283
|
+
]
|
|
284
|
+
}
|
|
285
|
+
)
|
|
236
286
|
] })
|
|
237
287
|
] });
|
|
238
288
|
}
|
|
@@ -263,10 +313,21 @@ function XpLevelIcon() {
|
|
|
263
313
|
strokeLinejoin: "round"
|
|
264
314
|
}
|
|
265
315
|
),
|
|
266
|
-
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
316
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
|
|
317
|
+
"linearGradient",
|
|
318
|
+
{
|
|
319
|
+
id: "xp-gradient",
|
|
320
|
+
x1: "13",
|
|
321
|
+
y1: "2",
|
|
322
|
+
x2: "13",
|
|
323
|
+
y2: "21.5",
|
|
324
|
+
gradientUnits: "userSpaceOnUse",
|
|
325
|
+
children: [
|
|
326
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#FDE68A" }),
|
|
327
|
+
/* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "#F59E0B" })
|
|
328
|
+
]
|
|
329
|
+
}
|
|
330
|
+
) })
|
|
270
331
|
] });
|
|
271
332
|
}
|
|
272
333
|
function PointsIcon() {
|
|
@@ -278,10 +339,21 @@ function PointsIcon() {
|
|
|
278
339
|
fill: "url(#points-gradient)"
|
|
279
340
|
}
|
|
280
341
|
),
|
|
281
|
-
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
342
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
|
|
343
|
+
"linearGradient",
|
|
344
|
+
{
|
|
345
|
+
id: "points-gradient",
|
|
346
|
+
x1: "12",
|
|
347
|
+
y1: "2",
|
|
348
|
+
x2: "12",
|
|
349
|
+
y2: "20.8",
|
|
350
|
+
gradientUnits: "userSpaceOnUse",
|
|
351
|
+
children: [
|
|
352
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#A78BFA" }),
|
|
353
|
+
/* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "#7C3AED" })
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
) })
|
|
285
357
|
] });
|
|
286
358
|
}
|
|
287
359
|
function DefaultIcon({
|
|
@@ -312,10 +384,10 @@ function AssetCard({
|
|
|
312
384
|
value,
|
|
313
385
|
selected = false,
|
|
314
386
|
onClick,
|
|
315
|
-
messages,
|
|
316
387
|
pointsData,
|
|
317
388
|
xpLevelData
|
|
318
389
|
}) {
|
|
390
|
+
const { messages } = useUserCenterLocale();
|
|
319
391
|
const title = getCardTitle(type, messages, pointsData, xpLevelData);
|
|
320
392
|
const iconUrl = getCardIconUrl(type, pointsData);
|
|
321
393
|
const iconClassName = `taskon-asset-card__icon${needsLightBackground(type) ? " taskon-asset-card__icon--light" : ""}`;
|
|
@@ -327,7 +399,14 @@ function AssetCard({
|
|
|
327
399
|
onClick,
|
|
328
400
|
"aria-pressed": selected,
|
|
329
401
|
children: [
|
|
330
|
-
/* @__PURE__ */ jsx("div", { className: iconClassName, children: iconUrl ? /* @__PURE__ */ jsx(
|
|
402
|
+
/* @__PURE__ */ jsx("div", { className: iconClassName, children: iconUrl ? /* @__PURE__ */ jsx(
|
|
403
|
+
"img",
|
|
404
|
+
{
|
|
405
|
+
src: iconUrl,
|
|
406
|
+
alt: title,
|
|
407
|
+
className: "taskon-asset-card__icon-img"
|
|
408
|
+
}
|
|
409
|
+
) : /* @__PURE__ */ jsx(DefaultIcon, { type }) }),
|
|
331
410
|
/* @__PURE__ */ jsxs("div", { className: "taskon-asset-card__content", children: [
|
|
332
411
|
/* @__PURE__ */ jsx("span", { className: "taskon-asset-card__title", children: title }),
|
|
333
412
|
/* @__PURE__ */ jsx("span", { className: "taskon-asset-card__value", children: value })
|
|
@@ -340,9 +419,9 @@ function AssetCarousel({
|
|
|
340
419
|
cards,
|
|
341
420
|
selectedCard,
|
|
342
421
|
selectedPointsId,
|
|
343
|
-
onSelectCard
|
|
344
|
-
messages
|
|
422
|
+
onSelectCard
|
|
345
423
|
}) {
|
|
424
|
+
const { messages } = useUserCenterLocale();
|
|
346
425
|
const containerRef = useRef(null);
|
|
347
426
|
const [showLeftArrow, setShowLeftArrow] = useState(false);
|
|
348
427
|
const [showRightArrow, setShowRightArrow] = useState(false);
|
|
@@ -354,19 +433,16 @@ function AssetCarousel({
|
|
|
354
433
|
setShowLeftArrow(scrollLeft > 0);
|
|
355
434
|
setShowRightArrow(scrollLeft + clientWidth < scrollWidth - 1);
|
|
356
435
|
}, []);
|
|
357
|
-
useCallback(
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
},
|
|
368
|
-
[]
|
|
369
|
-
);
|
|
436
|
+
useCallback((direction) => {
|
|
437
|
+
const container = containerRef.current;
|
|
438
|
+
if (!container) return;
|
|
439
|
+
const scrollAmount = 200;
|
|
440
|
+
const newScrollLeft = direction === "left" ? container.scrollLeft - scrollAmount : container.scrollLeft + scrollAmount;
|
|
441
|
+
container.scrollTo({
|
|
442
|
+
left: newScrollLeft,
|
|
443
|
+
behavior: "smooth"
|
|
444
|
+
});
|
|
445
|
+
}, []);
|
|
370
446
|
const isCardSelected = useCallback(
|
|
371
447
|
(card) => {
|
|
372
448
|
if (selectedCard !== card.type) return false;
|
|
@@ -392,7 +468,7 @@ function AssetCarousel({
|
|
|
392
468
|
return /* @__PURE__ */ jsx("div", { className: "taskon-asset-carousel--empty" });
|
|
393
469
|
}
|
|
394
470
|
return /* @__PURE__ */ jsxs("div", { className: "taskon-asset-carousel", children: [
|
|
395
|
-
/* @__PURE__ */ jsx("h3", { className: "taskon-asset-carousel__title", children: messages.
|
|
471
|
+
/* @__PURE__ */ jsx("h3", { className: "taskon-asset-carousel__title", children: messages.section_you_have_earned }),
|
|
396
472
|
/* @__PURE__ */ jsx("div", { ref: containerRef, className: "taskon-asset-carousel__container", children: visibleCards.map((card, index) => {
|
|
397
473
|
var _a;
|
|
398
474
|
return /* @__PURE__ */ jsx(
|
|
@@ -405,7 +481,6 @@ function AssetCarousel({
|
|
|
405
481
|
var _a2;
|
|
406
482
|
return onSelectCard(card.type, (_a2 = card.pointsData) == null ? void 0 : _a2.points_id);
|
|
407
483
|
},
|
|
408
|
-
messages,
|
|
409
484
|
pointsData: card.pointsData,
|
|
410
485
|
xpLevelData: card.xpLevelData
|
|
411
486
|
},
|
|
@@ -472,28 +547,28 @@ function XpLevelCard({
|
|
|
472
547
|
historyLoading,
|
|
473
548
|
historyError,
|
|
474
549
|
pagination,
|
|
475
|
-
messages,
|
|
476
550
|
className = ""
|
|
477
551
|
}) {
|
|
478
552
|
var _a;
|
|
553
|
+
const { messages } = useUserCenterLocale();
|
|
479
554
|
const { level, currentXp, nextLevelXp, totalXp } = xpData;
|
|
480
|
-
const pointsName = ((_a = xpData.pointsName) == null ? void 0 : _a.trim()) ||
|
|
555
|
+
const pointsName = ((_a = xpData.pointsName) == null ? void 0 : _a.trim()) || messages.default_xp_points_name;
|
|
481
556
|
const xpToNext = Math.max(0, nextLevelXp - currentXp);
|
|
482
557
|
const columns = [
|
|
483
558
|
{
|
|
484
559
|
key: "detail",
|
|
485
|
-
title: messages.
|
|
560
|
+
title: messages.column_detail,
|
|
486
561
|
render: (_, row) => /* @__PURE__ */ jsx("span", { className: "taskon-points-list__name", children: row.name })
|
|
487
562
|
},
|
|
488
563
|
{
|
|
489
564
|
key: "time",
|
|
490
|
-
title: messages.
|
|
565
|
+
title: messages.column_time,
|
|
491
566
|
width: 160,
|
|
492
567
|
render: (_, row) => /* @__PURE__ */ jsx("span", { className: "taskon-points-list__time", children: formatDateTime(row.receive_time) })
|
|
493
568
|
},
|
|
494
569
|
{
|
|
495
570
|
key: "amount",
|
|
496
|
-
title: `${messages.
|
|
571
|
+
title: `${messages.column_amount} (${pointsName})`,
|
|
497
572
|
width: 160,
|
|
498
573
|
align: "right",
|
|
499
574
|
render: (_, row) => {
|
|
@@ -535,7 +610,7 @@ function XpLevelCard({
|
|
|
535
610
|
] })
|
|
536
611
|
] }),
|
|
537
612
|
/* @__PURE__ */ jsxs("div", { className: "taskon-xp-level-card__xp", children: [
|
|
538
|
-
/* @__PURE__ */ jsx("span", { className: "taskon-xp-level-card__xp-label", children: messages.
|
|
613
|
+
/* @__PURE__ */ jsx("span", { className: "taskon-xp-level-card__xp-label", children: messages.total_xp }),
|
|
539
614
|
/* @__PURE__ */ jsxs("span", { className: "taskon-xp-level-card__xp-value", children: [
|
|
540
615
|
formatNumber(totalXp),
|
|
541
616
|
" ",
|
|
@@ -553,7 +628,7 @@ function XpLevelCard({
|
|
|
553
628
|
pointsName
|
|
554
629
|
] }),
|
|
555
630
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
556
|
-
messages.
|
|
631
|
+
messages.xp_to_next_level,
|
|
557
632
|
": ",
|
|
558
633
|
formatNumber(xpToNext),
|
|
559
634
|
" ",
|
|
@@ -563,10 +638,10 @@ function XpLevelCard({
|
|
|
563
638
|
/* @__PURE__ */ jsx(ProgressBar, { value: currentXp, max: nextLevelXp, height: 10 })
|
|
564
639
|
] }),
|
|
565
640
|
/* @__PURE__ */ jsxs("div", { className: "taskon-xp-level-card__history", children: [
|
|
566
|
-
/* @__PURE__ */ jsx("h4", { className: "taskon-xp-level-card__history-title", children: messages.
|
|
641
|
+
/* @__PURE__ */ jsx("h4", { className: "taskon-xp-level-card__history-title", children: messages.xp_history }),
|
|
567
642
|
historyLoading && historyData.length === 0 && /* @__PURE__ */ jsx(LoadingState, { message: messages.loading }),
|
|
568
643
|
historyError && historyData.length === 0 && /* @__PURE__ */ jsx("div", { className: "taskon-user-center-error", children: /* @__PURE__ */ jsx("p", { className: "taskon-user-center-error__message", children: historyError.message }) }),
|
|
569
|
-
!historyLoading && !historyError && historyData.length === 0 && /* @__PURE__ */ jsx(EmptyState, { message: messages.
|
|
644
|
+
!historyLoading && !historyError && historyData.length === 0 && /* @__PURE__ */ jsx(EmptyState, { message: messages.no_data }),
|
|
570
645
|
historyData.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
571
646
|
/* @__PURE__ */ jsx("div", { className: "taskon-xp-level-card__table-wrap", children: /* @__PURE__ */ jsx(
|
|
572
647
|
Table,
|
|
@@ -579,7 +654,7 @@ function XpLevelCard({
|
|
|
579
654
|
loading: historyLoading && historyData.length > 0,
|
|
580
655
|
loadingText: messages.loading,
|
|
581
656
|
empty: {
|
|
582
|
-
title: messages.
|
|
657
|
+
title: messages.no_data
|
|
583
658
|
}
|
|
584
659
|
}
|
|
585
660
|
) }),
|
|
@@ -591,8 +666,7 @@ function XpLevelCard({
|
|
|
591
666
|
onPrevious: pagination.goToPrevious,
|
|
592
667
|
onNext: pagination.goToNext,
|
|
593
668
|
hasPrevious: pagination.hasPrevious,
|
|
594
|
-
hasNext: pagination.hasNext
|
|
595
|
-
messages
|
|
669
|
+
hasNext: pagination.hasNext
|
|
596
670
|
}
|
|
597
671
|
)
|
|
598
672
|
] })
|
|
@@ -603,9 +677,9 @@ function WhitelistTable({
|
|
|
603
677
|
data,
|
|
604
678
|
loading,
|
|
605
679
|
error,
|
|
606
|
-
pagination
|
|
607
|
-
messages
|
|
680
|
+
pagination
|
|
608
681
|
}) {
|
|
682
|
+
const { messages } = useUserCenterLocale();
|
|
609
683
|
if (loading && data.length === 0) {
|
|
610
684
|
return /* @__PURE__ */ jsx(LoadingState, { message: messages.loading });
|
|
611
685
|
}
|
|
@@ -613,12 +687,12 @@ function WhitelistTable({
|
|
|
613
687
|
return /* @__PURE__ */ jsx("div", { className: "taskon-user-center-error", children: /* @__PURE__ */ jsx("p", { className: "taskon-user-center-error__message", children: error.message }) });
|
|
614
688
|
}
|
|
615
689
|
if (!loading && data.length === 0) {
|
|
616
|
-
return /* @__PURE__ */ jsx(EmptyState, { message: messages.
|
|
690
|
+
return /* @__PURE__ */ jsx(EmptyState, { message: messages.no_data });
|
|
617
691
|
}
|
|
618
692
|
const columns = [
|
|
619
693
|
{
|
|
620
694
|
key: "whitelist",
|
|
621
|
-
title: messages.
|
|
695
|
+
title: messages.column_whitelist,
|
|
622
696
|
width: 100,
|
|
623
697
|
render: (_, row) => {
|
|
624
698
|
const wlValue = row.reward_value;
|
|
@@ -636,21 +710,21 @@ function WhitelistTable({
|
|
|
636
710
|
},
|
|
637
711
|
{
|
|
638
712
|
key: "detail",
|
|
639
|
-
title: messages.
|
|
713
|
+
title: messages.column_detail,
|
|
640
714
|
render: (_, row) => /* @__PURE__ */ jsx("span", { className: "taskon-reward-table__campaign-name", children: row.campaign_name })
|
|
641
715
|
},
|
|
642
716
|
{
|
|
643
717
|
key: "time",
|
|
644
|
-
title: messages.
|
|
718
|
+
title: messages.column_time,
|
|
645
719
|
width: 160,
|
|
646
720
|
render: (_, row) => /* @__PURE__ */ jsx("span", { className: "taskon-reward-table__time", children: formatDateTime(row.reward_time) })
|
|
647
721
|
},
|
|
648
722
|
{
|
|
649
723
|
key: "status",
|
|
650
|
-
title: messages.
|
|
724
|
+
title: messages.column_status,
|
|
651
725
|
width: 120,
|
|
652
726
|
align: "right",
|
|
653
|
-
render: () => /* @__PURE__ */ jsx("span", { className: "taskon-reward-table__manual-drop", children: messages.
|
|
727
|
+
render: () => /* @__PURE__ */ jsx("span", { className: "taskon-reward-table__manual-drop", children: messages.manual_drop })
|
|
654
728
|
}
|
|
655
729
|
];
|
|
656
730
|
return /* @__PURE__ */ jsxs("div", { className: "taskon-reward-table", children: [
|
|
@@ -665,7 +739,7 @@ function WhitelistTable({
|
|
|
665
739
|
loading: loading && data.length > 0,
|
|
666
740
|
loadingText: messages.loading,
|
|
667
741
|
empty: {
|
|
668
|
-
title: messages.
|
|
742
|
+
title: messages.no_data
|
|
669
743
|
}
|
|
670
744
|
}
|
|
671
745
|
),
|
|
@@ -677,8 +751,7 @@ function WhitelistTable({
|
|
|
677
751
|
onPrevious: pagination.goToPrevious,
|
|
678
752
|
onNext: pagination.goToNext,
|
|
679
753
|
hasPrevious: pagination.hasPrevious,
|
|
680
|
-
hasNext: pagination.hasNext
|
|
681
|
-
messages
|
|
754
|
+
hasNext: pagination.hasNext
|
|
682
755
|
}
|
|
683
756
|
)
|
|
684
757
|
] });
|
|
@@ -687,9 +760,9 @@ function DiscordRoleTable({
|
|
|
687
760
|
data,
|
|
688
761
|
loading,
|
|
689
762
|
error,
|
|
690
|
-
pagination
|
|
691
|
-
messages
|
|
763
|
+
pagination
|
|
692
764
|
}) {
|
|
765
|
+
const { messages } = useUserCenterLocale();
|
|
693
766
|
if (loading && data.length === 0) {
|
|
694
767
|
return /* @__PURE__ */ jsx(LoadingState, { message: messages.loading });
|
|
695
768
|
}
|
|
@@ -697,12 +770,12 @@ function DiscordRoleTable({
|
|
|
697
770
|
return /* @__PURE__ */ jsx("div", { className: "taskon-user-center-error", children: /* @__PURE__ */ jsx("p", { className: "taskon-user-center-error__message", children: error.message }) });
|
|
698
771
|
}
|
|
699
772
|
if (!loading && data.length === 0) {
|
|
700
|
-
return /* @__PURE__ */ jsx(EmptyState, { message: messages.
|
|
773
|
+
return /* @__PURE__ */ jsx(EmptyState, { message: messages.no_data });
|
|
701
774
|
}
|
|
702
775
|
const columns = [
|
|
703
776
|
{
|
|
704
777
|
key: "discordRole",
|
|
705
|
-
title: messages.
|
|
778
|
+
title: messages.column_discord_role,
|
|
706
779
|
width: 160,
|
|
707
780
|
render: (_, row) => {
|
|
708
781
|
const dcValue = row.reward_value;
|
|
@@ -711,21 +784,21 @@ function DiscordRoleTable({
|
|
|
711
784
|
},
|
|
712
785
|
{
|
|
713
786
|
key: "detail",
|
|
714
|
-
title: messages.
|
|
787
|
+
title: messages.column_detail,
|
|
715
788
|
render: (_, row) => /* @__PURE__ */ jsx("span", { className: "taskon-reward-table__campaign-name", children: row.milestone_name || row.campaign_name })
|
|
716
789
|
},
|
|
717
790
|
{
|
|
718
791
|
key: "time",
|
|
719
|
-
title: messages.
|
|
792
|
+
title: messages.column_time,
|
|
720
793
|
width: 160,
|
|
721
794
|
render: (_, row) => /* @__PURE__ */ jsx("span", { className: "taskon-reward-table__time", children: formatDateTime(row.reward_time) })
|
|
722
795
|
},
|
|
723
796
|
{
|
|
724
797
|
key: "status",
|
|
725
|
-
title: messages.
|
|
798
|
+
title: messages.column_status,
|
|
726
799
|
width: 120,
|
|
727
800
|
align: "right",
|
|
728
|
-
render: () => /* @__PURE__ */ jsx("span", { className: "taskon-reward-table__manual-drop", children: messages.
|
|
801
|
+
render: () => /* @__PURE__ */ jsx("span", { className: "taskon-reward-table__manual-drop", children: messages.manual_drop })
|
|
729
802
|
}
|
|
730
803
|
];
|
|
731
804
|
return /* @__PURE__ */ jsxs("div", { className: "taskon-reward-table", children: [
|
|
@@ -740,7 +813,7 @@ function DiscordRoleTable({
|
|
|
740
813
|
loading: loading && data.length > 0,
|
|
741
814
|
loadingText: messages.loading,
|
|
742
815
|
empty: {
|
|
743
|
-
title: messages.
|
|
816
|
+
title: messages.no_data
|
|
744
817
|
}
|
|
745
818
|
}
|
|
746
819
|
),
|
|
@@ -752,8 +825,7 @@ function DiscordRoleTable({
|
|
|
752
825
|
onPrevious: pagination.goToPrevious,
|
|
753
826
|
onNext: pagination.goToNext,
|
|
754
827
|
hasPrevious: pagination.hasPrevious,
|
|
755
|
-
hasNext: pagination.hasNext
|
|
756
|
-
messages
|
|
828
|
+
hasNext: pagination.hasNext
|
|
757
829
|
}
|
|
758
830
|
)
|
|
759
831
|
] });
|
|
@@ -1895,7 +1967,11 @@ function ArrowButton({
|
|
|
1895
1967
|
}
|
|
1896
1968
|
);
|
|
1897
1969
|
}
|
|
1898
|
-
function CopyButton({
|
|
1970
|
+
function CopyButton({
|
|
1971
|
+
text,
|
|
1972
|
+
copyLabel,
|
|
1973
|
+
copiedLabel
|
|
1974
|
+
}) {
|
|
1899
1975
|
const [copied, setCopied] = useState(false);
|
|
1900
1976
|
const handleCopy = useCallback(() => {
|
|
1901
1977
|
navigator.clipboard.writeText(text).then(() => {
|
|
@@ -1908,7 +1984,8 @@ function CopyButton({ text }) {
|
|
|
1908
1984
|
{
|
|
1909
1985
|
className: "taskon-network-copy-btn",
|
|
1910
1986
|
onClick: handleCopy,
|
|
1911
|
-
title: copied ?
|
|
1987
|
+
title: copied ? copiedLabel : copyLabel,
|
|
1988
|
+
"aria-label": copied ? copiedLabel : copyLabel,
|
|
1912
1989
|
children: copied ? (
|
|
1913
1990
|
// 复制成功图标(勾选)
|
|
1914
1991
|
/* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M3 7L6 10L11 4", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
@@ -1931,7 +2008,7 @@ function SocialAccountItem({
|
|
|
1931
2008
|
disabledReason,
|
|
1932
2009
|
messages
|
|
1933
2010
|
}) {
|
|
1934
|
-
const displayText = data.isBound && data.account ? data.account.sns_user_name :
|
|
2011
|
+
const displayText = data.isBound && data.account ? data.account.sns_user_name : messages.link_platform_account.replace("{platform}", data.snsType);
|
|
1935
2012
|
return /* @__PURE__ */ jsxs(
|
|
1936
2013
|
"div",
|
|
1937
2014
|
{
|
|
@@ -1951,14 +2028,14 @@ function SocialAccountItem({
|
|
|
1951
2028
|
) : /* @__PURE__ */ jsx("span", { className: "taskon-identity-social-item__name", children: displayText }) })
|
|
1952
2029
|
] }),
|
|
1953
2030
|
data.isBound ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1954
|
-
/* @__PURE__ */ jsx("span", { className: "taskon-identity-social-item__linked", children: messages.linked
|
|
2031
|
+
/* @__PURE__ */ jsx("span", { className: "taskon-identity-social-item__linked", children: messages.linked }),
|
|
1955
2032
|
!disabled && /* @__PURE__ */ jsx(
|
|
1956
2033
|
"button",
|
|
1957
2034
|
{
|
|
1958
2035
|
className: "taskon-identity-social-item__unlink-btn",
|
|
1959
2036
|
onClick: onUnbind,
|
|
1960
2037
|
disabled: isLoading,
|
|
1961
|
-
"aria-label": messages.unbind
|
|
2038
|
+
"aria-label": messages.unbind,
|
|
1962
2039
|
children: isLoading ? /* @__PURE__ */ jsx("span", { className: "taskon-identity-social-btn__spinner" }) : /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M11 3L3 11M3 3L11 11", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
1963
2040
|
}
|
|
1964
2041
|
)
|
|
@@ -1991,18 +2068,25 @@ function WalletItem({
|
|
|
1991
2068
|
const isEvm = data.coreChainType === "evm";
|
|
1992
2069
|
if (isEvm && addresses && addresses.length > 0) {
|
|
1993
2070
|
return /* @__PURE__ */ jsxs("div", { className: "taskon-network-card taskon-network-card--multi", children: [
|
|
1994
|
-
/* @__PURE__ */ jsx("div", { className: "taskon-network-card__header", children: /* @__PURE__ */ jsx("span", { className: "taskon-network-card__label", children:
|
|
2071
|
+
/* @__PURE__ */ jsx("div", { className: "taskon-network-card__header", children: /* @__PURE__ */ jsx("span", { className: "taskon-network-card__label", children: messages.evm_chain }) }),
|
|
1995
2072
|
/* @__PURE__ */ jsx(EvmChainIcons, {}),
|
|
1996
2073
|
/* @__PURE__ */ jsx("div", { className: "taskon-network-card__addresses", children: addresses.map((addr, index) => {
|
|
1997
2074
|
var _a, _b, _c;
|
|
1998
2075
|
return /* @__PURE__ */ jsxs("div", { className: "taskon-network-address-row", children: [
|
|
1999
2076
|
/* @__PURE__ */ jsxs("div", { className: "taskon-network-address-row__left", children: [
|
|
2000
2077
|
/* @__PURE__ */ jsx("span", { className: `taskon-network-address-row__addr ${!addr.isPrimary ? "taskon-network-address-row__addr--secondary" : ""}`, children: truncateAddress(((_a = addr.address) == null ? void 0 : _a.address) ?? "") }),
|
|
2001
|
-
/* @__PURE__ */ jsx(
|
|
2078
|
+
/* @__PURE__ */ jsx(
|
|
2079
|
+
CopyButton,
|
|
2080
|
+
{
|
|
2081
|
+
text: ((_b = addr.address) == null ? void 0 : _b.address) ?? "",
|
|
2082
|
+
copyLabel: messages.copy,
|
|
2083
|
+
copiedLabel: messages.copied
|
|
2084
|
+
}
|
|
2085
|
+
)
|
|
2002
2086
|
] }),
|
|
2003
2087
|
/* @__PURE__ */ jsx("div", { className: "taskon-network-address-row__divider" }),
|
|
2004
2088
|
/* @__PURE__ */ jsxs("div", { className: "taskon-network-address-row__right", children: [
|
|
2005
|
-
/* @__PURE__ */ jsx("span", { className: `taskon-network-address-row__type ${addr.isPrimary ? "taskon-network-address-row__type--primary" : "taskon-network-address-row__type--secondary"}`, children: addr.isPrimary ?
|
|
2089
|
+
/* @__PURE__ */ jsx("span", { className: `taskon-network-address-row__type ${addr.isPrimary ? "taskon-network-address-row__type--primary" : "taskon-network-address-row__type--secondary"}`, children: addr.isPrimary ? messages.primary_address : messages.secondary_address }),
|
|
2006
2090
|
/* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "taskon-network-address-row__edit", children: [
|
|
2007
2091
|
/* @__PURE__ */ jsx("path", { d: "M2 12H4L10.5 5.5L8.5 3.5L2 10V12Z", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
2008
2092
|
/* @__PURE__ */ jsx("path", { d: "M8.5 3.5L10.5 5.5", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round" })
|
|
@@ -2018,7 +2102,7 @@ function WalletItem({
|
|
|
2018
2102
|
},
|
|
2019
2103
|
disabled: isLoading || disabled,
|
|
2020
2104
|
title: disabledReason,
|
|
2021
|
-
children: messages.unbind
|
|
2105
|
+
children: messages.unbind
|
|
2022
2106
|
}
|
|
2023
2107
|
)
|
|
2024
2108
|
] }, ((_c = addr.address) == null ? void 0 : _c.address) ?? index);
|
|
@@ -2027,7 +2111,7 @@ function WalletItem({
|
|
|
2027
2111
|
}
|
|
2028
2112
|
if (isEvm && !data.isBound) {
|
|
2029
2113
|
return /* @__PURE__ */ jsxs("div", { className: "taskon-network-card taskon-network-card--multi", children: [
|
|
2030
|
-
/* @__PURE__ */ jsx("div", { className: "taskon-network-card__header", children: /* @__PURE__ */ jsx("span", { className: "taskon-network-card__label", children:
|
|
2114
|
+
/* @__PURE__ */ jsx("div", { className: "taskon-network-card__header", children: /* @__PURE__ */ jsx("span", { className: "taskon-network-card__label", children: messages.evm_chain }) }),
|
|
2031
2115
|
/* @__PURE__ */ jsx(EvmChainIcons, {}),
|
|
2032
2116
|
/* @__PURE__ */ jsx(
|
|
2033
2117
|
"button",
|
|
@@ -2035,7 +2119,7 @@ function WalletItem({
|
|
|
2035
2119
|
className: "taskon-network-connect-btn",
|
|
2036
2120
|
onClick: onBind,
|
|
2037
2121
|
disabled: isLoading,
|
|
2038
|
-
children: isLoading ? messages.loading : messages.
|
|
2122
|
+
children: isLoading ? messages.loading : messages.connect_wallet
|
|
2039
2123
|
}
|
|
2040
2124
|
)
|
|
2041
2125
|
] });
|
|
@@ -2049,14 +2133,21 @@ function WalletItem({
|
|
|
2049
2133
|
onClick: () => onUnbind(),
|
|
2050
2134
|
disabled: isLoading || disabled,
|
|
2051
2135
|
title: disabledReason,
|
|
2052
|
-
children: messages.unbind
|
|
2136
|
+
children: messages.unbind
|
|
2053
2137
|
}
|
|
2054
2138
|
),
|
|
2055
2139
|
/* @__PURE__ */ jsx("div", { className: "taskon-network-card__header", children: /* @__PURE__ */ jsx("span", { className: "taskon-network-card__label", children: name }) }),
|
|
2056
2140
|
/* @__PURE__ */ jsx("div", { className: "taskon-network-card__chain-icon", children: /* @__PURE__ */ jsx(ChainIcon, { chain: data.coreChainType }) }),
|
|
2057
2141
|
/* @__PURE__ */ jsxs("div", { className: "taskon-network-address-input", children: [
|
|
2058
2142
|
/* @__PURE__ */ jsx("span", { className: "taskon-network-address-input__text", children: truncateAddress(data.address.address) }),
|
|
2059
|
-
/* @__PURE__ */ jsx(
|
|
2143
|
+
/* @__PURE__ */ jsx(
|
|
2144
|
+
CopyButton,
|
|
2145
|
+
{
|
|
2146
|
+
text: data.address.address,
|
|
2147
|
+
copyLabel: messages.copy,
|
|
2148
|
+
copiedLabel: messages.copied
|
|
2149
|
+
}
|
|
2150
|
+
)
|
|
2060
2151
|
] })
|
|
2061
2152
|
] });
|
|
2062
2153
|
}
|
|
@@ -2069,7 +2160,7 @@ function WalletItem({
|
|
|
2069
2160
|
className: "taskon-network-connect-btn",
|
|
2070
2161
|
onClick: onBind,
|
|
2071
2162
|
disabled: isLoading,
|
|
2072
|
-
children: isLoading ? messages.loading : messages.
|
|
2163
|
+
children: isLoading ? messages.loading : messages.connect_wallet
|
|
2073
2164
|
}
|
|
2074
2165
|
)
|
|
2075
2166
|
] });
|
|
@@ -2099,14 +2190,14 @@ function ConfirmUnlinkDialog({
|
|
|
2099
2190
|
{
|
|
2100
2191
|
open,
|
|
2101
2192
|
onOpenChange,
|
|
2102
|
-
title: messages.
|
|
2193
|
+
title: messages.confirm_unbind,
|
|
2103
2194
|
showCloseButton: false,
|
|
2104
2195
|
maxWidth: 400,
|
|
2105
2196
|
children: /* @__PURE__ */ jsxs("div", { className: "taskon-confirm-unlink", children: [
|
|
2106
2197
|
/* @__PURE__ */ jsx("div", { className: "taskon-confirm-unlink__icon", children: /* @__PURE__ */ jsx(WarningIcon, {}) }),
|
|
2107
2198
|
/* @__PURE__ */ jsxs("div", { className: "taskon-confirm-unlink__text", children: [
|
|
2108
|
-
/* @__PURE__ */ jsx("h4", { className: "taskon-confirm-unlink__title", children: messages.
|
|
2109
|
-
/* @__PURE__ */ jsx("p", { className: "taskon-confirm-unlink__description", children: messages.
|
|
2199
|
+
/* @__PURE__ */ jsx("h4", { className: "taskon-confirm-unlink__title", children: messages.confirm_unbind }),
|
|
2200
|
+
/* @__PURE__ */ jsx("p", { className: "taskon-confirm-unlink__description", children: messages.unbind_warning })
|
|
2110
2201
|
] }),
|
|
2111
2202
|
/* @__PURE__ */ jsxs("div", { className: "taskon-confirm-unlink__actions", children: [
|
|
2112
2203
|
/* @__PURE__ */ jsx(
|
|
@@ -2134,17 +2225,19 @@ function ConfirmUnlinkDialog({
|
|
|
2134
2225
|
}
|
|
2135
2226
|
function SocialAccountsSection({
|
|
2136
2227
|
accounts,
|
|
2137
|
-
messages,
|
|
2138
2228
|
onBind,
|
|
2139
2229
|
onUnbind,
|
|
2140
2230
|
isProcessing,
|
|
2141
2231
|
checkUnlink,
|
|
2142
2232
|
onShowWarning
|
|
2143
2233
|
}) {
|
|
2234
|
+
const { messages } = useUserCenterLocale();
|
|
2144
2235
|
if (accounts.length === 0) {
|
|
2145
2236
|
return null;
|
|
2146
2237
|
}
|
|
2147
|
-
const [confirmTarget, setConfirmTarget] = useState(
|
|
2238
|
+
const [confirmTarget, setConfirmTarget] = useState(
|
|
2239
|
+
null
|
|
2240
|
+
);
|
|
2148
2241
|
const showConfirm = confirmTarget !== null;
|
|
2149
2242
|
const handleBind = useCallback(
|
|
2150
2243
|
(account) => {
|
|
@@ -2157,7 +2250,7 @@ function SocialAccountsSection({
|
|
|
2157
2250
|
if (!account.account) return;
|
|
2158
2251
|
const check = checkUnlink(account.account);
|
|
2159
2252
|
if (check.disabled) {
|
|
2160
|
-
onShowWarning(check.message ?? messages.
|
|
2253
|
+
onShowWarning(check.message ?? messages.unbind_failed);
|
|
2161
2254
|
return;
|
|
2162
2255
|
}
|
|
2163
2256
|
setConfirmTarget(account);
|
|
@@ -2170,7 +2263,7 @@ function SocialAccountsSection({
|
|
|
2170
2263
|
setConfirmTarget(null);
|
|
2171
2264
|
}, [confirmTarget, onUnbind]);
|
|
2172
2265
|
return /* @__PURE__ */ jsxs("section", { className: "taskon-identity-social-section", children: [
|
|
2173
|
-
/* @__PURE__ */ jsx("h3", { className: "taskon-identity-social-section__title", children: messages.
|
|
2266
|
+
/* @__PURE__ */ jsx("h3", { className: "taskon-identity-social-section__title", children: messages.social_accounts }),
|
|
2174
2267
|
/* @__PURE__ */ jsx("div", { className: "taskon-identity-social-grid", children: accounts.map((account) => {
|
|
2175
2268
|
const check = account.account ? checkUnlink(account.account) : { disabled: false, message: null };
|
|
2176
2269
|
return /* @__PURE__ */ jsx(
|
|
@@ -2205,7 +2298,6 @@ function SocialAccountsSection({
|
|
|
2205
2298
|
function WalletsSection({
|
|
2206
2299
|
wallets,
|
|
2207
2300
|
rawAddresses,
|
|
2208
|
-
messages,
|
|
2209
2301
|
onBind,
|
|
2210
2302
|
onUnbind,
|
|
2211
2303
|
isProcessing,
|
|
@@ -2213,6 +2305,7 @@ function WalletsSection({
|
|
|
2213
2305
|
onShowWarning,
|
|
2214
2306
|
onShowInfo
|
|
2215
2307
|
}) {
|
|
2308
|
+
const { messages } = useUserCenterLocale();
|
|
2216
2309
|
if (wallets.length === 0) {
|
|
2217
2310
|
return null;
|
|
2218
2311
|
}
|
|
@@ -2242,11 +2335,11 @@ function WalletsSection({
|
|
|
2242
2335
|
if (!addressToUnbind || !wallet.address) return;
|
|
2243
2336
|
const check = checkUnlink(wallet.address, wallet.isKycVerified);
|
|
2244
2337
|
if (check.disabled) {
|
|
2245
|
-
onShowWarning(check.message ?? messages.
|
|
2338
|
+
onShowWarning(check.message ?? messages.unbind_failed);
|
|
2246
2339
|
return;
|
|
2247
2340
|
}
|
|
2248
2341
|
if (check.needsKycWarning) {
|
|
2249
|
-
onShowInfo(messages.
|
|
2342
|
+
onShowInfo(messages.kyc_warning);
|
|
2250
2343
|
}
|
|
2251
2344
|
setConfirmTarget({ wallet, address: addressToUnbind });
|
|
2252
2345
|
},
|
|
@@ -2258,7 +2351,7 @@ function WalletsSection({
|
|
|
2258
2351
|
setConfirmTarget(null);
|
|
2259
2352
|
}, [confirmTarget, onUnbind]);
|
|
2260
2353
|
return /* @__PURE__ */ jsxs("section", { className: "taskon-network-section", children: [
|
|
2261
|
-
/* @__PURE__ */ jsx("h3", { className: "taskon-network-section__title", children: messages.
|
|
2354
|
+
/* @__PURE__ */ jsx("h3", { className: "taskon-network-section__title", children: messages.wallet_addresses }),
|
|
2262
2355
|
/* @__PURE__ */ jsx("div", { className: "taskon-network-grid", children: wallets.map((wallet) => {
|
|
2263
2356
|
const check = wallet.address ? checkUnlink(wallet.address, wallet.isKycVerified) : { disabled: false, message: null };
|
|
2264
2357
|
const isEvm = wallet.coreChainType === "evm";
|
|
@@ -2314,16 +2407,16 @@ function EmailBindDialog({
|
|
|
2314
2407
|
const showCodeInput = status === "inputCode" || status === "submitting" || status === "success";
|
|
2315
2408
|
const emailError = useMemo(() => {
|
|
2316
2409
|
if (isEmailDuplicate) {
|
|
2317
|
-
return messages.
|
|
2410
|
+
return messages.email_already_linked;
|
|
2318
2411
|
}
|
|
2319
2412
|
if (email && !isEmailValid) {
|
|
2320
|
-
return messages.
|
|
2413
|
+
return messages.please_enter_valid_email;
|
|
2321
2414
|
}
|
|
2322
2415
|
return void 0;
|
|
2323
2416
|
}, [isEmailDuplicate, email, isEmailValid, messages]);
|
|
2324
2417
|
const codeError = useMemo(() => {
|
|
2325
2418
|
if (isCodeInvalid) {
|
|
2326
|
-
return messages.
|
|
2419
|
+
return messages.please_enter_valid_code;
|
|
2327
2420
|
}
|
|
2328
2421
|
return void 0;
|
|
2329
2422
|
}, [isCodeInvalid, messages]);
|
|
@@ -2367,20 +2460,20 @@ function EmailBindDialog({
|
|
|
2367
2460
|
onOpenChange: (open) => {
|
|
2368
2461
|
if (!open) handleClose();
|
|
2369
2462
|
},
|
|
2370
|
-
title: messages.
|
|
2463
|
+
title: messages.link_email_account,
|
|
2371
2464
|
showCloseButton: true,
|
|
2372
2465
|
maxWidth: 400,
|
|
2373
2466
|
children: /* @__PURE__ */ jsxs("div", { className: "taskon-email-bind-dialog", children: [
|
|
2374
|
-
/* @__PURE__ */ jsx("h2", { className: "taskon-email-bind-dialog__title", children: messages.
|
|
2467
|
+
/* @__PURE__ */ jsx("h2", { className: "taskon-email-bind-dialog__title", children: messages.link_email_account }),
|
|
2375
2468
|
/* @__PURE__ */ jsxs("div", { className: "taskon-email-bind-dialog__field", children: [
|
|
2376
|
-
/* @__PURE__ */ jsx("label", { className: "taskon-email-bind-dialog__label", children: messages.
|
|
2469
|
+
/* @__PURE__ */ jsx("label", { className: "taskon-email-bind-dialog__label", children: messages.email_address }),
|
|
2377
2470
|
/* @__PURE__ */ jsx(
|
|
2378
2471
|
Input,
|
|
2379
2472
|
{
|
|
2380
2473
|
type: "email",
|
|
2381
2474
|
value: email,
|
|
2382
2475
|
onChange: handleEmailChange,
|
|
2383
|
-
placeholder: messages.
|
|
2476
|
+
placeholder: messages.please_enter_email,
|
|
2384
2477
|
maxLength: 64,
|
|
2385
2478
|
disabled: showCodeInput,
|
|
2386
2479
|
error: emailError,
|
|
@@ -2389,7 +2482,7 @@ function EmailBindDialog({
|
|
|
2389
2482
|
)
|
|
2390
2483
|
] }),
|
|
2391
2484
|
showCodeInput && /* @__PURE__ */ jsxs("div", { className: "taskon-email-bind-dialog__field", children: [
|
|
2392
|
-
/* @__PURE__ */ jsx("label", { className: "taskon-email-bind-dialog__label", children: messages.
|
|
2485
|
+
/* @__PURE__ */ jsx("label", { className: "taskon-email-bind-dialog__label", children: messages.verification_code }),
|
|
2393
2486
|
/* @__PURE__ */ jsx(
|
|
2394
2487
|
Input,
|
|
2395
2488
|
{
|
|
@@ -2397,7 +2490,7 @@ function EmailBindDialog({
|
|
|
2397
2490
|
inputMode: "numeric",
|
|
2398
2491
|
value: code,
|
|
2399
2492
|
onChange: handleCodeChange,
|
|
2400
|
-
placeholder: messages.
|
|
2493
|
+
placeholder: messages.please_enter_code,
|
|
2401
2494
|
maxLength: 6,
|
|
2402
2495
|
disabled: isSubmitting,
|
|
2403
2496
|
error: codeError,
|
|
@@ -2409,7 +2502,7 @@ function EmailBindDialog({
|
|
|
2409
2502
|
disabled: countdown > 0 || isSending,
|
|
2410
2503
|
loading: isSending,
|
|
2411
2504
|
onClick: handleSendCode,
|
|
2412
|
-
children: countdown > 0 ? `${messages.
|
|
2505
|
+
children: countdown > 0 ? `${messages.resend_code} (${countdown}s)` : messages.resend_code
|
|
2413
2506
|
}
|
|
2414
2507
|
)
|
|
2415
2508
|
}
|
|
@@ -2426,7 +2519,7 @@ function EmailBindDialog({
|
|
|
2426
2519
|
loading: isSending,
|
|
2427
2520
|
onClick: handleSendCode,
|
|
2428
2521
|
style: { width: "100%" },
|
|
2429
|
-
children: messages.
|
|
2522
|
+
children: messages.send_verification_code
|
|
2430
2523
|
}
|
|
2431
2524
|
)
|
|
2432
2525
|
) : (
|
|
@@ -2440,7 +2533,7 @@ function EmailBindDialog({
|
|
|
2440
2533
|
loading: isSubmitting,
|
|
2441
2534
|
onClick: handleBind,
|
|
2442
2535
|
style: { width: "100%" },
|
|
2443
|
-
children: messages.confirm
|
|
2536
|
+
children: messages.confirm
|
|
2444
2537
|
}
|
|
2445
2538
|
)
|
|
2446
2539
|
) })
|
|
@@ -2450,7 +2543,6 @@ function EmailBindDialog({
|
|
|
2450
2543
|
}
|
|
2451
2544
|
function EmailSection({
|
|
2452
2545
|
emailAccount,
|
|
2453
|
-
messages,
|
|
2454
2546
|
onUnbind,
|
|
2455
2547
|
isUnbinding,
|
|
2456
2548
|
checkUnlink,
|
|
@@ -2458,6 +2550,7 @@ function EmailSection({
|
|
|
2458
2550
|
onShowError,
|
|
2459
2551
|
onShowWarning
|
|
2460
2552
|
}) {
|
|
2553
|
+
const { messages } = useUserCenterLocale();
|
|
2461
2554
|
const [dialogVisible, setDialogVisible] = useState(false);
|
|
2462
2555
|
const {
|
|
2463
2556
|
status: emailBindStatus,
|
|
@@ -2470,19 +2563,19 @@ function EmailSection({
|
|
|
2470
2563
|
clearError: clearEmailError
|
|
2471
2564
|
} = useBindEmail({
|
|
2472
2565
|
onSendCodeSuccess: () => {
|
|
2473
|
-
onShowSuccess(messages.
|
|
2566
|
+
onShowSuccess(messages.send_code_success);
|
|
2474
2567
|
},
|
|
2475
2568
|
onSendCodeError: (error) => {
|
|
2476
2569
|
if (!error.message.includes("duplicate")) {
|
|
2477
|
-
onShowError(messages.
|
|
2570
|
+
onShowError(messages.send_code_failed);
|
|
2478
2571
|
}
|
|
2479
2572
|
},
|
|
2480
2573
|
onBindSuccess: () => {
|
|
2481
|
-
onShowSuccess(messages.
|
|
2574
|
+
onShowSuccess(messages.bind_success);
|
|
2482
2575
|
setDialogVisible(false);
|
|
2483
2576
|
},
|
|
2484
2577
|
onBindError: () => {
|
|
2485
|
-
onShowError(messages.
|
|
2578
|
+
onShowError(messages.bind_failed);
|
|
2486
2579
|
}
|
|
2487
2580
|
});
|
|
2488
2581
|
const handleBind = useCallback(() => {
|
|
@@ -2492,7 +2585,7 @@ function EmailSection({
|
|
|
2492
2585
|
if (!emailAccount.account) return;
|
|
2493
2586
|
const check2 = checkUnlink(emailAccount.account);
|
|
2494
2587
|
if (check2.disabled) {
|
|
2495
|
-
onShowWarning(check2.message ?? messages.
|
|
2588
|
+
onShowWarning(check2.message ?? messages.unbind_failed);
|
|
2496
2589
|
return;
|
|
2497
2590
|
}
|
|
2498
2591
|
onUnbind(emailAccount.account.sns_id, "Email");
|
|
@@ -2504,7 +2597,7 @@ function EmailSection({
|
|
|
2504
2597
|
const check = emailAccount.account ? checkUnlink(emailAccount.account) : { disabled: false, message: null };
|
|
2505
2598
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2506
2599
|
/* @__PURE__ */ jsxs("section", { className: "taskon-identity-email-section", children: [
|
|
2507
|
-
/* @__PURE__ */ jsx("h3", { className: "taskon-identity-email-section__title", children: messages.
|
|
2600
|
+
/* @__PURE__ */ jsx("h3", { className: "taskon-identity-email-section__title", children: messages.email_address }),
|
|
2508
2601
|
/* @__PURE__ */ jsx("div", { className: "taskon-identity-email-card", children: /* @__PURE__ */ jsx(
|
|
2509
2602
|
SocialAccountItem,
|
|
2510
2603
|
{
|
|
@@ -2538,11 +2631,13 @@ function EmailSection({
|
|
|
2538
2631
|
const USER_CENTER_WALLET_ACCOUNT_TYPE = String(SnsType.All).toLowerCase();
|
|
2539
2632
|
const isWalletAccountType = (accountType) => accountType.toLowerCase() === USER_CENTER_WALLET_ACCOUNT_TYPE;
|
|
2540
2633
|
function IdentityContent({
|
|
2541
|
-
config
|
|
2542
|
-
messages
|
|
2634
|
+
config
|
|
2543
2635
|
}) {
|
|
2544
2636
|
var _a, _b, _c, _d;
|
|
2545
|
-
const
|
|
2637
|
+
const { t } = useUserCenterLocale();
|
|
2638
|
+
const identityTab = config.find(
|
|
2639
|
+
(t2) => t2.tab === "Identity"
|
|
2640
|
+
);
|
|
2546
2641
|
const enabledAccounts = identityTab ? filterEnabledAccounts(identityTab) : [];
|
|
2547
2642
|
const enabledWallets = identityTab ? filterEnabledWallets(identityTab) : [];
|
|
2548
2643
|
const identityParams = identityTab && !Array.isArray(identityTab.params) ? identityTab.params : void 0;
|
|
@@ -2561,18 +2656,22 @@ function IdentityContent({
|
|
|
2561
2656
|
processingType: socialProcessingType
|
|
2562
2657
|
} = useUnbindSocial({
|
|
2563
2658
|
onUnbindSuccess: () => {
|
|
2564
|
-
toast.success(
|
|
2659
|
+
toast.success(t("unbind_success"));
|
|
2565
2660
|
},
|
|
2566
2661
|
onUnbindError: () => {
|
|
2567
|
-
toast.error(
|
|
2662
|
+
toast.error(t("unbind_failed"));
|
|
2568
2663
|
}
|
|
2569
2664
|
});
|
|
2570
|
-
const {
|
|
2665
|
+
const {
|
|
2666
|
+
bind: bindOAuth,
|
|
2667
|
+
isBinding: isOAuthBinding,
|
|
2668
|
+
isOAuthSupported
|
|
2669
|
+
} = useOAuthBindings({
|
|
2571
2670
|
onSuccess: () => {
|
|
2572
|
-
toast.success(
|
|
2671
|
+
toast.success(t("bind_success"));
|
|
2573
2672
|
},
|
|
2574
2673
|
onFailed: (error) => {
|
|
2575
|
-
toast.error(error ||
|
|
2674
|
+
toast.error(error || t("bind_failed"));
|
|
2576
2675
|
}
|
|
2577
2676
|
});
|
|
2578
2677
|
const {
|
|
@@ -2583,16 +2682,16 @@ function IdentityContent({
|
|
|
2583
2682
|
processingChain: walletProcessingChain
|
|
2584
2683
|
} = useBindWallet({
|
|
2585
2684
|
onBindSuccess: () => {
|
|
2586
|
-
toast.success(
|
|
2685
|
+
toast.success(t("bind_success"));
|
|
2587
2686
|
},
|
|
2588
2687
|
onUnbindSuccess: () => {
|
|
2589
|
-
toast.success(
|
|
2688
|
+
toast.success(t("unbind_success"));
|
|
2590
2689
|
},
|
|
2591
2690
|
onBindError: () => {
|
|
2592
|
-
toast.error(
|
|
2691
|
+
toast.error(t("bind_failed"));
|
|
2593
2692
|
},
|
|
2594
2693
|
onUnbindError: () => {
|
|
2595
|
-
toast.error(
|
|
2694
|
+
toast.error(t("unbind_failed"));
|
|
2596
2695
|
}
|
|
2597
2696
|
});
|
|
2598
2697
|
const enabledSocialAccountTypes = useMemo(() => {
|
|
@@ -2626,7 +2725,12 @@ function IdentityContent({
|
|
|
2626
2725
|
return walletAddresses.filter((wallet) => {
|
|
2627
2726
|
return enabledWalletChainTypes.has(wallet.coreChainType.toLowerCase());
|
|
2628
2727
|
});
|
|
2629
|
-
}, [
|
|
2728
|
+
}, [
|
|
2729
|
+
walletAddresses,
|
|
2730
|
+
hasExplicitWalletConfig,
|
|
2731
|
+
enabledWalletChainTypes,
|
|
2732
|
+
isWalletAccountEnabled
|
|
2733
|
+
]);
|
|
2630
2734
|
const emailAccount = useMemo(() => {
|
|
2631
2735
|
return filteredSocialAccounts.find((a) => a.snsType === SnsType.Email);
|
|
2632
2736
|
}, [filteredSocialAccounts]);
|
|
@@ -2639,9 +2743,9 @@ function IdentityContent({
|
|
|
2639
2743
|
bindOAuth(snsType);
|
|
2640
2744
|
return;
|
|
2641
2745
|
}
|
|
2642
|
-
toast.info(
|
|
2746
|
+
toast.info(t("bind_social_todo"));
|
|
2643
2747
|
},
|
|
2644
|
-
[bindOAuth, isOAuthSupported, toast,
|
|
2748
|
+
[bindOAuth, isOAuthSupported, toast, t]
|
|
2645
2749
|
);
|
|
2646
2750
|
const isSocialProcessing = useCallback(
|
|
2647
2751
|
(snsType) => {
|
|
@@ -2672,7 +2776,7 @@ function IdentityContent({
|
|
|
2672
2776
|
return socialProcessingType === SnsType.Email && socialUnbindStatus === "loading";
|
|
2673
2777
|
}, [socialProcessingType, socialUnbindStatus]);
|
|
2674
2778
|
if (!isLoaded) {
|
|
2675
|
-
return /* @__PURE__ */ jsx("div", { className: "taskon-identity", children: /* @__PURE__ */ jsx("div", { className: "taskon-identity-loading", children:
|
|
2779
|
+
return /* @__PURE__ */ jsx("div", { className: "taskon-identity", children: /* @__PURE__ */ jsx("div", { className: "taskon-identity-loading", children: t("loading") }) });
|
|
2676
2780
|
}
|
|
2677
2781
|
const isEmpty = socialAccountsWithoutEmail.length === 0 && !emailAccount && filteredWalletAddresses.length === 0;
|
|
2678
2782
|
return /* @__PURE__ */ jsxs("div", { className: "taskon-identity", children: [
|
|
@@ -2680,7 +2784,6 @@ function IdentityContent({
|
|
|
2680
2784
|
SocialAccountsSection,
|
|
2681
2785
|
{
|
|
2682
2786
|
accounts: socialAccountsWithoutEmail,
|
|
2683
|
-
messages,
|
|
2684
2787
|
onBind: handleSocialBind,
|
|
2685
2788
|
onUnbind: unbindSocial,
|
|
2686
2789
|
isProcessing: isSocialProcessing,
|
|
@@ -2693,7 +2796,6 @@ function IdentityContent({
|
|
|
2693
2796
|
{
|
|
2694
2797
|
wallets: filteredWalletAddresses,
|
|
2695
2798
|
rawAddresses,
|
|
2696
|
-
messages,
|
|
2697
2799
|
onBind: handleWalletBind,
|
|
2698
2800
|
onUnbind: handleWalletUnbind,
|
|
2699
2801
|
isProcessing: isWalletProcessing,
|
|
@@ -2706,7 +2808,6 @@ function IdentityContent({
|
|
|
2706
2808
|
EmailSection,
|
|
2707
2809
|
{
|
|
2708
2810
|
emailAccount,
|
|
2709
|
-
messages,
|
|
2710
2811
|
onUnbind: unbindSocial,
|
|
2711
2812
|
isUnbinding: isEmailUnbinding,
|
|
2712
2813
|
checkUnlink: checkSocialUnlink,
|
|
@@ -2715,15 +2816,15 @@ function IdentityContent({
|
|
|
2715
2816
|
onShowWarning: toast.warning
|
|
2716
2817
|
}
|
|
2717
2818
|
),
|
|
2718
|
-
isEmpty && /* @__PURE__ */ jsx("div", { className: "taskon-identity-empty", children:
|
|
2819
|
+
isEmpty && /* @__PURE__ */ jsx("div", { className: "taskon-identity-empty", children: t("empty_identity") })
|
|
2719
2820
|
] });
|
|
2720
2821
|
}
|
|
2721
2822
|
function MyRewardsContent({
|
|
2722
|
-
messages,
|
|
2723
2823
|
defaultRewardCard,
|
|
2724
2824
|
defaultPointId
|
|
2725
2825
|
}) {
|
|
2726
2826
|
const { toast } = useToast();
|
|
2827
|
+
const { t } = useUserCenterLocale();
|
|
2727
2828
|
const { client } = useTaskOnContext();
|
|
2728
2829
|
const [selectedPointsId, setSelectedPointsId] = useState(null);
|
|
2729
2830
|
const hasUserSelectedRef = useRef(false);
|
|
@@ -2858,7 +2959,7 @@ function MyRewardsContent({
|
|
|
2858
2959
|
return;
|
|
2859
2960
|
}
|
|
2860
2961
|
if (!item.nonce || !item.receiver_address) {
|
|
2861
|
-
toast.error(
|
|
2962
|
+
toast.error(t("missing_resend_payload"));
|
|
2862
2963
|
return;
|
|
2863
2964
|
}
|
|
2864
2965
|
try {
|
|
@@ -2866,9 +2967,11 @@ function MyRewardsContent({
|
|
|
2866
2967
|
chain: viewingFrozenToken.chain,
|
|
2867
2968
|
nonce: item.nonce
|
|
2868
2969
|
});
|
|
2869
|
-
const withdrawableRequests = requests.filter(
|
|
2970
|
+
const withdrawableRequests = requests.filter(
|
|
2971
|
+
(request) => request.can_withdraw
|
|
2972
|
+
);
|
|
2870
2973
|
if (withdrawableRequests.length === 0) {
|
|
2871
|
-
toast.error(
|
|
2974
|
+
toast.error(t("no_tokens_for_resend"));
|
|
2872
2975
|
return;
|
|
2873
2976
|
}
|
|
2874
2977
|
setResendParams({
|
|
@@ -2879,7 +2982,9 @@ function MyRewardsContent({
|
|
|
2879
2982
|
setSelectedTokenForWithdraw(viewingFrozenToken);
|
|
2880
2983
|
setShowWithdrawForm(true);
|
|
2881
2984
|
} catch (error) {
|
|
2882
|
-
toast.error(
|
|
2985
|
+
toast.error(
|
|
2986
|
+
error instanceof Error ? error.message : t("failed_load_resend_details")
|
|
2987
|
+
);
|
|
2883
2988
|
}
|
|
2884
2989
|
};
|
|
2885
2990
|
const handleSelectCard = (type, pointsId) => {
|
|
@@ -2925,14 +3030,14 @@ function MyRewardsContent({
|
|
|
2925
3030
|
}
|
|
2926
3031
|
}, [selectedCard]);
|
|
2927
3032
|
if (rewardsLoading && cards.length === 0) {
|
|
2928
|
-
return /* @__PURE__ */ jsx(LoadingState, { message:
|
|
3033
|
+
return /* @__PURE__ */ jsx(LoadingState, { message: t("loading") });
|
|
2929
3034
|
}
|
|
2930
3035
|
if (rewardsError && cards.length === 0) {
|
|
2931
3036
|
return /* @__PURE__ */ jsx("div", { className: "taskon-user-center-error", children: /* @__PURE__ */ jsx("p", { className: "taskon-user-center-error__message", children: rewardsError.message }) });
|
|
2932
3037
|
}
|
|
2933
3038
|
const hasVisibleCards = cards.some((c) => c.visible);
|
|
2934
3039
|
if (!rewardsLoading && !hasVisibleCards) {
|
|
2935
|
-
return /* @__PURE__ */ jsx(EmptyState, { message:
|
|
3040
|
+
return /* @__PURE__ */ jsx(EmptyState, { message: t("empty_rewards") });
|
|
2936
3041
|
}
|
|
2937
3042
|
const renderSelectedContent = () => {
|
|
2938
3043
|
switch (selectedCard) {
|
|
@@ -2948,7 +3053,6 @@ function MyRewardsContent({
|
|
|
2948
3053
|
tokenHistoryLoading,
|
|
2949
3054
|
tokenHistoryError,
|
|
2950
3055
|
tokenHistoryPagination,
|
|
2951
|
-
messages,
|
|
2952
3056
|
onWithdraw: handleWithdraw,
|
|
2953
3057
|
onBatchWithdraw: handleBatchWithdraw,
|
|
2954
3058
|
onViewFrozen: handleViewFrozen,
|
|
@@ -2964,7 +3068,7 @@ function MyRewardsContent({
|
|
|
2964
3068
|
);
|
|
2965
3069
|
case USER_CENTER_REWARD_CARD_TYPES.XpLevel:
|
|
2966
3070
|
if (!selectedXpLevelData) {
|
|
2967
|
-
return /* @__PURE__ */ jsx(EmptyState, { message:
|
|
3071
|
+
return /* @__PURE__ */ jsx(EmptyState, { message: t("no_data") });
|
|
2968
3072
|
}
|
|
2969
3073
|
return /* @__PURE__ */ jsx(
|
|
2970
3074
|
XpLevelCard,
|
|
@@ -2979,8 +3083,7 @@ function MyRewardsContent({
|
|
|
2979
3083
|
historyData: xpLevelHistory,
|
|
2980
3084
|
historyLoading: xpLevelHistoryLoading,
|
|
2981
3085
|
historyError: xpLevelHistoryError,
|
|
2982
|
-
pagination: xpLevelHistoryPagination
|
|
2983
|
-
messages
|
|
3086
|
+
pagination: xpLevelHistoryPagination
|
|
2984
3087
|
}
|
|
2985
3088
|
);
|
|
2986
3089
|
case USER_CENTER_REWARD_CARD_TYPES.Nft:
|
|
@@ -2991,7 +3094,6 @@ function MyRewardsContent({
|
|
|
2991
3094
|
loading: nftLoading,
|
|
2992
3095
|
error: nftError,
|
|
2993
3096
|
pagination: nftPagination,
|
|
2994
|
-
messages,
|
|
2995
3097
|
onClaimSuccess: () => {
|
|
2996
3098
|
refreshNftList();
|
|
2997
3099
|
}
|
|
@@ -3004,8 +3106,7 @@ function MyRewardsContent({
|
|
|
3004
3106
|
data: whitelistList,
|
|
3005
3107
|
loading: whitelistLoading,
|
|
3006
3108
|
error: whitelistError,
|
|
3007
|
-
pagination: whitelistPagination
|
|
3008
|
-
messages
|
|
3109
|
+
pagination: whitelistPagination
|
|
3009
3110
|
}
|
|
3010
3111
|
);
|
|
3011
3112
|
case USER_CENTER_REWARD_CARD_TYPES.DiscordRole:
|
|
@@ -3015,13 +3116,12 @@ function MyRewardsContent({
|
|
|
3015
3116
|
data: discordRoleList,
|
|
3016
3117
|
loading: discordRoleLoading,
|
|
3017
3118
|
error: discordRoleError,
|
|
3018
|
-
pagination: discordRolePagination
|
|
3019
|
-
messages
|
|
3119
|
+
pagination: discordRolePagination
|
|
3020
3120
|
}
|
|
3021
3121
|
);
|
|
3022
3122
|
case USER_CENTER_REWARD_CARD_TYPES.Points:
|
|
3023
3123
|
if (!selectedPointsData) {
|
|
3024
|
-
return /* @__PURE__ */ jsx(EmptyState, { message:
|
|
3124
|
+
return /* @__PURE__ */ jsx(EmptyState, { message: t("empty_points") });
|
|
3025
3125
|
}
|
|
3026
3126
|
return /* @__PURE__ */ jsx(
|
|
3027
3127
|
PointsList,
|
|
@@ -3030,8 +3130,7 @@ function MyRewardsContent({
|
|
|
3030
3130
|
data: pointsHistory,
|
|
3031
3131
|
loading: pointsLoading,
|
|
3032
3132
|
error: pointsError,
|
|
3033
|
-
pagination: pointsPagination
|
|
3034
|
-
messages
|
|
3133
|
+
pagination: pointsPagination
|
|
3035
3134
|
}
|
|
3036
3135
|
);
|
|
3037
3136
|
default:
|
|
@@ -3045,8 +3144,7 @@ function MyRewardsContent({
|
|
|
3045
3144
|
cards,
|
|
3046
3145
|
selectedCard,
|
|
3047
3146
|
selectedPointsId,
|
|
3048
|
-
onSelectCard: handleSelectCard
|
|
3049
|
-
messages
|
|
3147
|
+
onSelectCard: handleSelectCard
|
|
3050
3148
|
}
|
|
3051
3149
|
),
|
|
3052
3150
|
renderSelectedContent(),
|
|
@@ -3054,7 +3152,6 @@ function MyRewardsContent({
|
|
|
3054
3152
|
WithdrawForm,
|
|
3055
3153
|
{
|
|
3056
3154
|
open: showWithdrawForm,
|
|
3057
|
-
messages,
|
|
3058
3155
|
tokenAssets,
|
|
3059
3156
|
tokenAssetsLoading,
|
|
3060
3157
|
initialTokenId: selectedTokenForWithdraw == null ? void 0 : selectedTokenForWithdraw.token_id,
|
|
@@ -3076,7 +3173,10 @@ function MyRewardsContent({
|
|
|
3076
3173
|
chain: request.chain,
|
|
3077
3174
|
chainLabel: (matchedToken == null ? void 0 : matchedToken.chain_label) ?? request.chain,
|
|
3078
3175
|
amount: request.token_amount,
|
|
3079
|
-
amountInWei: toWei(
|
|
3176
|
+
amountInWei: toWei(
|
|
3177
|
+
request.token_amount,
|
|
3178
|
+
request.token_decimals
|
|
3179
|
+
)
|
|
3080
3180
|
};
|
|
3081
3181
|
}) : void 0,
|
|
3082
3182
|
onClose: () => {
|
|
@@ -3092,9 +3192,7 @@ function MyRewardsContent({
|
|
|
3092
3192
|
)
|
|
3093
3193
|
] });
|
|
3094
3194
|
}
|
|
3095
|
-
function ActivityHistoryContent({
|
|
3096
|
-
messages
|
|
3097
|
-
}) {
|
|
3195
|
+
function ActivityHistoryContent() {
|
|
3098
3196
|
const { data, loading, error, pagination, refresh } = useActivityHistory({
|
|
3099
3197
|
mode: "pagination"
|
|
3100
3198
|
});
|
|
@@ -3105,7 +3203,6 @@ function ActivityHistoryContent({
|
|
|
3105
3203
|
loading,
|
|
3106
3204
|
error,
|
|
3107
3205
|
pagination,
|
|
3108
|
-
messages,
|
|
3109
3206
|
mode: "pagination",
|
|
3110
3207
|
onRetry: refresh
|
|
3111
3208
|
}
|
|
@@ -3119,17 +3216,13 @@ function mergeUserCenterConfig(props, cloud) {
|
|
|
3119
3216
|
};
|
|
3120
3217
|
}
|
|
3121
3218
|
const TAB_LABEL_KEYS = {
|
|
3122
|
-
[UserCenterTabType.MyRewards]: "
|
|
3123
|
-
[UserCenterTabType.Identity]: "
|
|
3124
|
-
[UserCenterTabType.ActivityHistory]: "
|
|
3125
|
-
};
|
|
3126
|
-
const TAB_DEFAULT_LABELS = {
|
|
3127
|
-
[UserCenterTabType.MyRewards]: "My Rewards",
|
|
3128
|
-
[UserCenterTabType.Identity]: "Identity",
|
|
3129
|
-
[UserCenterTabType.ActivityHistory]: "Activity History"
|
|
3219
|
+
[UserCenterTabType.MyRewards]: "tab_my_rewards",
|
|
3220
|
+
[UserCenterTabType.Identity]: "tab_identity",
|
|
3221
|
+
[UserCenterTabType.ActivityHistory]: "tab_activity_history"
|
|
3130
3222
|
};
|
|
3131
3223
|
function UserCenterWidget(props) {
|
|
3132
3224
|
const { widgetId, themeMode } = props;
|
|
3225
|
+
const { t } = useUserCenterLocale();
|
|
3133
3226
|
const { functionConfig, cloudTheme, isConfigLoading, configError } = useResolvedWidgetConfig(widgetId);
|
|
3134
3227
|
const mergedConfig = useMemo(() => {
|
|
3135
3228
|
return mergeUserCenterConfig(
|
|
@@ -3147,14 +3240,8 @@ function UserCenterWidget(props) {
|
|
|
3147
3240
|
cloudTheme,
|
|
3148
3241
|
themeMode,
|
|
3149
3242
|
className: "taskon-user-center",
|
|
3150
|
-
errorMessage: configError ?? (!isConfigured ? "
|
|
3151
|
-
children: Array.isArray(resolvedConfig) && resolvedConfig.length > 0 ? /* @__PURE__ */ jsx(
|
|
3152
|
-
UserCenterWidgetInner,
|
|
3153
|
-
{
|
|
3154
|
-
...props,
|
|
3155
|
-
config: resolvedConfig
|
|
3156
|
-
}
|
|
3157
|
-
) : null
|
|
3243
|
+
errorMessage: configError ?? (!isConfigured ? t("not_configured") : void 0),
|
|
3244
|
+
children: Array.isArray(resolvedConfig) && resolvedConfig.length > 0 ? /* @__PURE__ */ jsx(UserCenterWidgetInner, { ...props, config: resolvedConfig }) : null
|
|
3158
3245
|
}
|
|
3159
3246
|
);
|
|
3160
3247
|
}
|
|
@@ -3169,29 +3256,25 @@ function UserCenterWidgetInner({
|
|
|
3169
3256
|
}) {
|
|
3170
3257
|
var _a;
|
|
3171
3258
|
const { isInitializing } = useTaskOnContext();
|
|
3172
|
-
const {
|
|
3173
|
-
widgetId: "UserCenterWidget",
|
|
3174
|
-
defaultMessages: enMessages,
|
|
3175
|
-
loadMessages: (locale) => __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./locales/en.json": () => import("./UserCenterWidget-CvU6K4AC.js").then((n) => n.w), "./locales/ja.json": () => import("./usercenter-ja-B2465c1O.js"), "./locales/ko.json": () => import("./usercenter-ko-xAEYxqLg.js") }), `./locales/${locale}.json`, 3)
|
|
3176
|
-
});
|
|
3259
|
+
const { t, isLoading: isLocaleLoading } = useUserCenterLocale();
|
|
3177
3260
|
const enabledTabs = useMemo(() => filterEnabledTabs(config), [config]);
|
|
3178
3261
|
const tabItems = useMemo(() => {
|
|
3179
3262
|
return enabledTabs.map((tabConfig) => ({
|
|
3180
3263
|
key: tabConfig.tab,
|
|
3181
|
-
label:
|
|
3264
|
+
label: t(TAB_LABEL_KEYS[tabConfig.tab])
|
|
3182
3265
|
}));
|
|
3183
|
-
}, [enabledTabs,
|
|
3184
|
-
const initialTab = defaultTab && enabledTabs.some((
|
|
3266
|
+
}, [enabledTabs, t]);
|
|
3267
|
+
const initialTab = defaultTab && enabledTabs.some((t2) => t2.tab === defaultTab) ? defaultTab : ((_a = enabledTabs[0]) == null ? void 0 : _a.tab) ?? UserCenterTabType.MyRewards;
|
|
3185
3268
|
const [activeTab, setActiveTab] = useState(initialTab);
|
|
3186
3269
|
const handleTabChange = (tab) => {
|
|
3187
3270
|
setActiveTab(tab);
|
|
3188
3271
|
onTabChange == null ? void 0 : onTabChange(tab);
|
|
3189
3272
|
};
|
|
3190
3273
|
if (isInitializing || isLocaleLoading) {
|
|
3191
|
-
return /* @__PURE__ */ jsx("div", { className: `taskon-user-center ${className}`, style, children: /* @__PURE__ */ jsx(LoadingState, { message:
|
|
3274
|
+
return /* @__PURE__ */ jsx("div", { className: `taskon-user-center ${className}`, style, children: /* @__PURE__ */ jsx(LoadingState, { message: t("loading") }) });
|
|
3192
3275
|
}
|
|
3193
3276
|
if (enabledTabs.length === 0) {
|
|
3194
|
-
return /* @__PURE__ */ jsx("div", { className: `taskon-user-center ${className}`, style, children: /* @__PURE__ */ jsx("div", { className: "taskon-user-center-empty", children:
|
|
3277
|
+
return /* @__PURE__ */ jsx("div", { className: `taskon-user-center ${className}`, style, children: /* @__PURE__ */ jsx("div", { className: "taskon-user-center-empty", children: t("no_data") }) });
|
|
3195
3278
|
}
|
|
3196
3279
|
return /* @__PURE__ */ jsxs("div", { className: `taskon-user-center ${className}`, style, children: [
|
|
3197
3280
|
/* @__PURE__ */ jsx(Tabs, { items: tabItems, activeKey: activeTab, onChange: handleTabChange }),
|
|
@@ -3200,31 +3283,15 @@ function UserCenterWidgetInner({
|
|
|
3200
3283
|
MyRewardsContent,
|
|
3201
3284
|
{
|
|
3202
3285
|
config,
|
|
3203
|
-
messages,
|
|
3204
3286
|
defaultRewardCard,
|
|
3205
3287
|
defaultPointId
|
|
3206
3288
|
}
|
|
3207
3289
|
),
|
|
3208
|
-
activeTab === UserCenterTabType.Identity && /* @__PURE__ */ jsx(IdentityContent, { config
|
|
3209
|
-
activeTab === UserCenterTabType.ActivityHistory && /* @__PURE__ */ jsx(
|
|
3210
|
-
ActivityHistoryContent,
|
|
3211
|
-
{
|
|
3212
|
-
messages
|
|
3213
|
-
}
|
|
3214
|
-
)
|
|
3290
|
+
activeTab === UserCenterTabType.Identity && /* @__PURE__ */ jsx(IdentityContent, { config }),
|
|
3291
|
+
activeTab === UserCenterTabType.ActivityHistory && /* @__PURE__ */ jsx(ActivityHistoryContent, {})
|
|
3215
3292
|
] })
|
|
3216
3293
|
] });
|
|
3217
3294
|
}
|
|
3218
3295
|
export {
|
|
3219
|
-
|
|
3220
|
-
UserCenterWidget as U,
|
|
3221
|
-
AssetCard as a,
|
|
3222
|
-
AssetCarousel as b,
|
|
3223
|
-
useUserRewards as c,
|
|
3224
|
-
useFrozenAssets as d,
|
|
3225
|
-
useIdentityData as e,
|
|
3226
|
-
useUnbindSocial as f,
|
|
3227
|
-
useBindWallet as g,
|
|
3228
|
-
useDisableUnlink as h,
|
|
3229
|
-
useActivityHistory as u
|
|
3296
|
+
UserCenterWidget as U
|
|
3230
3297
|
};
|