@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,12 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React__default, { useState, useRef, useCallback, useEffect, useContext, useMemo } from "react";
|
|
3
3
|
import { isUnauthorizedError, TaskReviewResult, formatLongNumber, EligibilityType, Operator, MeetConditionStatus, RewardType, formatUtcTime, ErrorCode, SnsType, createCommunityTaskApi, TaskCardType, ChainType, getSwapDexTitleExpress, UserEligibleStatus, CampaignStatus, MediaType, createQuestApi, CampaignType, formatTokenAmount, TaskTemplateId, EligibilityTemplateId, RecurrenceType, createCommonApi, normalizeTask, formatSwapTokensForDisplay, formatAddress } from "@taskon/core";
|
|
4
|
-
import {
|
|
5
|
-
import { D as Dialog,
|
|
6
|
-
import { u as useTranslation, c as createLocaleLoader } from "./createLocaleLoader-BameiEhU.js";
|
|
4
|
+
import { c as useTranslation, e as createLocaleLoader, v as TaskOnContext, h as useTaskOnContext, x as useTaskOnPortalContainer } from "./ThemeProvider-mXLdLSkq.js";
|
|
5
|
+
import { D as Dialog, u as useResolvedWidgetConfig, W as WidgetShell } from "./WidgetShell-D7yC894Y.js";
|
|
7
6
|
import { d as useToast } from "./useToast-CaRkylKe.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { u as useBindWallet, T as TitleExpress, C as CardDescExpress, a as useNftClaimFlow, R as RewardModuleDialog, B as BlindBoxDialog, b as TaskItem, E as EligibilityInfo, c as Textarea } from "./EligibilityInfo-BV0Z2TgY.js";
|
|
8
|
+
import { a as useBindSocialAccount, B as BindWalletDialog, l as useChainMap, q as TipPopover, h as useIsMobile, I as Input } from "./UserCenterWidget-D5ttw4hO.js";
|
|
10
9
|
import { createPortal } from "react-dom";
|
|
11
10
|
import '../CommunityTaskList.css';function CardSelector({
|
|
12
11
|
options,
|
|
@@ -142,6 +141,76 @@ const community_points = "Points";
|
|
|
142
141
|
const community_token = "Token";
|
|
143
142
|
const community_dex = "DEX";
|
|
144
143
|
const community_rule_max = "(Max {val} {name})";
|
|
144
|
+
const taskchain_event_ended = "Event Ended";
|
|
145
|
+
const taskchain_login_required = "Login Required";
|
|
146
|
+
const taskchain_login_prompt = "Please login to participate in this task chain";
|
|
147
|
+
const taskchain_login_button = "Login";
|
|
148
|
+
const taskchain_not_eligible_title = "Not Eligible";
|
|
149
|
+
const taskchain_not_eligible_desc = "You don't meet the requirements to participate in this task chain.";
|
|
150
|
+
const taskchain_oops = "Oops!";
|
|
151
|
+
const taskchain_error_load_chain = "Failed to load task chain";
|
|
152
|
+
const taskchain_error_load_campaign_info = "Failed to load campaign info";
|
|
153
|
+
const taskchain_error_load_user_status = "Failed to load user status";
|
|
154
|
+
const taskchain_loading = "Loading...";
|
|
155
|
+
const taskchain_back = "Back";
|
|
156
|
+
const taskchain_next = "Next";
|
|
157
|
+
const taskchain_no_task_available = "No task available";
|
|
158
|
+
const taskchain_spots_left = "Spots left";
|
|
159
|
+
const taskchain_won = "Won";
|
|
160
|
+
const taskchain_ended = "Ended";
|
|
161
|
+
const taskchain_locked = "Locked";
|
|
162
|
+
const taskchain_unlock_prefix = "Complete the";
|
|
163
|
+
const taskchain_unlock_day_challenge = "Day {day} challenge";
|
|
164
|
+
const taskchain_unlock_suffix = "then wait until next day to unlock";
|
|
165
|
+
const taskchain_goal = "Goal";
|
|
166
|
+
const taskchain_token_fallback = "Token";
|
|
167
|
+
const taskchain_points_fallback = "Points";
|
|
168
|
+
const taskchain_nft_fallback = "NFT";
|
|
169
|
+
const taskchain_blindbox_submit_failed = "Failed to submit campaign. Please try again.";
|
|
170
|
+
const taskchain_blindbox_claim_failed = "Failed to claim reward. Please try again.";
|
|
171
|
+
const taskchain_blindbox_title_missed = "Oops! Better Luck Next Time!";
|
|
172
|
+
const taskchain_blindbox_title_won = "Congratulations!";
|
|
173
|
+
const taskchain_blindbox_subtitle_missed = "Rewards Missed";
|
|
174
|
+
const taskchain_blindbox_subtitle_won = "You Have Won";
|
|
175
|
+
const taskchain_blindbox_preparing_reward = "Preparing your reward...";
|
|
176
|
+
const taskchain_blindbox_submitting = "Submitting...";
|
|
177
|
+
const taskchain_blindbox_retry_submit = "Retry submit";
|
|
178
|
+
const taskchain_reward_submit_failed = "Failed to submit campaign. Please try again.";
|
|
179
|
+
const taskchain_reward_congratulations = "Congratulations!";
|
|
180
|
+
const taskchain_reward_you_won = "You have won";
|
|
181
|
+
const taskchain_reward_claiming = "Claiming...";
|
|
182
|
+
const taskchain_reward_claim = "Claim Reward";
|
|
183
|
+
const taskchain_nft_claim_failed = "Failed to claim NFT";
|
|
184
|
+
const taskchain_reward_token_label = "Reward Token";
|
|
185
|
+
const taskchain_value_label = "Value";
|
|
186
|
+
const taskchain_reward_type_cap = "Cap";
|
|
187
|
+
const taskchain_reward_type_nft = "NFT";
|
|
188
|
+
const taskchain_nft_cta_mint = "Mint";
|
|
189
|
+
const taskchain_nft_cta_view = "View my NFT";
|
|
190
|
+
const taskchain_nft_claim_not_supported = "NFT claim is not supported for this reward type yet.";
|
|
191
|
+
const taskchain_nft_alt = "NFT";
|
|
192
|
+
const taskchain_chain_alt = "Chain";
|
|
193
|
+
const taskchain_nft_claim_dialog_claim_nft = "Claim NFT";
|
|
194
|
+
const taskchain_nft_claim_dialog_claiming_nft = "Claiming NFT...";
|
|
195
|
+
const taskchain_nft_claim_dialog_connecting_wallet = "Connecting wallet...";
|
|
196
|
+
const taskchain_nft_claim_dialog_switching_network = "Switching network...";
|
|
197
|
+
const taskchain_nft_claim_dialog_getting_signature = "Getting signature...";
|
|
198
|
+
const taskchain_nft_claim_dialog_confirm_in_wallet = "Please confirm in your wallet";
|
|
199
|
+
const taskchain_nft_claim_dialog_tx_pending = "Transaction pending...";
|
|
200
|
+
const taskchain_nft_claim_dialog_success = "Claim successful!";
|
|
201
|
+
const taskchain_nft_claim_dialog_failed = "Claim failed";
|
|
202
|
+
const taskchain_nft_claim_dialog_canceled = "Transaction was rejected by user.";
|
|
203
|
+
const taskchain_nft_claim_dialog_view_explorer = "View on Explorer";
|
|
204
|
+
const taskchain_nft_claim_dialog_retry = "Retry";
|
|
205
|
+
const taskchain_nft_claim_dialog_close = "Close";
|
|
206
|
+
const taskchain_nft_pending_dialog_title = "Pending Transaction";
|
|
207
|
+
const taskchain_nft_pending_dialog_desc = "You have already claimed this NFT, please wait for this transaction to be confirmed.";
|
|
208
|
+
const taskchain_nft_pending_dialog_check_explorer = "You can check this transaction on explorer:";
|
|
209
|
+
const taskchain_nft_pending_dialog_hash_label = "Transaction hash:";
|
|
210
|
+
const taskchain_nft_pending_dialog_claim_again_warn = '"Claim Again" will send a new transaction it is only recommended when you are sure there is something wrong with the current transaction.';
|
|
211
|
+
const taskchain_nft_pending_dialog_receive_address_fixed = "This receive address can't be changed:";
|
|
212
|
+
const taskchain_nft_pending_dialog_claim_again = "Claim Again";
|
|
213
|
+
const taskchain_nft_pending_dialog_continue_waiting = "Continue Waiting";
|
|
145
214
|
const enMessages = {
|
|
146
215
|
once_tag,
|
|
147
216
|
daily_tag,
|
|
@@ -244,21 +313,91 @@ const enMessages = {
|
|
|
244
313
|
community_points,
|
|
245
314
|
community_token,
|
|
246
315
|
community_dex,
|
|
247
|
-
community_rule_max
|
|
316
|
+
community_rule_max,
|
|
317
|
+
taskchain_event_ended,
|
|
318
|
+
taskchain_login_required,
|
|
319
|
+
taskchain_login_prompt,
|
|
320
|
+
taskchain_login_button,
|
|
321
|
+
taskchain_not_eligible_title,
|
|
322
|
+
taskchain_not_eligible_desc,
|
|
323
|
+
taskchain_oops,
|
|
324
|
+
taskchain_error_load_chain,
|
|
325
|
+
taskchain_error_load_campaign_info,
|
|
326
|
+
taskchain_error_load_user_status,
|
|
327
|
+
taskchain_loading,
|
|
328
|
+
taskchain_back,
|
|
329
|
+
taskchain_next,
|
|
330
|
+
taskchain_no_task_available,
|
|
331
|
+
taskchain_spots_left,
|
|
332
|
+
taskchain_won,
|
|
333
|
+
taskchain_ended,
|
|
334
|
+
taskchain_locked,
|
|
335
|
+
taskchain_unlock_prefix,
|
|
336
|
+
taskchain_unlock_day_challenge,
|
|
337
|
+
taskchain_unlock_suffix,
|
|
338
|
+
taskchain_goal,
|
|
339
|
+
taskchain_token_fallback,
|
|
340
|
+
taskchain_points_fallback,
|
|
341
|
+
taskchain_nft_fallback,
|
|
342
|
+
taskchain_blindbox_submit_failed,
|
|
343
|
+
taskchain_blindbox_claim_failed,
|
|
344
|
+
taskchain_blindbox_title_missed,
|
|
345
|
+
taskchain_blindbox_title_won,
|
|
346
|
+
taskchain_blindbox_subtitle_missed,
|
|
347
|
+
taskchain_blindbox_subtitle_won,
|
|
348
|
+
taskchain_blindbox_preparing_reward,
|
|
349
|
+
taskchain_blindbox_submitting,
|
|
350
|
+
taskchain_blindbox_retry_submit,
|
|
351
|
+
taskchain_reward_submit_failed,
|
|
352
|
+
taskchain_reward_congratulations,
|
|
353
|
+
taskchain_reward_you_won,
|
|
354
|
+
taskchain_reward_claiming,
|
|
355
|
+
taskchain_reward_claim,
|
|
356
|
+
taskchain_nft_claim_failed,
|
|
357
|
+
taskchain_reward_token_label,
|
|
358
|
+
taskchain_value_label,
|
|
359
|
+
taskchain_reward_type_cap,
|
|
360
|
+
taskchain_reward_type_nft,
|
|
361
|
+
taskchain_nft_cta_mint,
|
|
362
|
+
taskchain_nft_cta_view,
|
|
363
|
+
taskchain_nft_claim_not_supported,
|
|
364
|
+
taskchain_nft_alt,
|
|
365
|
+
taskchain_chain_alt,
|
|
366
|
+
taskchain_nft_claim_dialog_claim_nft,
|
|
367
|
+
taskchain_nft_claim_dialog_claiming_nft,
|
|
368
|
+
taskchain_nft_claim_dialog_connecting_wallet,
|
|
369
|
+
taskchain_nft_claim_dialog_switching_network,
|
|
370
|
+
taskchain_nft_claim_dialog_getting_signature,
|
|
371
|
+
taskchain_nft_claim_dialog_confirm_in_wallet,
|
|
372
|
+
taskchain_nft_claim_dialog_tx_pending,
|
|
373
|
+
taskchain_nft_claim_dialog_success,
|
|
374
|
+
taskchain_nft_claim_dialog_failed,
|
|
375
|
+
taskchain_nft_claim_dialog_canceled,
|
|
376
|
+
taskchain_nft_claim_dialog_view_explorer,
|
|
377
|
+
taskchain_nft_claim_dialog_retry,
|
|
378
|
+
taskchain_nft_claim_dialog_close,
|
|
379
|
+
taskchain_nft_pending_dialog_title,
|
|
380
|
+
taskchain_nft_pending_dialog_desc,
|
|
381
|
+
taskchain_nft_pending_dialog_check_explorer,
|
|
382
|
+
taskchain_nft_pending_dialog_hash_label,
|
|
383
|
+
taskchain_nft_pending_dialog_claim_again_warn,
|
|
384
|
+
taskchain_nft_pending_dialog_receive_address_fixed,
|
|
385
|
+
taskchain_nft_pending_dialog_claim_again,
|
|
386
|
+
taskchain_nft_pending_dialog_continue_waiting
|
|
248
387
|
};
|
|
249
388
|
const loadMessages = createLocaleLoader(
|
|
250
389
|
enMessages,
|
|
251
390
|
{
|
|
252
|
-
ko: () => import("./communitytask-ko-
|
|
391
|
+
ko: () => import("./communitytask-ko-Bf24PQKI.js").then((module) => ({
|
|
253
392
|
default: module.default
|
|
254
393
|
})),
|
|
255
|
-
ja: () => import("./communitytask-ja-
|
|
394
|
+
ja: () => import("./communitytask-ja-GRf9cbdx.js").then((module) => ({
|
|
256
395
|
default: module.default
|
|
257
396
|
})),
|
|
258
|
-
ru: () => import("./communitytask-ru-
|
|
397
|
+
ru: () => import("./communitytask-ru-CZm2CPoV.js").then((module) => ({
|
|
259
398
|
default: module.default
|
|
260
399
|
})),
|
|
261
|
-
es: () => import("./communitytask-es-
|
|
400
|
+
es: () => import("./communitytask-es-CBNnS4o2.js").then((module) => ({
|
|
262
401
|
default: module.default
|
|
263
402
|
}))
|
|
264
403
|
}
|
|
@@ -2687,6 +2826,7 @@ function TaskChainCard({
|
|
|
2687
2826
|
className = "",
|
|
2688
2827
|
onOpen
|
|
2689
2828
|
}) {
|
|
2829
|
+
const { t } = useCommunityTaskLocale();
|
|
2690
2830
|
const isLocked = useMemo(() => {
|
|
2691
2831
|
return isLockedByPreDayChallenge(meetConditions);
|
|
2692
2832
|
}, [meetConditions]);
|
|
@@ -2712,10 +2852,10 @@ function TaskChainCard({
|
|
|
2712
2852
|
});
|
|
2713
2853
|
return {
|
|
2714
2854
|
icon: params.token_icon || TOKEN_ICON,
|
|
2715
|
-
name: params.token_name || "",
|
|
2855
|
+
name: params.token_name || t("taskchain_token_fallback"),
|
|
2716
2856
|
amount
|
|
2717
2857
|
};
|
|
2718
|
-
}, [taskChain.reward_list]);
|
|
2858
|
+
}, [taskChain.reward_list, t]);
|
|
2719
2859
|
const pointsReward = useMemo(() => {
|
|
2720
2860
|
const reward = taskChain.reward_list.find(
|
|
2721
2861
|
(r) => r.reward_type === RewardType.GTCPoints
|
|
@@ -2725,10 +2865,10 @@ function TaskChainCard({
|
|
|
2725
2865
|
if (!params) return null;
|
|
2726
2866
|
return {
|
|
2727
2867
|
icon: params.points_icon || POINTS_ICON,
|
|
2728
|
-
name: params.points_name || "
|
|
2868
|
+
name: params.points_name || t("taskchain_points_fallback"),
|
|
2729
2869
|
amount: params.amount || 0
|
|
2730
2870
|
};
|
|
2731
|
-
}, [taskChain.reward_list]);
|
|
2871
|
+
}, [taskChain.reward_list, t]);
|
|
2732
2872
|
const nftReward = useMemo(() => {
|
|
2733
2873
|
const reward = taskChain.reward_list.find(
|
|
2734
2874
|
(r) => r.reward_type === RewardType.BMintedNft
|
|
@@ -2739,9 +2879,9 @@ function TaskChainCard({
|
|
|
2739
2879
|
const icon = params.media_type === MediaType.Video || !params.nft_cdn_image ? NFT_ICON$1 : getMiniNftCdnUrl$1(params.nft_cdn_image);
|
|
2740
2880
|
return {
|
|
2741
2881
|
icon,
|
|
2742
|
-
name: params.nft_collection_name || "
|
|
2882
|
+
name: params.nft_collection_name || t("taskchain_nft_fallback")
|
|
2743
2883
|
};
|
|
2744
|
-
}, [taskChain.reward_list]);
|
|
2884
|
+
}, [taskChain.reward_list, t]);
|
|
2745
2885
|
const handleClick = useCallback(() => {
|
|
2746
2886
|
if (disabled || isEnded || isLocked) return;
|
|
2747
2887
|
onOpen == null ? void 0 : onOpen(taskChain.id);
|
|
@@ -2765,7 +2905,7 @@ function TaskChainCard({
|
|
|
2765
2905
|
children: [
|
|
2766
2906
|
/* @__PURE__ */ jsx("div", { className: "taskon-taskchain-card-name", children: taskChain.name }),
|
|
2767
2907
|
taskChain.token_reward_quantity > 0 && /* @__PURE__ */ jsxs("div", { className: "taskon-taskchain-card-spots", children: [
|
|
2768
|
-
/* @__PURE__ */ jsx("span", { className: "taskon-taskchain-card-spots-label", children: "
|
|
2908
|
+
/* @__PURE__ */ jsx("span", { className: "taskon-taskchain-card-spots-label", children: t("taskchain_spots_left") }),
|
|
2769
2909
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
2770
2910
|
taskChain.token_reward_left_quantity,
|
|
2771
2911
|
"/",
|
|
@@ -2818,15 +2958,15 @@ function TaskChainCard({
|
|
|
2818
2958
|
)
|
|
2819
2959
|
] })
|
|
2820
2960
|
] }),
|
|
2821
|
-
isCompleted && /* @__PURE__ */ jsx("div", { className: "taskon-taskchain-card-won", children: "
|
|
2961
|
+
isCompleted && /* @__PURE__ */ jsx("div", { className: "taskon-taskchain-card-won", children: t("taskchain_won") })
|
|
2822
2962
|
] }),
|
|
2823
|
-
isEnded && /* @__PURE__ */ jsx("div", { className: "taskon-taskchain-card-overlay taskon-taskchain-card-overlay--ended", children: /* @__PURE__ */ jsx("span", { className: "taskon-taskchain-card-overlay-text", children: "
|
|
2963
|
+
isEnded && /* @__PURE__ */ jsx("div", { className: "taskon-taskchain-card-overlay taskon-taskchain-card-overlay--ended", children: /* @__PURE__ */ jsx("span", { className: "taskon-taskchain-card-overlay-text", children: t("taskchain_ended") }) }),
|
|
2824
2964
|
isLocked && /* @__PURE__ */ jsxs("div", { className: "taskon-taskchain-card-overlay taskon-taskchain-card-overlay--locked", children: [
|
|
2825
2965
|
/* @__PURE__ */ jsx(
|
|
2826
2966
|
"img",
|
|
2827
2967
|
{
|
|
2828
2968
|
src: LOCK_ICON,
|
|
2829
|
-
alt: "
|
|
2969
|
+
alt: t("taskchain_locked"),
|
|
2830
2970
|
className: "taskon-taskchain-card-lock-icon"
|
|
2831
2971
|
}
|
|
2832
2972
|
),
|
|
@@ -2835,22 +2975,19 @@ function TaskChainCard({
|
|
|
2835
2975
|
"img",
|
|
2836
2976
|
{
|
|
2837
2977
|
src: LOCK_ICON,
|
|
2838
|
-
alt: "
|
|
2978
|
+
alt: t("taskchain_locked"),
|
|
2839
2979
|
className: "taskon-taskchain-card-lock-icon"
|
|
2840
2980
|
}
|
|
2841
2981
|
),
|
|
2842
2982
|
/* @__PURE__ */ jsxs("div", { className: "taskon-taskchain-card-lock-text", children: [
|
|
2843
2983
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2844
|
-
"
|
|
2984
|
+
t("taskchain_unlock_prefix"),
|
|
2845
2985
|
" ",
|
|
2846
|
-
/* @__PURE__ */
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
" challenge"
|
|
2850
|
-
] }),
|
|
2851
|
-
","
|
|
2986
|
+
/* @__PURE__ */ jsx("span", { className: "taskon-taskchain-card-lock-highlight", children: t("taskchain_unlock_day_challenge", {
|
|
2987
|
+
day: previousDayNumber
|
|
2988
|
+
}) })
|
|
2852
2989
|
] }),
|
|
2853
|
-
/* @__PURE__ */ jsx("div", { children: "
|
|
2990
|
+
/* @__PURE__ */ jsx("div", { children: t("taskchain_unlock_suffix") })
|
|
2854
2991
|
] })
|
|
2855
2992
|
] })
|
|
2856
2993
|
] })
|
|
@@ -2896,6 +3033,7 @@ function useTaskChainStore(options) {
|
|
|
2896
3033
|
function useTaskChainDetail(options) {
|
|
2897
3034
|
const { campaignId, enabled = true } = options;
|
|
2898
3035
|
const { client, isLoggedIn } = useTaskOnContext();
|
|
3036
|
+
const { t } = useCommunityTaskLocale();
|
|
2899
3037
|
const [campaign, setCampaign] = useState(null);
|
|
2900
3038
|
const [userStatus, setUserStatus] = useState(null);
|
|
2901
3039
|
const [campaignStatusInfo, setCampaignStatusInfo] = useState(null);
|
|
@@ -2911,22 +3049,22 @@ function useTaskChainDetail(options) {
|
|
|
2911
3049
|
const result = await api.getCampaignInfo({ campaign_id: campaignId });
|
|
2912
3050
|
setCampaign(result);
|
|
2913
3051
|
} catch (err) {
|
|
2914
|
-
const errorMessage = err instanceof Error ? err.message : "
|
|
3052
|
+
const errorMessage = err instanceof Error ? err.message : t("taskchain_error_load_campaign_info");
|
|
2915
3053
|
setError(errorMessage);
|
|
2916
3054
|
console.error("[useTaskChainDetail] Error loading campaign:", err);
|
|
2917
3055
|
}
|
|
2918
|
-
}, [enabled, api, campaignId]);
|
|
3056
|
+
}, [enabled, api, campaignId, t]);
|
|
2919
3057
|
const fetchUserStatus = useCallback(async () => {
|
|
2920
3058
|
if (!enabled || !api || !campaignId || !isLoggedIn) return;
|
|
2921
3059
|
try {
|
|
2922
3060
|
const result = await api.getUserCampaignStatus({ campaign_id: campaignId });
|
|
2923
3061
|
setUserStatus(result);
|
|
2924
3062
|
} catch (err) {
|
|
2925
|
-
const errorMessage = err instanceof Error ? err.message : "
|
|
3063
|
+
const errorMessage = err instanceof Error ? err.message : t("taskchain_error_load_user_status");
|
|
2926
3064
|
setError(errorMessage);
|
|
2927
3065
|
console.error("[useTaskChainDetail] Error loading user status:", err);
|
|
2928
3066
|
}
|
|
2929
|
-
}, [enabled, api, campaignId, isLoggedIn]);
|
|
3067
|
+
}, [enabled, api, campaignId, isLoggedIn, t]);
|
|
2930
3068
|
const fetchCampaignStatusInfo = useCallback(async () => {
|
|
2931
3069
|
if (!enabled || !api || !campaignId) return;
|
|
2932
3070
|
try {
|
|
@@ -3004,6 +3142,7 @@ function StepIndicator({
|
|
|
3004
3142
|
children,
|
|
3005
3143
|
className = ""
|
|
3006
3144
|
}) {
|
|
3145
|
+
const { t } = useCommunityTaskLocale();
|
|
3007
3146
|
const stepBars = Array.from({ length: count }, (_, index) => {
|
|
3008
3147
|
const isCompleted = index < currentStep + 1;
|
|
3009
3148
|
return /* @__PURE__ */ jsx(
|
|
@@ -3020,35 +3159,22 @@ function StepIndicator({
|
|
|
3020
3159
|
"img",
|
|
3021
3160
|
{
|
|
3022
3161
|
src: FLAG_ICON,
|
|
3023
|
-
alt: "
|
|
3162
|
+
alt: t("taskchain_goal"),
|
|
3024
3163
|
className: "taskon-taskchain-step-indicator-flag"
|
|
3025
3164
|
}
|
|
3026
3165
|
),
|
|
3027
3166
|
children
|
|
3028
3167
|
] });
|
|
3029
3168
|
}
|
|
3030
|
-
function formatDate(timestamp) {
|
|
3169
|
+
function formatDate(timestamp, locale) {
|
|
3031
3170
|
const ts = typeof timestamp === "string" ? parseInt(timestamp, 10) : timestamp;
|
|
3032
3171
|
const ms = ts < 1e12 ? ts * 1e3 : ts;
|
|
3033
3172
|
const date = new Date(ms);
|
|
3034
|
-
|
|
3035
|
-
"
|
|
3036
|
-
"
|
|
3037
|
-
"
|
|
3038
|
-
|
|
3039
|
-
"May",
|
|
3040
|
-
"Jun",
|
|
3041
|
-
"Jul",
|
|
3042
|
-
"Aug",
|
|
3043
|
-
"Sep",
|
|
3044
|
-
"Oct",
|
|
3045
|
-
"Nov",
|
|
3046
|
-
"Dec"
|
|
3047
|
-
];
|
|
3048
|
-
const month = months[date.getMonth()];
|
|
3049
|
-
const day = date.getDate().toString().padStart(2, "0");
|
|
3050
|
-
const year = date.getFullYear();
|
|
3051
|
-
return `${month} ${day}, ${year}`;
|
|
3173
|
+
return new Intl.DateTimeFormat(locale, {
|
|
3174
|
+
year: "numeric",
|
|
3175
|
+
month: "short",
|
|
3176
|
+
day: "2-digit"
|
|
3177
|
+
}).format(date);
|
|
3052
3178
|
}
|
|
3053
3179
|
function IconDate() {
|
|
3054
3180
|
return /* @__PURE__ */ jsxs(
|
|
@@ -3086,14 +3212,16 @@ function TaskChainDetailTime({
|
|
|
3086
3212
|
campaignStatusInfo,
|
|
3087
3213
|
className = ""
|
|
3088
3214
|
}) {
|
|
3215
|
+
const { locale } = useTaskOnContext();
|
|
3216
|
+
const { t } = useCommunityTaskLocale();
|
|
3089
3217
|
const timeRange = useMemo(() => {
|
|
3090
3218
|
if (!campaign) return "";
|
|
3091
3219
|
const { start_time, end_time } = campaign;
|
|
3092
3220
|
if (!start_time || !end_time) return "";
|
|
3093
|
-
const startStr = formatDate(start_time);
|
|
3094
|
-
const endStr = formatDate(end_time);
|
|
3221
|
+
const startStr = formatDate(start_time, locale);
|
|
3222
|
+
const endStr = formatDate(end_time, locale);
|
|
3095
3223
|
return `${startStr} - ${endStr}`;
|
|
3096
|
-
}, [campaign]);
|
|
3224
|
+
}, [campaign, locale]);
|
|
3097
3225
|
const spots = useMemo(() => {
|
|
3098
3226
|
var _a, _b, _c, _d;
|
|
3099
3227
|
if (!(campaign == null ? void 0 : campaign.winner_rewards) || !((_a = campaignStatusInfo == null ? void 0 : campaignStatusInfo.statistics) == null ? void 0 : _a.winner_number))
|
|
@@ -3132,7 +3260,7 @@ function TaskChainDetailTime({
|
|
|
3132
3260
|
] }),
|
|
3133
3261
|
timeRange && spots && /* @__PURE__ */ jsx("div", { className: "taskon-taskchain-time-divider" }),
|
|
3134
3262
|
spots && /* @__PURE__ */ jsxs("div", { className: "taskon-taskchain-time-item", children: [
|
|
3135
|
-
/* @__PURE__ */ jsx("span", { className: "taskon-taskchain-time-label", children: "
|
|
3263
|
+
/* @__PURE__ */ jsx("span", { className: "taskon-taskchain-time-label", children: t("taskchain_spots_left") }),
|
|
3136
3264
|
/* @__PURE__ */ jsx("span", { className: "taskon-taskchain-time-value", children: spots })
|
|
3137
3265
|
] })
|
|
3138
3266
|
] }) });
|
|
@@ -3168,6 +3296,7 @@ function RewardDisplay({
|
|
|
3168
3296
|
winnerRewardsSimple,
|
|
3169
3297
|
className = ""
|
|
3170
3298
|
}) {
|
|
3299
|
+
const { t } = useCommunityTaskLocale();
|
|
3171
3300
|
const allRewards = useMemo(() => {
|
|
3172
3301
|
return (winnerRewards == null ? void 0 : winnerRewards.flatMap(
|
|
3173
3302
|
(reward) => (reward.winner_layer_rewards || []).flatMap((layer) => layer.rewards || [])
|
|
@@ -3201,17 +3330,28 @@ function RewardDisplay({
|
|
|
3201
3330
|
totalWinners: tokenMaxWinners
|
|
3202
3331
|
});
|
|
3203
3332
|
}, [tokenParam, tokenHasBlindBox, tokenMaxWinners]);
|
|
3333
|
+
const tokenName = useMemo(
|
|
3334
|
+
() => (tokenParam == null ? void 0 : tokenParam.token_name) || t("taskchain_token_fallback"),
|
|
3335
|
+
[tokenParam == null ? void 0 : tokenParam.token_name, t]
|
|
3336
|
+
);
|
|
3204
3337
|
const pointParam = useMemo(() => {
|
|
3205
3338
|
const target = allRewards.find(
|
|
3206
3339
|
(reward) => reward.reward_type === RewardType.Points || reward.reward_type === RewardType.GTCPoints
|
|
3207
3340
|
);
|
|
3208
3341
|
return (target == null ? void 0 : target.reward_params) || null;
|
|
3209
3342
|
}, [allRewards]);
|
|
3343
|
+
const pointsName = useMemo(
|
|
3344
|
+
() => (pointParam == null ? void 0 : pointParam.points_name) || t("taskchain_points_fallback"),
|
|
3345
|
+
[pointParam == null ? void 0 : pointParam.points_name, t]
|
|
3346
|
+
);
|
|
3210
3347
|
const mintedNftReward = useMemo(() => {
|
|
3211
3348
|
const target = allRewards.find((reward) => reward.reward_type === RewardType.BMintedNft);
|
|
3212
3349
|
return (target == null ? void 0 : target.reward_params) || null;
|
|
3213
3350
|
}, [allRewards]);
|
|
3214
|
-
const mintedNftName = useMemo(
|
|
3351
|
+
const mintedNftName = useMemo(
|
|
3352
|
+
() => (mintedNftReward == null ? void 0 : mintedNftReward.nft_collection_name) || t("taskchain_nft_fallback"),
|
|
3353
|
+
[mintedNftReward == null ? void 0 : mintedNftReward.nft_collection_name, t]
|
|
3354
|
+
);
|
|
3215
3355
|
const mintedNftImage = useMemo(() => {
|
|
3216
3356
|
if (!mintedNftReward) return "";
|
|
3217
3357
|
if (mintedNftReward.media_type === "video") return "";
|
|
@@ -3231,14 +3371,14 @@ function RewardDisplay({
|
|
|
3231
3371
|
"img",
|
|
3232
3372
|
{
|
|
3233
3373
|
src: tokenParam.token_icon || DEFAULT_TOKEN_ICON$2,
|
|
3234
|
-
alt:
|
|
3374
|
+
alt: tokenName,
|
|
3235
3375
|
className: "taskon-taskchain-reward-display-icon"
|
|
3236
3376
|
}
|
|
3237
3377
|
),
|
|
3238
3378
|
/* @__PURE__ */ jsxs("div", { className: "taskon-taskchain-reward-display-text taskon-taskchain-reward-display-text--token", children: [
|
|
3239
3379
|
tokenAmountDisplay,
|
|
3240
3380
|
" ",
|
|
3241
|
-
|
|
3381
|
+
tokenName
|
|
3242
3382
|
] })
|
|
3243
3383
|
] }),
|
|
3244
3384
|
pointParam && /* @__PURE__ */ jsxs("div", { className: "taskon-taskchain-reward-display-item", children: [
|
|
@@ -3246,14 +3386,14 @@ function RewardDisplay({
|
|
|
3246
3386
|
"img",
|
|
3247
3387
|
{
|
|
3248
3388
|
src: pointParam.points_icon,
|
|
3249
|
-
alt:
|
|
3389
|
+
alt: pointsName,
|
|
3250
3390
|
className: "taskon-taskchain-reward-display-icon"
|
|
3251
3391
|
}
|
|
3252
3392
|
),
|
|
3253
3393
|
/* @__PURE__ */ jsxs("div", { className: "taskon-taskchain-reward-display-text taskon-taskchain-reward-display-text--points", children: [
|
|
3254
3394
|
pointParam.amount,
|
|
3255
3395
|
" ",
|
|
3256
|
-
|
|
3396
|
+
pointsName
|
|
3257
3397
|
] })
|
|
3258
3398
|
] }),
|
|
3259
3399
|
mintedNftReward && /* @__PURE__ */ jsxs("div", { className: "taskon-taskchain-reward-display-item", children: [
|
|
@@ -3318,33 +3458,39 @@ function getMiniNftCdnUrl(url) {
|
|
|
3318
3458
|
const separator = url.includes("?") ? "&" : "?";
|
|
3319
3459
|
return `${url}${separator}x-oss-process=image/resize,m_fill,h_160,w_160`;
|
|
3320
3460
|
}
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3461
|
+
function buildTaskChainNftClaimMessages(t) {
|
|
3462
|
+
return {
|
|
3463
|
+
claimDialog: {
|
|
3464
|
+
claimNft: t("taskchain_nft_claim_dialog_claim_nft"),
|
|
3465
|
+
claimingNft: t("taskchain_nft_claim_dialog_claiming_nft"),
|
|
3466
|
+
claimConnectingWallet: t("taskchain_nft_claim_dialog_connecting_wallet"),
|
|
3467
|
+
claimSwitchingNetwork: t("taskchain_nft_claim_dialog_switching_network"),
|
|
3468
|
+
claimGettingSignature: t("taskchain_nft_claim_dialog_getting_signature"),
|
|
3469
|
+
claimConfirmInWallet: t("taskchain_nft_claim_dialog_confirm_in_wallet"),
|
|
3470
|
+
claimTransactionPending: t("taskchain_nft_claim_dialog_tx_pending"),
|
|
3471
|
+
claimSuccess: t("taskchain_nft_claim_dialog_success"),
|
|
3472
|
+
claimFailed: t("taskchain_nft_claim_dialog_failed"),
|
|
3473
|
+
claimCanceled: t("taskchain_nft_claim_dialog_canceled"),
|
|
3474
|
+
viewOnExplorer: t("taskchain_nft_claim_dialog_view_explorer"),
|
|
3475
|
+
retry: t("taskchain_nft_claim_dialog_retry"),
|
|
3476
|
+
close: t("taskchain_nft_claim_dialog_close")
|
|
3477
|
+
},
|
|
3478
|
+
pendingDialog: {
|
|
3479
|
+
pendingTransaction: t("taskchain_nft_pending_dialog_title"),
|
|
3480
|
+
claimPendingTitle: t("taskchain_nft_pending_dialog_desc"),
|
|
3481
|
+
claimPendingCheckExplorer: t("taskchain_nft_pending_dialog_check_explorer"),
|
|
3482
|
+
claimPendingHashLabel: t("taskchain_nft_pending_dialog_hash_label"),
|
|
3483
|
+
claimPendingClaimAgainWarn: t(
|
|
3484
|
+
"taskchain_nft_pending_dialog_claim_again_warn"
|
|
3485
|
+
),
|
|
3486
|
+
claimPendingReceiveAddressNoChange: t(
|
|
3487
|
+
"taskchain_nft_pending_dialog_receive_address_fixed"
|
|
3488
|
+
),
|
|
3489
|
+
claimAgain: t("taskchain_nft_pending_dialog_claim_again"),
|
|
3490
|
+
continueWaiting: t("taskchain_nft_pending_dialog_continue_waiting")
|
|
3491
|
+
}
|
|
3492
|
+
};
|
|
3493
|
+
}
|
|
3348
3494
|
function RightChevronIcon({ className }) {
|
|
3349
3495
|
return /* @__PURE__ */ jsx(
|
|
3350
3496
|
"svg",
|
|
@@ -3368,11 +3514,11 @@ function RightChevronIcon({ className }) {
|
|
|
3368
3514
|
}
|
|
3369
3515
|
);
|
|
3370
3516
|
}
|
|
3371
|
-
function getClaimedRewardDisplay(reward) {
|
|
3517
|
+
function getClaimedRewardDisplay(reward, labels) {
|
|
3372
3518
|
if (reward.reward_type === RewardType.Token) {
|
|
3373
3519
|
const rewardValue = reward.reward_value;
|
|
3374
3520
|
const icon = DEFAULT_TOKEN_ICON$1;
|
|
3375
|
-
const name = (rewardValue == null ? void 0 : rewardValue.token_name) ||
|
|
3521
|
+
const name = (rewardValue == null ? void 0 : rewardValue.token_name) || labels.token;
|
|
3376
3522
|
const rawAmount = (rewardValue == null ? void 0 : rewardValue.amount) || "0";
|
|
3377
3523
|
const amount = formatLongNumber(Number(rawAmount) || 0) || rawAmount;
|
|
3378
3524
|
return {
|
|
@@ -3385,7 +3531,7 @@ function getClaimedRewardDisplay(reward) {
|
|
|
3385
3531
|
if (reward.reward_type === RewardType.GTCPoints || reward.reward_type === RewardType.Points) {
|
|
3386
3532
|
const rewardValue = reward.reward_value;
|
|
3387
3533
|
const icon = (rewardValue == null ? void 0 : rewardValue.points_icon) || "";
|
|
3388
|
-
const name = (rewardValue == null ? void 0 : rewardValue.points_name) ||
|
|
3534
|
+
const name = (rewardValue == null ? void 0 : rewardValue.points_name) || labels.points;
|
|
3389
3535
|
const amount = (rewardValue == null ? void 0 : rewardValue.amount) != null ? String(rewardValue.amount) : "0";
|
|
3390
3536
|
return {
|
|
3391
3537
|
icon,
|
|
@@ -3407,8 +3553,20 @@ function TaskChainClaimedRewards({
|
|
|
3407
3553
|
className
|
|
3408
3554
|
}) {
|
|
3409
3555
|
const { toast } = useToast();
|
|
3556
|
+
const { t } = useCommunityTaskLocale();
|
|
3410
3557
|
const [isTokenRewardPopupOpen, setIsTokenRewardPopupOpen] = useState(false);
|
|
3411
3558
|
const [isViewMyNftPopupOpen, setIsViewMyNftPopupOpen] = useState(false);
|
|
3559
|
+
const nftClaimMessages = useMemo(
|
|
3560
|
+
() => buildTaskChainNftClaimMessages(t),
|
|
3561
|
+
[t]
|
|
3562
|
+
);
|
|
3563
|
+
const rewardLabels = useMemo(
|
|
3564
|
+
() => ({
|
|
3565
|
+
token: t("taskchain_token_fallback"),
|
|
3566
|
+
points: t("taskchain_points_fallback")
|
|
3567
|
+
}),
|
|
3568
|
+
[t]
|
|
3569
|
+
);
|
|
3412
3570
|
const {
|
|
3413
3571
|
claimNftReward,
|
|
3414
3572
|
isSupportedNftRewardType,
|
|
@@ -3416,12 +3574,12 @@ function TaskChainClaimedRewards({
|
|
|
3416
3574
|
} = useNftClaimFlow({
|
|
3417
3575
|
campaignId,
|
|
3418
3576
|
targetType: campaignType === CampaignType.Event ? "event" : "campaign",
|
|
3419
|
-
messages:
|
|
3577
|
+
messages: nftClaimMessages,
|
|
3420
3578
|
onClaimSuccess: async () => {
|
|
3421
3579
|
await (onClaimedNft == null ? void 0 : onClaimedNft());
|
|
3422
3580
|
},
|
|
3423
3581
|
onClaimError: (error2) => {
|
|
3424
|
-
toast.error(error2.message || "
|
|
3582
|
+
toast.error(error2.message || t("taskchain_nft_claim_failed"));
|
|
3425
3583
|
},
|
|
3426
3584
|
onWalletError: (errorMessage) => {
|
|
3427
3585
|
toast.error(errorMessage);
|
|
@@ -3475,12 +3633,12 @@ function TaskChainClaimedRewards({
|
|
|
3475
3633
|
{
|
|
3476
3634
|
className: `taskon-taskchain-claimed-card ${isMultiClaimed ? "taskon-taskchain-claimed-card--multi" : ""}`,
|
|
3477
3635
|
children: otherClaimedRewards.map((reward, index) => {
|
|
3478
|
-
const display = getClaimedRewardDisplay(reward);
|
|
3636
|
+
const display = getClaimedRewardDisplay(reward, rewardLabels);
|
|
3479
3637
|
const isToken = reward.reward_type === RewardType.Token;
|
|
3480
3638
|
if (isToken) {
|
|
3481
3639
|
const tokenRewardValue = reward.reward_value;
|
|
3482
3640
|
const rawAmount = (tokenRewardValue == null ? void 0 : tokenRewardValue.amount) || "0";
|
|
3483
|
-
const tokenName = (tokenRewardValue == null ? void 0 : tokenRewardValue.token_name) || "
|
|
3641
|
+
const tokenName = (tokenRewardValue == null ? void 0 : tokenRewardValue.token_name) || t("taskchain_token_fallback");
|
|
3484
3642
|
const formattedAmount = formatLongNumber(Number(rawAmount) || 0) || rawAmount;
|
|
3485
3643
|
const usdValue = formatTokenAmount(
|
|
3486
3644
|
Number(rawAmount) * tokenPrice,
|
|
@@ -3490,7 +3648,7 @@ function TaskChainClaimedRewards({
|
|
|
3490
3648
|
);
|
|
3491
3649
|
const tooltipContent = /* @__PURE__ */ jsxs("div", { className: "taskon-taskchain-token-tooltip", children: [
|
|
3492
3650
|
/* @__PURE__ */ jsxs("div", { className: "taskon-taskchain-token-tooltip-row", children: [
|
|
3493
|
-
/* @__PURE__ */ jsx("span", { className: "taskon-taskchain-token-tooltip-label", children: "
|
|
3651
|
+
/* @__PURE__ */ jsx("span", { className: "taskon-taskchain-token-tooltip-label", children: t("taskchain_reward_token_label") }),
|
|
3494
3652
|
/* @__PURE__ */ jsxs("span", { className: "taskon-taskchain-token-tooltip-value", children: [
|
|
3495
3653
|
formattedAmount,
|
|
3496
3654
|
" ",
|
|
@@ -3498,7 +3656,7 @@ function TaskChainClaimedRewards({
|
|
|
3498
3656
|
] })
|
|
3499
3657
|
] }),
|
|
3500
3658
|
/* @__PURE__ */ jsxs("div", { className: "taskon-taskchain-token-tooltip-row", children: [
|
|
3501
|
-
/* @__PURE__ */ jsx("span", { className: "taskon-taskchain-token-tooltip-label", children: "
|
|
3659
|
+
/* @__PURE__ */ jsx("span", { className: "taskon-taskchain-token-tooltip-label", children: t("taskchain_value_label") }),
|
|
3502
3660
|
/* @__PURE__ */ jsxs("span", { className: "taskon-taskchain-token-tooltip-usd", children: [
|
|
3503
3661
|
"≈$",
|
|
3504
3662
|
usdValue
|
|
@@ -3569,13 +3727,13 @@ function TaskChainClaimedRewards({
|
|
|
3569
3727
|
nftClaimedRewards.length > 0 && /* @__PURE__ */ jsx("div", { className: "taskon-taskchain-claimed-nft-list", children: nftClaimedRewards.map((reward, index) => {
|
|
3570
3728
|
var _a;
|
|
3571
3729
|
const nftValue = reward.reward_value;
|
|
3572
|
-
const rewardTypeLabel = reward.reward_type === RewardType.Cap ? "
|
|
3730
|
+
const rewardTypeLabel = reward.reward_type === RewardType.Cap ? t("taskchain_reward_type_cap") : t("taskchain_reward_type_nft");
|
|
3573
3731
|
const nftName = (nftValue == null ? void 0 : nftValue.collection_name) || (nftValue == null ? void 0 : nftValue.title) || rewardTypeLabel;
|
|
3574
3732
|
const nftImage = (nftValue == null ? void 0 : nftValue.media_type) === "video" ? "" : (nftValue == null ? void 0 : nftValue.collection_image) ? getMiniNftCdnUrl(nftValue.collection_image) : "";
|
|
3575
3733
|
const chainIcon = (nftValue == null ? void 0 : nftValue.chain_icon) || "";
|
|
3576
3734
|
const claimable = ((_a = reward.reward_value) == null ? void 0 : _a.claimable) ?? false;
|
|
3577
3735
|
const isNftClaimSupported = isSupportedNftRewardType(reward.reward_type);
|
|
3578
|
-
const ctaLabel = claimable ? "
|
|
3736
|
+
const ctaLabel = claimable ? t("taskchain_nft_cta_mint") : t("taskchain_nft_cta_view");
|
|
3579
3737
|
return /* @__PURE__ */ jsxs("div", { className: "taskon-taskchain-claimed-nft-card", children: [
|
|
3580
3738
|
/* @__PURE__ */ jsxs("div", { className: "taskon-taskchain-claimed-nft-info", children: [
|
|
3581
3739
|
/* @__PURE__ */ jsxs("div", { className: "taskon-taskchain-claimed-nft-image-wrap", children: [
|
|
@@ -3583,14 +3741,14 @@ function TaskChainClaimedRewards({
|
|
|
3583
3741
|
"img",
|
|
3584
3742
|
{
|
|
3585
3743
|
src: nftImage,
|
|
3586
|
-
alt: "
|
|
3744
|
+
alt: t("taskchain_nft_alt"),
|
|
3587
3745
|
className: "taskon-taskchain-claimed-nft-image"
|
|
3588
3746
|
}
|
|
3589
3747
|
) : /* @__PURE__ */ jsx(
|
|
3590
3748
|
"img",
|
|
3591
3749
|
{
|
|
3592
3750
|
src: DEFAULT_NFT_ICON,
|
|
3593
|
-
alt: "
|
|
3751
|
+
alt: t("taskchain_nft_alt"),
|
|
3594
3752
|
className: "taskon-taskchain-claimed-nft-image taskon-taskchain-claimed-nft-image--fallback"
|
|
3595
3753
|
}
|
|
3596
3754
|
),
|
|
@@ -3598,7 +3756,7 @@ function TaskChainClaimedRewards({
|
|
|
3598
3756
|
"img",
|
|
3599
3757
|
{
|
|
3600
3758
|
src: chainIcon,
|
|
3601
|
-
alt: "
|
|
3759
|
+
alt: t("taskchain_chain_alt"),
|
|
3602
3760
|
className: "taskon-taskchain-claimed-nft-chain"
|
|
3603
3761
|
}
|
|
3604
3762
|
)
|
|
@@ -3615,7 +3773,7 @@ function TaskChainClaimedRewards({
|
|
|
3615
3773
|
className: "taskon-taskchain-claimed-nft-btn",
|
|
3616
3774
|
onClick: () => {
|
|
3617
3775
|
if (!isNftClaimSupported) {
|
|
3618
|
-
toast.info("
|
|
3776
|
+
toast.info(t("taskchain_nft_claim_not_supported"));
|
|
3619
3777
|
return;
|
|
3620
3778
|
}
|
|
3621
3779
|
if (!claimable) {
|
|
@@ -3731,13 +3889,13 @@ function triggerConfetti(container) {
|
|
|
3731
3889
|
function sleep(ms) {
|
|
3732
3890
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
3733
3891
|
}
|
|
3734
|
-
function getExpectedRewardDisplay(reward) {
|
|
3892
|
+
function getExpectedRewardDisplay(reward, labels) {
|
|
3735
3893
|
const params = reward.reward_params;
|
|
3736
3894
|
if (reward.reward_type === RewardType.Token && params) {
|
|
3737
3895
|
const tokenParams = params;
|
|
3738
3896
|
const icon = tokenParams.token_icon || DEFAULT_TOKEN_ICON;
|
|
3739
3897
|
const amount = tokenParams.per_amount || tokenParams.total_amount || "";
|
|
3740
|
-
const name = tokenParams.token_name ||
|
|
3898
|
+
const name = tokenParams.token_name || labels.token;
|
|
3741
3899
|
return {
|
|
3742
3900
|
icon,
|
|
3743
3901
|
text: `+ ${amount} ${name}`.trim(),
|
|
@@ -3748,7 +3906,7 @@ function getExpectedRewardDisplay(reward) {
|
|
|
3748
3906
|
const pointsParams = params;
|
|
3749
3907
|
const icon = pointsParams.points_icon || "";
|
|
3750
3908
|
const amount = pointsParams.amount != null ? String(pointsParams.amount) : "";
|
|
3751
|
-
const name = pointsParams.points_name ||
|
|
3909
|
+
const name = pointsParams.points_name || labels.points;
|
|
3752
3910
|
return {
|
|
3753
3911
|
icon,
|
|
3754
3912
|
text: `+ ${amount} ${name}`.trim(),
|
|
@@ -3758,7 +3916,7 @@ function getExpectedRewardDisplay(reward) {
|
|
|
3758
3916
|
if (reward.reward_type === RewardType.BMintedNft && params) {
|
|
3759
3917
|
const nftParams = params;
|
|
3760
3918
|
const icon = nftParams.media_type === "video" ? "" : nftParams.nft_cdn_image || "";
|
|
3761
|
-
const name = nftParams.nft_collection_name ||
|
|
3919
|
+
const name = nftParams.nft_collection_name || labels.nft;
|
|
3762
3920
|
return { icon, text: name, colorClass: "" };
|
|
3763
3921
|
}
|
|
3764
3922
|
return { icon: "", text: "", colorClass: "" };
|
|
@@ -3774,6 +3932,7 @@ function TaskChainRewardStep({
|
|
|
3774
3932
|
}) {
|
|
3775
3933
|
const { client } = useTaskOnContext();
|
|
3776
3934
|
const { toast } = useToast();
|
|
3935
|
+
const { t } = useCommunityTaskLocale();
|
|
3777
3936
|
const containerRef = useRef(null);
|
|
3778
3937
|
const isMobile = useIsMobile();
|
|
3779
3938
|
const initialIsClaimed = useMemo(
|
|
@@ -3823,6 +3982,14 @@ function TaskChainRewardStep({
|
|
|
3823
3982
|
}
|
|
3824
3983
|
return 0;
|
|
3825
3984
|
}, [expectedRewards]);
|
|
3985
|
+
const rewardLabels = useMemo(
|
|
3986
|
+
() => ({
|
|
3987
|
+
token: t("taskchain_token_fallback"),
|
|
3988
|
+
points: t("taskchain_points_fallback"),
|
|
3989
|
+
nft: t("taskchain_nft_fallback")
|
|
3990
|
+
}),
|
|
3991
|
+
[t]
|
|
3992
|
+
);
|
|
3826
3993
|
const switchToClaimedView = useCallback(async () => {
|
|
3827
3994
|
setShouldAnimate(true);
|
|
3828
3995
|
if (containerRef.current) {
|
|
@@ -3845,11 +4012,11 @@ function TaskChainRewardStep({
|
|
|
3845
4012
|
await switchToClaimedView();
|
|
3846
4013
|
} catch (error2) {
|
|
3847
4014
|
console.error("Failed to claim reward:", error2);
|
|
3848
|
-
toast.error("
|
|
4015
|
+
toast.error(t("taskchain_reward_submit_failed"));
|
|
3849
4016
|
} finally {
|
|
3850
4017
|
setIsLoading(false);
|
|
3851
4018
|
}
|
|
3852
|
-
}, [isLoading, campaign, api, refetchUserStatus, switchToClaimedView, toast]);
|
|
4019
|
+
}, [isLoading, campaign, api, refetchUserStatus, switchToClaimedView, toast, t]);
|
|
3853
4020
|
const scatterStyles = useMemo(() => {
|
|
3854
4021
|
const total = expectedRewards.length;
|
|
3855
4022
|
return expectedRewards.map((_, index) => {
|
|
@@ -3864,8 +4031,8 @@ function TaskChainRewardStep({
|
|
|
3864
4031
|
});
|
|
3865
4032
|
}, [expectedRewards, isSpread, isMobile]);
|
|
3866
4033
|
return /* @__PURE__ */ jsx("div", { className: "taskon-taskchain-reward-step", ref: containerRef, children: /* @__PURE__ */ jsxs("div", { className: "taskon-taskchain-reward-content", children: [
|
|
3867
|
-
/* @__PURE__ */ jsx("div", { className: "taskon-taskchain-reward-title", children: "
|
|
3868
|
-
/* @__PURE__ */ jsx("div", { className: "taskon-taskchain-reward-subtitle", children: "
|
|
4034
|
+
/* @__PURE__ */ jsx("div", { className: "taskon-taskchain-reward-title", children: t("taskchain_reward_congratulations") }),
|
|
4035
|
+
/* @__PURE__ */ jsx("div", { className: "taskon-taskchain-reward-subtitle", children: t("taskchain_reward_you_won") }),
|
|
3869
4036
|
showClaimedContent && /* @__PURE__ */ jsxs(
|
|
3870
4037
|
"div",
|
|
3871
4038
|
{
|
|
@@ -3889,7 +4056,7 @@ function TaskChainRewardStep({
|
|
|
3889
4056
|
type: "button",
|
|
3890
4057
|
className: "taskon-taskchain-btn taskon-taskchain-btn--secondary",
|
|
3891
4058
|
onClick: onClose,
|
|
3892
|
-
children: "
|
|
4059
|
+
children: t("taskchain_back")
|
|
3893
4060
|
}
|
|
3894
4061
|
) })
|
|
3895
4062
|
]
|
|
@@ -3901,7 +4068,7 @@ function TaskChainRewardStep({
|
|
|
3901
4068
|
className: `taskon-taskchain-reward-unclaimed ${isClaimAnimating ? "taskon-taskchain-reward-unclaimed--exit" : ""}`,
|
|
3902
4069
|
children: [
|
|
3903
4070
|
/* @__PURE__ */ jsx("div", { className: "taskon-taskchain-win-rewards", children: expectedRewards.map((reward, index) => {
|
|
3904
|
-
const display = getExpectedRewardDisplay(reward);
|
|
4071
|
+
const display = getExpectedRewardDisplay(reward, rewardLabels);
|
|
3905
4072
|
const style = scatterStyles[index];
|
|
3906
4073
|
return /* @__PURE__ */ jsxs(
|
|
3907
4074
|
"div",
|
|
@@ -3940,7 +4107,7 @@ function TaskChainRewardStep({
|
|
|
3940
4107
|
className: "taskon-taskchain-btn taskon-taskchain-btn--primary",
|
|
3941
4108
|
onClick: handleClaim,
|
|
3942
4109
|
disabled: isLoading,
|
|
3943
|
-
children: isLoading ? "
|
|
4110
|
+
children: isLoading ? t("taskchain_reward_claiming") : t("taskchain_reward_claim")
|
|
3944
4111
|
}
|
|
3945
4112
|
) })
|
|
3946
4113
|
}
|
|
@@ -3999,6 +4166,7 @@ function TaskChainBlindBoxStep({
|
|
|
3999
4166
|
}) {
|
|
4000
4167
|
const { client } = useTaskOnContext();
|
|
4001
4168
|
const { toast } = useToast();
|
|
4169
|
+
const { t } = useCommunityTaskLocale();
|
|
4002
4170
|
const blindBoxDialogRef = useRef(null);
|
|
4003
4171
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
4004
4172
|
const [isClaiming, setIsClaiming] = useState(false);
|
|
@@ -4060,7 +4228,7 @@ function TaskChainBlindBoxStep({
|
|
|
4060
4228
|
await refetchUserStatus();
|
|
4061
4229
|
} catch (error2) {
|
|
4062
4230
|
console.error("Failed to submit campaign:", error2);
|
|
4063
|
-
toast.error("
|
|
4231
|
+
toast.error(t("taskchain_blindbox_submit_failed"));
|
|
4064
4232
|
setShowManualSubmit(true);
|
|
4065
4233
|
} finally {
|
|
4066
4234
|
setIsSubmitting(false);
|
|
@@ -4068,7 +4236,7 @@ function TaskChainBlindBoxStep({
|
|
|
4068
4236
|
}
|
|
4069
4237
|
})();
|
|
4070
4238
|
await submitPromiseRef.current;
|
|
4071
|
-
}, [campaign, api, isSubmitting, refetchUserStatus, toast]);
|
|
4239
|
+
}, [campaign, api, isSubmitting, refetchUserStatus, toast, t]);
|
|
4072
4240
|
const handleBlindBoxOpened = useCallback(async () => {
|
|
4073
4241
|
var _a;
|
|
4074
4242
|
if (!campaign || !api || isClaiming) return;
|
|
@@ -4081,12 +4249,12 @@ function TaskChainBlindBoxStep({
|
|
|
4081
4249
|
await refetchUserStatus();
|
|
4082
4250
|
} catch (error2) {
|
|
4083
4251
|
console.error("Failed to claim blind box:", error2);
|
|
4084
|
-
toast.error("
|
|
4252
|
+
toast.error(t("taskchain_blindbox_claim_failed"));
|
|
4085
4253
|
(_a = blindBoxDialogRef.current) == null ? void 0 : _a.resetToUnopened();
|
|
4086
4254
|
} finally {
|
|
4087
4255
|
setIsClaiming(false);
|
|
4088
4256
|
}
|
|
4089
|
-
}, [campaign, api, isClaiming, refetchUserStatus, toast]);
|
|
4257
|
+
}, [campaign, api, isClaiming, refetchUserStatus, toast, t]);
|
|
4090
4258
|
useEffect(() => {
|
|
4091
4259
|
var _a;
|
|
4092
4260
|
const isQualifier = ((_a = userStatus == null ? void 0 : userStatus.user_status) == null ? void 0 : _a.is_qualifier) ?? false;
|
|
@@ -4095,8 +4263,8 @@ function TaskChainBlindBoxStep({
|
|
|
4095
4263
|
}
|
|
4096
4264
|
}, [campaign, api]);
|
|
4097
4265
|
if (userBlindBoxStatus === "claimed") {
|
|
4098
|
-
const title = isOpenedButNotWon ? "
|
|
4099
|
-
const subtitle = isOpenedButNotWon ? "
|
|
4266
|
+
const title = isOpenedButNotWon ? t("taskchain_blindbox_title_missed") : t("taskchain_blindbox_title_won");
|
|
4267
|
+
const subtitle = isOpenedButNotWon ? t("taskchain_blindbox_subtitle_missed") : t("taskchain_blindbox_subtitle_won");
|
|
4100
4268
|
const displayRewards = emptyReward ? [emptyReward, ...userRewards] : userRewards;
|
|
4101
4269
|
return /* @__PURE__ */ jsx("div", { className: "taskon-taskchain-blindbox-step", children: /* @__PURE__ */ jsxs("div", { className: "taskon-taskchain-blindbox-result", children: [
|
|
4102
4270
|
/* @__PURE__ */ jsx("h2", { className: "taskon-taskchain-blindbox-result-title", children: title }),
|
|
@@ -4120,7 +4288,7 @@ function TaskChainBlindBoxStep({
|
|
|
4120
4288
|
type: "button",
|
|
4121
4289
|
className: "taskon-taskchain-btn taskon-taskchain-btn--secondary",
|
|
4122
4290
|
onClick: onClose,
|
|
4123
|
-
children: "
|
|
4291
|
+
children: t("taskchain_back")
|
|
4124
4292
|
}
|
|
4125
4293
|
) })
|
|
4126
4294
|
] }) });
|
|
@@ -4138,7 +4306,7 @@ function TaskChainBlindBoxStep({
|
|
|
4138
4306
|
if (isSubmitting && userBlindBoxStatus === "none") {
|
|
4139
4307
|
return /* @__PURE__ */ jsx("div", { className: "taskon-taskchain-blindbox-step", children: /* @__PURE__ */ jsxs("div", { className: "taskon-taskchain-blindbox-loading", children: [
|
|
4140
4308
|
/* @__PURE__ */ jsx("div", { className: "taskon-taskchain-spinner" }),
|
|
4141
|
-
/* @__PURE__ */ jsx("div", { children: "
|
|
4309
|
+
/* @__PURE__ */ jsx("div", { children: t("taskchain_blindbox_preparing_reward") })
|
|
4142
4310
|
] }) });
|
|
4143
4311
|
}
|
|
4144
4312
|
if (showManualSubmit && userBlindBoxStatus === "none") {
|
|
@@ -4149,7 +4317,7 @@ function TaskChainBlindBoxStep({
|
|
|
4149
4317
|
className: "taskon-taskchain-blindbox-btn",
|
|
4150
4318
|
onClick: handleSubmitCampaign,
|
|
4151
4319
|
disabled: isSubmitting,
|
|
4152
|
-
children: isSubmitting ? "
|
|
4320
|
+
children: isSubmitting ? t("taskchain_blindbox_submitting") : t("taskchain_blindbox_retry_submit")
|
|
4153
4321
|
}
|
|
4154
4322
|
) }) });
|
|
4155
4323
|
}
|
|
@@ -4173,6 +4341,7 @@ function TaskChainMain({
|
|
|
4173
4341
|
rewardDisplayMode,
|
|
4174
4342
|
rewardRedirectUrl
|
|
4175
4343
|
}) {
|
|
4344
|
+
const { t } = useCommunityTaskLocale();
|
|
4176
4345
|
const handleVerifyAttempted = useCallback(
|
|
4177
4346
|
async (_taskId, success) => {
|
|
4178
4347
|
if (!task) return;
|
|
@@ -4211,7 +4380,7 @@ function TaskChainMain({
|
|
|
4211
4380
|
);
|
|
4212
4381
|
}
|
|
4213
4382
|
if (!task) {
|
|
4214
|
-
return /* @__PURE__ */ jsx("div", { children: "
|
|
4383
|
+
return /* @__PURE__ */ jsx("div", { children: t("taskchain_no_task_available") });
|
|
4215
4384
|
}
|
|
4216
4385
|
return /* @__PURE__ */ jsx("div", { className: "taskon-taskchain-main", children: /* @__PURE__ */ jsx(
|
|
4217
4386
|
TaskItem,
|
|
@@ -4237,6 +4406,7 @@ function NotEligible({
|
|
|
4237
4406
|
className = ""
|
|
4238
4407
|
}) {
|
|
4239
4408
|
const { client } = useTaskOnContext();
|
|
4409
|
+
const { t } = useCommunityTaskLocale();
|
|
4240
4410
|
const [isRefreshing, setIsRefreshing] = useState(false);
|
|
4241
4411
|
const filteredEligs = useMemo(() => {
|
|
4242
4412
|
if (!(campaign == null ? void 0 : campaign.eligs)) return [];
|
|
@@ -4262,12 +4432,12 @@ function NotEligible({
|
|
|
4262
4432
|
if (!campaign || !userStatus) {
|
|
4263
4433
|
return /* @__PURE__ */ jsxs("div", { className: `taskon-taskchain-not-eligible ${className}`, children: [
|
|
4264
4434
|
/* @__PURE__ */ jsx("div", { className: "taskon-taskchain-not-eligible-emoji", children: "🔒" }),
|
|
4265
|
-
/* @__PURE__ */ jsx("div", { className: "taskon-taskchain-not-eligible-title", children: "
|
|
4266
|
-
/* @__PURE__ */ jsx("div", { className: "taskon-taskchain-not-eligible-desc", children:
|
|
4435
|
+
/* @__PURE__ */ jsx("div", { className: "taskon-taskchain-not-eligible-title", children: t("taskchain_not_eligible_title") }),
|
|
4436
|
+
/* @__PURE__ */ jsx("div", { className: "taskon-taskchain-not-eligible-desc", children: t("taskchain_not_eligible_desc") })
|
|
4267
4437
|
] });
|
|
4268
4438
|
}
|
|
4269
4439
|
return /* @__PURE__ */ jsxs("div", { className: `taskon-taskchain-not-eligible ${className}`, children: [
|
|
4270
|
-
/* @__PURE__ */ jsx("div", { className: "taskon-taskchain-not-eligible-oops", children: "
|
|
4440
|
+
/* @__PURE__ */ jsx("div", { className: "taskon-taskchain-not-eligible-oops", children: t("taskchain_oops") }),
|
|
4271
4441
|
/* @__PURE__ */ jsx("div", { className: "taskon-taskchain-not-eligible-panel", children: /* @__PURE__ */ jsx(
|
|
4272
4442
|
EligibilityInfo,
|
|
4273
4443
|
{
|
|
@@ -4290,6 +4460,7 @@ const endedImageUrl = new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJ0
|
|
|
4290
4460
|
function ActionEndedMask({
|
|
4291
4461
|
className = ""
|
|
4292
4462
|
}) {
|
|
4463
|
+
const { t } = useCommunityTaskLocale();
|
|
4293
4464
|
return /* @__PURE__ */ jsxs("div", { className: `taskon-taskchain-ended-mask ${className}`, children: [
|
|
4294
4465
|
/* @__PURE__ */ jsx(
|
|
4295
4466
|
"img",
|
|
@@ -4299,13 +4470,14 @@ function ActionEndedMask({
|
|
|
4299
4470
|
alt: ""
|
|
4300
4471
|
}
|
|
4301
4472
|
),
|
|
4302
|
-
/* @__PURE__ */ jsx("div", { className: "taskon-taskchain-ended-mask-title", children: "
|
|
4473
|
+
/* @__PURE__ */ jsx("div", { className: "taskon-taskchain-ended-mask-title", children: t("taskchain_event_ended") })
|
|
4303
4474
|
] });
|
|
4304
4475
|
}
|
|
4305
4476
|
function NeedLoginMask({
|
|
4306
4477
|
onRequestLogin,
|
|
4307
4478
|
className = ""
|
|
4308
4479
|
}) {
|
|
4480
|
+
const { t } = useCommunityTaskLocale();
|
|
4309
4481
|
return /* @__PURE__ */ jsxs(
|
|
4310
4482
|
"div",
|
|
4311
4483
|
{
|
|
@@ -4339,7 +4511,7 @@ function NeedLoginMask({
|
|
|
4339
4511
|
color: "var(--taskon-color-text)",
|
|
4340
4512
|
marginBottom: "8px"
|
|
4341
4513
|
},
|
|
4342
|
-
children: "
|
|
4514
|
+
children: t("taskchain_login_required")
|
|
4343
4515
|
}
|
|
4344
4516
|
),
|
|
4345
4517
|
/* @__PURE__ */ jsx(
|
|
@@ -4352,7 +4524,7 @@ function NeedLoginMask({
|
|
|
4352
4524
|
maxWidth: "300px",
|
|
4353
4525
|
lineHeight: 1.5
|
|
4354
4526
|
},
|
|
4355
|
-
children: "
|
|
4527
|
+
children: t("taskchain_login_prompt")
|
|
4356
4528
|
}
|
|
4357
4529
|
),
|
|
4358
4530
|
/* @__PURE__ */ jsx(
|
|
@@ -4377,7 +4549,7 @@ function NeedLoginMask({
|
|
|
4377
4549
|
onMouseOut: (e) => {
|
|
4378
4550
|
e.currentTarget.style.opacity = "1";
|
|
4379
4551
|
},
|
|
4380
|
-
children: "
|
|
4552
|
+
children: t("taskchain_login_button")
|
|
4381
4553
|
}
|
|
4382
4554
|
)
|
|
4383
4555
|
]
|
|
@@ -4402,6 +4574,7 @@ function TaskChainDetail({
|
|
|
4402
4574
|
}) {
|
|
4403
4575
|
var _a, _b;
|
|
4404
4576
|
const { isLoggedIn, requestLogin, client } = useTaskOnContext();
|
|
4577
|
+
const { t } = useCommunityTaskLocale();
|
|
4405
4578
|
const wasLoggedInRef = useRef(isLoggedIn);
|
|
4406
4579
|
const totalSteps = useMemo(() => {
|
|
4407
4580
|
var _a2;
|
|
@@ -4438,24 +4611,33 @@ function TaskChainDetail({
|
|
|
4438
4611
|
const shouldShowEndedMask = useMemo(() => {
|
|
4439
4612
|
return isEnded && !isAllTasksCompleted;
|
|
4440
4613
|
}, [isEnded, isAllTasksCompleted]);
|
|
4614
|
+
const canShowNavigation = useMemo(() => {
|
|
4615
|
+
return isLoggedIn && !shouldShowEndedMask && isEligible;
|
|
4616
|
+
}, [isLoggedIn, shouldShowEndedMask, isEligible]);
|
|
4441
4617
|
const showBackButton = useMemo(() => {
|
|
4442
|
-
return totalSteps > 1 && stepIndex > 0 && !isRewardStep;
|
|
4443
|
-
}, [totalSteps, stepIndex, isRewardStep]);
|
|
4618
|
+
return canShowNavigation && totalSteps > 1 && stepIndex > 0 && !isRewardStep;
|
|
4619
|
+
}, [canShowNavigation, totalSteps, stepIndex, isRewardStep]);
|
|
4444
4620
|
const showNextButton = useMemo(() => {
|
|
4445
4621
|
var _a2;
|
|
4446
4622
|
const taskCount = ((_a2 = campaign == null ? void 0 : campaign.tasks) == null ? void 0 : _a2.length) || 0;
|
|
4447
|
-
return totalSteps > 1 && stepIndex < taskCount - 1;
|
|
4448
|
-
}, [totalSteps, stepIndex, (_b = campaign == null ? void 0 : campaign.tasks) == null ? void 0 : _b.length]);
|
|
4623
|
+
return canShowNavigation && totalSteps > 1 && stepIndex < taskCount - 1;
|
|
4624
|
+
}, [canShowNavigation, totalSteps, stepIndex, (_b = campaign == null ? void 0 : campaign.tasks) == null ? void 0 : _b.length]);
|
|
4449
4625
|
const handleBack = useCallback(() => {
|
|
4626
|
+
if (!canShowNavigation) {
|
|
4627
|
+
return;
|
|
4628
|
+
}
|
|
4450
4629
|
if (stepIndex > 0) {
|
|
4451
4630
|
onStepChange(stepIndex - 1);
|
|
4452
4631
|
}
|
|
4453
|
-
}, [stepIndex, onStepChange]);
|
|
4632
|
+
}, [canShowNavigation, stepIndex, onStepChange]);
|
|
4454
4633
|
const handleNext = useCallback(() => {
|
|
4634
|
+
if (!canShowNavigation) {
|
|
4635
|
+
return;
|
|
4636
|
+
}
|
|
4455
4637
|
if (stepIndex < totalSteps - 1) {
|
|
4456
4638
|
onStepChange(stepIndex + 1);
|
|
4457
4639
|
}
|
|
4458
|
-
}, [stepIndex, totalSteps, onStepChange]);
|
|
4640
|
+
}, [canShowNavigation, stepIndex, totalSteps, onStepChange]);
|
|
4459
4641
|
useEffect(() => {
|
|
4460
4642
|
if (isAllTasksCompleted && !isRewardStep && campaign) {
|
|
4461
4643
|
onStepChange(campaign.tasks.length);
|
|
@@ -4480,7 +4662,7 @@ function TaskChainDetail({
|
|
|
4480
4662
|
if (isLoading) {
|
|
4481
4663
|
return /* @__PURE__ */ jsx("div", { className: "taskon-taskchain-detail", children: /* @__PURE__ */ jsxs("div", { className: "taskon-taskchain-detail-loading", children: [
|
|
4482
4664
|
/* @__PURE__ */ jsx("div", { className: "taskon-taskchain-spinner" }),
|
|
4483
|
-
/* @__PURE__ */ jsx("div", { children: "
|
|
4665
|
+
/* @__PURE__ */ jsx("div", { children: t("taskchain_loading") })
|
|
4484
4666
|
] }) });
|
|
4485
4667
|
}
|
|
4486
4668
|
const renderContent = () => {
|
|
@@ -4565,7 +4747,7 @@ function TaskChainDetail({
|
|
|
4565
4747
|
type: "button",
|
|
4566
4748
|
className: "taskon-taskchain-btn taskon-taskchain-btn--secondary",
|
|
4567
4749
|
onClick: handleBack,
|
|
4568
|
-
children: "
|
|
4750
|
+
children: t("taskchain_back")
|
|
4569
4751
|
}
|
|
4570
4752
|
),
|
|
4571
4753
|
showNextButton && /* @__PURE__ */ jsx(
|
|
@@ -4574,7 +4756,7 @@ function TaskChainDetail({
|
|
|
4574
4756
|
type: "button",
|
|
4575
4757
|
className: "taskon-taskchain-btn taskon-taskchain-btn--primary",
|
|
4576
4758
|
onClick: handleNext,
|
|
4577
|
-
children: "
|
|
4759
|
+
children: t("taskchain_next")
|
|
4578
4760
|
}
|
|
4579
4761
|
)
|
|
4580
4762
|
] })
|
|
@@ -4705,6 +4887,7 @@ function TaskChainDialog({
|
|
|
4705
4887
|
rewardRedirectUrl
|
|
4706
4888
|
}) {
|
|
4707
4889
|
var _a, _b;
|
|
4890
|
+
const { t } = useCommunityTaskLocale();
|
|
4708
4891
|
const {
|
|
4709
4892
|
campaign,
|
|
4710
4893
|
userStatus,
|
|
@@ -4768,7 +4951,7 @@ function TaskChainDialog({
|
|
|
4768
4951
|
}, [(_b = userStatus == null ? void 0 : userStatus.user_status) == null ? void 0 : _b.is_winner, onUpdate]);
|
|
4769
4952
|
return /* @__PURE__ */ jsx(BottomDialog, { open, onClose, top: "6vh", children: /* @__PURE__ */ jsxs("div", { className: "taskon-taskchain-dialog-content", children: [
|
|
4770
4953
|
error2 && /* @__PURE__ */ jsxs("div", { className: "taskon-taskchain-dialog-error", children: [
|
|
4771
|
-
/* @__PURE__ */ jsx("div", { children: "
|
|
4954
|
+
/* @__PURE__ */ jsx("div", { children: t("taskchain_error_load_chain") }),
|
|
4772
4955
|
/* @__PURE__ */ jsx("div", { className: "taskon-taskchain-dialog-error-detail", children: error2 })
|
|
4773
4956
|
] }),
|
|
4774
4957
|
!error2 && /* @__PURE__ */ jsx(
|
|
@@ -6745,6 +6928,12 @@ function mergeCommunityTaskConfig(props, cloud) {
|
|
|
6745
6928
|
rewardRedirectUrl: props.rewardRedirectUrl ?? (cloud == null ? void 0 : cloud.rewardRedirectUrl) ?? ""
|
|
6746
6929
|
};
|
|
6747
6930
|
}
|
|
6931
|
+
function toSectorIdsKey(sectorIds) {
|
|
6932
|
+
if (!sectorIds || sectorIds.length === 0) {
|
|
6933
|
+
return "all";
|
|
6934
|
+
}
|
|
6935
|
+
return sectorIds.join(",");
|
|
6936
|
+
}
|
|
6748
6937
|
function findTaskByIdFromCards(data, taskId) {
|
|
6749
6938
|
for (const sectorItem of data) {
|
|
6750
6939
|
const found = sectorItem.cards.find((card) => card.card_info.id === taskId);
|
|
@@ -6826,8 +7015,10 @@ function CommunityTaskListInner(props) {
|
|
|
6826
7015
|
rewardDisplayMode = "popup",
|
|
6827
7016
|
rewardRedirectUrl = ""
|
|
6828
7017
|
} = props;
|
|
6829
|
-
const { client, userToken } = useTaskOnContext();
|
|
7018
|
+
const { client, userToken, isSessionReady } = useTaskOnContext();
|
|
6830
7019
|
const { t } = useCommunityTaskLocale();
|
|
7020
|
+
const inFlightLoadKeyRef = useRef(null);
|
|
7021
|
+
const lastSuccessfulLoadKeyRef = useRef(null);
|
|
6831
7022
|
const [taskCards, setTaskCards] = useState(
|
|
6832
7023
|
[]
|
|
6833
7024
|
);
|
|
@@ -6875,11 +7066,25 @@ function CommunityTaskListInner(props) {
|
|
|
6875
7066
|
}, [initialTaskChainId]);
|
|
6876
7067
|
useEffect(() => {
|
|
6877
7068
|
const loadTasks = async () => {
|
|
7069
|
+
if (!isSessionReady) {
|
|
7070
|
+
setError(null);
|
|
7071
|
+
setIsLoading(true);
|
|
7072
|
+
return;
|
|
7073
|
+
}
|
|
6878
7074
|
if (!client) {
|
|
6879
|
-
setError(
|
|
7075
|
+
setError({ type: "localized", key: "client_not_initialized" });
|
|
6880
7076
|
setIsLoading(false);
|
|
6881
7077
|
return;
|
|
6882
7078
|
}
|
|
7079
|
+
const clientToken = client.getUserToken();
|
|
7080
|
+
const loadKey = [
|
|
7081
|
+
isPreview ? "preview" : "normal",
|
|
7082
|
+
toSectorIdsKey(sectorIds),
|
|
7083
|
+
clientToken ?? "anonymous"
|
|
7084
|
+
].join("|");
|
|
7085
|
+
if (inFlightLoadKeyRef.current === loadKey) return;
|
|
7086
|
+
if (lastSuccessfulLoadKeyRef.current === loadKey) return;
|
|
7087
|
+
inFlightLoadKeyRef.current = loadKey;
|
|
6883
7088
|
try {
|
|
6884
7089
|
setIsLoading(true);
|
|
6885
7090
|
setError(null);
|
|
@@ -6889,15 +7094,21 @@ function CommunityTaskListInner(props) {
|
|
|
6889
7094
|
...sectorIds && sectorIds.length > 0 ? { sector_id: sectorIds } : {}
|
|
6890
7095
|
});
|
|
6891
7096
|
setTaskCards(data);
|
|
7097
|
+
lastSuccessfulLoadKeyRef.current = loadKey;
|
|
6892
7098
|
} catch (err) {
|
|
6893
|
-
setError(
|
|
7099
|
+
setError(
|
|
7100
|
+
err instanceof Error ? { type: "raw", message: err.message } : { type: "localized", key: "failed_to_load" }
|
|
7101
|
+
);
|
|
6894
7102
|
console.error("Failed to load community tasks:", err);
|
|
6895
7103
|
} finally {
|
|
7104
|
+
if (inFlightLoadKeyRef.current === loadKey) {
|
|
7105
|
+
inFlightLoadKeyRef.current = null;
|
|
7106
|
+
}
|
|
6896
7107
|
setIsLoading(false);
|
|
6897
7108
|
}
|
|
6898
7109
|
};
|
|
6899
7110
|
loadTasks();
|
|
6900
|
-
}, [client, isPreview, userToken, sectorIds
|
|
7111
|
+
}, [client, isSessionReady, isPreview, userToken, sectorIds]);
|
|
6901
7112
|
const selectorOptions = React__default.useMemo(() => {
|
|
6902
7113
|
const sectors = taskCards.map((item) => item.sector);
|
|
6903
7114
|
let options = sectors.map((sector) => ({
|
|
@@ -7161,7 +7372,8 @@ function CommunityTaskListInner(props) {
|
|
|
7161
7372
|
const isDialogOpen = openTask !== null || openTaskId !== null;
|
|
7162
7373
|
const currentSelectorValue = selectedSectorId ?? void 0;
|
|
7163
7374
|
if (error2) {
|
|
7164
|
-
|
|
7375
|
+
const errorMessage = error2.type === "raw" ? error2.message : t(error2.key);
|
|
7376
|
+
return /* @__PURE__ */ jsx("div", { className: "taskon-community-list", children: /* @__PURE__ */ jsx("div", { className: "taskon-community-list-error", children: errorMessage }) });
|
|
7165
7377
|
}
|
|
7166
7378
|
return /* @__PURE__ */ jsxs("div", { className: "taskon-community-list", children: [
|
|
7167
7379
|
showSectorTab && !isLoading && /* @__PURE__ */ jsx(
|
|
@@ -7229,11 +7441,5 @@ function CommunityTaskListInner(props) {
|
|
|
7229
7441
|
] });
|
|
7230
7442
|
}
|
|
7231
7443
|
export {
|
|
7232
|
-
|
|
7233
|
-
CardSelector as C,
|
|
7234
|
-
TemplateTask as T,
|
|
7235
|
-
CommunityTaskList as a,
|
|
7236
|
-
useTaskTime as b,
|
|
7237
|
-
useSubmitTask as c,
|
|
7238
|
-
useTaskReward as u
|
|
7444
|
+
CommunityTaskList as C
|
|
7239
7445
|
};
|