@kodiak-finance/orderly-trading-leaderboard 2.8.22-beta.1 → 2.8.22-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +31 -1
- package/dist/index.d.ts +31 -1
- package/dist/index.js +100 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +100 -16
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +9 -9
package/dist/index.d.mts
CHANGED
|
@@ -168,7 +168,7 @@ type TradingListWidgetProps = Pick<TradingListProps, "style" | "className">;
|
|
|
168
168
|
*/
|
|
169
169
|
declare const TradingListWidget: FC<TradingListWidgetProps>;
|
|
170
170
|
|
|
171
|
-
type RankingColumnFields = "rank" | "address" | "volume" | "pnl" | "rewards" | "points";
|
|
171
|
+
type RankingColumnFields = "rank" | "address" | "tier" | "volume" | "pnl" | "rewards" | "points";
|
|
172
172
|
|
|
173
173
|
type ListStyle = "disc" | "decimal" | "none" | "circle" | "square" | "decimal-leading-zero" | "lower-alpha" | "upper-alpha" | "lower-roman" | "upper-roman";
|
|
174
174
|
type DescriptionItem = {
|
|
@@ -421,6 +421,33 @@ type GeneralRankingData = {
|
|
|
421
421
|
perp_volume: number;
|
|
422
422
|
realized_pnl: number;
|
|
423
423
|
total_fee: number;
|
|
424
|
+
vip_tier?: string;
|
|
425
|
+
vipTier?: string;
|
|
426
|
+
vip_tier_name?: string;
|
|
427
|
+
vipTierName?: string;
|
|
428
|
+
vip_badge_url?: string;
|
|
429
|
+
vipBadgeUrl?: string;
|
|
430
|
+
vip_tier_image?: string;
|
|
431
|
+
vipTierImage?: string;
|
|
432
|
+
vip_tier_badge?: string;
|
|
433
|
+
vipTierBadge?: string;
|
|
434
|
+
tier?: string | {
|
|
435
|
+
name?: string;
|
|
436
|
+
label?: string;
|
|
437
|
+
tier?: string;
|
|
438
|
+
badge_url?: string;
|
|
439
|
+
badgeUrl?: string;
|
|
440
|
+
image?: string;
|
|
441
|
+
imageUrl?: string;
|
|
442
|
+
};
|
|
443
|
+
tier_name?: string;
|
|
444
|
+
tierName?: string;
|
|
445
|
+
tier_label?: string;
|
|
446
|
+
tierLabel?: string;
|
|
447
|
+
tier_image?: string;
|
|
448
|
+
tierImage?: string;
|
|
449
|
+
tier_badge_url?: string;
|
|
450
|
+
tierBadgeUrl?: string;
|
|
424
451
|
key?: string;
|
|
425
452
|
rank?: number | string;
|
|
426
453
|
volume?: number;
|
|
@@ -433,6 +460,7 @@ type GeneralRankingScriptOptions = {
|
|
|
433
460
|
address?: string;
|
|
434
461
|
sortKey?: "perp_volume" | "realized_pnl";
|
|
435
462
|
leaderboardEndpoint?: string;
|
|
463
|
+
foxifyOnly?: boolean;
|
|
436
464
|
};
|
|
437
465
|
declare function useGeneralRankingScript(options?: GeneralRankingScriptOptions): {
|
|
438
466
|
pagination: _kodiak_finance_orderly_ui.PaginationMeta;
|
|
@@ -493,6 +521,8 @@ declare function useGeneralLeaderboardScript(options?: GeneralLeaderboardScriptO
|
|
|
493
521
|
useCampaignDateRange: boolean;
|
|
494
522
|
weeklyRanges: WeeklyDateRange[];
|
|
495
523
|
currentOrAllTimeRange: WeeklyDateRange | undefined;
|
|
524
|
+
foxifyOnly: any;
|
|
525
|
+
setFoxifyOnly: (value: boolean) => void;
|
|
496
526
|
searchValue: string;
|
|
497
527
|
onSearchValueChange: (value: string) => void;
|
|
498
528
|
clearSearchValue: () => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -168,7 +168,7 @@ type TradingListWidgetProps = Pick<TradingListProps, "style" | "className">;
|
|
|
168
168
|
*/
|
|
169
169
|
declare const TradingListWidget: FC<TradingListWidgetProps>;
|
|
170
170
|
|
|
171
|
-
type RankingColumnFields = "rank" | "address" | "volume" | "pnl" | "rewards" | "points";
|
|
171
|
+
type RankingColumnFields = "rank" | "address" | "tier" | "volume" | "pnl" | "rewards" | "points";
|
|
172
172
|
|
|
173
173
|
type ListStyle = "disc" | "decimal" | "none" | "circle" | "square" | "decimal-leading-zero" | "lower-alpha" | "upper-alpha" | "lower-roman" | "upper-roman";
|
|
174
174
|
type DescriptionItem = {
|
|
@@ -421,6 +421,33 @@ type GeneralRankingData = {
|
|
|
421
421
|
perp_volume: number;
|
|
422
422
|
realized_pnl: number;
|
|
423
423
|
total_fee: number;
|
|
424
|
+
vip_tier?: string;
|
|
425
|
+
vipTier?: string;
|
|
426
|
+
vip_tier_name?: string;
|
|
427
|
+
vipTierName?: string;
|
|
428
|
+
vip_badge_url?: string;
|
|
429
|
+
vipBadgeUrl?: string;
|
|
430
|
+
vip_tier_image?: string;
|
|
431
|
+
vipTierImage?: string;
|
|
432
|
+
vip_tier_badge?: string;
|
|
433
|
+
vipTierBadge?: string;
|
|
434
|
+
tier?: string | {
|
|
435
|
+
name?: string;
|
|
436
|
+
label?: string;
|
|
437
|
+
tier?: string;
|
|
438
|
+
badge_url?: string;
|
|
439
|
+
badgeUrl?: string;
|
|
440
|
+
image?: string;
|
|
441
|
+
imageUrl?: string;
|
|
442
|
+
};
|
|
443
|
+
tier_name?: string;
|
|
444
|
+
tierName?: string;
|
|
445
|
+
tier_label?: string;
|
|
446
|
+
tierLabel?: string;
|
|
447
|
+
tier_image?: string;
|
|
448
|
+
tierImage?: string;
|
|
449
|
+
tier_badge_url?: string;
|
|
450
|
+
tierBadgeUrl?: string;
|
|
424
451
|
key?: string;
|
|
425
452
|
rank?: number | string;
|
|
426
453
|
volume?: number;
|
|
@@ -433,6 +460,7 @@ type GeneralRankingScriptOptions = {
|
|
|
433
460
|
address?: string;
|
|
434
461
|
sortKey?: "perp_volume" | "realized_pnl";
|
|
435
462
|
leaderboardEndpoint?: string;
|
|
463
|
+
foxifyOnly?: boolean;
|
|
436
464
|
};
|
|
437
465
|
declare function useGeneralRankingScript(options?: GeneralRankingScriptOptions): {
|
|
438
466
|
pagination: _kodiak_finance_orderly_ui.PaginationMeta;
|
|
@@ -493,6 +521,8 @@ declare function useGeneralLeaderboardScript(options?: GeneralLeaderboardScriptO
|
|
|
493
521
|
useCampaignDateRange: boolean;
|
|
494
522
|
weeklyRanges: WeeklyDateRange[];
|
|
495
523
|
currentOrAllTimeRange: WeeklyDateRange | undefined;
|
|
524
|
+
foxifyOnly: any;
|
|
525
|
+
setFoxifyOnly: (value: boolean) => void;
|
|
496
526
|
searchValue: string;
|
|
497
527
|
onSearchValueChange: (value: string) => void;
|
|
498
528
|
clearSearchValue: () => void;
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var dateFns = require('date-fns');
|
|
4
4
|
var react = require('react');
|
|
5
|
-
var orderlyI18n = require('@kodiak-finance/orderly-i18n');
|
|
6
5
|
var orderlyHooks = require('@kodiak-finance/orderly-hooks');
|
|
6
|
+
var orderlyI18n = require('@kodiak-finance/orderly-i18n');
|
|
7
7
|
var orderlyUi = require('@kodiak-finance/orderly-ui');
|
|
8
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
9
|
var lucideReact = require('lucide-react');
|
|
@@ -237,7 +237,7 @@ var init_util = __esm({
|
|
|
237
237
|
"src/components/ranking/shared/util.ts"() {
|
|
238
238
|
}
|
|
239
239
|
});
|
|
240
|
-
var useRankingColumns, FirstRankIcon, SecondRankIcon, ThirdRankIcon, PnLColumnTitle, VolumeColumnTitle, PointsColumnTitle;
|
|
240
|
+
var useRankingColumns, getTierInfo, TierBadge, FirstRankIcon, SecondRankIcon, ThirdRankIcon, PnLColumnTitle, VolumeColumnTitle, PointsColumnTitle;
|
|
241
241
|
var init_column = __esm({
|
|
242
242
|
"src/components/ranking/shared/column.tsx"() {
|
|
243
243
|
init_first_badge();
|
|
@@ -300,7 +300,7 @@ var init_column = __esm({
|
|
|
300
300
|
if (!isYou) {
|
|
301
301
|
if (record.rank === 1) ; else if (record.rank === 2) ; else if (record.rank === 3) ;
|
|
302
302
|
}
|
|
303
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
303
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-flex oui-flex-col", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
304
304
|
"a",
|
|
305
305
|
{
|
|
306
306
|
className: "oui-flex oui-items-start oui-gap-1",
|
|
@@ -331,6 +331,18 @@ var init_column = __esm({
|
|
|
331
331
|
},
|
|
332
332
|
width: 90
|
|
333
333
|
},
|
|
334
|
+
{
|
|
335
|
+
title: "VIP Tier",
|
|
336
|
+
dataIndex: "tier",
|
|
337
|
+
render: (_value, record) => {
|
|
338
|
+
const tierInfo = getTierInfo(record);
|
|
339
|
+
if (!tierInfo?.label) {
|
|
340
|
+
return "-";
|
|
341
|
+
}
|
|
342
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TierBadge, { label: tierInfo.label, imageUrl: tierInfo.imageUrl });
|
|
343
|
+
},
|
|
344
|
+
width: 120
|
|
345
|
+
},
|
|
334
346
|
{
|
|
335
347
|
title: /* @__PURE__ */ jsxRuntime.jsx(VolumeColumnTitle, {}),
|
|
336
348
|
dataIndex: "volume",
|
|
@@ -396,6 +408,46 @@ var init_column = __esm({
|
|
|
396
408
|
);
|
|
397
409
|
}, [t, isMobile, address, fields, enableSort, type]);
|
|
398
410
|
};
|
|
411
|
+
getTierInfo = (record) => {
|
|
412
|
+
if (!record) {
|
|
413
|
+
return {};
|
|
414
|
+
}
|
|
415
|
+
const tierValue = record.tier;
|
|
416
|
+
if (tierValue && typeof tierValue === "object") {
|
|
417
|
+
return {
|
|
418
|
+
label: tierValue.name || tierValue.label || tierValue.tier,
|
|
419
|
+
imageUrl: tierValue.badge_url || tierValue.badgeUrl || tierValue.image || tierValue.imageUrl
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
const label = record.vip_tier || record.vipTier || record.vip_tier_name || record.vipTierName || record.tier || record.tier_name || record.tierName || record.tier_label || record.tierLabel;
|
|
423
|
+
const imageUrl = record.vip_badge_url || record.vipBadgeUrl || record.vip_tier_image || record.vipTierImage || record.vip_tier_badge || record.vipTierBadge || record.tier_image || record.tierImage || record.tier_badge_url || record.tierBadgeUrl;
|
|
424
|
+
return { label, imageUrl };
|
|
425
|
+
};
|
|
426
|
+
TierBadge = ({
|
|
427
|
+
label,
|
|
428
|
+
imageUrl,
|
|
429
|
+
className
|
|
430
|
+
}) => {
|
|
431
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
432
|
+
orderlyUi.Flex,
|
|
433
|
+
{
|
|
434
|
+
itemAlign: "center",
|
|
435
|
+
gap: 1,
|
|
436
|
+
className: orderlyUi.cn("oui-text-2xs", className),
|
|
437
|
+
children: [
|
|
438
|
+
imageUrl && /* @__PURE__ */ jsxRuntime.jsx(
|
|
439
|
+
"img",
|
|
440
|
+
{
|
|
441
|
+
src: imageUrl,
|
|
442
|
+
alt: `${label} badge`,
|
|
443
|
+
className: "oui-h-4 oui-w-4 oui-object-contain"
|
|
444
|
+
}
|
|
445
|
+
),
|
|
446
|
+
/* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { className: "oui-text-2xs", children: label })
|
|
447
|
+
]
|
|
448
|
+
}
|
|
449
|
+
);
|
|
450
|
+
};
|
|
399
451
|
FirstRankIcon = () => {
|
|
400
452
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
401
453
|
"svg",
|
|
@@ -666,7 +718,8 @@ function useGeneralRankingScript(options) {
|
|
|
666
718
|
dateRange = exports.getDateRange(90),
|
|
667
719
|
address: searchValue,
|
|
668
720
|
sortKey = "perp_volume",
|
|
669
|
-
leaderboardEndpoint
|
|
721
|
+
leaderboardEndpoint,
|
|
722
|
+
foxifyOnly = false
|
|
670
723
|
} = options || {};
|
|
671
724
|
const [initialSort] = react.useState({
|
|
672
725
|
sortKey,
|
|
@@ -714,6 +767,9 @@ function useGeneralRankingScript(options) {
|
|
|
714
767
|
if (args.address) {
|
|
715
768
|
searchParams.set("address", args.address);
|
|
716
769
|
}
|
|
770
|
+
if (foxifyOnly) {
|
|
771
|
+
searchParams.set("foxify_only", "true");
|
|
772
|
+
}
|
|
717
773
|
const baseUrl = leaderboardEndpoint || `/v1/broker/leaderboard/daily`;
|
|
718
774
|
return `${baseUrl}?${searchParams.toString()}`;
|
|
719
775
|
};
|
|
@@ -1028,12 +1084,13 @@ var init_generalRanking_widget = __esm({
|
|
|
1028
1084
|
init_ranking_ui();
|
|
1029
1085
|
init_generalRanking_script();
|
|
1030
1086
|
exports.GeneralRankingWidget = (props) => {
|
|
1031
|
-
const { dateRange, address, fields, sortKey, leaderboardEndpoint, ...rest } = props;
|
|
1087
|
+
const { dateRange, address, fields, sortKey, leaderboardEndpoint, foxifyOnly, ...rest } = props;
|
|
1032
1088
|
const state = useGeneralRankingScript({
|
|
1033
1089
|
dateRange,
|
|
1034
1090
|
address,
|
|
1035
1091
|
sortKey,
|
|
1036
|
-
leaderboardEndpoint
|
|
1092
|
+
leaderboardEndpoint,
|
|
1093
|
+
foxifyOnly
|
|
1037
1094
|
});
|
|
1038
1095
|
return /* @__PURE__ */ jsxRuntime.jsx(exports.Ranking, { ...state, ...rest, fields, type: "general" });
|
|
1039
1096
|
};
|
|
@@ -1069,7 +1126,7 @@ var TradingLeaderboardProvider = (props) => {
|
|
|
1069
1126
|
var useTradingLeaderboardContext = () => {
|
|
1070
1127
|
return react.useContext(TradingLeaderboardContext);
|
|
1071
1128
|
};
|
|
1072
|
-
var API_BASE = "https://backend.kodiak.finance/orderly/stats";
|
|
1129
|
+
var API_BASE = "https://staging.backend.kodiak.finance/orderly/stats";
|
|
1073
1130
|
var formatDateLocal = (date) => {
|
|
1074
1131
|
const year = date.getFullYear();
|
|
1075
1132
|
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
@@ -3102,6 +3159,18 @@ var LeaderboardTab = /* @__PURE__ */ ((LeaderboardTab2) => {
|
|
|
3102
3159
|
|
|
3103
3160
|
// src/components/leaderboard/generalLeaderboard/generalLeaderboard.script.ts
|
|
3104
3161
|
init_utils();
|
|
3162
|
+
var useLeaderboardLocalStorage = () => {
|
|
3163
|
+
const [foxifyOnly, setFoxifyOnly] = orderlyHooks.useLocalStorage(
|
|
3164
|
+
"leaderboard_foxify_only",
|
|
3165
|
+
false
|
|
3166
|
+
);
|
|
3167
|
+
return {
|
|
3168
|
+
foxifyOnly,
|
|
3169
|
+
setFoxifyOnly
|
|
3170
|
+
};
|
|
3171
|
+
};
|
|
3172
|
+
|
|
3173
|
+
// src/components/leaderboard/generalLeaderboard/generalLeaderboard.script.ts
|
|
3105
3174
|
var FilterDays2 = [1, 7, 30, 90];
|
|
3106
3175
|
function useGeneralLeaderboardScript(options) {
|
|
3107
3176
|
const { campaignDateRange, timeRange } = options || {};
|
|
@@ -3124,12 +3193,14 @@ function useGeneralLeaderboardScript(options) {
|
|
|
3124
3193
|
customTimeRange: parsedTimeRange
|
|
3125
3194
|
});
|
|
3126
3195
|
const searchState = useSearch();
|
|
3196
|
+
const foxifyState = useLeaderboardLocalStorage();
|
|
3127
3197
|
const useCampaignDateRange = react.useMemo(() => {
|
|
3128
3198
|
return !!campaignDateRange;
|
|
3129
3199
|
}, [campaignDateRange]);
|
|
3130
3200
|
return {
|
|
3131
3201
|
...filterState,
|
|
3132
3202
|
...searchState,
|
|
3203
|
+
...foxifyState,
|
|
3133
3204
|
activeTab,
|
|
3134
3205
|
onTabChange: setActiveTab,
|
|
3135
3206
|
useCampaignDateRange,
|
|
@@ -3283,6 +3354,17 @@ var LeaderboardFilter = (props) => {
|
|
|
3283
3354
|
value
|
|
3284
3355
|
);
|
|
3285
3356
|
});
|
|
3357
|
+
const foxifyFilterButton = /* @__PURE__ */ jsxRuntime.jsx(
|
|
3358
|
+
"button",
|
|
3359
|
+
{
|
|
3360
|
+
className: `oui-px-3 oui-py-1 oui-rounded oui-text-xs oui-font-medium oui-transition-colors oui-whitespace-nowrap ${props.foxifyOnly ? "oui-bg-primary oui-text-white" : "oui-bg-base-6 oui-text-base-contrast-60 hover:oui-bg-base-4 hover:oui-text-base-contrast"}`,
|
|
3361
|
+
onClick: () => {
|
|
3362
|
+
props.setFoxifyOnly(!props.foxifyOnly);
|
|
3363
|
+
},
|
|
3364
|
+
title: t("tradingLeaderboard.foxifyOnly.tooltip"),
|
|
3365
|
+
children: t("tradingLeaderboard.foxifyOnly")
|
|
3366
|
+
}
|
|
3367
|
+
);
|
|
3286
3368
|
if (isMobile) {
|
|
3287
3369
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3288
3370
|
orderlyUi.Flex,
|
|
@@ -3295,6 +3377,7 @@ var LeaderboardFilter = (props) => {
|
|
|
3295
3377
|
className: orderlyUi.cn("oui-mobile-trading-leaderboard-ranking-filter"),
|
|
3296
3378
|
children: [
|
|
3297
3379
|
input,
|
|
3380
|
+
/* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Flex, { gap: 2, width: "100%", mt: 3, itemAlign: "center", children: foxifyFilterButton }),
|
|
3298
3381
|
useCampaignDateRange ? /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Flex, { gap: 3, className: "oui-w-full oui-py-3", children: /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.ScrollIndicator, { className: "oui-w-full", children: weeklyView }) }) : /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { gap: 3, className: "oui-w-full", children: [
|
|
3299
3382
|
dateRangeView,
|
|
3300
3383
|
/* @__PURE__ */ jsxRuntime.jsx(orderlyUi.ScrollIndicator, { className: "oui-w-full", children: /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Flex, { gap: 3, children: filterDayView }) })
|
|
@@ -3316,7 +3399,10 @@ var LeaderboardFilter = (props) => {
|
|
|
3316
3399
|
!useCampaignDateRange && dateRangeView,
|
|
3317
3400
|
!useCampaignDateRange && filterDayView
|
|
3318
3401
|
] }),
|
|
3319
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3402
|
+
/* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { gap: 2, itemAlign: "center", children: [
|
|
3403
|
+
foxifyFilterButton,
|
|
3404
|
+
/* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Box, { width: 240, children: input })
|
|
3405
|
+
] })
|
|
3320
3406
|
]
|
|
3321
3407
|
}
|
|
3322
3408
|
);
|
|
@@ -3464,12 +3550,8 @@ var GeneralLeaderboard = (props) => {
|
|
|
3464
3550
|
props.activeTab === "volume" /* Volume */ ? "volume" : "pnl"
|
|
3465
3551
|
];
|
|
3466
3552
|
}
|
|
3467
|
-
const baseFields = [
|
|
3468
|
-
|
|
3469
|
-
"address",
|
|
3470
|
-
"volume",
|
|
3471
|
-
"pnl"
|
|
3472
|
-
];
|
|
3553
|
+
const baseFields = ["rank", "address"];
|
|
3554
|
+
baseFields.push("volume", "pnl");
|
|
3473
3555
|
if (props.leaderboardEndpoint) {
|
|
3474
3556
|
baseFields.push("points");
|
|
3475
3557
|
}
|
|
@@ -3510,7 +3592,8 @@ var GeneralLeaderboard = (props) => {
|
|
|
3510
3592
|
address: props.searchValue,
|
|
3511
3593
|
sortKey: props.activeTab === "volume" /* Volume */ ? "perp_volume" : "realized_pnl",
|
|
3512
3594
|
fields,
|
|
3513
|
-
leaderboardEndpoint: props.leaderboardEndpoint
|
|
3595
|
+
leaderboardEndpoint: props.leaderboardEndpoint,
|
|
3596
|
+
foxifyOnly: props.foxifyOnly
|
|
3514
3597
|
}
|
|
3515
3598
|
) })
|
|
3516
3599
|
]
|
|
@@ -3542,7 +3625,8 @@ var GeneralLeaderboard = (props) => {
|
|
|
3542
3625
|
dateRange: props.dateRange,
|
|
3543
3626
|
address: props.searchValue,
|
|
3544
3627
|
fields,
|
|
3545
|
-
leaderboardEndpoint: props.leaderboardEndpoint
|
|
3628
|
+
leaderboardEndpoint: props.leaderboardEndpoint,
|
|
3629
|
+
foxifyOnly: props.foxifyOnly
|
|
3546
3630
|
}
|
|
3547
3631
|
) })
|
|
3548
3632
|
]
|