@agg-build/ui 2.8.0 → 4.0.0
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/{chunk-AKLGQ6AB.mjs → chunk-JTSLZARU.mjs} +50 -250
- package/dist/{chunk-2QCNDFNC.mjs → chunk-R362GNI2.mjs} +1120 -400
- package/dist/{chunk-R5S2QOYL.mjs → chunk-XIDQ2A6W.mjs} +152 -59
- package/dist/index.js +1764 -1155
- package/dist/index.mjs +5 -3
- package/dist/modals.js +391 -845
- package/dist/modals.mjs +1 -1
- package/dist/pages.js +1724 -916
- package/dist/pages.mjs +4 -2
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +567 -472
- package/dist/trading.mjs +1 -1
- package/dist/types/pages/user-profile/components/available-balance-card.d.mts +5 -1
- package/dist/types/pages/user-profile/components/available-balance-card.d.ts +5 -1
- package/dist/types/pages/user-profile/components/manage-balances-modal.d.mts +8 -0
- package/dist/types/pages/user-profile/components/manage-balances-modal.d.ts +8 -0
- package/dist/types/pages/user-profile/index.d.mts +1 -0
- package/dist/types/pages/user-profile/index.d.ts +1 -0
- package/dist/types/profile/profile-modal.constants.d.mts +1 -2
- package/dist/types/profile/profile-modal.constants.d.ts +1 -2
- package/dist/types/trading/place-order/index.place-order.constants.d.mts +1 -0
- package/dist/types/trading/place-order/index.place-order.constants.d.ts +1 -0
- package/dist/types/trading/place-order/index.place-order.types.d.mts +4 -0
- package/dist/types/trading/place-order/index.place-order.types.d.ts +4 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +7 -3
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +7 -3
- package/package.json +3 -3
- package/dist/types/profile/tabs/balance-management-tab.d.mts +0 -3
- package/dist/types/profile/tabs/balance-management-tab.d.ts +0 -3
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
WITHDRAW_MODAL_OPEN_EVENT,
|
|
19
19
|
useClaimWinnings,
|
|
20
20
|
useResolvedMarketClaim
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-XIDQ2A6W.mjs";
|
|
22
22
|
import {
|
|
23
23
|
getDisplayOutcomePrice,
|
|
24
24
|
resolveHeaderOutcomeItems,
|
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
__spreadValues,
|
|
51
51
|
cn,
|
|
52
52
|
filterOpenEvents,
|
|
53
|
+
formatUsd,
|
|
53
54
|
normalizeVenueMarketCluster,
|
|
54
55
|
resolveTabVenus,
|
|
55
56
|
shortenAddress,
|
|
@@ -3181,19 +3182,19 @@ import {
|
|
|
3181
3182
|
getWalletAddressFromUserProfile,
|
|
3182
3183
|
useAppConfig as useAppConfig2,
|
|
3183
3184
|
useAggAuthState,
|
|
3184
|
-
useAggBalance,
|
|
3185
|
+
useAggBalance as useAggBalance2,
|
|
3185
3186
|
useAggClient,
|
|
3186
3187
|
useCancelManagedOrder,
|
|
3187
3188
|
useExecutionOrders,
|
|
3188
3189
|
useExecutionPositions,
|
|
3189
3190
|
useGeoBlock,
|
|
3190
|
-
useLabels as
|
|
3191
|
+
useLabels as useLabels12,
|
|
3191
3192
|
useSdkUiConfig as useSdkUiConfig5,
|
|
3192
3193
|
useUserActivity
|
|
3193
3194
|
} from "@agg-build/hooks";
|
|
3194
|
-
import { Venue as
|
|
3195
|
+
import { Venue as Venue3 } from "@agg-build/sdk";
|
|
3195
3196
|
import dayjs from "dayjs";
|
|
3196
|
-
import { useCallback as
|
|
3197
|
+
import { useCallback as useCallback6, useEffect as useEffect11, useMemo as useMemo8, useRef as useRef10, useState as useState12 } from "react";
|
|
3197
3198
|
|
|
3198
3199
|
// src/pages/user-profile/chain-display.ts
|
|
3199
3200
|
var CHAIN_ID_TO_LABEL = {
|
|
@@ -3270,7 +3271,9 @@ var AvailableBalanceCard = ({
|
|
|
3270
3271
|
reservedValueLabel,
|
|
3271
3272
|
chains,
|
|
3272
3273
|
isLoading = false,
|
|
3273
|
-
className
|
|
3274
|
+
className,
|
|
3275
|
+
onManage,
|
|
3276
|
+
manageButtonRef
|
|
3274
3277
|
}) => {
|
|
3275
3278
|
const labels = useLabels5();
|
|
3276
3279
|
const balanceLabels = labels.userProfile.balance;
|
|
@@ -3285,28 +3288,23 @@ var AvailableBalanceCard = ({
|
|
|
3285
3288
|
className
|
|
3286
3289
|
),
|
|
3287
3290
|
children: [
|
|
3288
|
-
/* @__PURE__ */
|
|
3289
|
-
/* @__PURE__ */
|
|
3290
|
-
"
|
|
3291
|
+
/* @__PURE__ */ jsxs7("div", { className: "agg-balance-header flex items-center justify-between gap-3", children: [
|
|
3292
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2", children: [
|
|
3293
|
+
/* @__PURE__ */ jsx8(Icon, { name: "wallet", size: "small", className: "size-4 text-agg-muted-foreground" }),
|
|
3294
|
+
/* @__PURE__ */ jsx8("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children: resolvedLabel })
|
|
3295
|
+
] }),
|
|
3296
|
+
onManage ? /* @__PURE__ */ jsx8(
|
|
3297
|
+
"button",
|
|
3291
3298
|
{
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
focusable: "false",
|
|
3299
|
-
children: /* @__PURE__ */ jsx8(
|
|
3300
|
-
"path",
|
|
3301
|
-
{
|
|
3302
|
-
d: "M14 4.00065H3.33333C2.76067 4.00065 2.21867 3.75265 1.84333 3.33465C2.21 2.92532 2.74267 2.66732 3.33333 2.66732H15.3333C15.702 2.66732 16 2.36865 16 2.00065C16 1.63265 15.702 1.33398 15.3333 1.33398H3.33333C1.49267 1.33398 0 2.82665 0 4.66732V11.334C0 13.1747 1.49267 14.6673 3.33333 14.6673H14C15.1047 14.6673 16 13.772 16 12.6673V6.00065C16 4.89598 15.1047 4.00065 14 4.00065ZM14.6667 12.6673C14.6667 13.0347 14.368 13.334 14 13.334H3.33333C2.23067 13.334 1.33333 12.4367 1.33333 11.334V4.66598C1.90267 5.09198 2.60267 5.33398 3.33333 5.33398H14C14.368 5.33398 14.6667 5.63332 14.6667 6.00065V12.6673ZM13.3333 9.33399C13.3333 9.70199 13.0347 10.0007 12.6667 10.0007C12.2987 10.0007 12 9.70199 12 9.33399C12 8.96599 12.2987 8.66732 12.6667 8.66732C13.0347 8.66732 13.3333 8.96599 13.3333 9.33399Z",
|
|
3303
|
-
fill: "#9D9FAF"
|
|
3304
|
-
}
|
|
3305
|
-
)
|
|
3299
|
+
ref: manageButtonRef,
|
|
3300
|
+
type: "button",
|
|
3301
|
+
"aria-haspopup": "dialog",
|
|
3302
|
+
className: "cursor-pointer rounded-agg-sm font-agg-sans text-agg-base leading-6 font-agg-bold text-agg-primary outline-none hover:text-agg-primary-hover focus-visible:ring-2 focus-visible:ring-agg-primary-hover",
|
|
3303
|
+
onClick: onManage,
|
|
3304
|
+
children: balanceLabels.manage
|
|
3306
3305
|
}
|
|
3307
|
-
)
|
|
3308
|
-
|
|
3309
|
-
] }) }),
|
|
3306
|
+
) : null
|
|
3307
|
+
] }),
|
|
3310
3308
|
/* @__PURE__ */ jsxs7("div", { className: "agg-balance-summary flex items-center justify-between gap-3", children: [
|
|
3311
3309
|
/* @__PURE__ */ jsx8("div", { className: "agg-balance-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: isLoading ? /* @__PURE__ */ jsx8("div", { role: "status", "aria-label": "Loading available balance", children: /* @__PURE__ */ jsx8(SkeletonBlock, { className: "h-8 w-24 rounded-agg-sm" }) }) : valueLabel }),
|
|
3312
3310
|
/* @__PURE__ */ jsx8(
|
|
@@ -3559,9 +3557,720 @@ var ClaimActivityBreakdownModal = ({
|
|
|
3559
3557
|
);
|
|
3560
3558
|
};
|
|
3561
3559
|
|
|
3560
|
+
// src/pages/user-profile/components/manage-balances-modal.tsx
|
|
3561
|
+
import {
|
|
3562
|
+
useAggBalance,
|
|
3563
|
+
useBalanceRefillPolicies,
|
|
3564
|
+
useDepositAddresses,
|
|
3565
|
+
useLabels as useLabels7
|
|
3566
|
+
} from "@agg-build/hooks";
|
|
3567
|
+
import { Venue as Venue2 } from "@agg-build/sdk";
|
|
3568
|
+
import * as Dialog2 from "@radix-ui/react-dialog";
|
|
3569
|
+
import { useCallback as useCallback5, useEffect as useEffect9, useId, useMemo as useMemo6, useRef as useRef8, useState as useState10 } from "react";
|
|
3570
|
+
import { z } from "zod";
|
|
3571
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3572
|
+
var USDC_DECIMALS = 6;
|
|
3573
|
+
var EDITABLE_AMOUNT_PATTERN = /^\d*(?:\.\d{0,6})?$/;
|
|
3574
|
+
var FINAL_AMOUNT_PATTERN = /^\d+(?:\.\d{1,6})?$/;
|
|
3575
|
+
var NETWORK_PRESENTATION = {
|
|
3576
|
+
137: { name: "Polygon", order: 0, venues: [Venue2.polymarket] },
|
|
3577
|
+
56: { name: "BNB", order: 1, venues: [Venue2.limitless, Venue2.myriad] },
|
|
3578
|
+
792703809: { name: "Solana", order: 2, venues: [Venue2.kalshi] },
|
|
3579
|
+
1337: { name: "Hyperliquid", order: 3, venues: [Venue2.hyperliquid] },
|
|
3580
|
+
42161: { name: "Arbitrum", order: 4, venues: [] },
|
|
3581
|
+
8453: { name: "Base", order: 5, venues: [] },
|
|
3582
|
+
1: { name: "Ethereum", order: 6, venues: [] }
|
|
3583
|
+
};
|
|
3584
|
+
var VENUE_LABELS = {
|
|
3585
|
+
[Venue2.kalshi]: "Kalshi",
|
|
3586
|
+
[Venue2.limitless]: "Limitless",
|
|
3587
|
+
[Venue2.opinion]: "Opinion",
|
|
3588
|
+
[Venue2.polymarket]: "Polymarket",
|
|
3589
|
+
[Venue2.predict]: "Predict",
|
|
3590
|
+
[Venue2.probable]: "Probable",
|
|
3591
|
+
[Venue2.myriad]: "Myriad",
|
|
3592
|
+
[Venue2.hyperliquid]: "Hyperliquid"
|
|
3593
|
+
};
|
|
3594
|
+
var amountSchema = z.string().min(1).regex(FINAL_AMOUNT_PATTERN);
|
|
3595
|
+
var decimalToRaw = (value, decimals = USDC_DECIMALS) => {
|
|
3596
|
+
const parsed = amountSchema.safeParse(value.trim());
|
|
3597
|
+
if (!parsed.success) return null;
|
|
3598
|
+
const [whole = "0", fraction = ""] = parsed.data.split(".");
|
|
3599
|
+
const paddedFraction = fraction.padEnd(decimals, "0").slice(0, decimals);
|
|
3600
|
+
const normalizedWhole = whole.replace(/^0+(?=\d)/, "") || "0";
|
|
3601
|
+
return BigInt(`${normalizedWhole}${paddedFraction}`).toString();
|
|
3602
|
+
};
|
|
3603
|
+
var rawToDecimal = (rawValue, decimals = USDC_DECIMALS) => {
|
|
3604
|
+
const normalizedRaw = rawValue.replace(/^0+(?=\d)/, "") || "0";
|
|
3605
|
+
const paddedRaw = normalizedRaw.padStart(decimals + 1, "0");
|
|
3606
|
+
const whole = paddedRaw.slice(0, -decimals);
|
|
3607
|
+
const fraction = paddedRaw.slice(-decimals).replace(/0+$/, "");
|
|
3608
|
+
return fraction ? `${whole}.${fraction}` : whole;
|
|
3609
|
+
};
|
|
3610
|
+
var getInitialDraft = (policy) => {
|
|
3611
|
+
if ((policy == null ? void 0 : policy.status) !== "enabled") return { minimum: "0", refillTo: "0" };
|
|
3612
|
+
return {
|
|
3613
|
+
minimum: rawToDecimal(policy.minimumRaw),
|
|
3614
|
+
refillTo: rawToDecimal(policy.refillAmountRaw)
|
|
3615
|
+
};
|
|
3616
|
+
};
|
|
3617
|
+
var areDraftsEqual = (current, initial) => {
|
|
3618
|
+
const currentMinimumRaw = decimalToRaw(current.minimum);
|
|
3619
|
+
const currentRefillToRaw = decimalToRaw(current.refillTo);
|
|
3620
|
+
const initialMinimumRaw = decimalToRaw(initial.minimum);
|
|
3621
|
+
const initialRefillToRaw = decimalToRaw(initial.refillTo);
|
|
3622
|
+
return currentMinimumRaw !== null && currentRefillToRaw !== null && currentMinimumRaw === initialMinimumRaw && currentRefillToRaw === initialRefillToRaw;
|
|
3623
|
+
};
|
|
3624
|
+
var getPolicyMaximumRaw = (policy) => {
|
|
3625
|
+
if (!(policy == null ? void 0 : policy.dailyCapRaw) || !policy.maxFeeRaw) return null;
|
|
3626
|
+
const dailyCapRaw = BigInt(policy.dailyCapRaw);
|
|
3627
|
+
const maximumFeeRaw = BigInt(policy.maxFeeRaw);
|
|
3628
|
+
if (dailyCapRaw <= maximumFeeRaw) return "0";
|
|
3629
|
+
return (dailyCapRaw - maximumFeeRaw).toString();
|
|
3630
|
+
};
|
|
3631
|
+
var getApiFieldErrors = (error) => {
|
|
3632
|
+
var _a;
|
|
3633
|
+
if (!(error instanceof Error)) return [];
|
|
3634
|
+
return (_a = error.errors) != null ? _a : [];
|
|
3635
|
+
};
|
|
3636
|
+
var getApiErrorMessage = (error, fallback) => {
|
|
3637
|
+
if (!(error instanceof Error) || !error.message.trim()) return fallback;
|
|
3638
|
+
return error.message;
|
|
3639
|
+
};
|
|
3640
|
+
var ManageBalancesModal = ({
|
|
3641
|
+
open,
|
|
3642
|
+
onOpenChange
|
|
3643
|
+
}) => {
|
|
3644
|
+
const labels = useLabels7();
|
|
3645
|
+
const refillLabels = labels.balanceRefill;
|
|
3646
|
+
const balanceState = useAggBalance();
|
|
3647
|
+
const depositAddressesQuery = useDepositAddresses({ enabled: open });
|
|
3648
|
+
const policiesQuery = useBalanceRefillPolicies({ enabled: open });
|
|
3649
|
+
const toastContext = useOptionalToast();
|
|
3650
|
+
const descriptionId = useId();
|
|
3651
|
+
const savingRef = useRef8(false);
|
|
3652
|
+
const [expandedChainIds, setExpandedChainIds] = useState10(/* @__PURE__ */ new Set());
|
|
3653
|
+
const [resetChainIds, setResetChainIds] = useState10(/* @__PURE__ */ new Set());
|
|
3654
|
+
const [drafts, setDrafts] = useState10({});
|
|
3655
|
+
const [initialDrafts, setInitialDrafts] = useState10({});
|
|
3656
|
+
const [submissionErrors, setSubmissionErrors] = useState10({});
|
|
3657
|
+
const [isInitialized, setIsInitialized] = useState10(false);
|
|
3658
|
+
const [isSaving, setIsSaving] = useState10(false);
|
|
3659
|
+
const networks = useMemo6(() => {
|
|
3660
|
+
var _a, _b, _c;
|
|
3661
|
+
const supportedChains = (_a = depositAddressesQuery.supportedChains) != null ? _a : [];
|
|
3662
|
+
const availableBalanceBreakdown = (_c = (_b = balanceState.availableBalanceBreakdown) != null ? _b : balanceState.balanceBreakdown) != null ? _c : [];
|
|
3663
|
+
return supportedChains.flatMap((chain) => {
|
|
3664
|
+
var _a2, _b2;
|
|
3665
|
+
const usdcToken = chain.tokens.find((token) => token.symbol.toUpperCase() === "USDC");
|
|
3666
|
+
if (!usdcToken) return [];
|
|
3667
|
+
const presentation = NETWORK_PRESENTATION[chain.chainId];
|
|
3668
|
+
const chainBalance = availableBalanceBreakdown.find(
|
|
3669
|
+
(balance) => balance.key === String(chain.chainId)
|
|
3670
|
+
);
|
|
3671
|
+
return [
|
|
3672
|
+
{
|
|
3673
|
+
chainId: chain.chainId,
|
|
3674
|
+
name: (_a2 = presentation == null ? void 0 : presentation.name) != null ? _a2 : chain.name,
|
|
3675
|
+
balance: chainBalance == null ? void 0 : chainBalance.balance,
|
|
3676
|
+
policy: policiesQuery.policies.find(
|
|
3677
|
+
(policy) => policy.targetChainId === chain.chainId && policy.targetTokenSymbol.toUpperCase() === "USDC"
|
|
3678
|
+
),
|
|
3679
|
+
venues: (_b2 = presentation == null ? void 0 : presentation.venues) != null ? _b2 : []
|
|
3680
|
+
}
|
|
3681
|
+
];
|
|
3682
|
+
}).sort((left, right) => {
|
|
3683
|
+
var _a2, _b2, _c2, _d;
|
|
3684
|
+
const leftOrder = (_b2 = (_a2 = NETWORK_PRESENTATION[left.chainId]) == null ? void 0 : _a2.order) != null ? _b2 : Number.MAX_SAFE_INTEGER;
|
|
3685
|
+
const rightOrder = (_d = (_c2 = NETWORK_PRESENTATION[right.chainId]) == null ? void 0 : _c2.order) != null ? _d : Number.MAX_SAFE_INTEGER;
|
|
3686
|
+
if (leftOrder !== rightOrder) return leftOrder - rightOrder;
|
|
3687
|
+
return left.name.localeCompare(right.name);
|
|
3688
|
+
});
|
|
3689
|
+
}, [
|
|
3690
|
+
balanceState.availableBalanceBreakdown,
|
|
3691
|
+
balanceState.balanceBreakdown,
|
|
3692
|
+
depositAddressesQuery.supportedChains,
|
|
3693
|
+
policiesQuery.policies
|
|
3694
|
+
]);
|
|
3695
|
+
const isLoading = depositAddressesQuery.isLoading || policiesQuery.isLoading || balanceState.isLoading || open && !depositAddressesQuery.isReady && !depositAddressesQuery.isError && !depositAddressesQuery.isTimedOut;
|
|
3696
|
+
const hasDepositAddressesLoadError = !depositAddressesQuery.isReady && (depositAddressesQuery.isError || depositAddressesQuery.isTimedOut);
|
|
3697
|
+
const hasPoliciesLoadError = policiesQuery.isError && policiesQuery.data === void 0;
|
|
3698
|
+
const loadError = hasDepositAddressesLoadError ? depositAddressesQuery.error : hasPoliciesLoadError ? policiesQuery.error : balanceState.error;
|
|
3699
|
+
const hasLoadError = hasDepositAddressesLoadError || hasPoliciesLoadError || Boolean(balanceState.error);
|
|
3700
|
+
useEffect9(() => {
|
|
3701
|
+
if (open) return;
|
|
3702
|
+
setExpandedChainIds(/* @__PURE__ */ new Set());
|
|
3703
|
+
setResetChainIds(/* @__PURE__ */ new Set());
|
|
3704
|
+
setDrafts({});
|
|
3705
|
+
setInitialDrafts({});
|
|
3706
|
+
setSubmissionErrors({});
|
|
3707
|
+
setIsInitialized(false);
|
|
3708
|
+
setIsSaving(false);
|
|
3709
|
+
savingRef.current = false;
|
|
3710
|
+
}, [open]);
|
|
3711
|
+
useEffect9(() => {
|
|
3712
|
+
if (!open || isLoading || hasLoadError || isInitialized) return;
|
|
3713
|
+
const nextDrafts = Object.fromEntries(
|
|
3714
|
+
networks.map((network) => [network.chainId, getInitialDraft(network.policy)])
|
|
3715
|
+
);
|
|
3716
|
+
setDrafts(nextDrafts);
|
|
3717
|
+
setInitialDrafts(nextDrafts);
|
|
3718
|
+
setIsInitialized(true);
|
|
3719
|
+
}, [hasLoadError, isInitialized, isLoading, networks, open]);
|
|
3720
|
+
const validateDraft = useCallback5(
|
|
3721
|
+
(network, draft) => {
|
|
3722
|
+
const errors = {};
|
|
3723
|
+
const minimum = draft.minimum.trim();
|
|
3724
|
+
const refillTo = draft.refillTo.trim();
|
|
3725
|
+
if (!minimum) {
|
|
3726
|
+
errors.minimum = refillLabels.requiredError;
|
|
3727
|
+
} else if (!FINAL_AMOUNT_PATTERN.test(minimum)) {
|
|
3728
|
+
errors.minimum = refillLabels.precisionError;
|
|
3729
|
+
}
|
|
3730
|
+
if (!refillTo) {
|
|
3731
|
+
errors.refillTo = refillLabels.requiredError;
|
|
3732
|
+
} else if (!FINAL_AMOUNT_PATTERN.test(refillTo)) {
|
|
3733
|
+
errors.refillTo = refillLabels.precisionError;
|
|
3734
|
+
}
|
|
3735
|
+
const minimumRaw = decimalToRaw(minimum);
|
|
3736
|
+
const refillToRaw = decimalToRaw(refillTo);
|
|
3737
|
+
if (minimumRaw === "0") errors.minimum = refillLabels.positiveError;
|
|
3738
|
+
if (refillToRaw === "0") errors.refillTo = refillLabels.positiveError;
|
|
3739
|
+
if (minimumRaw !== null && refillToRaw !== null && BigInt(refillToRaw) < BigInt(minimumRaw)) {
|
|
3740
|
+
errors.refillTo = refillLabels.relationshipError;
|
|
3741
|
+
}
|
|
3742
|
+
const maximumRaw = getPolicyMaximumRaw(network.policy);
|
|
3743
|
+
if (maximumRaw !== null) {
|
|
3744
|
+
const maximumLabel = rawToDecimal(maximumRaw);
|
|
3745
|
+
if (minimumRaw !== null && BigInt(minimumRaw) > BigInt(maximumRaw)) {
|
|
3746
|
+
errors.minimum = refillLabels.maximumError(maximumLabel);
|
|
3747
|
+
}
|
|
3748
|
+
if (refillToRaw !== null && BigInt(refillToRaw) > BigInt(maximumRaw)) {
|
|
3749
|
+
errors.refillTo = refillLabels.maximumError(maximumLabel);
|
|
3750
|
+
}
|
|
3751
|
+
}
|
|
3752
|
+
return errors;
|
|
3753
|
+
},
|
|
3754
|
+
[refillLabels]
|
|
3755
|
+
);
|
|
3756
|
+
const dirtyNetworks = useMemo6(
|
|
3757
|
+
() => networks.filter((network) => {
|
|
3758
|
+
if (network.venues.length === 0) return false;
|
|
3759
|
+
if (resetChainIds.has(network.chainId)) return true;
|
|
3760
|
+
const draft = drafts[network.chainId];
|
|
3761
|
+
const initialDraft = initialDrafts[network.chainId];
|
|
3762
|
+
if (!draft || !initialDraft) return false;
|
|
3763
|
+
return !areDraftsEqual(draft, initialDraft);
|
|
3764
|
+
}),
|
|
3765
|
+
[drafts, initialDrafts, networks, resetChainIds]
|
|
3766
|
+
);
|
|
3767
|
+
const validationErrors = useMemo6(
|
|
3768
|
+
() => Object.fromEntries(
|
|
3769
|
+
dirtyNetworks.map((network) => {
|
|
3770
|
+
var _a;
|
|
3771
|
+
return [
|
|
3772
|
+
network.chainId,
|
|
3773
|
+
resetChainIds.has(network.chainId) ? {} : validateDraft(network, (_a = drafts[network.chainId]) != null ? _a : getInitialDraft(network.policy))
|
|
3774
|
+
];
|
|
3775
|
+
})
|
|
3776
|
+
),
|
|
3777
|
+
[dirtyNetworks, drafts, resetChainIds, validateDraft]
|
|
3778
|
+
);
|
|
3779
|
+
const hasValidationErrors = Object.values(validationErrors).some(
|
|
3780
|
+
(errors) => errors.minimum || errors.refillTo || errors.general
|
|
3781
|
+
);
|
|
3782
|
+
const isSaveDisabled = dirtyNetworks.length === 0 || hasValidationErrors || isSaving;
|
|
3783
|
+
const handleOpenChange = useCallback5(
|
|
3784
|
+
(nextOpen) => {
|
|
3785
|
+
if (isSaving && !nextOpen) return;
|
|
3786
|
+
onOpenChange(nextOpen);
|
|
3787
|
+
},
|
|
3788
|
+
[isSaving, onOpenChange]
|
|
3789
|
+
);
|
|
3790
|
+
const handleToggleNetwork = useCallback5((chainId, canManageBalance) => {
|
|
3791
|
+
if (!canManageBalance) return;
|
|
3792
|
+
setExpandedChainIds((current) => {
|
|
3793
|
+
const next = new Set(current);
|
|
3794
|
+
if (next.has(chainId)) next.delete(chainId);
|
|
3795
|
+
else next.add(chainId);
|
|
3796
|
+
return next;
|
|
3797
|
+
});
|
|
3798
|
+
}, []);
|
|
3799
|
+
const handleDraftChange = useCallback5(
|
|
3800
|
+
(chainId, field, value) => {
|
|
3801
|
+
if (!EDITABLE_AMOUNT_PATTERN.test(value)) return;
|
|
3802
|
+
setDrafts((current) => {
|
|
3803
|
+
var _a;
|
|
3804
|
+
const currentDraft = (_a = current[chainId]) != null ? _a : { minimum: "0", refillTo: "0" };
|
|
3805
|
+
const nextDraft = __spreadProps(__spreadValues({}, currentDraft), { [field]: value });
|
|
3806
|
+
if (field === "minimum") {
|
|
3807
|
+
const minimumRaw = decimalToRaw(value);
|
|
3808
|
+
const refillToRaw = decimalToRaw(currentDraft.refillTo);
|
|
3809
|
+
if (minimumRaw !== null && refillToRaw !== null && BigInt(minimumRaw) > BigInt(refillToRaw)) {
|
|
3810
|
+
nextDraft.refillTo = value;
|
|
3811
|
+
}
|
|
3812
|
+
}
|
|
3813
|
+
return __spreadProps(__spreadValues({}, current), { [chainId]: nextDraft });
|
|
3814
|
+
});
|
|
3815
|
+
setResetChainIds((current) => {
|
|
3816
|
+
if (!current.has(chainId)) return current;
|
|
3817
|
+
const next = new Set(current);
|
|
3818
|
+
next.delete(chainId);
|
|
3819
|
+
return next;
|
|
3820
|
+
});
|
|
3821
|
+
setSubmissionErrors((current) => {
|
|
3822
|
+
if (!current[chainId]) return current;
|
|
3823
|
+
return __spreadProps(__spreadValues({}, current), { [chainId]: {} });
|
|
3824
|
+
});
|
|
3825
|
+
},
|
|
3826
|
+
[]
|
|
3827
|
+
);
|
|
3828
|
+
const handleResetNetwork = useCallback5((network) => {
|
|
3829
|
+
setDrafts((current) => __spreadProps(__spreadValues({}, current), {
|
|
3830
|
+
[network.chainId]: { minimum: "0", refillTo: "0" }
|
|
3831
|
+
}));
|
|
3832
|
+
setResetChainIds((current) => {
|
|
3833
|
+
var _a;
|
|
3834
|
+
const next = new Set(current);
|
|
3835
|
+
if (((_a = network.policy) == null ? void 0 : _a.status) === "enabled") next.add(network.chainId);
|
|
3836
|
+
else next.delete(network.chainId);
|
|
3837
|
+
return next;
|
|
3838
|
+
});
|
|
3839
|
+
setSubmissionErrors((current) => {
|
|
3840
|
+
if (!current[network.chainId]) return current;
|
|
3841
|
+
return __spreadProps(__spreadValues({}, current), { [network.chainId]: {} });
|
|
3842
|
+
});
|
|
3843
|
+
}, []);
|
|
3844
|
+
const handleAmountBlur = useCallback5((chainId, field) => {
|
|
3845
|
+
setDrafts((current) => {
|
|
3846
|
+
const currentDraft = current[chainId];
|
|
3847
|
+
if (!currentDraft) return current;
|
|
3848
|
+
const rawValue = decimalToRaw(currentDraft[field]);
|
|
3849
|
+
if (rawValue === null) return current;
|
|
3850
|
+
return __spreadProps(__spreadValues({}, current), {
|
|
3851
|
+
[chainId]: __spreadProps(__spreadValues({}, currentDraft), { [field]: rawToDecimal(rawValue) })
|
|
3852
|
+
});
|
|
3853
|
+
});
|
|
3854
|
+
}, []);
|
|
3855
|
+
const handleRetry = useCallback5(() => {
|
|
3856
|
+
void depositAddressesQuery.refetch();
|
|
3857
|
+
void policiesQuery.refetch();
|
|
3858
|
+
balanceState.refetch();
|
|
3859
|
+
}, [balanceState, depositAddressesQuery, policiesQuery]);
|
|
3860
|
+
const handleSave = useCallback5(() => __async(null, null, function* () {
|
|
3861
|
+
if (savingRef.current || isSaveDisabled) return;
|
|
3862
|
+
savingRef.current = true;
|
|
3863
|
+
setIsSaving(true);
|
|
3864
|
+
setSubmissionErrors({});
|
|
3865
|
+
const nextInitialDrafts = __spreadValues({}, initialDrafts);
|
|
3866
|
+
const nextResetChainIds = new Set(resetChainIds);
|
|
3867
|
+
let failureCount = 0;
|
|
3868
|
+
yield Promise.all(
|
|
3869
|
+
dirtyNetworks.map((network) => __async(null, null, function* () {
|
|
3870
|
+
const draft = drafts[network.chainId];
|
|
3871
|
+
if (!draft) return;
|
|
3872
|
+
try {
|
|
3873
|
+
const isResetting = resetChainIds.has(network.chainId);
|
|
3874
|
+
const minimumRaw = decimalToRaw(draft.minimum);
|
|
3875
|
+
const refillAmountRaw = decimalToRaw(draft.refillTo);
|
|
3876
|
+
let savedPolicy;
|
|
3877
|
+
if (isResetting) {
|
|
3878
|
+
if (!network.policy) return;
|
|
3879
|
+
savedPolicy = yield policiesQuery.updatePolicy.mutateAsync({
|
|
3880
|
+
policyId: network.policy.id,
|
|
3881
|
+
params: { status: "paused" }
|
|
3882
|
+
});
|
|
3883
|
+
} else {
|
|
3884
|
+
if (minimumRaw === null || refillAmountRaw === null) return;
|
|
3885
|
+
savedPolicy = network.policy ? yield policiesQuery.updatePolicy.mutateAsync({
|
|
3886
|
+
policyId: network.policy.id,
|
|
3887
|
+
params: { minimumRaw, refillAmountRaw, status: "enabled" }
|
|
3888
|
+
}) : yield policiesQuery.createPolicy.mutateAsync({
|
|
3889
|
+
targetChainId: network.chainId,
|
|
3890
|
+
targetTokenSymbol: "USDC",
|
|
3891
|
+
minimumRaw,
|
|
3892
|
+
refillAmountRaw
|
|
3893
|
+
});
|
|
3894
|
+
}
|
|
3895
|
+
nextInitialDrafts[network.chainId] = getInitialDraft(savedPolicy);
|
|
3896
|
+
nextResetChainIds.delete(network.chainId);
|
|
3897
|
+
} catch (error) {
|
|
3898
|
+
failureCount += 1;
|
|
3899
|
+
const fieldErrors = getApiFieldErrors(error);
|
|
3900
|
+
const nextErrors = {};
|
|
3901
|
+
fieldErrors.forEach((fieldError) => {
|
|
3902
|
+
if (!fieldError.message) return;
|
|
3903
|
+
if (fieldError.field === "minimumRaw") nextErrors.minimum = fieldError.message;
|
|
3904
|
+
else if (fieldError.field === "refillAmountRaw") {
|
|
3905
|
+
nextErrors.refillTo = fieldError.message;
|
|
3906
|
+
} else nextErrors.general = fieldError.message;
|
|
3907
|
+
});
|
|
3908
|
+
if (!nextErrors.minimum && !nextErrors.refillTo && !nextErrors.general) {
|
|
3909
|
+
nextErrors.general = getApiErrorMessage(error, refillLabels.saveError);
|
|
3910
|
+
}
|
|
3911
|
+
setSubmissionErrors((current) => __spreadProps(__spreadValues({}, current), {
|
|
3912
|
+
[network.chainId]: nextErrors
|
|
3913
|
+
}));
|
|
3914
|
+
}
|
|
3915
|
+
}))
|
|
3916
|
+
);
|
|
3917
|
+
setInitialDrafts(nextInitialDrafts);
|
|
3918
|
+
setResetChainIds(nextResetChainIds);
|
|
3919
|
+
if (failureCount === 0) {
|
|
3920
|
+
yield policiesQuery.refetch();
|
|
3921
|
+
toastContext == null ? void 0 : toastContext.toast(refillLabels.saved, { tone: "success" });
|
|
3922
|
+
} else {
|
|
3923
|
+
toastContext == null ? void 0 : toastContext.toast(refillLabels.saveError, { tone: "error" });
|
|
3924
|
+
}
|
|
3925
|
+
savingRef.current = false;
|
|
3926
|
+
setIsSaving(false);
|
|
3927
|
+
}), [
|
|
3928
|
+
dirtyNetworks,
|
|
3929
|
+
drafts,
|
|
3930
|
+
initialDrafts,
|
|
3931
|
+
isSaveDisabled,
|
|
3932
|
+
policiesQuery,
|
|
3933
|
+
refillLabels,
|
|
3934
|
+
resetChainIds,
|
|
3935
|
+
toastContext
|
|
3936
|
+
]);
|
|
3937
|
+
return /* @__PURE__ */ jsx10(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs9(
|
|
3938
|
+
Modal.Container,
|
|
3939
|
+
{
|
|
3940
|
+
maxWidth: "600px",
|
|
3941
|
+
"aria-label": refillLabels.manageTitle,
|
|
3942
|
+
classNames: {
|
|
3943
|
+
container: "max-h-[calc(100%-2rem)] border-0 ring-1 ring-inset ring-agg-separator md:max-h-[calc(100%-2rem)]"
|
|
3944
|
+
},
|
|
3945
|
+
children: [
|
|
3946
|
+
/* @__PURE__ */ jsx10(
|
|
3947
|
+
Modal.Header,
|
|
3948
|
+
{
|
|
3949
|
+
title: refillLabels.manageTitle,
|
|
3950
|
+
subtitle: refillLabels.manageDescription,
|
|
3951
|
+
hideBorder: true,
|
|
3952
|
+
classNames: {
|
|
3953
|
+
root: "static min-h-0 shrink-0",
|
|
3954
|
+
container: "relative items-start! px-8! pt-7! pb-0!",
|
|
3955
|
+
title: "text-agg-2xl leading-agg-8",
|
|
3956
|
+
titleContainer: "flex max-w-none! flex-col gap-2",
|
|
3957
|
+
subtitle: "text-agg-sm! leading-agg-5! text-agg-foreground!",
|
|
3958
|
+
close: "absolute top-7 right-8"
|
|
3959
|
+
}
|
|
3960
|
+
}
|
|
3961
|
+
),
|
|
3962
|
+
/* @__PURE__ */ jsx10(Dialog2.Description, { className: "sr-only", children: refillLabels.manageDescription }),
|
|
3963
|
+
/* @__PURE__ */ jsx10(Modal.Body, { classNames: { root: "min-h-0 px-8! pt-6! pb-0!" }, children: isLoading ? /* @__PURE__ */ jsx10("div", { role: "status", "aria-label": refillLabels.modalLoading, className: "h-[448px]", children: Array.from({ length: 7 }, (_, index) => /* @__PURE__ */ jsxs9(
|
|
3964
|
+
"div",
|
|
3965
|
+
{
|
|
3966
|
+
className: "flex h-16 items-center gap-3 border-b border-agg-separator last:border-b-0",
|
|
3967
|
+
children: [
|
|
3968
|
+
/* @__PURE__ */ jsx10(SkeletonBlock, { className: "size-4 shrink-0 rounded-[4px]" }),
|
|
3969
|
+
/* @__PURE__ */ jsx10(SkeletonBlock, { className: "h-5 w-20 rounded-agg-sm" }),
|
|
3970
|
+
/* @__PURE__ */ jsx10(SkeletonBlock, { className: "h-6 w-20 rounded-agg-full" }),
|
|
3971
|
+
/* @__PURE__ */ jsx10(SkeletonBlock, { className: "ml-auto h-4 w-20 rounded-agg-sm" }),
|
|
3972
|
+
/* @__PURE__ */ jsx10(SkeletonBlock, { className: "h-5 w-12 rounded-agg-sm" }),
|
|
3973
|
+
/* @__PURE__ */ jsx10(SkeletonBlock, { className: "size-4 rounded-agg-sm" })
|
|
3974
|
+
]
|
|
3975
|
+
},
|
|
3976
|
+
index
|
|
3977
|
+
)) }) : hasLoadError ? /* @__PURE__ */ jsx10(
|
|
3978
|
+
StateMessage,
|
|
3979
|
+
{
|
|
3980
|
+
icon: /* @__PURE__ */ jsx10(Icon, { name: "error-filled" }),
|
|
3981
|
+
title: refillLabels.modalLoadError,
|
|
3982
|
+
description: getApiErrorMessage(loadError, refillLabels.modalLoadError),
|
|
3983
|
+
onAction: handleRetry,
|
|
3984
|
+
classNames: { root: "h-[448px] min-h-[448px]" }
|
|
3985
|
+
}
|
|
3986
|
+
) : networks.length === 0 ? /* @__PURE__ */ jsx10(
|
|
3987
|
+
StateMessage,
|
|
3988
|
+
{
|
|
3989
|
+
icon: /* @__PURE__ */ jsx10(Icon, { name: "search-empty" }),
|
|
3990
|
+
title: refillLabels.modalEmptyTitle,
|
|
3991
|
+
description: refillLabels.modalEmptyDescription,
|
|
3992
|
+
classNames: { root: "h-[448px] min-h-[448px]" }
|
|
3993
|
+
}
|
|
3994
|
+
) : /* @__PURE__ */ jsx10("div", { className: "flex flex-col", role: "list", children: networks.map((network, networkIndex) => {
|
|
3995
|
+
var _a, _b, _c, _d, _e;
|
|
3996
|
+
const canManageBalance = network.venues.length > 0;
|
|
3997
|
+
const isExpanded = canManageBalance && expandedChainIds.has(network.chainId);
|
|
3998
|
+
const isLastNetwork = networkIndex === networks.length - 1;
|
|
3999
|
+
const isPendingReset = resetChainIds.has(network.chainId);
|
|
4000
|
+
const draft = (_a = drafts[network.chainId]) != null ? _a : getInitialDraft(network.policy);
|
|
4001
|
+
const initialDraft = (_b = initialDrafts[network.chainId]) != null ? _b : getInitialDraft(network.policy);
|
|
4002
|
+
const isDirty = isPendingReset || !areDraftsEqual(draft, initialDraft);
|
|
4003
|
+
const rowValidationErrors = isDirty ? (_c = validationErrors[network.chainId]) != null ? _c : {} : {};
|
|
4004
|
+
const rowSubmissionErrors = (_d = submissionErrors[network.chainId]) != null ? _d : {};
|
|
4005
|
+
const rowErrors = __spreadValues(__spreadValues({}, rowValidationErrors), rowSubmissionErrors);
|
|
4006
|
+
const isDraftValid = !rowValidationErrors.minimum && !rowValidationErrors.refillTo && !rowValidationErrors.general;
|
|
4007
|
+
const hasConfiguredAutoRefill = ((_e = network.policy) == null ? void 0 : _e.status) === "enabled" && !areDraftsEqual(initialDraft, { minimum: "0", refillTo: "0" });
|
|
4008
|
+
const hasDraftAutoRefill = isDirty && !isPendingReset && isDraftValid;
|
|
4009
|
+
const hasAutoRefill = !isPendingReset && (hasConfiguredAutoRefill || hasDraftAutoRefill);
|
|
4010
|
+
const minimumInputId = `${descriptionId}-${network.chainId}-minimum`;
|
|
4011
|
+
const refillToInputId = `${descriptionId}-${network.chainId}-refill-to`;
|
|
4012
|
+
const minimumErrorId = `${minimumInputId}-error`;
|
|
4013
|
+
const refillToErrorId = `${refillToInputId}-error`;
|
|
4014
|
+
const formattedBalance = network.balance === void 0 ? "$\u2014" : formatUsd(network.balance);
|
|
4015
|
+
return /* @__PURE__ */ jsxs9(
|
|
4016
|
+
"div",
|
|
4017
|
+
{
|
|
4018
|
+
role: "listitem",
|
|
4019
|
+
className: cn(
|
|
4020
|
+
networkIndex > 0 && "pt-5",
|
|
4021
|
+
!isLastNetwork && "border-b border-agg-separator pb-5"
|
|
4022
|
+
),
|
|
4023
|
+
children: [
|
|
4024
|
+
/* @__PURE__ */ jsxs9(
|
|
4025
|
+
"button",
|
|
4026
|
+
{
|
|
4027
|
+
type: "button",
|
|
4028
|
+
"aria-expanded": isExpanded,
|
|
4029
|
+
"aria-controls": `${descriptionId}-${network.chainId}-settings`,
|
|
4030
|
+
"aria-label": isExpanded ? refillLabels.collapseNetwork(network.name) : refillLabels.expandNetwork(network.name),
|
|
4031
|
+
disabled: isSaving || !canManageBalance,
|
|
4032
|
+
className: cn(
|
|
4033
|
+
"group flex w-full cursor-pointer items-center gap-3 rounded-agg-sm text-left outline-none disabled:cursor-not-allowed focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-agg-primary-hover",
|
|
4034
|
+
canManageBalance ? "h-6" : "h-5"
|
|
4035
|
+
),
|
|
4036
|
+
onClick: () => handleToggleNetwork(network.chainId, canManageBalance),
|
|
4037
|
+
children: [
|
|
4038
|
+
/* @__PURE__ */ jsxs9("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
4039
|
+
chainIconUrl(network.name, String(network.chainId)) ? /* @__PURE__ */ jsx10(
|
|
4040
|
+
"img",
|
|
4041
|
+
{
|
|
4042
|
+
src: chainIconUrl(network.name, String(network.chainId)),
|
|
4043
|
+
alt: "",
|
|
4044
|
+
"aria-hidden": "true",
|
|
4045
|
+
className: "size-4 shrink-0 rounded-[4px] object-contain"
|
|
4046
|
+
}
|
|
4047
|
+
) : /* @__PURE__ */ jsx10("span", { className: "flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-agg-separator text-[8px] text-agg-muted-foreground", children: network.name.slice(0, 2).toUpperCase() }),
|
|
4048
|
+
/* @__PURE__ */ jsx10("span", { className: "truncate text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: network.name })
|
|
4049
|
+
] }),
|
|
4050
|
+
network.venues.length > 0 ? /* @__PURE__ */ jsx10("span", { className: "hidden min-w-0 items-center gap-2 min-[440px]:flex", children: network.venues.map((venue) => /* @__PURE__ */ jsxs9(
|
|
4051
|
+
"span",
|
|
4052
|
+
{
|
|
4053
|
+
className: "flex h-6 shrink-0 items-center gap-1 rounded-agg-full bg-agg-secondary-hover px-3 text-agg-xs leading-agg-4 text-agg-foreground",
|
|
4054
|
+
children: [
|
|
4055
|
+
/* @__PURE__ */ jsx10(VenueLogo, { venue, size: "small", className: "size-3" }),
|
|
4056
|
+
VENUE_LABELS[venue]
|
|
4057
|
+
]
|
|
4058
|
+
},
|
|
4059
|
+
venue
|
|
4060
|
+
)) }) : null,
|
|
4061
|
+
/* @__PURE__ */ jsxs9("span", { className: "ml-auto flex shrink-0 items-center gap-4", children: [
|
|
4062
|
+
canManageBalance ? /* @__PURE__ */ jsxs9(
|
|
4063
|
+
"span",
|
|
4064
|
+
{
|
|
4065
|
+
className: cn(
|
|
4066
|
+
"hidden shrink-0 items-center gap-1.5 text-agg-xs leading-agg-4 min-[520px]:flex",
|
|
4067
|
+
hasAutoRefill ? "text-agg-foreground" : "text-agg-muted-foreground"
|
|
4068
|
+
),
|
|
4069
|
+
children: [
|
|
4070
|
+
hasAutoRefill ? /* @__PURE__ */ jsx10(
|
|
4071
|
+
Icon,
|
|
4072
|
+
{
|
|
4073
|
+
name: "success-check",
|
|
4074
|
+
size: "small",
|
|
4075
|
+
className: "size-2! text-agg-foreground"
|
|
4076
|
+
}
|
|
4077
|
+
) : null,
|
|
4078
|
+
hasAutoRefill ? refillLabels.autoRefill : refillLabels.noAutoRefill
|
|
4079
|
+
]
|
|
4080
|
+
}
|
|
4081
|
+
) : null,
|
|
4082
|
+
/* @__PURE__ */ jsx10(
|
|
4083
|
+
"span",
|
|
4084
|
+
{
|
|
4085
|
+
title: formattedBalance,
|
|
4086
|
+
className: "w-[60px] shrink-0 truncate text-right text-agg-sm leading-agg-5 font-agg-bold tabular-nums text-agg-foreground",
|
|
4087
|
+
children: formattedBalance
|
|
4088
|
+
}
|
|
4089
|
+
),
|
|
4090
|
+
/* @__PURE__ */ jsx10(
|
|
4091
|
+
Icon,
|
|
4092
|
+
{
|
|
4093
|
+
name: isExpanded ? "chevron-up" : "chevron-down",
|
|
4094
|
+
size: "small",
|
|
4095
|
+
className: cn(
|
|
4096
|
+
"size-4 shrink-0 text-agg-muted-foreground",
|
|
4097
|
+
canManageBalance ? "group-hover:text-agg-foreground" : "opacity-50"
|
|
4098
|
+
)
|
|
4099
|
+
}
|
|
4100
|
+
)
|
|
4101
|
+
] })
|
|
4102
|
+
]
|
|
4103
|
+
}
|
|
4104
|
+
),
|
|
4105
|
+
isExpanded ? /* @__PURE__ */ jsxs9("div", { id: `${descriptionId}-${network.chainId}-settings`, className: "mt-4", children: [
|
|
4106
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-start gap-x-6 gap-y-2", children: [
|
|
4107
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex w-[174px] shrink-0 items-start gap-2", children: [
|
|
4108
|
+
/* @__PURE__ */ jsx10(
|
|
4109
|
+
"label",
|
|
4110
|
+
{
|
|
4111
|
+
htmlFor: minimumInputId,
|
|
4112
|
+
className: "flex h-8 w-[26px] shrink-0 items-center text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground",
|
|
4113
|
+
children: refillLabels.minimumShortLabel
|
|
4114
|
+
}
|
|
4115
|
+
),
|
|
4116
|
+
/* @__PURE__ */ jsxs9("div", { className: "w-[140px]", children: [
|
|
4117
|
+
/* @__PURE__ */ jsxs9(
|
|
4118
|
+
"div",
|
|
4119
|
+
{
|
|
4120
|
+
className: cn(
|
|
4121
|
+
"flex h-8 items-center gap-2 rounded-agg-sm border bg-agg-secondary focus-within:ring-1 focus-within:ring-inset",
|
|
4122
|
+
rowErrors.minimum ? "border-agg-error focus-within:ring-agg-error" : "border-agg-separator focus-within:border-agg-primary focus-within:ring-agg-primary"
|
|
4123
|
+
),
|
|
4124
|
+
children: [
|
|
4125
|
+
/* @__PURE__ */ jsx10(
|
|
4126
|
+
"input",
|
|
4127
|
+
{
|
|
4128
|
+
id: minimumInputId,
|
|
4129
|
+
type: "text",
|
|
4130
|
+
inputMode: "decimal",
|
|
4131
|
+
autoComplete: "off",
|
|
4132
|
+
value: draft.minimum,
|
|
4133
|
+
disabled: isSaving,
|
|
4134
|
+
"aria-invalid": Boolean(rowErrors.minimum),
|
|
4135
|
+
"aria-describedby": rowErrors.minimum ? minimumErrorId : void 0,
|
|
4136
|
+
className: "h-full min-w-0 flex-1 rounded-l-agg-sm border-0 bg-transparent pr-0 pl-3 text-agg-sm leading-agg-5 text-agg-foreground outline-none disabled:cursor-not-allowed disabled:text-agg-muted-foreground",
|
|
4137
|
+
onChange: (event) => handleDraftChange(
|
|
4138
|
+
network.chainId,
|
|
4139
|
+
"minimum",
|
|
4140
|
+
event.target.value
|
|
4141
|
+
),
|
|
4142
|
+
onBlur: () => handleAmountBlur(network.chainId, "minimum")
|
|
4143
|
+
}
|
|
4144
|
+
),
|
|
4145
|
+
/* @__PURE__ */ jsx10("span", { className: "shrink-0 pr-3 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: refillLabels.unitLabel })
|
|
4146
|
+
]
|
|
4147
|
+
}
|
|
4148
|
+
),
|
|
4149
|
+
rowErrors.minimum ? /* @__PURE__ */ jsx10(
|
|
4150
|
+
"p",
|
|
4151
|
+
{
|
|
4152
|
+
id: minimumErrorId,
|
|
4153
|
+
role: "alert",
|
|
4154
|
+
className: "mt-1 text-agg-xs leading-agg-4 text-agg-error",
|
|
4155
|
+
children: rowErrors.minimum
|
|
4156
|
+
}
|
|
4157
|
+
) : null
|
|
4158
|
+
] })
|
|
4159
|
+
] }),
|
|
4160
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex w-[200px] shrink-0 items-start gap-2", children: [
|
|
4161
|
+
/* @__PURE__ */ jsx10(
|
|
4162
|
+
"label",
|
|
4163
|
+
{
|
|
4164
|
+
htmlFor: refillToInputId,
|
|
4165
|
+
className: "flex h-8 w-[52px] shrink-0 items-center text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground",
|
|
4166
|
+
children: refillLabels.refillToLabel
|
|
4167
|
+
}
|
|
4168
|
+
),
|
|
4169
|
+
/* @__PURE__ */ jsxs9("div", { className: "w-[140px]", children: [
|
|
4170
|
+
/* @__PURE__ */ jsxs9(
|
|
4171
|
+
"div",
|
|
4172
|
+
{
|
|
4173
|
+
className: cn(
|
|
4174
|
+
"flex h-8 items-center gap-2 rounded-agg-sm border bg-agg-secondary focus-within:ring-1 focus-within:ring-inset",
|
|
4175
|
+
rowErrors.refillTo ? "border-agg-error focus-within:ring-agg-error" : "border-agg-separator focus-within:border-agg-primary focus-within:ring-agg-primary"
|
|
4176
|
+
),
|
|
4177
|
+
children: [
|
|
4178
|
+
/* @__PURE__ */ jsx10(
|
|
4179
|
+
"input",
|
|
4180
|
+
{
|
|
4181
|
+
id: refillToInputId,
|
|
4182
|
+
type: "text",
|
|
4183
|
+
inputMode: "decimal",
|
|
4184
|
+
autoComplete: "off",
|
|
4185
|
+
value: draft.refillTo,
|
|
4186
|
+
disabled: isSaving,
|
|
4187
|
+
"aria-invalid": Boolean(rowErrors.refillTo),
|
|
4188
|
+
"aria-describedby": rowErrors.refillTo ? refillToErrorId : void 0,
|
|
4189
|
+
className: "h-full min-w-0 flex-1 rounded-l-agg-sm border-0 bg-transparent pr-0 pl-3 text-agg-sm leading-agg-5 text-agg-foreground outline-none disabled:cursor-not-allowed disabled:text-agg-muted-foreground",
|
|
4190
|
+
onChange: (event) => handleDraftChange(
|
|
4191
|
+
network.chainId,
|
|
4192
|
+
"refillTo",
|
|
4193
|
+
event.target.value
|
|
4194
|
+
),
|
|
4195
|
+
onBlur: () => handleAmountBlur(network.chainId, "refillTo")
|
|
4196
|
+
}
|
|
4197
|
+
),
|
|
4198
|
+
/* @__PURE__ */ jsx10("span", { className: "shrink-0 pr-3 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: refillLabels.unitLabel })
|
|
4199
|
+
]
|
|
4200
|
+
}
|
|
4201
|
+
),
|
|
4202
|
+
rowErrors.refillTo ? /* @__PURE__ */ jsx10(
|
|
4203
|
+
"p",
|
|
4204
|
+
{
|
|
4205
|
+
id: refillToErrorId,
|
|
4206
|
+
role: "alert",
|
|
4207
|
+
className: "mt-1 text-agg-xs leading-agg-4 text-agg-error",
|
|
4208
|
+
children: rowErrors.refillTo
|
|
4209
|
+
}
|
|
4210
|
+
) : null
|
|
4211
|
+
] })
|
|
4212
|
+
] }),
|
|
4213
|
+
hasAutoRefill ? /* @__PURE__ */ jsx10(
|
|
4214
|
+
"button",
|
|
4215
|
+
{
|
|
4216
|
+
type: "button",
|
|
4217
|
+
disabled: isSaving,
|
|
4218
|
+
className: "shrink-0 mt-1.5 cursor-pointer text-agg-sm leading-agg-5 font-agg-bold text-agg-primary outline-none hover:text-agg-primary-hover focus-visible:ring-2 focus-visible:ring-agg-primary-hover disabled:cursor-not-allowed disabled:opacity-60",
|
|
4219
|
+
onClick: () => handleResetNetwork(network),
|
|
4220
|
+
children: refillLabels.resetAction
|
|
4221
|
+
}
|
|
4222
|
+
) : null
|
|
4223
|
+
] }),
|
|
4224
|
+
rowErrors.general ? /* @__PURE__ */ jsx10("p", { role: "alert", className: "mt-2 text-agg-xs leading-agg-4 text-agg-error", children: rowErrors.general }) : null
|
|
4225
|
+
] }) : null
|
|
4226
|
+
]
|
|
4227
|
+
},
|
|
4228
|
+
network.chainId
|
|
4229
|
+
);
|
|
4230
|
+
}) }) }),
|
|
4231
|
+
/* @__PURE__ */ jsxs9(
|
|
4232
|
+
Modal.Footer,
|
|
4233
|
+
{
|
|
4234
|
+
hideBorder: true,
|
|
4235
|
+
classNames: {
|
|
4236
|
+
root: "h-[92px]! shrink-0 items-start! gap-3 px-8! pt-6! pb-7!"
|
|
4237
|
+
},
|
|
4238
|
+
children: [
|
|
4239
|
+
/* @__PURE__ */ jsx10(
|
|
4240
|
+
Button,
|
|
4241
|
+
{
|
|
4242
|
+
variant: "secondary",
|
|
4243
|
+
size: "large",
|
|
4244
|
+
className: "min-w-0 flex-1 md:w-[120px] md:flex-none",
|
|
4245
|
+
disabled: isSaving,
|
|
4246
|
+
onClick: () => handleOpenChange(false),
|
|
4247
|
+
children: refillLabels.cancelAction
|
|
4248
|
+
}
|
|
4249
|
+
),
|
|
4250
|
+
/* @__PURE__ */ jsx10(
|
|
4251
|
+
Button,
|
|
4252
|
+
{
|
|
4253
|
+
size: "large",
|
|
4254
|
+
className: "min-w-0 flex-1 md:w-[158px] md:flex-none",
|
|
4255
|
+
isLoading: isSaving,
|
|
4256
|
+
disabled: isSaveDisabled,
|
|
4257
|
+
"aria-label": refillLabels.saveChangesAction,
|
|
4258
|
+
onClick: () => void handleSave(),
|
|
4259
|
+
children: refillLabels.saveChangesAction
|
|
4260
|
+
}
|
|
4261
|
+
)
|
|
4262
|
+
]
|
|
4263
|
+
}
|
|
4264
|
+
)
|
|
4265
|
+
]
|
|
4266
|
+
}
|
|
4267
|
+
) });
|
|
4268
|
+
};
|
|
4269
|
+
ManageBalancesModal.displayName = "ManageBalancesModal";
|
|
4270
|
+
|
|
3562
4271
|
// src/pages/user-profile/components/positions-activity.tsx
|
|
3563
|
-
import { optimizedImageUrl as optimizedImageUrl3, useAggUiConfig as useAggUiConfig2, useLabels as
|
|
3564
|
-
import { Fragment as Fragment4, useEffect as
|
|
4272
|
+
import { optimizedImageUrl as optimizedImageUrl3, useAggUiConfig as useAggUiConfig2, useLabels as useLabels10 } from "@agg-build/hooks";
|
|
4273
|
+
import { Fragment as Fragment4, useEffect as useEffect10, useMemo as useMemo7, useRef as useRef9, useState as useState11 } from "react";
|
|
3565
4274
|
|
|
3566
4275
|
// src/pages/user-profile/user-profile.constants.ts
|
|
3567
4276
|
var USER_PROFILE_TAB_POSITIONS = "positions";
|
|
@@ -3761,7 +4470,7 @@ var toPositionRowViewModel = (position, labels = defaultLabels, formatters = {})
|
|
|
3761
4470
|
};
|
|
3762
4471
|
|
|
3763
4472
|
// src/pages/user-profile/components/activity-row.tsx
|
|
3764
|
-
import { Fragment as Fragment2, jsx as
|
|
4473
|
+
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3765
4474
|
var shouldOpenInNewTab = (activity) => {
|
|
3766
4475
|
return activity.kind === "redeem" || activity.kind === "deposit" || activity.kind === "withdrawal";
|
|
3767
4476
|
};
|
|
@@ -3778,7 +4487,7 @@ var RowWrapper = ({
|
|
|
3778
4487
|
}) => {
|
|
3779
4488
|
if (href) {
|
|
3780
4489
|
const opensInNewTab = target === "_blank";
|
|
3781
|
-
return /* @__PURE__ */
|
|
4490
|
+
return /* @__PURE__ */ jsx11(
|
|
3782
4491
|
"a",
|
|
3783
4492
|
{
|
|
3784
4493
|
href,
|
|
@@ -3794,7 +4503,7 @@ var RowWrapper = ({
|
|
|
3794
4503
|
}
|
|
3795
4504
|
);
|
|
3796
4505
|
}
|
|
3797
|
-
return /* @__PURE__ */
|
|
4506
|
+
return /* @__PURE__ */ jsx11("button", { type: "button", className, onClick, children });
|
|
3798
4507
|
};
|
|
3799
4508
|
var TRANSFER_ICON = {
|
|
3800
4509
|
withdrawal: "upload",
|
|
@@ -3829,7 +4538,7 @@ var AmountTimeStack = ({
|
|
|
3829
4538
|
timeLabel,
|
|
3830
4539
|
tone,
|
|
3831
4540
|
mobile
|
|
3832
|
-
}) => /* @__PURE__ */
|
|
4541
|
+
}) => /* @__PURE__ */ jsxs10(
|
|
3833
4542
|
"div",
|
|
3834
4543
|
{
|
|
3835
4544
|
className: cn(
|
|
@@ -3837,7 +4546,7 @@ var AmountTimeStack = ({
|
|
|
3837
4546
|
mobile ? "sm:hidden" : "hidden sm:flex sm:w-[120px] sm:shrink-0"
|
|
3838
4547
|
),
|
|
3839
4548
|
children: [
|
|
3840
|
-
/* @__PURE__ */
|
|
4549
|
+
/* @__PURE__ */ jsx11(
|
|
3841
4550
|
"p",
|
|
3842
4551
|
{
|
|
3843
4552
|
className: cn(
|
|
@@ -3848,7 +4557,7 @@ var AmountTimeStack = ({
|
|
|
3848
4557
|
children: amountLabel
|
|
3849
4558
|
}
|
|
3850
4559
|
),
|
|
3851
|
-
/* @__PURE__ */
|
|
4560
|
+
/* @__PURE__ */ jsx11(
|
|
3852
4561
|
"p",
|
|
3853
4562
|
{
|
|
3854
4563
|
className: cn(
|
|
@@ -3865,9 +4574,9 @@ var AmountTimeStack = ({
|
|
|
3865
4574
|
var TradeTypeCell = ({
|
|
3866
4575
|
activity,
|
|
3867
4576
|
tone
|
|
3868
|
-
}) => /* @__PURE__ */
|
|
3869
|
-
/* @__PURE__ */
|
|
3870
|
-
/* @__PURE__ */
|
|
4577
|
+
}) => /* @__PURE__ */ jsxs10("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
|
|
4578
|
+
/* @__PURE__ */ jsx11(VenueLogo, { venue: activity.venue, size: "small", className: "shrink-0" }),
|
|
4579
|
+
/* @__PURE__ */ jsx11(
|
|
3871
4580
|
"p",
|
|
3872
4581
|
{
|
|
3873
4582
|
className: cn(
|
|
@@ -3882,8 +4591,8 @@ var TradeTypeCell = ({
|
|
|
3882
4591
|
var TransferTypeCell = ({
|
|
3883
4592
|
activity,
|
|
3884
4593
|
tone
|
|
3885
|
-
}) => /* @__PURE__ */
|
|
3886
|
-
/* @__PURE__ */
|
|
4594
|
+
}) => /* @__PURE__ */ jsxs10("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
|
|
4595
|
+
/* @__PURE__ */ jsx11(
|
|
3887
4596
|
Icon,
|
|
3888
4597
|
{
|
|
3889
4598
|
name: TRANSFER_ICON[activity.kind],
|
|
@@ -3894,7 +4603,7 @@ var TransferTypeCell = ({
|
|
|
3894
4603
|
)
|
|
3895
4604
|
}
|
|
3896
4605
|
),
|
|
3897
|
-
/* @__PURE__ */
|
|
4606
|
+
/* @__PURE__ */ jsx11(
|
|
3898
4607
|
"p",
|
|
3899
4608
|
{
|
|
3900
4609
|
className: cn(
|
|
@@ -3909,8 +4618,8 @@ var TransferTypeCell = ({
|
|
|
3909
4618
|
var RedeemTypeCell = ({
|
|
3910
4619
|
activity,
|
|
3911
4620
|
tone
|
|
3912
|
-
}) => /* @__PURE__ */
|
|
3913
|
-
/* @__PURE__ */
|
|
4621
|
+
}) => /* @__PURE__ */ jsxs10("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
|
|
4622
|
+
/* @__PURE__ */ jsx11(
|
|
3914
4623
|
Icon,
|
|
3915
4624
|
{
|
|
3916
4625
|
name: "gift-bonus",
|
|
@@ -3921,7 +4630,7 @@ var RedeemTypeCell = ({
|
|
|
3921
4630
|
)
|
|
3922
4631
|
}
|
|
3923
4632
|
),
|
|
3924
|
-
/* @__PURE__ */
|
|
4633
|
+
/* @__PURE__ */ jsx11(
|
|
3925
4634
|
"p",
|
|
3926
4635
|
{
|
|
3927
4636
|
className: cn(
|
|
@@ -3938,7 +4647,7 @@ var OutcomeBadge = ({
|
|
|
3938
4647
|
tone
|
|
3939
4648
|
}) => {
|
|
3940
4649
|
if (!label) return null;
|
|
3941
|
-
return /* @__PURE__ */
|
|
4650
|
+
return /* @__PURE__ */ jsx11("span", { className: "agg-activity-outcome inline-flex items-center justify-center gap-1.5 rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ jsx11(
|
|
3942
4651
|
"span",
|
|
3943
4652
|
{
|
|
3944
4653
|
className: cn(
|
|
@@ -3952,9 +4661,9 @@ var OutcomeBadge = ({
|
|
|
3952
4661
|
var TradeOutcomeShares = ({
|
|
3953
4662
|
activity,
|
|
3954
4663
|
tone
|
|
3955
|
-
}) => /* @__PURE__ */
|
|
3956
|
-
/* @__PURE__ */
|
|
3957
|
-
/* @__PURE__ */
|
|
4664
|
+
}) => /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
4665
|
+
/* @__PURE__ */ jsx11(OutcomeBadge, { label: activity.outcomeLabel, tone }),
|
|
4666
|
+
/* @__PURE__ */ jsx11(
|
|
3958
4667
|
"span",
|
|
3959
4668
|
{
|
|
3960
4669
|
className: cn(
|
|
@@ -3975,7 +4684,7 @@ var RedeemRow = ({
|
|
|
3975
4684
|
const statusVisual = getStatusVisual(activity);
|
|
3976
4685
|
const activityStatus = resolveActivityStatus(activity);
|
|
3977
4686
|
const shouldShowInlineStatus = activityStatus === "pending";
|
|
3978
|
-
return /* @__PURE__ */
|
|
4687
|
+
return /* @__PURE__ */ jsx11(
|
|
3979
4688
|
RowWrapper,
|
|
3980
4689
|
{
|
|
3981
4690
|
className,
|
|
@@ -3983,7 +4692,7 @@ var RedeemRow = ({
|
|
|
3983
4692
|
target: href ? "_blank" : void 0,
|
|
3984
4693
|
rel: href ? "noopener noreferrer" : void 0,
|
|
3985
4694
|
onClick,
|
|
3986
|
-
children: /* @__PURE__ */
|
|
4695
|
+
children: /* @__PURE__ */ jsxs10(
|
|
3987
4696
|
"div",
|
|
3988
4697
|
{
|
|
3989
4698
|
className: cn(
|
|
@@ -3992,10 +4701,10 @@ var RedeemRow = ({
|
|
|
3992
4701
|
),
|
|
3993
4702
|
"data-status": activityStatus,
|
|
3994
4703
|
children: [
|
|
3995
|
-
/* @__PURE__ */
|
|
3996
|
-
/* @__PURE__ */
|
|
3997
|
-
/* @__PURE__ */
|
|
3998
|
-
/* @__PURE__ */
|
|
4704
|
+
/* @__PURE__ */ jsx11(RedeemTypeCell, { activity, tone }),
|
|
4705
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex w-full items-center justify-between sm:hidden", children: [
|
|
4706
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
4707
|
+
/* @__PURE__ */ jsx11(
|
|
3999
4708
|
Icon,
|
|
4000
4709
|
{
|
|
4001
4710
|
name: "gift-bonus",
|
|
@@ -4006,7 +4715,7 @@ var RedeemRow = ({
|
|
|
4006
4715
|
)
|
|
4007
4716
|
}
|
|
4008
4717
|
),
|
|
4009
|
-
/* @__PURE__ */
|
|
4718
|
+
/* @__PURE__ */ jsx11(
|
|
4010
4719
|
"p",
|
|
4011
4720
|
{
|
|
4012
4721
|
className: cn(
|
|
@@ -4018,11 +4727,11 @@ var RedeemRow = ({
|
|
|
4018
4727
|
}
|
|
4019
4728
|
)
|
|
4020
4729
|
] }),
|
|
4021
|
-
/* @__PURE__ */
|
|
4730
|
+
/* @__PURE__ */ jsx11(OutcomeBadge, { label: activity.outcomeLabel, tone })
|
|
4022
4731
|
] }),
|
|
4023
|
-
/* @__PURE__ */
|
|
4024
|
-
/* @__PURE__ */
|
|
4025
|
-
/* @__PURE__ */
|
|
4732
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex w-full items-center justify-between sm:contents", children: [
|
|
4733
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
|
|
4734
|
+
/* @__PURE__ */ jsx11("div", { className: "agg-activity-image flex h-10 w-10 shrink-0 items-center justify-center sm:h-15 sm:w-15", children: /* @__PURE__ */ jsx11(
|
|
4026
4735
|
RemoteImage,
|
|
4027
4736
|
{
|
|
4028
4737
|
src: activity.thumbnailSrc,
|
|
@@ -4031,9 +4740,9 @@ var RedeemRow = ({
|
|
|
4031
4740
|
classNames: { placeholder: "rounded-agg-sm sm:rounded-agg-lg" }
|
|
4032
4741
|
}
|
|
4033
4742
|
) }),
|
|
4034
|
-
/* @__PURE__ */
|
|
4035
|
-
/* @__PURE__ */
|
|
4036
|
-
/* @__PURE__ */
|
|
4743
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-1 sm:gap-2", children: [
|
|
4744
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
4745
|
+
/* @__PURE__ */ jsx11(
|
|
4037
4746
|
"p",
|
|
4038
4747
|
{
|
|
4039
4748
|
className: cn(
|
|
@@ -4043,13 +4752,13 @@ var RedeemRow = ({
|
|
|
4043
4752
|
children: activity.title
|
|
4044
4753
|
}
|
|
4045
4754
|
),
|
|
4046
|
-
shouldShowInlineStatus ? statusVisual.spin ? /* @__PURE__ */
|
|
4755
|
+
shouldShowInlineStatus ? statusVisual.spin ? /* @__PURE__ */ jsx11(
|
|
4047
4756
|
LoadingIcon,
|
|
4048
4757
|
{
|
|
4049
4758
|
size: "small",
|
|
4050
4759
|
className: cn("shrink-0", statusVisual.iconClassName)
|
|
4051
4760
|
}
|
|
4052
|
-
) : /* @__PURE__ */
|
|
4761
|
+
) : /* @__PURE__ */ jsx11(
|
|
4053
4762
|
Icon,
|
|
4054
4763
|
{
|
|
4055
4764
|
name: statusVisual.icon,
|
|
@@ -4058,9 +4767,9 @@ var RedeemRow = ({
|
|
|
4058
4767
|
}
|
|
4059
4768
|
) : null
|
|
4060
4769
|
] }),
|
|
4061
|
-
/* @__PURE__ */
|
|
4062
|
-
/* @__PURE__ */
|
|
4063
|
-
/* @__PURE__ */
|
|
4770
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 items-center gap-2 sm:gap-3", children: [
|
|
4771
|
+
/* @__PURE__ */ jsx11("div", { className: "hidden sm:block", children: /* @__PURE__ */ jsx11(OutcomeBadge, { label: activity.outcomeLabel, tone }) }),
|
|
4772
|
+
/* @__PURE__ */ jsx11(
|
|
4064
4773
|
"p",
|
|
4065
4774
|
{
|
|
4066
4775
|
className: cn(
|
|
@@ -4073,7 +4782,7 @@ var RedeemRow = ({
|
|
|
4073
4782
|
] })
|
|
4074
4783
|
] })
|
|
4075
4784
|
] }),
|
|
4076
|
-
/* @__PURE__ */
|
|
4785
|
+
/* @__PURE__ */ jsx11(
|
|
4077
4786
|
AmountTimeStack,
|
|
4078
4787
|
{
|
|
4079
4788
|
amountLabel: activity.amountLabel,
|
|
@@ -4083,7 +4792,7 @@ var RedeemRow = ({
|
|
|
4083
4792
|
}
|
|
4084
4793
|
)
|
|
4085
4794
|
] }),
|
|
4086
|
-
/* @__PURE__ */
|
|
4795
|
+
/* @__PURE__ */ jsx11(
|
|
4087
4796
|
AmountTimeStack,
|
|
4088
4797
|
{
|
|
4089
4798
|
amountLabel: activity.amountLabel,
|
|
@@ -4104,7 +4813,7 @@ var TradeRow = ({
|
|
|
4104
4813
|
onClick
|
|
4105
4814
|
}) => {
|
|
4106
4815
|
const tone = resolveToneClasses(activity);
|
|
4107
|
-
return /* @__PURE__ */
|
|
4816
|
+
return /* @__PURE__ */ jsx11(RowWrapper, { className: cn(className), href, onClick, children: /* @__PURE__ */ jsxs10(
|
|
4108
4817
|
"div",
|
|
4109
4818
|
{
|
|
4110
4819
|
className: cn(
|
|
@@ -4112,10 +4821,10 @@ var TradeRow = ({
|
|
|
4112
4821
|
"relative z-10"
|
|
4113
4822
|
),
|
|
4114
4823
|
children: [
|
|
4115
|
-
/* @__PURE__ */
|
|
4116
|
-
/* @__PURE__ */
|
|
4117
|
-
/* @__PURE__ */
|
|
4118
|
-
/* @__PURE__ */
|
|
4824
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex w-full items-center justify-between sm:hidden", children: [
|
|
4825
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
4826
|
+
/* @__PURE__ */ jsx11(VenueLogo, { venue: activity.venue, size: "small", className: "size-5 shrink-0" }),
|
|
4827
|
+
/* @__PURE__ */ jsx11(
|
|
4119
4828
|
"p",
|
|
4120
4829
|
{
|
|
4121
4830
|
className: cn(
|
|
@@ -4127,12 +4836,12 @@ var TradeRow = ({
|
|
|
4127
4836
|
}
|
|
4128
4837
|
)
|
|
4129
4838
|
] }),
|
|
4130
|
-
/* @__PURE__ */
|
|
4839
|
+
/* @__PURE__ */ jsx11("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsx11(TradeOutcomeShares, { activity, tone }) })
|
|
4131
4840
|
] }),
|
|
4132
|
-
/* @__PURE__ */
|
|
4133
|
-
/* @__PURE__ */
|
|
4134
|
-
/* @__PURE__ */
|
|
4135
|
-
/* @__PURE__ */
|
|
4841
|
+
/* @__PURE__ */ jsx11(TradeTypeCell, { activity, tone }),
|
|
4842
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex w-full items-center justify-between sm:contents", children: [
|
|
4843
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
|
|
4844
|
+
/* @__PURE__ */ jsx11("div", { className: "agg-activity-image flex h-10 w-10 shrink-0 items-center justify-center sm:h-15 sm:w-15", children: /* @__PURE__ */ jsx11(
|
|
4136
4845
|
RemoteImage,
|
|
4137
4846
|
{
|
|
4138
4847
|
src: activity.thumbnailSrc,
|
|
@@ -4141,8 +4850,8 @@ var TradeRow = ({
|
|
|
4141
4850
|
classNames: { placeholder: "rounded-agg-sm sm:rounded-agg-lg" }
|
|
4142
4851
|
}
|
|
4143
4852
|
) }),
|
|
4144
|
-
/* @__PURE__ */
|
|
4145
|
-
/* @__PURE__ */
|
|
4853
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
|
|
4854
|
+
/* @__PURE__ */ jsx11(
|
|
4146
4855
|
"p",
|
|
4147
4856
|
{
|
|
4148
4857
|
className: cn(
|
|
@@ -4152,10 +4861,10 @@ var TradeRow = ({
|
|
|
4152
4861
|
children: activity.title
|
|
4153
4862
|
}
|
|
4154
4863
|
),
|
|
4155
|
-
/* @__PURE__ */
|
|
4864
|
+
/* @__PURE__ */ jsx11("div", { className: "hidden flex-wrap items-center gap-2 sm:flex sm:gap-3", children: /* @__PURE__ */ jsx11(TradeOutcomeShares, { activity, tone }) })
|
|
4156
4865
|
] })
|
|
4157
4866
|
] }),
|
|
4158
|
-
/* @__PURE__ */
|
|
4867
|
+
/* @__PURE__ */ jsx11(
|
|
4159
4868
|
AmountTimeStack,
|
|
4160
4869
|
{
|
|
4161
4870
|
amountLabel: activity.amountLabel,
|
|
@@ -4165,7 +4874,7 @@ var TradeRow = ({
|
|
|
4165
4874
|
}
|
|
4166
4875
|
)
|
|
4167
4876
|
] }),
|
|
4168
|
-
/* @__PURE__ */
|
|
4877
|
+
/* @__PURE__ */ jsx11(
|
|
4169
4878
|
AmountTimeStack,
|
|
4170
4879
|
{
|
|
4171
4880
|
amountLabel: activity.amountLabel,
|
|
@@ -4187,7 +4896,7 @@ var TransferRow = ({
|
|
|
4187
4896
|
const transferStatus = resolveActivityStatus(activity);
|
|
4188
4897
|
const transferIconName = TRANSFER_ICON[activity.kind];
|
|
4189
4898
|
const statusVisual = getStatusVisual(activity);
|
|
4190
|
-
return /* @__PURE__ */
|
|
4899
|
+
return /* @__PURE__ */ jsx11(
|
|
4191
4900
|
RowWrapper,
|
|
4192
4901
|
{
|
|
4193
4902
|
className,
|
|
@@ -4195,7 +4904,7 @@ var TransferRow = ({
|
|
|
4195
4904
|
target: href ? "_blank" : void 0,
|
|
4196
4905
|
rel: href ? "noopener noreferrer" : void 0,
|
|
4197
4906
|
onClick,
|
|
4198
|
-
children: /* @__PURE__ */
|
|
4907
|
+
children: /* @__PURE__ */ jsxs10(
|
|
4199
4908
|
"div",
|
|
4200
4909
|
{
|
|
4201
4910
|
className: cn(
|
|
@@ -4203,9 +4912,9 @@ var TransferRow = ({
|
|
|
4203
4912
|
"relative z-10"
|
|
4204
4913
|
),
|
|
4205
4914
|
children: [
|
|
4206
|
-
/* @__PURE__ */
|
|
4207
|
-
/* @__PURE__ */
|
|
4208
|
-
/* @__PURE__ */
|
|
4915
|
+
/* @__PURE__ */ jsx11(TransferTypeCell, { activity, tone }),
|
|
4916
|
+
/* @__PURE__ */ jsx11("div", { className: "flex w-full items-center justify-between sm:hidden", children: /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
4917
|
+
/* @__PURE__ */ jsx11(
|
|
4209
4918
|
Icon,
|
|
4210
4919
|
{
|
|
4211
4920
|
name: transferIconName,
|
|
@@ -4216,7 +4925,7 @@ var TransferRow = ({
|
|
|
4216
4925
|
)
|
|
4217
4926
|
}
|
|
4218
4927
|
),
|
|
4219
|
-
/* @__PURE__ */
|
|
4928
|
+
/* @__PURE__ */ jsx11(
|
|
4220
4929
|
"p",
|
|
4221
4930
|
{
|
|
4222
4931
|
className: cn(
|
|
@@ -4228,14 +4937,14 @@ var TransferRow = ({
|
|
|
4228
4937
|
}
|
|
4229
4938
|
)
|
|
4230
4939
|
] }) }),
|
|
4231
|
-
/* @__PURE__ */
|
|
4232
|
-
/* @__PURE__ */
|
|
4233
|
-
/* @__PURE__ */
|
|
4940
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex w-full items-center justify-between sm:contents", children: [
|
|
4941
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
|
|
4942
|
+
/* @__PURE__ */ jsx11(
|
|
4234
4943
|
"div",
|
|
4235
4944
|
{
|
|
4236
4945
|
className: "agg-activity-deposit-square hidden h-15 w-15 shrink-0 items-center justify-center rounded-agg-lg bg-agg-secondary-hover sm:flex",
|
|
4237
4946
|
"data-status": transferStatus,
|
|
4238
|
-
children: statusVisual.spin ? /* @__PURE__ */
|
|
4947
|
+
children: statusVisual.spin ? /* @__PURE__ */ jsx11(LoadingIcon, { size: "medium", className: cn(statusVisual.iconClassName) }) : /* @__PURE__ */ jsx11(
|
|
4239
4948
|
Icon,
|
|
4240
4949
|
{
|
|
4241
4950
|
name: statusVisual.icon,
|
|
@@ -4245,8 +4954,8 @@ var TransferRow = ({
|
|
|
4245
4954
|
)
|
|
4246
4955
|
}
|
|
4247
4956
|
),
|
|
4248
|
-
/* @__PURE__ */
|
|
4249
|
-
/* @__PURE__ */
|
|
4957
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-1", children: [
|
|
4958
|
+
/* @__PURE__ */ jsx11(
|
|
4250
4959
|
"p",
|
|
4251
4960
|
{
|
|
4252
4961
|
className: cn(
|
|
@@ -4256,7 +4965,7 @@ var TransferRow = ({
|
|
|
4256
4965
|
children: activity.title
|
|
4257
4966
|
}
|
|
4258
4967
|
),
|
|
4259
|
-
/* @__PURE__ */
|
|
4968
|
+
/* @__PURE__ */ jsx11(
|
|
4260
4969
|
"p",
|
|
4261
4970
|
{
|
|
4262
4971
|
className: cn(
|
|
@@ -4268,7 +4977,7 @@ var TransferRow = ({
|
|
|
4268
4977
|
)
|
|
4269
4978
|
] })
|
|
4270
4979
|
] }),
|
|
4271
|
-
/* @__PURE__ */
|
|
4980
|
+
/* @__PURE__ */ jsx11(
|
|
4272
4981
|
AmountTimeStack,
|
|
4273
4982
|
{
|
|
4274
4983
|
amountLabel: activity.amountLabel,
|
|
@@ -4278,7 +4987,7 @@ var TransferRow = ({
|
|
|
4278
4987
|
}
|
|
4279
4988
|
)
|
|
4280
4989
|
] }),
|
|
4281
|
-
/* @__PURE__ */
|
|
4990
|
+
/* @__PURE__ */ jsx11(
|
|
4282
4991
|
AmountTimeStack,
|
|
4283
4992
|
{
|
|
4284
4993
|
amountLabel: activity.amountLabel,
|
|
@@ -4304,10 +5013,10 @@ var ActivityRow = ({ activity, href, onClick }) => {
|
|
|
4304
5013
|
"before:bg-agg-secondary-hover before:rounded-agg-xl"
|
|
4305
5014
|
);
|
|
4306
5015
|
if (activity.kind === "trade") {
|
|
4307
|
-
return /* @__PURE__ */
|
|
5016
|
+
return /* @__PURE__ */ jsx11(TradeRow, { activity, className: sharedClassName, href, onClick: handleClick });
|
|
4308
5017
|
}
|
|
4309
5018
|
if (activity.kind === "redeem") {
|
|
4310
|
-
return /* @__PURE__ */
|
|
5019
|
+
return /* @__PURE__ */ jsx11(
|
|
4311
5020
|
RedeemRow,
|
|
4312
5021
|
{
|
|
4313
5022
|
activity,
|
|
@@ -4317,7 +5026,7 @@ var ActivityRow = ({ activity, href, onClick }) => {
|
|
|
4317
5026
|
}
|
|
4318
5027
|
);
|
|
4319
5028
|
}
|
|
4320
|
-
return /* @__PURE__ */
|
|
5029
|
+
return /* @__PURE__ */ jsx11(
|
|
4321
5030
|
TransferRow,
|
|
4322
5031
|
{
|
|
4323
5032
|
activity,
|
|
@@ -4330,19 +5039,19 @@ var ActivityRow = ({ activity, href, onClick }) => {
|
|
|
4330
5039
|
ActivityRow.displayName = "ActivityRow";
|
|
4331
5040
|
|
|
4332
5041
|
// src/pages/user-profile/components/empty-state.tsx
|
|
4333
|
-
import { jsx as
|
|
5042
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4334
5043
|
var EmptyState = ({ title, description, className }) => {
|
|
4335
|
-
return /* @__PURE__ */
|
|
5044
|
+
return /* @__PURE__ */ jsx12(
|
|
4336
5045
|
"div",
|
|
4337
5046
|
{
|
|
4338
5047
|
className: cn("flex flex-col items-center justify-center gap-8 p-10", className),
|
|
4339
5048
|
role: "status",
|
|
4340
5049
|
"aria-live": "polite",
|
|
4341
|
-
children: /* @__PURE__ */
|
|
4342
|
-
/* @__PURE__ */
|
|
4343
|
-
/* @__PURE__ */
|
|
4344
|
-
/* @__PURE__ */
|
|
4345
|
-
description ? /* @__PURE__ */
|
|
5050
|
+
children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-center gap-5", children: [
|
|
5051
|
+
/* @__PURE__ */ jsx12(SearchEmptyIcon, { className: "h-10 w-10 text-agg-muted-foreground", "aria-hidden": true }),
|
|
5052
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-center gap-1 text-center text-agg-foreground", children: [
|
|
5053
|
+
/* @__PURE__ */ jsx12("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold", children: title }),
|
|
5054
|
+
description ? /* @__PURE__ */ jsx12("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal", children: description }) : null
|
|
4346
5055
|
] })
|
|
4347
5056
|
] })
|
|
4348
5057
|
}
|
|
@@ -4351,8 +5060,8 @@ var EmptyState = ({ title, description, className }) => {
|
|
|
4351
5060
|
EmptyState.displayName = "EmptyState";
|
|
4352
5061
|
|
|
4353
5062
|
// src/pages/user-profile/components/open-order-row.tsx
|
|
4354
|
-
import { optimizedImageUrl, useLabels as
|
|
4355
|
-
import { jsx as
|
|
5063
|
+
import { optimizedImageUrl, useLabels as useLabels8 } from "@agg-build/hooks";
|
|
5064
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4356
5065
|
var shouldUseNativeLinkNavigation2 = (event) => {
|
|
4357
5066
|
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
|
|
4358
5067
|
};
|
|
@@ -4383,7 +5092,7 @@ var OpenOrderRow = ({
|
|
|
4383
5092
|
expirationHeader
|
|
4384
5093
|
}) => {
|
|
4385
5094
|
var _a, _b, _c, _d;
|
|
4386
|
-
const labels =
|
|
5095
|
+
const labels = useLabels8().userProfile.openOrders;
|
|
4387
5096
|
const resolvedCancelLabel = cancelLabel != null ? cancelLabel : labels.cancel;
|
|
4388
5097
|
const resolvedCancelAriaLabel = cancelAriaLabel != null ? cancelAriaLabel : labels.cancelOrderAria(order.id);
|
|
4389
5098
|
const resolvedLimitPriceHeader = limitPriceHeader != null ? limitPriceHeader : labels.limitPriceHeader;
|
|
@@ -4420,7 +5129,7 @@ var OpenOrderRow = ({
|
|
|
4420
5129
|
handleDivClick();
|
|
4421
5130
|
}
|
|
4422
5131
|
};
|
|
4423
|
-
return /* @__PURE__ */
|
|
5132
|
+
return /* @__PURE__ */ jsx13(
|
|
4424
5133
|
Wrapper,
|
|
4425
5134
|
__spreadProps(__spreadValues({
|
|
4426
5135
|
"aria-label": order.title,
|
|
@@ -4431,9 +5140,9 @@ var OpenOrderRow = ({
|
|
|
4431
5140
|
"hover:before:opacity-100 focus-visible:before:opacity-100"
|
|
4432
5141
|
)
|
|
4433
5142
|
}, wrapperProps), {
|
|
4434
|
-
children: /* @__PURE__ */
|
|
4435
|
-
/* @__PURE__ */
|
|
4436
|
-
/* @__PURE__ */
|
|
5143
|
+
children: /* @__PURE__ */ jsxs12("div", { className: "agg-open-order-row-content relative z-10 flex w-full flex-col gap-3 rounded-agg-xl px-3 py-2.5 text-left lg:flex-row lg:items-center lg:gap-6 lg:px-0 lg:py-0", children: [
|
|
5144
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex min-w-0 flex-1 items-center gap-3 lg:gap-4", children: [
|
|
5145
|
+
/* @__PURE__ */ jsx13("div", { className: "agg-open-order-image flex h-10 w-10 shrink-0 items-center justify-center lg:h-15 lg:w-15", children: /* @__PURE__ */ jsx13(
|
|
4437
5146
|
RemoteImage,
|
|
4438
5147
|
{
|
|
4439
5148
|
src: optimizedImageUrl(order.thumbnailSrc, 60),
|
|
@@ -4441,35 +5150,35 @@ var OpenOrderRow = ({
|
|
|
4441
5150
|
className: "h-full w-full rounded-agg-sm object-cover"
|
|
4442
5151
|
}
|
|
4443
5152
|
) }),
|
|
4444
|
-
/* @__PURE__ */
|
|
4445
|
-
/* @__PURE__ */
|
|
4446
|
-
/* @__PURE__ */
|
|
5153
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
|
|
5154
|
+
/* @__PURE__ */ jsx13("p", { className: "agg-open-order-market min-w-0 overflow-hidden font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground [display:-webkit-box] [-webkit-line-clamp:2] [-webkit-box-orient:vertical] lg:text-agg-base lg:leading-agg-6 lg:whitespace-nowrap lg:text-ellipsis lg:[-webkit-line-clamp:1] lg:[display:block]", children: order.title }),
|
|
5155
|
+
/* @__PURE__ */ jsx13("span", { className: "agg-open-order-outcome hidden lg:inline-flex w-fit items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ jsx13("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: order.outcomeLabel }) })
|
|
4447
5156
|
] })
|
|
4448
5157
|
] }),
|
|
4449
|
-
/* @__PURE__ */
|
|
4450
|
-
/* @__PURE__ */
|
|
5158
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex w-full flex-wrap items-center gap-x-4 gap-y-2 lg:hidden", children: [
|
|
5159
|
+
/* @__PURE__ */ jsx13("span", { className: "agg-open-order-outcome inline-flex shrink-0 items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ jsx13("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: order.outcomeLabel }) }),
|
|
4451
5160
|
[
|
|
4452
5161
|
{ label: resolvedLimitPriceHeader, value: (_a = order.limitPriceLabel) != null ? _a : "\u2014" },
|
|
4453
5162
|
{ label: resolvedFilledHeader, value: order.filledLabel },
|
|
4454
5163
|
{ label: resolvedTotalHeader, value: order.valueLabel },
|
|
4455
5164
|
{ label: resolvedExpirationHeader, value: (_b = order.expirationLabel) != null ? _b : "\u2014" }
|
|
4456
|
-
].map(({ label, value }) => /* @__PURE__ */
|
|
4457
|
-
/* @__PURE__ */
|
|
4458
|
-
/* @__PURE__ */
|
|
5165
|
+
].map(({ label, value }) => /* @__PURE__ */ jsxs12("div", { className: "flex items-baseline gap-1.5 whitespace-nowrap", children: [
|
|
5166
|
+
/* @__PURE__ */ jsx13("span", { className: "font-agg-sans text-agg-lg leading-agg-7 font-agg-normal text-agg-foreground", children: value }),
|
|
5167
|
+
/* @__PURE__ */ jsx13("span", { className: "font-agg-sans text-[10px] leading-[14px] font-agg-bold uppercase text-agg-muted-foreground", children: label })
|
|
4459
5168
|
] }, label))
|
|
4460
5169
|
] }),
|
|
4461
|
-
/* @__PURE__ */
|
|
4462
|
-
/* @__PURE__ */
|
|
4463
|
-
/* @__PURE__ */
|
|
4464
|
-
/* @__PURE__ */
|
|
4465
|
-
/* @__PURE__ */
|
|
5170
|
+
/* @__PURE__ */ jsx13("p", { className: "agg-open-order-limit-price hidden w-[120px] shrink-0 agg-type-body-strong text-agg-foreground lg:block", children: (_c = order.limitPriceLabel) != null ? _c : "\u2014" }),
|
|
5171
|
+
/* @__PURE__ */ jsx13("p", { className: "agg-open-order-filled hidden w-[120px] shrink-0 agg-type-body-strong text-agg-foreground lg:block", children: order.filledLabel }),
|
|
5172
|
+
/* @__PURE__ */ jsx13("p", { className: "agg-open-order-value hidden w-[120px] shrink-0 agg-type-body-strong text-agg-foreground lg:block", children: order.valueLabel }),
|
|
5173
|
+
/* @__PURE__ */ jsx13("p", { className: "agg-open-order-expiration hidden w-[140px] shrink-0 agg-type-label text-agg-foreground lg:block", children: (_d = order.expirationLabel) != null ? _d : "\u2014" }),
|
|
5174
|
+
/* @__PURE__ */ jsx13(
|
|
4466
5175
|
"div",
|
|
4467
5176
|
{
|
|
4468
5177
|
className: cn(
|
|
4469
5178
|
"shrink-0 justify-end",
|
|
4470
5179
|
canCancel ? "flex w-full lg:w-[80px]" : "hidden lg:flex lg:w-[80px]"
|
|
4471
5180
|
),
|
|
4472
|
-
children: canCancel ? /* @__PURE__ */
|
|
5181
|
+
children: canCancel ? /* @__PURE__ */ jsx13(
|
|
4473
5182
|
Button,
|
|
4474
5183
|
{
|
|
4475
5184
|
variant: "secondary",
|
|
@@ -4491,8 +5200,8 @@ var OpenOrderRow = ({
|
|
|
4491
5200
|
OpenOrderRow.displayName = "OpenOrderRow";
|
|
4492
5201
|
|
|
4493
5202
|
// src/pages/user-profile/components/position-row.tsx
|
|
4494
|
-
import { optimizedImageUrl as optimizedImageUrl2, useAggUiConfig, useLabels as
|
|
4495
|
-
import { Fragment as Fragment3, jsx as
|
|
5203
|
+
import { optimizedImageUrl as optimizedImageUrl2, useAggUiConfig, useLabels as useLabels9 } from "@agg-build/hooks";
|
|
5204
|
+
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4496
5205
|
var shouldUseNativeLinkNavigation3 = (event) => {
|
|
4497
5206
|
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
|
|
4498
5207
|
};
|
|
@@ -4501,21 +5210,21 @@ var toneTextClassName = (tone) => {
|
|
|
4501
5210
|
if (tone === "negative") return "text-agg-error";
|
|
4502
5211
|
return "text-agg-muted-foreground";
|
|
4503
5212
|
};
|
|
4504
|
-
var OutcomePill = ({ label }) => /* @__PURE__ */
|
|
4505
|
-
var ResolutionPill = ({ label }) => /* @__PURE__ */
|
|
5213
|
+
var OutcomePill = ({ label }) => /* @__PURE__ */ jsx14("span", { className: "agg-position-outcome max-w-[120px] inline-flex items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ jsx14("span", { className: "whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground truncate", children: label }) });
|
|
5214
|
+
var ResolutionPill = ({ label }) => /* @__PURE__ */ jsx14("span", { className: "agg-position-resolution-pill inline-flex w-full items-center justify-center overflow-hidden rounded-full bg-agg-secondary-hover px-4 py-[6px] md:w-auto", children: /* @__PURE__ */ jsx14("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: label }) });
|
|
4506
5215
|
var VenueShares = ({
|
|
4507
5216
|
model,
|
|
4508
5217
|
className,
|
|
4509
5218
|
keyPrefix
|
|
4510
5219
|
}) => {
|
|
4511
5220
|
if (model.venueShareBreakdown.length === 0) return null;
|
|
4512
|
-
return /* @__PURE__ */
|
|
5221
|
+
return /* @__PURE__ */ jsx14("div", { className: cn(className, "gap-x-3 gap-y-2"), children: model.venueShareBreakdown.map((row, index) => /* @__PURE__ */ jsxs13(
|
|
4513
5222
|
"div",
|
|
4514
5223
|
{
|
|
4515
5224
|
className: "flex min-w-0 max-w-full items-center gap-1",
|
|
4516
5225
|
children: [
|
|
4517
|
-
/* @__PURE__ */
|
|
4518
|
-
/* @__PURE__ */
|
|
5226
|
+
/* @__PURE__ */ jsx14(VenueLogo, { venue: row.venue, size: "small", className: "size-4 shrink-0" }),
|
|
5227
|
+
/* @__PURE__ */ jsx14("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: row.sharesLabel })
|
|
4519
5228
|
]
|
|
4520
5229
|
},
|
|
4521
5230
|
`${keyPrefix}-${row.venue}-${row.sharesLabel}-${String(index)}`
|
|
@@ -4527,7 +5236,7 @@ var StatusBadge = ({
|
|
|
4527
5236
|
}) => {
|
|
4528
5237
|
if (status === "lost" || status === "won_claimed") return null;
|
|
4529
5238
|
const isWon = status === "won_unclaimed";
|
|
4530
|
-
return /* @__PURE__ */
|
|
5239
|
+
return /* @__PURE__ */ jsxs13(
|
|
4531
5240
|
"span",
|
|
4532
5241
|
{
|
|
4533
5242
|
className: cn(
|
|
@@ -4536,7 +5245,7 @@ var StatusBadge = ({
|
|
|
4536
5245
|
isWon ? "border-agg-success/50 bg-agg-success/10 text-agg-success" : "border-agg-muted-foreground/30 bg-agg-secondary-hover text-agg-foreground"
|
|
4537
5246
|
),
|
|
4538
5247
|
children: [
|
|
4539
|
-
/* @__PURE__ */
|
|
5248
|
+
/* @__PURE__ */ jsx14(Icon, { name: isWon ? "check-circle" : "hourglass-start", size: "small", className: "size-2.5!" }),
|
|
4540
5249
|
isWon ? labels.won : labels.open
|
|
4541
5250
|
]
|
|
4542
5251
|
}
|
|
@@ -4549,7 +5258,7 @@ var ResultBadge = ({
|
|
|
4549
5258
|
if (status !== "won_claimed" && status !== "lost" && status !== "sold") return null;
|
|
4550
5259
|
const isWon = status === "won_claimed";
|
|
4551
5260
|
const isSold = status === "sold";
|
|
4552
|
-
return /* @__PURE__ */
|
|
5261
|
+
return /* @__PURE__ */ jsxs13(
|
|
4553
5262
|
"span",
|
|
4554
5263
|
{
|
|
4555
5264
|
className: cn(
|
|
@@ -4558,7 +5267,7 @@ var ResultBadge = ({
|
|
|
4558
5267
|
isWon ? "border-agg-success/50 bg-agg-success/10 text-agg-success" : isSold ? "border-agg-muted-foreground/30 bg-agg-secondary-hover text-agg-muted-foreground" : "border-agg-error/50 bg-agg-error/10 text-agg-error"
|
|
4559
5268
|
),
|
|
4560
5269
|
children: [
|
|
4561
|
-
/* @__PURE__ */
|
|
5270
|
+
/* @__PURE__ */ jsx14(
|
|
4562
5271
|
Icon,
|
|
4563
5272
|
{
|
|
4564
5273
|
name: isWon ? "check-circle" : isSold ? "hourglass-start" : "cross-circle",
|
|
@@ -4574,27 +5283,27 @@ var ResultBadge = ({
|
|
|
4574
5283
|
var TotalTradedCell = ({
|
|
4575
5284
|
model,
|
|
4576
5285
|
className
|
|
4577
|
-
}) => /* @__PURE__ */
|
|
5286
|
+
}) => /* @__PURE__ */ jsxs13(
|
|
4578
5287
|
"div",
|
|
4579
5288
|
{
|
|
4580
5289
|
className: cn("agg-position-total-traded flex flex-col gap-[2px] whitespace-nowrap", className),
|
|
4581
5290
|
children: [
|
|
4582
|
-
/* @__PURE__ */
|
|
4583
|
-
/* @__PURE__ */
|
|
5291
|
+
/* @__PURE__ */ jsx14("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: model.totalTraded.primaryLabel }),
|
|
5292
|
+
/* @__PURE__ */ jsx14("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: model.totalTraded.averageLabel })
|
|
4584
5293
|
]
|
|
4585
5294
|
}
|
|
4586
5295
|
);
|
|
4587
5296
|
var PositionValueCell = ({
|
|
4588
5297
|
value,
|
|
4589
5298
|
className
|
|
4590
|
-
}) => /* @__PURE__ */
|
|
5299
|
+
}) => /* @__PURE__ */ jsxs13(
|
|
4591
5300
|
"div",
|
|
4592
5301
|
{
|
|
4593
5302
|
className: cn("agg-position-value-cell flex flex-col gap-[2px] whitespace-nowrap", className),
|
|
4594
5303
|
children: [
|
|
4595
|
-
/* @__PURE__ */
|
|
4596
|
-
/* @__PURE__ */
|
|
4597
|
-
/* @__PURE__ */
|
|
5304
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-baseline gap-1.5", children: [
|
|
5305
|
+
/* @__PURE__ */ jsx14("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: value.primaryLabel }),
|
|
5306
|
+
/* @__PURE__ */ jsx14(
|
|
4598
5307
|
"p",
|
|
4599
5308
|
{
|
|
4600
5309
|
className: cn(
|
|
@@ -4605,9 +5314,9 @@ var PositionValueCell = ({
|
|
|
4605
5314
|
}
|
|
4606
5315
|
)
|
|
4607
5316
|
] }),
|
|
4608
|
-
/* @__PURE__ */
|
|
4609
|
-
/* @__PURE__ */
|
|
4610
|
-
/* @__PURE__ */
|
|
5317
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-baseline gap-1.5", children: [
|
|
5318
|
+
/* @__PURE__ */ jsx14("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: value.priceLabel }),
|
|
5319
|
+
/* @__PURE__ */ jsx14(
|
|
4611
5320
|
"p",
|
|
4612
5321
|
{
|
|
4613
5322
|
className: cn(
|
|
@@ -4629,7 +5338,7 @@ var PositionRow = ({
|
|
|
4629
5338
|
onClaim,
|
|
4630
5339
|
isClaiming = false
|
|
4631
5340
|
}) => {
|
|
4632
|
-
const labels =
|
|
5341
|
+
const labels = useLabels9().userProfile.positions;
|
|
4633
5342
|
const { formatCurrency: formatCurrency2, formatPrice } = useAggUiConfig().formatting;
|
|
4634
5343
|
const model = toPositionRowViewModel(
|
|
4635
5344
|
position,
|
|
@@ -4675,7 +5384,7 @@ var PositionRow = ({
|
|
|
4675
5384
|
handleDivClick();
|
|
4676
5385
|
}
|
|
4677
5386
|
};
|
|
4678
|
-
return /* @__PURE__ */
|
|
5387
|
+
return /* @__PURE__ */ jsx14(Wrapper, __spreadProps(__spreadValues({ className: sharedClassName }, wrapperProps), { children: /* @__PURE__ */ jsxs13(
|
|
4679
5388
|
"div",
|
|
4680
5389
|
{
|
|
4681
5390
|
className: cn(
|
|
@@ -4683,9 +5392,9 @@ var PositionRow = ({
|
|
|
4683
5392
|
isClosed ? "md:gap-8" : "md:gap-6"
|
|
4684
5393
|
),
|
|
4685
5394
|
children: [
|
|
4686
|
-
/* @__PURE__ */
|
|
4687
|
-
/* @__PURE__ */
|
|
4688
|
-
/* @__PURE__ */
|
|
5395
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex w-full items-center justify-between gap-3 md:w-auto md:min-w-0 md:flex-1 md:justify-start md:gap-4", children: [
|
|
5396
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex min-w-0 flex-1 items-center gap-3 md:gap-4", children: [
|
|
5397
|
+
/* @__PURE__ */ jsx14("div", { className: "agg-position-image flex h-10 w-10 shrink-0 items-center justify-center md:h-15 md:w-15", children: /* @__PURE__ */ jsx14(
|
|
4689
5398
|
RemoteImage,
|
|
4690
5399
|
{
|
|
4691
5400
|
src: optimizedImageUrl2(model.thumbnailSrc, 60),
|
|
@@ -4693,11 +5402,11 @@ var PositionRow = ({
|
|
|
4693
5402
|
className: "h-full w-full rounded-agg-sm object-cover"
|
|
4694
5403
|
}
|
|
4695
5404
|
) }),
|
|
4696
|
-
/* @__PURE__ */
|
|
4697
|
-
/* @__PURE__ */
|
|
4698
|
-
/* @__PURE__ */
|
|
4699
|
-
/* @__PURE__ */
|
|
4700
|
-
/* @__PURE__ */
|
|
5405
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
5406
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-position-market min-w-0 overflow-hidden font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground [display:-webkit-box] [-webkit-line-clamp:2] [-webkit-box-orient:vertical] md:block md:truncate md:text-agg-base md:leading-agg-6", children: model.title }),
|
|
5407
|
+
/* @__PURE__ */ jsxs13("div", { className: "hidden min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-2 pt-1 md:flex", children: [
|
|
5408
|
+
/* @__PURE__ */ jsx14(OutcomePill, { label: model.selectedOutcomeLabel }),
|
|
5409
|
+
/* @__PURE__ */ jsx14(
|
|
4701
5410
|
VenueShares,
|
|
4702
5411
|
{
|
|
4703
5412
|
model,
|
|
@@ -4708,10 +5417,10 @@ var PositionRow = ({
|
|
|
4708
5417
|
] })
|
|
4709
5418
|
] })
|
|
4710
5419
|
] }),
|
|
4711
|
-
/* @__PURE__ */
|
|
5420
|
+
/* @__PURE__ */ jsx14("div", { className: "flex shrink-0 items-center justify-end md:hidden", children: /* @__PURE__ */ jsx14(OutcomePill, { label: model.selectedOutcomeLabel }) })
|
|
4712
5421
|
] }),
|
|
4713
|
-
isClosed ? /* @__PURE__ */
|
|
4714
|
-
/* @__PURE__ */
|
|
5422
|
+
isClosed ? /* @__PURE__ */ jsx14("div", { className: "md:hidden", children: /* @__PURE__ */ jsx14(ResolutionPill, { label: `${labels.resolutionHeader}: ${model.resolutionLabel}` }) }) : null,
|
|
5423
|
+
/* @__PURE__ */ jsx14(
|
|
4715
5424
|
VenueShares,
|
|
4716
5425
|
{
|
|
4717
5426
|
model,
|
|
@@ -4719,14 +5428,14 @@ var PositionRow = ({
|
|
|
4719
5428
|
className: "agg-position-venues flex min-w-0 flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2 md:hidden"
|
|
4720
5429
|
}
|
|
4721
5430
|
),
|
|
4722
|
-
/* @__PURE__ */
|
|
4723
|
-
/* @__PURE__ */
|
|
4724
|
-
/* @__PURE__ */
|
|
4725
|
-
/* @__PURE__ */
|
|
5431
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex w-full items-center justify-between gap-3 md:hidden", children: [
|
|
5432
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex min-w-0 items-center gap-5", children: [
|
|
5433
|
+
/* @__PURE__ */ jsx14(TotalTradedCell, { model }),
|
|
5434
|
+
/* @__PURE__ */ jsx14(PositionValueCell, { value: isClosed ? model.payout : model.currentValue })
|
|
4726
5435
|
] }),
|
|
4727
|
-
isClosed ? /* @__PURE__ */
|
|
4728
|
-
/* @__PURE__ */
|
|
4729
|
-
model.canClaim ? /* @__PURE__ */
|
|
5436
|
+
isClosed ? /* @__PURE__ */ jsx14(ResultBadge, { status: model.positionStatus, labels }) : /* @__PURE__ */ jsxs13("div", { className: "flex shrink-0 flex-col items-start justify-center gap-2", children: [
|
|
5437
|
+
/* @__PURE__ */ jsx14(StatusBadge, { status: model.positionStatus, labels }),
|
|
5438
|
+
model.canClaim ? /* @__PURE__ */ jsxs13(
|
|
4730
5439
|
"button",
|
|
4731
5440
|
{
|
|
4732
5441
|
type: "button",
|
|
@@ -4735,48 +5444,48 @@ var PositionRow = ({
|
|
|
4735
5444
|
disabled: isClaiming,
|
|
4736
5445
|
"aria-busy": isClaiming || void 0,
|
|
4737
5446
|
children: [
|
|
4738
|
-
isClaiming ? /* @__PURE__ */
|
|
5447
|
+
isClaiming ? /* @__PURE__ */ jsx14(LoadingIcon, { size: "small", className: "text-agg-primary" }) : null,
|
|
4739
5448
|
labels.claim
|
|
4740
5449
|
]
|
|
4741
5450
|
}
|
|
4742
5451
|
) : null
|
|
4743
5452
|
] })
|
|
4744
5453
|
] }),
|
|
4745
|
-
isClosed ? /* @__PURE__ */
|
|
4746
|
-
/* @__PURE__ */
|
|
4747
|
-
/* @__PURE__ */
|
|
5454
|
+
isClosed ? /* @__PURE__ */ jsxs13(Fragment3, { children: [
|
|
5455
|
+
/* @__PURE__ */ jsx14("div", { className: "hidden w-[90px] shrink-0 md:block lg:w-[120px]", children: /* @__PURE__ */ jsx14(ResolutionPill, { label: model.resolutionLabel }) }),
|
|
5456
|
+
/* @__PURE__ */ jsx14(
|
|
4748
5457
|
TotalTradedCell,
|
|
4749
5458
|
{
|
|
4750
5459
|
model,
|
|
4751
5460
|
className: "hidden w-[110px] shrink-0 md:flex lg:w-[130px]"
|
|
4752
5461
|
}
|
|
4753
5462
|
),
|
|
4754
|
-
/* @__PURE__ */
|
|
5463
|
+
/* @__PURE__ */ jsx14(
|
|
4755
5464
|
PositionValueCell,
|
|
4756
5465
|
{
|
|
4757
5466
|
value: model.payout,
|
|
4758
5467
|
className: "hidden w-[130px] shrink-0 md:flex lg:w-[160px]"
|
|
4759
5468
|
}
|
|
4760
5469
|
),
|
|
4761
|
-
/* @__PURE__ */
|
|
4762
|
-
] }) : /* @__PURE__ */
|
|
4763
|
-
/* @__PURE__ */
|
|
5470
|
+
/* @__PURE__ */ jsx14("div", { className: "hidden w-[60px] shrink-0 items-center md:flex", children: /* @__PURE__ */ jsx14(ResultBadge, { status: model.positionStatus, labels }) })
|
|
5471
|
+
] }) : /* @__PURE__ */ jsxs13(Fragment3, { children: [
|
|
5472
|
+
/* @__PURE__ */ jsx14(
|
|
4764
5473
|
TotalTradedCell,
|
|
4765
5474
|
{
|
|
4766
5475
|
model,
|
|
4767
5476
|
className: "hidden w-[120px] shrink-0 md:flex lg:w-[140px]"
|
|
4768
5477
|
}
|
|
4769
5478
|
),
|
|
4770
|
-
/* @__PURE__ */
|
|
5479
|
+
/* @__PURE__ */ jsx14(
|
|
4771
5480
|
PositionValueCell,
|
|
4772
5481
|
{
|
|
4773
5482
|
value: model.currentValue,
|
|
4774
5483
|
className: "hidden w-[130px] shrink-0 md:flex lg:w-[160px]"
|
|
4775
5484
|
}
|
|
4776
5485
|
),
|
|
4777
|
-
/* @__PURE__ */
|
|
4778
|
-
/* @__PURE__ */
|
|
4779
|
-
model.canClaim ? /* @__PURE__ */
|
|
5486
|
+
/* @__PURE__ */ jsxs13("div", { className: "hidden w-[100px] shrink-0 items-center gap-3 md:flex", children: [
|
|
5487
|
+
/* @__PURE__ */ jsx14(StatusBadge, { status: model.positionStatus, labels }),
|
|
5488
|
+
model.canClaim ? /* @__PURE__ */ jsxs13(
|
|
4780
5489
|
"button",
|
|
4781
5490
|
{
|
|
4782
5491
|
type: "button",
|
|
@@ -4785,14 +5494,14 @@ var PositionRow = ({
|
|
|
4785
5494
|
disabled: isClaiming,
|
|
4786
5495
|
"aria-busy": isClaiming || void 0,
|
|
4787
5496
|
children: [
|
|
4788
|
-
isClaiming ? /* @__PURE__ */
|
|
5497
|
+
isClaiming ? /* @__PURE__ */ jsx14(LoadingIcon, { size: "small", className: "text-agg-primary" }) : null,
|
|
4789
5498
|
labels.claim
|
|
4790
5499
|
]
|
|
4791
5500
|
}
|
|
4792
5501
|
) : null
|
|
4793
5502
|
] })
|
|
4794
5503
|
] }),
|
|
4795
|
-
/* @__PURE__ */
|
|
5504
|
+
/* @__PURE__ */ jsx14("div", { className: "hidden w-5 shrink-0 items-center justify-end md:flex", children: /* @__PURE__ */ jsx14(
|
|
4796
5505
|
Icon,
|
|
4797
5506
|
{
|
|
4798
5507
|
name: "chevron-right",
|
|
@@ -4807,15 +5516,15 @@ var PositionRow = ({
|
|
|
4807
5516
|
PositionRow.displayName = "PositionRow";
|
|
4808
5517
|
|
|
4809
5518
|
// src/pages/user-profile/components/positions-activity.tsx
|
|
4810
|
-
import { Fragment as Fragment5, jsx as
|
|
5519
|
+
import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4811
5520
|
var getTabItems = (tabsLabels, showOpenOrders) => [
|
|
4812
5521
|
{ value: USER_PROFILE_TAB_POSITIONS, label: tabsLabels.positions },
|
|
4813
5522
|
...showOpenOrders ? [{ value: USER_PROFILE_TAB_OPEN_ORDERS, label: tabsLabels.openOrders }] : [],
|
|
4814
5523
|
{ value: USER_PROFILE_TAB_ACTIVITY, label: tabsLabels.activity }
|
|
4815
5524
|
];
|
|
4816
|
-
var TabRowsSkeleton = ({ ariaLabel }) => /* @__PURE__ */
|
|
4817
|
-
/* @__PURE__ */
|
|
4818
|
-
index < acc.length - 1 ? /* @__PURE__ */
|
|
5525
|
+
var TabRowsSkeleton = ({ ariaLabel }) => /* @__PURE__ */ jsx15("div", { role: "status", "aria-label": ariaLabel, className: "flex flex-col gap-3 sm:gap-4", children: Array.from({ length: 3 }).map((_, index, acc) => /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
5526
|
+
/* @__PURE__ */ jsx15("div", { className: "h-14 rounded-agg-sm bg-agg-secondary-hover/80 sm:h-16" }, index),
|
|
5527
|
+
index < acc.length - 1 ? /* @__PURE__ */ jsx15("div", { className: "agg-position-divider h-px w-full shrink-0 bg-agg-separator", "aria-hidden": true }) : null
|
|
4819
5528
|
] }, index)) });
|
|
4820
5529
|
var PositionsActivity = ({
|
|
4821
5530
|
activePositions = [],
|
|
@@ -4857,16 +5566,16 @@ var PositionsActivity = ({
|
|
|
4857
5566
|
initialPositionFilter = "active",
|
|
4858
5567
|
className
|
|
4859
5568
|
}) => {
|
|
4860
|
-
const userProfileLabels =
|
|
5569
|
+
const userProfileLabels = useLabels10().userProfile;
|
|
4861
5570
|
const positionsLabels = userProfileLabels.positions;
|
|
4862
5571
|
const openOrdersLabels = userProfileLabels.openOrders;
|
|
4863
5572
|
const { formatCurrency: formatCurrency2, formatPrice } = useAggUiConfig2().formatting;
|
|
4864
|
-
const tabItems =
|
|
5573
|
+
const tabItems = useMemo7(
|
|
4865
5574
|
() => getTabItems(userProfileLabels.tabs, showOpenOrders),
|
|
4866
5575
|
[showOpenOrders, userProfileLabels.tabs]
|
|
4867
5576
|
);
|
|
4868
5577
|
const isTabControlled = tab !== void 0;
|
|
4869
|
-
const [internalActiveTab, setInternalActiveTab] =
|
|
5578
|
+
const [internalActiveTab, setInternalActiveTab] = useState11(
|
|
4870
5579
|
tab != null ? tab : USER_PROFILE_TAB_POSITIONS
|
|
4871
5580
|
);
|
|
4872
5581
|
const requestedActiveTab = isTabControlled ? tab : internalActiveTab;
|
|
@@ -4876,21 +5585,21 @@ var PositionsActivity = ({
|
|
|
4876
5585
|
if (!isTabControlled) setInternalActiveTab(next);
|
|
4877
5586
|
onTabChange == null ? void 0 : onTabChange(next);
|
|
4878
5587
|
};
|
|
4879
|
-
const [positionFilter, setPositionFilter] =
|
|
4880
|
-
const [searchValue, setSearchValue] =
|
|
4881
|
-
const [isSearchFocused, setIsSearchFocused] =
|
|
4882
|
-
const [locallyClaimedPositionIds, setLocallyClaimedPositionIds] =
|
|
5588
|
+
const [positionFilter, setPositionFilter] = useState11(initialPositionFilter);
|
|
5589
|
+
const [searchValue, setSearchValue] = useState11("");
|
|
5590
|
+
const [isSearchFocused, setIsSearchFocused] = useState11(false);
|
|
5591
|
+
const [locallyClaimedPositionIds, setLocallyClaimedPositionIds] = useState11(
|
|
4883
5592
|
() => /* @__PURE__ */ new Set()
|
|
4884
5593
|
);
|
|
4885
|
-
const positionsLoadMoreRef =
|
|
4886
|
-
const openOrdersLoadMoreRef =
|
|
4887
|
-
const activitiesLoadMoreRef =
|
|
4888
|
-
const rowsScrollRef =
|
|
5594
|
+
const positionsLoadMoreRef = useRef9(null);
|
|
5595
|
+
const openOrdersLoadMoreRef = useRef9(null);
|
|
5596
|
+
const activitiesLoadMoreRef = useRef9(null);
|
|
5597
|
+
const rowsScrollRef = useRef9(null);
|
|
4889
5598
|
const isPositionsTab = activeTab === USER_PROFILE_TAB_POSITIONS;
|
|
4890
5599
|
const isOpenOrdersTab = activeTab === USER_PROFILE_TAB_OPEN_ORDERS;
|
|
4891
5600
|
const isActivityTab = activeTab === USER_PROFILE_TAB_ACTIVITY;
|
|
4892
5601
|
const isClosedPositionsFilter = isPositionsTab && positionFilter === "closed";
|
|
4893
|
-
const positionsForCurrentFilter =
|
|
5602
|
+
const positionsForCurrentFilter = useMemo7(() => {
|
|
4894
5603
|
if (positionFilter === "active") {
|
|
4895
5604
|
return activePositions.filter((position) => !locallyClaimedPositionIds.has(position.id));
|
|
4896
5605
|
}
|
|
@@ -4907,7 +5616,7 @@ var PositionsActivity = ({
|
|
|
4907
5616
|
}
|
|
4908
5617
|
return Array.from(byId.values());
|
|
4909
5618
|
}, [activePositions, closedPositions, locallyClaimedPositionIds, positionFilter]);
|
|
4910
|
-
const filteredPositions =
|
|
5619
|
+
const filteredPositions = useMemo7(() => {
|
|
4911
5620
|
if (!searchValue.trim()) return positionsForCurrentFilter;
|
|
4912
5621
|
const q = searchValue.toLowerCase();
|
|
4913
5622
|
return positionsForCurrentFilter.filter((p) => p.title.toLowerCase().includes(q));
|
|
@@ -4932,7 +5641,7 @@ var PositionsActivity = ({
|
|
|
4932
5641
|
const isLoadingMorePositions = positionFilter === "active" ? isLoadingMoreActivePositions : isLoadingMoreClosedPositions;
|
|
4933
5642
|
const loadMorePositions = positionFilter === "active" ? onLoadMoreActivePositions : onLoadMoreClosedPositions;
|
|
4934
5643
|
const filteredActivities = activities;
|
|
4935
|
-
const searchResults =
|
|
5644
|
+
const searchResults = useMemo7(() => {
|
|
4936
5645
|
if (!isPositionsTab || !searchValue.trim()) return [];
|
|
4937
5646
|
return filteredPositions.slice(0, 5).map((position) => ({
|
|
4938
5647
|
id: position.id,
|
|
@@ -4961,11 +5670,11 @@ var PositionsActivity = ({
|
|
|
4961
5670
|
const handleSearchChange = (event) => {
|
|
4962
5671
|
setSearchValue(event.target.value);
|
|
4963
5672
|
};
|
|
4964
|
-
|
|
5673
|
+
useEffect10(() => {
|
|
4965
5674
|
if (isPositionsTab) return;
|
|
4966
5675
|
setIsSearchFocused(false);
|
|
4967
5676
|
}, [isPositionsTab]);
|
|
4968
|
-
|
|
5677
|
+
useEffect10(() => {
|
|
4969
5678
|
if (!isPositionsTab || !hasMorePositions) return;
|
|
4970
5679
|
const target = positionsLoadMoreRef.current;
|
|
4971
5680
|
if (!target || !loadMorePositions) return;
|
|
@@ -4987,7 +5696,7 @@ var PositionsActivity = ({
|
|
|
4987
5696
|
isPositionsTab,
|
|
4988
5697
|
loadMorePositions
|
|
4989
5698
|
]);
|
|
4990
|
-
|
|
5699
|
+
useEffect10(() => {
|
|
4991
5700
|
if (!isActivityTab || !hasMoreActivities) return;
|
|
4992
5701
|
const target = activitiesLoadMoreRef.current;
|
|
4993
5702
|
if (!target || !onLoadMoreActivities) return;
|
|
@@ -5009,7 +5718,7 @@ var PositionsActivity = ({
|
|
|
5009
5718
|
isLoadingMoreActivities,
|
|
5010
5719
|
onLoadMoreActivities
|
|
5011
5720
|
]);
|
|
5012
|
-
|
|
5721
|
+
useEffect10(() => {
|
|
5013
5722
|
if (!isOpenOrdersTab || !hasMoreOpenOrders) return;
|
|
5014
5723
|
const target = openOrdersLoadMoreRef.current;
|
|
5015
5724
|
if (!target || !onLoadMoreOpenOrders) return;
|
|
@@ -5031,7 +5740,7 @@ var PositionsActivity = ({
|
|
|
5031
5740
|
isOpenOrdersTab,
|
|
5032
5741
|
onLoadMoreOpenOrders
|
|
5033
5742
|
]);
|
|
5034
|
-
return /* @__PURE__ */
|
|
5743
|
+
return /* @__PURE__ */ jsxs14(
|
|
5035
5744
|
"div",
|
|
5036
5745
|
{
|
|
5037
5746
|
className: cn(
|
|
@@ -5040,7 +5749,7 @@ var PositionsActivity = ({
|
|
|
5040
5749
|
className
|
|
5041
5750
|
),
|
|
5042
5751
|
children: [
|
|
5043
|
-
/* @__PURE__ */
|
|
5752
|
+
/* @__PURE__ */ jsx15(
|
|
5044
5753
|
Tabs,
|
|
5045
5754
|
{
|
|
5046
5755
|
items: tabItems,
|
|
@@ -5054,7 +5763,7 @@ var PositionsActivity = ({
|
|
|
5054
5763
|
}
|
|
5055
5764
|
}
|
|
5056
5765
|
),
|
|
5057
|
-
/* @__PURE__ */
|
|
5766
|
+
/* @__PURE__ */ jsxs14(
|
|
5058
5767
|
"div",
|
|
5059
5768
|
{
|
|
5060
5769
|
className: cn(
|
|
@@ -5062,12 +5771,12 @@ var PositionsActivity = ({
|
|
|
5062
5771
|
isPositionsTab ? "pt-4 md:pt-6" : "pt-0 md:pt-6"
|
|
5063
5772
|
),
|
|
5064
5773
|
children: [
|
|
5065
|
-
isPositionsTab ? /* @__PURE__ */
|
|
5066
|
-
/* @__PURE__ */
|
|
5774
|
+
isPositionsTab ? /* @__PURE__ */ jsxs14("div", { className: "agg-toolbar flex flex-row items-start gap-3 px-4 sm:gap-5 sm:px-6", children: [
|
|
5775
|
+
/* @__PURE__ */ jsx15("div", { className: "agg-position-filters flex h-10 w-[45%] max-w-[169px] shrink-0 items-stretch overflow-clip rounded-agg-sm border border-agg-separator sm:w-auto sm:min-w-[200px] sm:max-w-[270px]", children: USER_PROFILE_POSITION_FILTERS.map((filter, idx) => {
|
|
5067
5776
|
const isActive = filter.value === positionFilter;
|
|
5068
|
-
return /* @__PURE__ */
|
|
5069
|
-
idx > 0 ? /* @__PURE__ */
|
|
5070
|
-
/* @__PURE__ */
|
|
5777
|
+
return /* @__PURE__ */ jsxs14("div", { className: "flex flex-1 items-stretch", children: [
|
|
5778
|
+
idx > 0 ? /* @__PURE__ */ jsx15("div", { className: "w-px bg-agg-separator", "aria-hidden": true }) : null,
|
|
5779
|
+
/* @__PURE__ */ jsx15(
|
|
5071
5780
|
"button",
|
|
5072
5781
|
{
|
|
5073
5782
|
type: "button",
|
|
@@ -5082,7 +5791,7 @@ var PositionsActivity = ({
|
|
|
5082
5791
|
)
|
|
5083
5792
|
] }, filter.value);
|
|
5084
5793
|
}) }),
|
|
5085
|
-
/* @__PURE__ */
|
|
5794
|
+
/* @__PURE__ */ jsxs14(
|
|
5086
5795
|
"div",
|
|
5087
5796
|
{
|
|
5088
5797
|
className: "agg-position-search relative flex w-full min-w-0 flex-1",
|
|
@@ -5093,9 +5802,9 @@ var PositionsActivity = ({
|
|
|
5093
5802
|
setIsSearchFocused(false);
|
|
5094
5803
|
},
|
|
5095
5804
|
children: [
|
|
5096
|
-
/* @__PURE__ */
|
|
5097
|
-
/* @__PURE__ */
|
|
5098
|
-
/* @__PURE__ */
|
|
5805
|
+
/* @__PURE__ */ jsx15("label", { className: "flex w-full min-w-0 flex-1", children: /* @__PURE__ */ jsxs14("div", { className: "flex h-11 w-full items-center gap-3 rounded-agg-sm border border-agg-separator bg-agg-secondary px-3 py-2.5 focus-within:border-2 focus-within:border-agg-primary sm:h-10", children: [
|
|
5806
|
+
/* @__PURE__ */ jsx15(Icon, { name: "search", size: "small", className: "shrink-0 text-agg-muted-foreground" }),
|
|
5807
|
+
/* @__PURE__ */ jsx15(
|
|
5099
5808
|
"input",
|
|
5100
5809
|
{
|
|
5101
5810
|
value: searchValue,
|
|
@@ -5110,7 +5819,7 @@ var PositionsActivity = ({
|
|
|
5110
5819
|
}
|
|
5111
5820
|
)
|
|
5112
5821
|
] }) }),
|
|
5113
|
-
isSearchFocused && searchValue.trim() ? /* @__PURE__ */
|
|
5822
|
+
isSearchFocused && searchValue.trim() ? /* @__PURE__ */ jsx15("div", { className: "agg-position-search-results absolute left-0 right-0 top-full z-50 mt-1 w-full overflow-hidden rounded-agg-xl border border-agg-separator bg-agg-secondary pt-2 shadow-[0px_8px_16px_0px_rgba(0,0,0,0.1)]", children: searchResults.length > 0 ? /* @__PURE__ */ jsx15(
|
|
5114
5823
|
"ul",
|
|
5115
5824
|
{
|
|
5116
5825
|
className: "agg-position-search-results-list m-0 flex list-none flex-col p-0",
|
|
@@ -5123,9 +5832,9 @@ var PositionsActivity = ({
|
|
|
5123
5832
|
setIsSearchFocused(false);
|
|
5124
5833
|
onPositionClick == null ? void 0 : onPositionClick(item.raw);
|
|
5125
5834
|
};
|
|
5126
|
-
const innerContent = /* @__PURE__ */
|
|
5127
|
-
/* @__PURE__ */
|
|
5128
|
-
/* @__PURE__ */
|
|
5835
|
+
const innerContent = /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
5836
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
|
|
5837
|
+
/* @__PURE__ */ jsx15(
|
|
5129
5838
|
"img",
|
|
5130
5839
|
{
|
|
5131
5840
|
src: optimizedImageUrl3(item.thumbnailSrc, 48),
|
|
@@ -5133,16 +5842,16 @@ var PositionsActivity = ({
|
|
|
5133
5842
|
className: "size-12 shrink-0 rounded-agg-lg object-cover"
|
|
5134
5843
|
}
|
|
5135
5844
|
),
|
|
5136
|
-
/* @__PURE__ */
|
|
5137
|
-
/* @__PURE__ */
|
|
5138
|
-
/* @__PURE__ */
|
|
5139
|
-
/* @__PURE__ */
|
|
5140
|
-
/* @__PURE__ */
|
|
5141
|
-
/* @__PURE__ */
|
|
5845
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
5846
|
+
/* @__PURE__ */ jsx15("p", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-base leading-agg-6 font-agg-normal text-agg-foreground", children: item.title }),
|
|
5847
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex min-w-0 items-center gap-2 text-agg-muted-foreground", children: [
|
|
5848
|
+
/* @__PURE__ */ jsx15("p", { className: "shrink-0 whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: item.metaPrimary }),
|
|
5849
|
+
/* @__PURE__ */ jsx15("span", { className: "text-agg-muted-foreground", "aria-hidden": true, children: "\xB7" }),
|
|
5850
|
+
/* @__PURE__ */ jsx15("p", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: item.metaSecondary })
|
|
5142
5851
|
] })
|
|
5143
5852
|
] })
|
|
5144
5853
|
] }),
|
|
5145
|
-
/* @__PURE__ */
|
|
5854
|
+
/* @__PURE__ */ jsx15(
|
|
5146
5855
|
Icon,
|
|
5147
5856
|
{
|
|
5148
5857
|
name: "chevron-right",
|
|
@@ -5151,7 +5860,7 @@ var PositionsActivity = ({
|
|
|
5151
5860
|
}
|
|
5152
5861
|
)
|
|
5153
5862
|
] });
|
|
5154
|
-
return /* @__PURE__ */
|
|
5863
|
+
return /* @__PURE__ */ jsx15(
|
|
5155
5864
|
"li",
|
|
5156
5865
|
{
|
|
5157
5866
|
role: "presentation",
|
|
@@ -5159,7 +5868,7 @@ var PositionsActivity = ({
|
|
|
5159
5868
|
"agg-position-search-result-item",
|
|
5160
5869
|
index > 0 && "border-t border-agg-separator"
|
|
5161
5870
|
),
|
|
5162
|
-
children: itemHref ? /* @__PURE__ */
|
|
5871
|
+
children: itemHref ? /* @__PURE__ */ jsx15(
|
|
5163
5872
|
"a",
|
|
5164
5873
|
{
|
|
5165
5874
|
href: itemHref,
|
|
@@ -5174,7 +5883,7 @@ var PositionsActivity = ({
|
|
|
5174
5883
|
},
|
|
5175
5884
|
children: innerContent
|
|
5176
5885
|
}
|
|
5177
|
-
) : /* @__PURE__ */
|
|
5886
|
+
) : /* @__PURE__ */ jsx15(
|
|
5178
5887
|
"button",
|
|
5179
5888
|
{
|
|
5180
5889
|
type: "button",
|
|
@@ -5188,42 +5897,42 @@ var PositionsActivity = ({
|
|
|
5188
5897
|
);
|
|
5189
5898
|
})
|
|
5190
5899
|
}
|
|
5191
|
-
) : /* @__PURE__ */
|
|
5900
|
+
) : /* @__PURE__ */ jsx15("div", { className: "px-5 py-6 font-agg-sans text-agg-sm leading-agg-5 text-agg-muted-foreground", children: positionsLabels.noResults }) }) : null
|
|
5192
5901
|
]
|
|
5193
5902
|
}
|
|
5194
5903
|
)
|
|
5195
5904
|
] }) : null,
|
|
5196
|
-
/* @__PURE__ */
|
|
5197
|
-
/* @__PURE__ */
|
|
5198
|
-
isPositionsTab && filteredPositions.length > 0 ? isClosedPositionsFilter ? /* @__PURE__ */
|
|
5199
|
-
/* @__PURE__ */
|
|
5200
|
-
/* @__PURE__ */
|
|
5201
|
-
/* @__PURE__ */
|
|
5202
|
-
/* @__PURE__ */
|
|
5203
|
-
/* @__PURE__ */
|
|
5204
|
-
/* @__PURE__ */
|
|
5205
|
-
] }) : /* @__PURE__ */
|
|
5206
|
-
/* @__PURE__ */
|
|
5207
|
-
/* @__PURE__ */
|
|
5208
|
-
/* @__PURE__ */
|
|
5209
|
-
/* @__PURE__ */
|
|
5210
|
-
/* @__PURE__ */
|
|
5905
|
+
/* @__PURE__ */ jsxs14("div", { className: "agg-positions-table-wrapper flex w-full gap-0 flex-col", children: [
|
|
5906
|
+
/* @__PURE__ */ jsxs14("div", { className: "w-full px-4 sm:px-6", children: [
|
|
5907
|
+
isPositionsTab && filteredPositions.length > 0 ? isClosedPositionsFilter ? /* @__PURE__ */ jsxs14("div", { className: "hidden items-start gap-8 px-0 md:flex", children: [
|
|
5908
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: positionsLabels.marketHeader }),
|
|
5909
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[90px] shrink-0 lg:w-[120px]", children: positionsLabels.resolutionHeader }),
|
|
5910
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[110px] shrink-0 lg:w-[130px]", children: positionsLabels.totalTradedHeader }),
|
|
5911
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[130px] shrink-0 lg:w-[160px]", children: positionsLabels.payoutHeader }),
|
|
5912
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[60px] shrink-0", children: positionsLabels.resultHeader }),
|
|
5913
|
+
/* @__PURE__ */ jsx15("span", { className: "hidden w-5 shrink-0 sm:block", "aria-hidden": true })
|
|
5914
|
+
] }) : /* @__PURE__ */ jsxs14("div", { className: "hidden items-start gap-6 px-0 md:flex", children: [
|
|
5915
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: positionsLabels.marketHeader }),
|
|
5916
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[120px] shrink-0 lg:w-[140px]", children: positionsLabels.totalTradedHeader }),
|
|
5917
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[130px] shrink-0 lg:w-[160px]", children: positionsLabels.currentValueHeader }),
|
|
5918
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[100px] shrink-0", children: positionsLabels.statusHeader }),
|
|
5919
|
+
/* @__PURE__ */ jsx15("span", { className: "hidden w-5 shrink-0 sm:block", "aria-hidden": true })
|
|
5211
5920
|
] }) : null,
|
|
5212
|
-
isOpenOrdersTab && openOrders.length > 0 ? /* @__PURE__ */
|
|
5213
|
-
/* @__PURE__ */
|
|
5214
|
-
/* @__PURE__ */
|
|
5215
|
-
/* @__PURE__ */
|
|
5216
|
-
/* @__PURE__ */
|
|
5217
|
-
/* @__PURE__ */
|
|
5218
|
-
/* @__PURE__ */
|
|
5921
|
+
isOpenOrdersTab && openOrders.length > 0 ? /* @__PURE__ */ jsxs14("div", { className: "hidden items-start gap-6 px-0 lg:flex", children: [
|
|
5922
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: openOrdersLabels.marketHeader }),
|
|
5923
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[120px] shrink-0", children: openOrdersLabels.limitPriceHeader }),
|
|
5924
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[120px] shrink-0", children: openOrdersLabels.filledHeader }),
|
|
5925
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[120px] shrink-0", children: openOrdersLabels.totalHeader }),
|
|
5926
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[140px] shrink-0", children: openOrdersLabels.expirationHeader }),
|
|
5927
|
+
/* @__PURE__ */ jsx15("span", { className: "w-[80px] shrink-0", "aria-hidden": true })
|
|
5219
5928
|
] }) : null,
|
|
5220
|
-
isActivityTab && filteredActivities.length > 0 ? /* @__PURE__ */
|
|
5221
|
-
/* @__PURE__ */
|
|
5222
|
-
/* @__PURE__ */
|
|
5223
|
-
/* @__PURE__ */
|
|
5929
|
+
isActivityTab && filteredActivities.length > 0 ? /* @__PURE__ */ jsxs14("div", { className: "hidden items-start gap-6 px-0 md:flex", children: [
|
|
5930
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-22 shrink-0", children: "Type" }),
|
|
5931
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: "Market" }),
|
|
5932
|
+
/* @__PURE__ */ jsx15("p", { className: "agg-user-profile-table-header w-[120px] shrink-0 text-right", children: "Amount" })
|
|
5224
5933
|
] }) : null
|
|
5225
5934
|
] }),
|
|
5226
|
-
/* @__PURE__ */
|
|
5935
|
+
/* @__PURE__ */ jsx15(
|
|
5227
5936
|
"div",
|
|
5228
5937
|
{
|
|
5229
5938
|
ref: rowsScrollRef,
|
|
@@ -5235,8 +5944,8 @@ var PositionsActivity = ({
|
|
|
5235
5944
|
"[&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-agg-muted-foreground/50",
|
|
5236
5945
|
"[&::-webkit-scrollbar-thumb:hover]:bg-agg-muted-foreground/70"
|
|
5237
5946
|
),
|
|
5238
|
-
children: isPositionsTab ? /* @__PURE__ */
|
|
5239
|
-
isLoadingPositions && filteredPositions.length === 0 ? /* @__PURE__ */
|
|
5947
|
+
children: isPositionsTab ? /* @__PURE__ */ jsxs14("div", { className: "agg-portfolio-list flex flex-col gap-5", children: [
|
|
5948
|
+
isLoadingPositions && filteredPositions.length === 0 ? /* @__PURE__ */ jsx15(TabRowsSkeleton, { ariaLabel: "Loading positions" }) : positionsError && filteredPositions.length === 0 ? /* @__PURE__ */ jsx15(
|
|
5240
5949
|
EmptyState,
|
|
5241
5950
|
{
|
|
5242
5951
|
title: "Unable to load positions",
|
|
@@ -5244,15 +5953,15 @@ var PositionsActivity = ({
|
|
|
5244
5953
|
}
|
|
5245
5954
|
) : filteredPositions.length > 0 ? filteredPositions.map((position, index) => {
|
|
5246
5955
|
var _a;
|
|
5247
|
-
return /* @__PURE__ */
|
|
5248
|
-
index > 0 ? /* @__PURE__ */
|
|
5956
|
+
return /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
5957
|
+
index > 0 ? /* @__PURE__ */ jsx15(
|
|
5249
5958
|
"div",
|
|
5250
5959
|
{
|
|
5251
5960
|
className: "agg-position-divider h-px w-full shrink-0 bg-agg-separator",
|
|
5252
5961
|
"aria-hidden": true
|
|
5253
5962
|
}
|
|
5254
5963
|
) : null,
|
|
5255
|
-
/* @__PURE__ */
|
|
5964
|
+
/* @__PURE__ */ jsx15(
|
|
5256
5965
|
PositionRow,
|
|
5257
5966
|
{
|
|
5258
5967
|
position,
|
|
@@ -5266,15 +5975,15 @@ var PositionsActivity = ({
|
|
|
5266
5975
|
}
|
|
5267
5976
|
)
|
|
5268
5977
|
] }, position.id);
|
|
5269
|
-
}) : /* @__PURE__ */
|
|
5978
|
+
}) : /* @__PURE__ */ jsx15(
|
|
5270
5979
|
EmptyState,
|
|
5271
5980
|
{
|
|
5272
5981
|
title: "No positions yet",
|
|
5273
5982
|
description: "Your open trades will appear here once you place an order."
|
|
5274
5983
|
}
|
|
5275
5984
|
),
|
|
5276
|
-
isLoadingMorePositions ? /* @__PURE__ */
|
|
5277
|
-
hasMorePositions ? /* @__PURE__ */
|
|
5985
|
+
isLoadingMorePositions ? /* @__PURE__ */ jsx15(TabRowsSkeleton, { ariaLabel: "Loading more positions" }) : null,
|
|
5986
|
+
hasMorePositions ? /* @__PURE__ */ jsx15(
|
|
5278
5987
|
"div",
|
|
5279
5988
|
{
|
|
5280
5989
|
ref: positionsLoadMoreRef,
|
|
@@ -5282,22 +5991,22 @@ var PositionsActivity = ({
|
|
|
5282
5991
|
"aria-hidden": true
|
|
5283
5992
|
}
|
|
5284
5993
|
) : null
|
|
5285
|
-
] }) : isOpenOrdersTab ? /* @__PURE__ */
|
|
5286
|
-
isLoadingOpenOrders && openOrders.length === 0 ? /* @__PURE__ */
|
|
5994
|
+
] }) : isOpenOrdersTab ? /* @__PURE__ */ jsxs14("div", { className: "agg-open-orders-list flex flex-col gap-5", children: [
|
|
5995
|
+
isLoadingOpenOrders && openOrders.length === 0 ? /* @__PURE__ */ jsx15(TabRowsSkeleton, { ariaLabel: openOrdersLabels.loading }) : openOrdersError && openOrders.length === 0 ? /* @__PURE__ */ jsx15(
|
|
5287
5996
|
EmptyState,
|
|
5288
5997
|
{
|
|
5289
5998
|
title: openOrdersLabels.errorTitle,
|
|
5290
5999
|
description: openOrdersLabels.errorDescription
|
|
5291
6000
|
}
|
|
5292
|
-
) : openOrders.length > 0 ? openOrders.map((order, index) => /* @__PURE__ */
|
|
5293
|
-
index > 0 ? /* @__PURE__ */
|
|
6001
|
+
) : openOrders.length > 0 ? openOrders.map((order, index) => /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
6002
|
+
index > 0 ? /* @__PURE__ */ jsx15(
|
|
5294
6003
|
"div",
|
|
5295
6004
|
{
|
|
5296
6005
|
className: "agg-open-order-divider h-px w-full shrink-0 bg-agg-separator",
|
|
5297
6006
|
"aria-hidden": true
|
|
5298
6007
|
}
|
|
5299
6008
|
) : null,
|
|
5300
|
-
/* @__PURE__ */
|
|
6009
|
+
/* @__PURE__ */ jsx15(
|
|
5301
6010
|
OpenOrderRow,
|
|
5302
6011
|
{
|
|
5303
6012
|
order,
|
|
@@ -5313,15 +6022,15 @@ var PositionsActivity = ({
|
|
|
5313
6022
|
expirationHeader: openOrdersLabels.expirationHeader
|
|
5314
6023
|
}
|
|
5315
6024
|
)
|
|
5316
|
-
] }, order.id)) : /* @__PURE__ */
|
|
6025
|
+
] }, order.id)) : /* @__PURE__ */ jsx15(
|
|
5317
6026
|
EmptyState,
|
|
5318
6027
|
{
|
|
5319
6028
|
title: openOrdersLabels.emptyTitle,
|
|
5320
6029
|
description: openOrdersLabels.emptyDescription
|
|
5321
6030
|
}
|
|
5322
6031
|
),
|
|
5323
|
-
isLoadingMoreOpenOrders ? /* @__PURE__ */
|
|
5324
|
-
hasMoreOpenOrders ? /* @__PURE__ */
|
|
6032
|
+
isLoadingMoreOpenOrders ? /* @__PURE__ */ jsx15(TabRowsSkeleton, { ariaLabel: openOrdersLabels.loadingMore }) : null,
|
|
6033
|
+
hasMoreOpenOrders ? /* @__PURE__ */ jsx15(
|
|
5325
6034
|
"div",
|
|
5326
6035
|
{
|
|
5327
6036
|
ref: openOrdersLoadMoreRef,
|
|
@@ -5329,22 +6038,22 @@ var PositionsActivity = ({
|
|
|
5329
6038
|
"aria-hidden": true
|
|
5330
6039
|
}
|
|
5331
6040
|
) : null
|
|
5332
|
-
] }) : /* @__PURE__ */
|
|
5333
|
-
isLoadingActivities && filteredActivities.length === 0 ? /* @__PURE__ */
|
|
6041
|
+
] }) : /* @__PURE__ */ jsxs14("div", { className: "agg-activity-list flex flex-col gap-5", children: [
|
|
6042
|
+
isLoadingActivities && filteredActivities.length === 0 ? /* @__PURE__ */ jsx15(TabRowsSkeleton, { ariaLabel: "Loading activity" }) : activitiesError && filteredActivities.length === 0 ? /* @__PURE__ */ jsx15(
|
|
5334
6043
|
EmptyState,
|
|
5335
6044
|
{
|
|
5336
6045
|
title: "Unable to load activity",
|
|
5337
6046
|
description: "Please try again in a moment."
|
|
5338
6047
|
}
|
|
5339
|
-
) : filteredActivities.length > 0 ? filteredActivities.map((activity, index) => /* @__PURE__ */
|
|
5340
|
-
index > 0 ? /* @__PURE__ */
|
|
6048
|
+
) : filteredActivities.length > 0 ? filteredActivities.map((activity, index) => /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
6049
|
+
index > 0 ? /* @__PURE__ */ jsx15(
|
|
5341
6050
|
"div",
|
|
5342
6051
|
{
|
|
5343
6052
|
className: "agg-activity-divider h-px w-full shrink-0 bg-agg-separator",
|
|
5344
6053
|
"aria-hidden": true
|
|
5345
6054
|
}
|
|
5346
6055
|
) : null,
|
|
5347
|
-
/* @__PURE__ */
|
|
6056
|
+
/* @__PURE__ */ jsx15(
|
|
5348
6057
|
ActivityRow,
|
|
5349
6058
|
{
|
|
5350
6059
|
activity,
|
|
@@ -5352,15 +6061,15 @@ var PositionsActivity = ({
|
|
|
5352
6061
|
onClick: onActivityClick
|
|
5353
6062
|
}
|
|
5354
6063
|
)
|
|
5355
|
-
] }, activity.id)) : /* @__PURE__ */
|
|
6064
|
+
] }, activity.id)) : /* @__PURE__ */ jsx15(
|
|
5356
6065
|
EmptyState,
|
|
5357
6066
|
{
|
|
5358
6067
|
title: "No activity yet",
|
|
5359
6068
|
description: "Your trading activity will appear here."
|
|
5360
6069
|
}
|
|
5361
6070
|
),
|
|
5362
|
-
isLoadingMoreActivities ? /* @__PURE__ */
|
|
5363
|
-
hasMoreActivities ? /* @__PURE__ */
|
|
6071
|
+
isLoadingMoreActivities ? /* @__PURE__ */ jsx15(TabRowsSkeleton, { ariaLabel: "Loading more activity" }) : null,
|
|
6072
|
+
hasMoreActivities ? /* @__PURE__ */ jsx15(
|
|
5364
6073
|
"div",
|
|
5365
6074
|
{
|
|
5366
6075
|
ref: activitiesLoadMoreRef,
|
|
@@ -5382,7 +6091,7 @@ var PositionsActivity = ({
|
|
|
5382
6091
|
PositionsActivity.displayName = "PositionsActivity";
|
|
5383
6092
|
|
|
5384
6093
|
// src/pages/user-profile/components/positions-value-card.tsx
|
|
5385
|
-
import { jsx as
|
|
6094
|
+
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5386
6095
|
var PositionsValueCard = ({
|
|
5387
6096
|
label,
|
|
5388
6097
|
valueLabel,
|
|
@@ -5390,7 +6099,7 @@ var PositionsValueCard = ({
|
|
|
5390
6099
|
className,
|
|
5391
6100
|
icon
|
|
5392
6101
|
}) => {
|
|
5393
|
-
return /* @__PURE__ */
|
|
6102
|
+
return /* @__PURE__ */ jsxs15(
|
|
5394
6103
|
"div",
|
|
5395
6104
|
{
|
|
5396
6105
|
className: cn(
|
|
@@ -5399,8 +6108,8 @@ var PositionsValueCard = ({
|
|
|
5399
6108
|
className
|
|
5400
6109
|
),
|
|
5401
6110
|
children: [
|
|
5402
|
-
/* @__PURE__ */
|
|
5403
|
-
icon != null ? icon : /* @__PURE__ */
|
|
6111
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2", children: [
|
|
6112
|
+
icon != null ? icon : /* @__PURE__ */ jsx16(
|
|
5404
6113
|
"svg",
|
|
5405
6114
|
{
|
|
5406
6115
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5409,7 +6118,7 @@ var PositionsValueCard = ({
|
|
|
5409
6118
|
viewBox: "0 0 16 16",
|
|
5410
6119
|
fill: "none",
|
|
5411
6120
|
"aria-hidden": "true",
|
|
5412
|
-
children: /* @__PURE__ */
|
|
6121
|
+
children: /* @__PURE__ */ jsx16(
|
|
5413
6122
|
"path",
|
|
5414
6123
|
{
|
|
5415
6124
|
d: "M16 7.99957C16 8.36757 15.702 8.66623 15.3333 8.66623H13.6893C13.388 8.66623 13.1233 8.86957 13.0453 9.15957L11.9273 13.3209C11.8 13.7376 11.444 13.9996 11.0333 13.9996H11.022C10.6067 13.9949 10.252 13.7229 10.1393 13.3236L7.95667 4.50623L5.838 11.9989C5.71067 12.3969 5.378 12.6496 4.98467 12.6649C4.57667 12.6869 4.23867 12.4549 4.088 12.0902L3.02133 9.10757C2.926 8.84357 2.674 8.66557 2.39333 8.66557H0.666667C0.298 8.66557 0 8.3669 0 7.9989C0 7.6309 0.298 7.33223 0.666667 7.33223H2.394C3.23667 7.33223 3.99267 7.8649 4.27733 8.65823L4.90267 10.4089L7.092 2.66557C7.226 2.2489 7.57667 1.9809 7.99933 1.9989C8.41133 2.00623 8.76333 2.27757 8.876 2.67357L11.0487 11.4509L11.7567 8.81357C11.9907 7.94157 12.7847 7.33223 13.688 7.33223H15.332C15.7007 7.33223 15.9987 7.6309 15.9987 7.9989L16 7.99957Z",
|
|
@@ -5418,9 +6127,9 @@ var PositionsValueCard = ({
|
|
|
5418
6127
|
)
|
|
5419
6128
|
}
|
|
5420
6129
|
),
|
|
5421
|
-
/* @__PURE__ */
|
|
6130
|
+
/* @__PURE__ */ jsx16("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children: label })
|
|
5422
6131
|
] }),
|
|
5423
|
-
/* @__PURE__ */
|
|
6132
|
+
/* @__PURE__ */ jsx16("div", { className: "agg-portfolio-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: isLoading ? /* @__PURE__ */ jsx16("div", { role: "status", "aria-label": "Loading positions value", children: /* @__PURE__ */ jsx16(SkeletonBlock, { className: "h-8 w-24 rounded-agg-sm" }) }) : valueLabel })
|
|
5424
6133
|
]
|
|
5425
6134
|
}
|
|
5426
6135
|
);
|
|
@@ -5449,7 +6158,7 @@ var buildAggTxExplorerHref = (chainId, txHash) => {
|
|
|
5449
6158
|
};
|
|
5450
6159
|
|
|
5451
6160
|
// src/pages/user-profile/components/user-info-card.tsx
|
|
5452
|
-
import { optimizedImageUrl as optimizedImageUrl4, useLabels as
|
|
6161
|
+
import { optimizedImageUrl as optimizedImageUrl4, useLabels as useLabels11 } from "@agg-build/hooks";
|
|
5453
6162
|
|
|
5454
6163
|
// src/primitives/conditional-wrapper.tsx
|
|
5455
6164
|
var ConditionalWrapper = ({
|
|
@@ -5460,9 +6169,9 @@ var ConditionalWrapper = ({
|
|
|
5460
6169
|
ConditionalWrapper.displayName = "ConditionalWrapper";
|
|
5461
6170
|
|
|
5462
6171
|
// src/pages/user-profile/components/default-avatar.tsx
|
|
5463
|
-
import { jsx as
|
|
6172
|
+
import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5464
6173
|
var DefaultAvatar = ({ className }) => {
|
|
5465
|
-
return /* @__PURE__ */
|
|
6174
|
+
return /* @__PURE__ */ jsxs16(
|
|
5466
6175
|
"svg",
|
|
5467
6176
|
{
|
|
5468
6177
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5473,15 +6182,15 @@ var DefaultAvatar = ({ className }) => {
|
|
|
5473
6182
|
className: cn("shrink-0 text-agg-muted-foreground", className),
|
|
5474
6183
|
"aria-hidden": true,
|
|
5475
6184
|
children: [
|
|
5476
|
-
/* @__PURE__ */
|
|
5477
|
-
/* @__PURE__ */
|
|
6185
|
+
/* @__PURE__ */ jsxs16("g", { clipPath: "url(#clip0_default_avatar)", children: [
|
|
6186
|
+
/* @__PURE__ */ jsx17(
|
|
5478
6187
|
"path",
|
|
5479
6188
|
{
|
|
5480
6189
|
d: "M60 120C93.1371 120 120 93.1371 120 60C120 26.8629 93.1371 0 60 0C26.8629 0 0 26.8629 0 60C0 93.1371 26.8629 120 60 120Z",
|
|
5481
6190
|
fill: "var(--agg-color-secondary-hover)"
|
|
5482
6191
|
}
|
|
5483
6192
|
),
|
|
5484
|
-
/* @__PURE__ */
|
|
6193
|
+
/* @__PURE__ */ jsx17(
|
|
5485
6194
|
"path",
|
|
5486
6195
|
{
|
|
5487
6196
|
d: "M60 120C93.1371 120 120 93.1371 120 60C120 26.8629 93.1371 0 60 0C26.8629 0 0 26.8629 0 60C0 93.1371 26.8629 120 60 120Z",
|
|
@@ -5489,7 +6198,7 @@ var DefaultAvatar = ({ className }) => {
|
|
|
5489
6198
|
fillOpacity: "0.12"
|
|
5490
6199
|
}
|
|
5491
6200
|
),
|
|
5492
|
-
/* @__PURE__ */
|
|
6201
|
+
/* @__PURE__ */ jsx17(
|
|
5493
6202
|
"path",
|
|
5494
6203
|
{
|
|
5495
6204
|
d: "M73.7338 64.1259C80.4187 59.6756 84.8276 52.0804 84.8276 43.4487C84.8276 29.7376 73.7111 18.6211 60 18.6211C46.2890 18.6211 35.1724 29.7376 35.1724 43.4487C35.1724 52.0804 39.5814 59.6756 46.2662 64.1259C46.2662 64.1259 46.2683 64.1280 46.2704 64.1280C46.2683 64.1280 46.2683 64.1259 46.2683 64.1259C30.2669 68.9487 17.8076 81.9356 13.7959 98.2742L13.7980 98.2763C14.4518 99.0645 15.1304 99.8342 15.8235 100.589C15.9911 100.774 16.1669 100.949 16.3387 101.129C16.8724 101.696 17.4124 102.255 17.9669 102.801C18.1966 103.027 18.4304 103.244 18.6642 103.465C19.1773 103.954 19.6966 104.436 20.2262 104.905C20.4890 105.137 20.7559 105.367 21.0207 105.594C21.5400 106.039 22.0656 106.476 22.6014 106.902C22.8828 107.127 23.1662 107.349 23.4497 107.570C23.9918 107.988 24.5421 108.394 25.0987 108.791C25.3862 108.996 25.6697 109.205 25.9614 109.405C26.5490 109.811 27.1469 110.200 27.7490 110.585C28.0200 110.756 28.2849 110.934 28.5580 111.104C29.2531 111.532 29.9607 111.942 30.6745 112.343C30.8628 112.449 31.0469 112.562 31.2373 112.666C32.1600 113.171 33.0973 113.655 34.0490 114.112C34.0718 114.122 34.0966 114.133 34.1193 114.143C35.0276 114.578 35.9504 114.989 36.8835 115.378C37.1731 115.500 37.4690 115.608 37.7607 115.724C38.4352 115.993 39.1097 116.258 39.7966 116.502C40.1607 116.632 40.5290 116.750 40.8952 116.874C41.5200 117.085 42.1490 117.290 42.7821 117.478C43.1835 117.598 43.5869 117.710 43.9924 117.822C44.6049 117.991 45.2214 118.153 45.8442 118.304C46.2642 118.405 46.6862 118.502 47.1104 118.596C47.7331 118.732 48.3580 118.856 48.9869 118.972C49.4131 119.051 49.8373 119.131 50.2676 119.200C50.9173 119.305 51.5711 119.394 52.2269 119.479C52.6407 119.533 53.0524 119.593 53.4683 119.636C54.1924 119.715 54.9228 119.771 55.6531 119.822C56.0069 119.847 56.3566 119.885 56.7104 119.903C57.8007 119.965 58.8952 120 60 120C61.1049 120 62.1993 119.965 63.2897 119.907C63.6435 119.889 63.9952 119.851 64.3469 119.827C65.0793 119.775 65.8097 119.719 66.5318 119.640C66.9476 119.595 67.3593 119.537 67.7731 119.483C68.4290 119.398 69.0828 119.309 69.7324 119.204C70.1607 119.134 70.5869 119.055 71.0131 118.976C71.6421 118.860 72.2690 118.736 72.8897 118.600C73.3138 118.507 73.7359 118.409 74.1559 118.308C74.7766 118.157 75.3931 117.996 76.0076 117.826C76.4111 117.714 76.8166 117.602 77.2180 117.482C77.8531 117.292 78.4800 117.087 79.1049 116.878C79.4711 116.754 79.8414 116.636 80.2035 116.506C80.8883 116.260 81.5649 115.997 82.2393 115.728C82.5311 115.612 82.8269 115.502 83.1166 115.382C84.0456 114.994 84.9642 114.586 85.8683 114.151C85.8952 114.139 85.9242 114.127 85.9511 114.114C86.9028 113.657 87.8400 113.173 88.7628 112.668C88.9531 112.565 89.1373 112.451 89.3256 112.345C90.0393 111.944 90.7469 111.534 91.4421 111.106C91.7152 110.938 91.9821 110.760 92.2511 110.587C92.8531 110.202 93.4511 109.811 94.0387 109.407C94.3283 109.207 94.6138 109.000 94.9014 108.793C95.4580 108.394 96.0083 107.988 96.5504 107.572C96.8359 107.353 97.1173 107.129 97.3987 106.904C97.9324 106.478 98.4600 106.041 98.9793 105.596C99.2462 105.369 99.5131 105.139 99.7738 104.907C100.303 104.438 100.823 103.956 101.336 103.467C101.568 103.246 101.803 103.027 102.033 102.803C102.588 102.257 103.130 101.698 103.661 101.131C103.831 100.949 104.007 100.774 104.177 100.591C104.870 99.8363 105.548 99.0666 106.202 98.2783L106.204 98.2763C102.195 81.9356 89.7352 68.9487 73.7338 64.1259Z",
|
|
@@ -5498,7 +6207,7 @@ var DefaultAvatar = ({ className }) => {
|
|
|
5498
6207
|
}
|
|
5499
6208
|
)
|
|
5500
6209
|
] }),
|
|
5501
|
-
/* @__PURE__ */
|
|
6210
|
+
/* @__PURE__ */ jsx17("defs", { children: /* @__PURE__ */ jsx17("clipPath", { id: "clip0_default_avatar", children: /* @__PURE__ */ jsx17("rect", { width: "120", height: "120", fill: "white" }) }) })
|
|
5502
6211
|
]
|
|
5503
6212
|
}
|
|
5504
6213
|
);
|
|
@@ -5506,7 +6215,7 @@ var DefaultAvatar = ({ className }) => {
|
|
|
5506
6215
|
DefaultAvatar.displayName = "DefaultAvatar";
|
|
5507
6216
|
|
|
5508
6217
|
// src/pages/user-profile/components/user-info-card.tsx
|
|
5509
|
-
import { jsx as
|
|
6218
|
+
import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5510
6219
|
var UserInfoCard = ({
|
|
5511
6220
|
user,
|
|
5512
6221
|
onEditProfile,
|
|
@@ -5516,10 +6225,10 @@ var UserInfoCard = ({
|
|
|
5516
6225
|
className
|
|
5517
6226
|
}) => {
|
|
5518
6227
|
var _a;
|
|
5519
|
-
const labels =
|
|
6228
|
+
const labels = useLabels11();
|
|
5520
6229
|
const wallets = (_a = user.connectedWallets) != null ? _a : [];
|
|
5521
6230
|
const hasWallets = wallets.length > 0;
|
|
5522
|
-
return /* @__PURE__ */
|
|
6231
|
+
return /* @__PURE__ */ jsxs17(
|
|
5523
6232
|
"div",
|
|
5524
6233
|
{
|
|
5525
6234
|
className: cn(
|
|
@@ -5528,26 +6237,26 @@ var UserInfoCard = ({
|
|
|
5528
6237
|
className
|
|
5529
6238
|
),
|
|
5530
6239
|
children: [
|
|
5531
|
-
/* @__PURE__ */
|
|
5532
|
-
/* @__PURE__ */
|
|
6240
|
+
/* @__PURE__ */ jsxs17("div", { className: "agg-profile-header flex w-full flex-row flex-wrap items-center gap-4 sm:gap-5 pt-5", children: [
|
|
6241
|
+
/* @__PURE__ */ jsx18("div", { className: "agg-profile-avatar shrink-0", children: user.avatarUrl ? /* @__PURE__ */ jsx18(
|
|
5533
6242
|
RemoteImage,
|
|
5534
6243
|
{
|
|
5535
6244
|
src: optimizedImageUrl4(user.avatarUrl, 120),
|
|
5536
6245
|
alt: user.username,
|
|
5537
6246
|
className: "h-20 w-20 rounded-full object-cover sm:h-[120px] sm:w-[120px]"
|
|
5538
6247
|
}
|
|
5539
|
-
) : /* @__PURE__ */
|
|
5540
|
-
/* @__PURE__ */
|
|
5541
|
-
/* @__PURE__ */
|
|
5542
|
-
/* @__PURE__ */
|
|
5543
|
-
/* @__PURE__ */
|
|
5544
|
-
user.socialLinks && user.socialLinks.length > 0 ? /* @__PURE__ */
|
|
6248
|
+
) : /* @__PURE__ */ jsx18(DefaultAvatar, { className: "h-20 w-20 rounded-full sm:h-[120px] sm:w-[120px]" }) }),
|
|
6249
|
+
/* @__PURE__ */ jsxs17("div", { className: "agg-profile-details flex min-w-0 w-full flex-1 flex-col gap-3 sm:gap-4", children: [
|
|
6250
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-wrap items-center justify-between gap-3 sm:gap-4", children: [
|
|
6251
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
6252
|
+
/* @__PURE__ */ jsx18("h2", { className: "truncate text-[22px] leading-7 font-agg-bold text-agg-foreground sm:agg-type-heading", children: user.username }),
|
|
6253
|
+
user.socialLinks && user.socialLinks.length > 0 ? /* @__PURE__ */ jsx18("div", { className: "agg-profile-social-links flex items-center gap-2", children: user.socialLinks.map((social) => {
|
|
5545
6254
|
const iconName = social.platform === "twitter" ? "twitter" : social.platform === "discord" ? "discord" : "telegram";
|
|
5546
|
-
const iconNode = /* @__PURE__ */
|
|
6255
|
+
const iconNode = /* @__PURE__ */ jsx18("span", { className: "flex size-7 shrink-0 items-center justify-center rounded-full border border-agg-separator bg-agg-secondary sm:size-8", children: /* @__PURE__ */ jsx18(Icon, { name: iconName, size: "small", className: "text-agg-foreground" }) });
|
|
5547
6256
|
if (!social.handle) {
|
|
5548
|
-
return /* @__PURE__ */
|
|
6257
|
+
return /* @__PURE__ */ jsx18("span", { children: iconNode }, `${social.platform}-icon`);
|
|
5549
6258
|
}
|
|
5550
|
-
return /* @__PURE__ */
|
|
6259
|
+
return /* @__PURE__ */ jsx18(
|
|
5551
6260
|
"a",
|
|
5552
6261
|
{
|
|
5553
6262
|
href: social.handle,
|
|
@@ -5560,55 +6269,55 @@ var UserInfoCard = ({
|
|
|
5560
6269
|
);
|
|
5561
6270
|
}) }) : null
|
|
5562
6271
|
] }),
|
|
5563
|
-
onEditProfile ? /* @__PURE__ */
|
|
6272
|
+
onEditProfile ? /* @__PURE__ */ jsxs17(
|
|
5564
6273
|
"button",
|
|
5565
6274
|
{
|
|
5566
6275
|
type: "button",
|
|
5567
6276
|
onClick: onEditProfile,
|
|
5568
6277
|
className: "hidden sm:flex shrink-0 cursor-pointer items-center gap-1.5 bg-transparent text-agg-primary hover:opacity-80",
|
|
5569
6278
|
children: [
|
|
5570
|
-
/* @__PURE__ */
|
|
5571
|
-
/* @__PURE__ */
|
|
6279
|
+
/* @__PURE__ */ jsx18(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
|
|
6280
|
+
/* @__PURE__ */ jsx18("span", { className: "text-agg-base font-agg-bold leading-6", children: "Edit" })
|
|
5572
6281
|
]
|
|
5573
6282
|
}
|
|
5574
6283
|
) : null
|
|
5575
6284
|
] }),
|
|
5576
|
-
hasWallets || !!user.socialHandle ? /* @__PURE__ */
|
|
6285
|
+
hasWallets || !!user.socialHandle ? /* @__PURE__ */ jsxs17("div", { className: "agg-profile-accounts flex w-full flex-col gap-2.5 sm:gap-3", children: [
|
|
5577
6286
|
wallets.map((wallet, idx) => {
|
|
5578
6287
|
const chainLower = wallet.chain.toLowerCase();
|
|
5579
6288
|
const iconName = chainLower === "solana" || chainLower === "svm" ? "solana" : "ethereum";
|
|
5580
|
-
return /* @__PURE__ */
|
|
6289
|
+
return /* @__PURE__ */ jsxs17(
|
|
5581
6290
|
"div",
|
|
5582
6291
|
{
|
|
5583
6292
|
className: "flex min-w-0 flex-wrap items-center gap-2 sm:gap-3",
|
|
5584
6293
|
children: [
|
|
5585
|
-
/* @__PURE__ */
|
|
5586
|
-
/* @__PURE__ */
|
|
6294
|
+
/* @__PURE__ */ jsx18("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx18(Icon, { name: iconName, size: "small", className: "text-agg-foreground" }) }),
|
|
6295
|
+
/* @__PURE__ */ jsx18("span", { className: "min-w-0 truncate text-agg-sm font-agg-normal leading-5 text-agg-foreground sm:text-agg-base sm:leading-6", children: wallet.displayAddress })
|
|
5587
6296
|
]
|
|
5588
6297
|
},
|
|
5589
6298
|
`wallet-${idx}`
|
|
5590
6299
|
);
|
|
5591
6300
|
}),
|
|
5592
|
-
user.socialHandle ? /* @__PURE__ */
|
|
6301
|
+
user.socialHandle ? /* @__PURE__ */ jsx18("div", { className: "flex min-w-0 items-center gap-2 sm:gap-3", children: /* @__PURE__ */ jsx18("span", { className: "min-w-0 truncate text-agg-sm font-agg-normal leading-5 text-agg-foreground sm:text-agg-base sm:leading-6", children: user.socialHandle }) }) : null
|
|
5593
6302
|
] }) : null
|
|
5594
6303
|
] })
|
|
5595
6304
|
] }),
|
|
5596
|
-
(onDeposit || onWithdraw) && /* @__PURE__ */
|
|
5597
|
-
onDeposit ? /* @__PURE__ */
|
|
6305
|
+
(onDeposit || onWithdraw) && /* @__PURE__ */ jsxs17("div", { className: "agg-profile-actions flex w-full flex-1 items-center gap-3 py-5", children: [
|
|
6306
|
+
onDeposit ? /* @__PURE__ */ jsx18(
|
|
5598
6307
|
ConditionalWrapper,
|
|
5599
6308
|
{
|
|
5600
6309
|
condition: isDepositBlocked,
|
|
5601
|
-
wrapper: (children) => /* @__PURE__ */
|
|
6310
|
+
wrapper: (children) => /* @__PURE__ */ jsx18(
|
|
5602
6311
|
Tooltip,
|
|
5603
6312
|
{
|
|
5604
|
-
content: /* @__PURE__ */
|
|
6313
|
+
content: /* @__PURE__ */ jsx18("p", { className: "text-center", children: labels.auth.depositGeoBlocked }),
|
|
5605
6314
|
size: "small",
|
|
5606
6315
|
side: "bottom",
|
|
5607
6316
|
sideOffset: 4,
|
|
5608
6317
|
children
|
|
5609
6318
|
}
|
|
5610
6319
|
),
|
|
5611
|
-
children: /* @__PURE__ */
|
|
6320
|
+
children: /* @__PURE__ */ jsx18(
|
|
5612
6321
|
Button,
|
|
5613
6322
|
__spreadProps(__spreadValues({
|
|
5614
6323
|
variant: "primary",
|
|
@@ -5620,7 +6329,7 @@ var UserInfoCard = ({
|
|
|
5620
6329
|
)
|
|
5621
6330
|
}
|
|
5622
6331
|
) : null,
|
|
5623
|
-
onWithdraw ? /* @__PURE__ */
|
|
6332
|
+
onWithdraw ? /* @__PURE__ */ jsx18(
|
|
5624
6333
|
Button,
|
|
5625
6334
|
{
|
|
5626
6335
|
variant: "secondary",
|
|
@@ -5630,15 +6339,15 @@ var UserInfoCard = ({
|
|
|
5630
6339
|
children: labels.auth.withdraw
|
|
5631
6340
|
}
|
|
5632
6341
|
) : null,
|
|
5633
|
-
onEditProfile ? /* @__PURE__ */
|
|
6342
|
+
onEditProfile ? /* @__PURE__ */ jsxs17(
|
|
5634
6343
|
"button",
|
|
5635
6344
|
{
|
|
5636
6345
|
type: "button",
|
|
5637
6346
|
onClick: onEditProfile,
|
|
5638
6347
|
className: "flex sm:hidden shrink-0 cursor-pointer items-center gap-1.5 bg-transparent px-2 py-2 text-agg-primary hover:opacity-80",
|
|
5639
6348
|
children: [
|
|
5640
|
-
/* @__PURE__ */
|
|
5641
|
-
/* @__PURE__ */
|
|
6349
|
+
/* @__PURE__ */ jsx18(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
|
|
6350
|
+
/* @__PURE__ */ jsx18("span", { className: "text-agg-sm font-agg-bold leading-5", children: "Edit" })
|
|
5642
6351
|
]
|
|
5643
6352
|
}
|
|
5644
6353
|
) : null
|
|
@@ -5650,14 +6359,14 @@ var UserInfoCard = ({
|
|
|
5650
6359
|
UserInfoCard.displayName = "UserInfoCard";
|
|
5651
6360
|
|
|
5652
6361
|
// src/pages/user-profile/index.tsx
|
|
5653
|
-
import { jsx as
|
|
6362
|
+
import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5654
6363
|
var currencyFormatter = new Intl.NumberFormat("en-US", {
|
|
5655
6364
|
style: "currency",
|
|
5656
6365
|
currency: "USD",
|
|
5657
6366
|
minimumFractionDigits: 2,
|
|
5658
6367
|
maximumFractionDigits: 2
|
|
5659
6368
|
});
|
|
5660
|
-
var
|
|
6369
|
+
var formatUsd2 = (value) => currencyFormatter.format(Number.isFinite(value) ? value : 0);
|
|
5661
6370
|
var formatSignedPercentLabel = (ratio) => {
|
|
5662
6371
|
const pct = Number.isFinite(ratio) ? ratio * 100 : 0;
|
|
5663
6372
|
const sign = pct > 0 ? "+" : "";
|
|
@@ -6060,10 +6769,10 @@ var toRedeemTransactions = (item) => {
|
|
|
6060
6769
|
});
|
|
6061
6770
|
};
|
|
6062
6771
|
var POSITION_ROW_VENUE_ORDER = [
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6772
|
+
Venue3.polymarket,
|
|
6773
|
+
Venue3.kalshi,
|
|
6774
|
+
Venue3.opinion,
|
|
6775
|
+
Venue3.limitless
|
|
6067
6776
|
];
|
|
6068
6777
|
function venueBreakdownSortKey(venue) {
|
|
6069
6778
|
const idx = POSITION_ROW_VENUE_ORDER.indexOf(venue);
|
|
@@ -6148,14 +6857,14 @@ var UserProfilePage = ({
|
|
|
6148
6857
|
onError
|
|
6149
6858
|
}) => {
|
|
6150
6859
|
var _a, _b;
|
|
6151
|
-
const [isHydrated, setIsHydrated] =
|
|
6152
|
-
|
|
6860
|
+
const [isHydrated, setIsHydrated] = useState12(false);
|
|
6861
|
+
useEffect11(() => {
|
|
6153
6862
|
setIsHydrated(true);
|
|
6154
6863
|
}, []);
|
|
6155
6864
|
const { user: currentUser, isAuthenticated } = useAggAuthState();
|
|
6156
6865
|
const { isDepositBlocked } = useGeoBlock();
|
|
6157
|
-
const balanceState =
|
|
6158
|
-
const labels =
|
|
6866
|
+
const balanceState = useAggBalance2();
|
|
6867
|
+
const labels = useLabels12();
|
|
6159
6868
|
const {
|
|
6160
6869
|
features: { showLimitOrders },
|
|
6161
6870
|
trading: { executionMode: configuredExecutionMode }
|
|
@@ -6163,25 +6872,35 @@ var UserProfilePage = ({
|
|
|
6163
6872
|
const client = useAggClient();
|
|
6164
6873
|
const cancelOrderMutation = useCancelManagedOrder();
|
|
6165
6874
|
const toastContext = useOptionalToast();
|
|
6166
|
-
const [internalCancellingIds, setInternalCancellingIds] =
|
|
6875
|
+
const [internalCancellingIds, setInternalCancellingIds] = useState12({});
|
|
6167
6876
|
const { claim: startClaim, claimingKeys } = useClaimWinnings({
|
|
6168
6877
|
onClaim,
|
|
6169
6878
|
onClaimResult,
|
|
6170
6879
|
onClaimSubmitError,
|
|
6171
6880
|
externalClaimingKeys: claimingPositionKeys
|
|
6172
6881
|
});
|
|
6173
|
-
const [profileUser, setProfileUser] =
|
|
6882
|
+
const [profileUser, setProfileUser] = useState12(void 0);
|
|
6174
6883
|
const shouldUseHookData = !user;
|
|
6175
|
-
const connectedVenues =
|
|
6884
|
+
const connectedVenues = useMemo8(() => {
|
|
6176
6885
|
var _a2;
|
|
6177
6886
|
if (!shouldUseHookData) return [];
|
|
6178
6887
|
const fromBalance = (_a2 = balanceState.connectedVenues) != null ? _a2 : [];
|
|
6179
6888
|
return [...new Set(fromBalance)].sort((a, b) => a.localeCompare(b));
|
|
6180
6889
|
}, [balanceState, shouldUseHookData]);
|
|
6181
|
-
const [positionFilter, setPositionFilter] =
|
|
6182
|
-
const [selectedClaimActivity, setSelectedClaimActivity] =
|
|
6890
|
+
const [positionFilter, setPositionFilter] = useState12(initialPositionFilter);
|
|
6891
|
+
const [selectedClaimActivity, setSelectedClaimActivity] = useState12(null);
|
|
6892
|
+
const [isManageBalancesOpen, setIsManageBalancesOpen] = useState12(false);
|
|
6893
|
+
const manageBalancesButtonRef = useRef10(null);
|
|
6183
6894
|
const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
|
|
6184
6895
|
const queryExecutionMode = resolvedExecutionMode === "paper" ? "paper" : void 0;
|
|
6896
|
+
const handleManageBalancesOpenChange = useCallback6((open) => {
|
|
6897
|
+
setIsManageBalancesOpen(open);
|
|
6898
|
+
if (open) return;
|
|
6899
|
+
requestAnimationFrame(() => {
|
|
6900
|
+
var _a2;
|
|
6901
|
+
return (_a2 = manageBalancesButtonRef.current) == null ? void 0 : _a2.focus();
|
|
6902
|
+
});
|
|
6903
|
+
}, []);
|
|
6185
6904
|
const activePositionsQuery = useExecutionPositions({
|
|
6186
6905
|
enabled: shouldUseHookData && isAuthenticated,
|
|
6187
6906
|
status: "active",
|
|
@@ -6194,14 +6913,14 @@ var UserProfilePage = ({
|
|
|
6194
6913
|
limit: 25,
|
|
6195
6914
|
mode: queryExecutionMode
|
|
6196
6915
|
});
|
|
6197
|
-
const handlePositionFilterChange =
|
|
6916
|
+
const handlePositionFilterChange = useCallback6(
|
|
6198
6917
|
(filter) => {
|
|
6199
6918
|
setPositionFilter(filter);
|
|
6200
6919
|
onPositionFilterChangeProp == null ? void 0 : onPositionFilterChangeProp(filter);
|
|
6201
6920
|
},
|
|
6202
6921
|
[onPositionFilterChangeProp]
|
|
6203
6922
|
);
|
|
6204
|
-
|
|
6923
|
+
useEffect11(() => {
|
|
6205
6924
|
setPositionFilter(initialPositionFilter);
|
|
6206
6925
|
}, [initialPositionFilter]);
|
|
6207
6926
|
const ordersQuery = useExecutionOrders({
|
|
@@ -6258,7 +6977,7 @@ var UserProfilePage = ({
|
|
|
6258
6977
|
limit: 25,
|
|
6259
6978
|
mode: queryExecutionMode
|
|
6260
6979
|
});
|
|
6261
|
-
const openOrderQueries =
|
|
6980
|
+
const openOrderQueries = useMemo8(
|
|
6262
6981
|
() => [
|
|
6263
6982
|
pendingOpenOrdersQuery,
|
|
6264
6983
|
signingOpenOrdersQuery,
|
|
@@ -6284,7 +7003,7 @@ var UserProfilePage = ({
|
|
|
6284
7003
|
enabled: shouldUseHookData && isAuthenticated,
|
|
6285
7004
|
limit: 25
|
|
6286
7005
|
});
|
|
6287
|
-
const handleCancelOrder =
|
|
7006
|
+
const handleCancelOrder = useCallback6(
|
|
6288
7007
|
(order) => __async(null, null, function* () {
|
|
6289
7008
|
if (onCancelOrder) {
|
|
6290
7009
|
onCancelOrder(order);
|
|
@@ -6317,7 +7036,7 @@ var UserProfilePage = ({
|
|
|
6317
7036
|
}),
|
|
6318
7037
|
[cancelOrderMutation, labels.notifications.order, onCancelOrder, toastContext]
|
|
6319
7038
|
);
|
|
6320
|
-
const handleClaimPosition =
|
|
7039
|
+
const handleClaimPosition = useCallback6(
|
|
6321
7040
|
(position) => {
|
|
6322
7041
|
var _a2, _b2;
|
|
6323
7042
|
return startClaim({
|
|
@@ -6328,7 +7047,7 @@ var UserProfilePage = ({
|
|
|
6328
7047
|
},
|
|
6329
7048
|
[startClaim]
|
|
6330
7049
|
);
|
|
6331
|
-
const handleActivityRowClick =
|
|
7050
|
+
const handleActivityRowClick = useCallback6(
|
|
6332
7051
|
(activity) => {
|
|
6333
7052
|
if (activity.kind === "redeem") {
|
|
6334
7053
|
setSelectedClaimActivity(activity);
|
|
@@ -6338,13 +7057,13 @@ var UserProfilePage = ({
|
|
|
6338
7057
|
},
|
|
6339
7058
|
[onActivityClick]
|
|
6340
7059
|
);
|
|
6341
|
-
const handleClaimTransactionSelect =
|
|
7060
|
+
const handleClaimTransactionSelect = useCallback6((transaction) => {
|
|
6342
7061
|
const href = buildAggTxExplorerHref(transaction.chainId, transaction.txHash);
|
|
6343
7062
|
setSelectedClaimActivity(null);
|
|
6344
7063
|
if (!href || typeof window === "undefined") return;
|
|
6345
7064
|
window.open(href, "_blank", "noopener,noreferrer");
|
|
6346
7065
|
}, []);
|
|
6347
|
-
|
|
7066
|
+
useEffect11(() => {
|
|
6348
7067
|
if (!shouldUseHookData || !isAuthenticated) {
|
|
6349
7068
|
setProfileUser(void 0);
|
|
6350
7069
|
return;
|
|
@@ -6363,7 +7082,7 @@ var UserProfilePage = ({
|
|
|
6363
7082
|
isActive = false;
|
|
6364
7083
|
};
|
|
6365
7084
|
}, [client, currentUser, isAuthenticated, shouldUseHookData]);
|
|
6366
|
-
const resolvedUser =
|
|
7085
|
+
const resolvedUser = useMemo8(() => {
|
|
6367
7086
|
var _a2, _b2, _c, _d, _e, _f;
|
|
6368
7087
|
if (user) return user;
|
|
6369
7088
|
const fullUser = profileUser != null ? profileUser : currentUser;
|
|
@@ -6397,40 +7116,32 @@ var UserProfilePage = ({
|
|
|
6397
7116
|
socialHandle: normalizedTwitterHandle != null ? normalizedTwitterHandle : void 0
|
|
6398
7117
|
};
|
|
6399
7118
|
}, [connectedVenues, currentUser, profileUser, user]);
|
|
6400
|
-
const _resolvedVenueBalances =
|
|
7119
|
+
const _resolvedVenueBalances = useMemo8(() => {
|
|
6401
7120
|
if (_venueBalances) return _venueBalances;
|
|
6402
7121
|
return balanceState.balanceBreakdown.map((item) => ({
|
|
6403
7122
|
chain: item.label,
|
|
6404
7123
|
accountCount: item.accountCount,
|
|
6405
|
-
balanceLabel:
|
|
7124
|
+
balanceLabel: formatUsd2(item.balance)
|
|
6406
7125
|
}));
|
|
6407
7126
|
}, [_venueBalances, balanceState.balanceBreakdown]);
|
|
6408
|
-
const positionsValueLabel =
|
|
7127
|
+
const positionsValueLabel = useMemo8(() => {
|
|
6409
7128
|
var _a2;
|
|
6410
7129
|
if (balance == null ? void 0 : balance.totalLabel) return balance.totalLabel;
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
return formatUsd(positionsValueTotal);
|
|
6415
|
-
}, [balance, balanceState]);
|
|
6416
|
-
const availableBalanceLabel = useMemo7(() => {
|
|
7130
|
+
return formatUsd2((_a2 = balanceState.positionsBalanceTotal) != null ? _a2 : 0);
|
|
7131
|
+
}, [balance == null ? void 0 : balance.totalLabel, balanceState.positionsBalanceTotal]);
|
|
7132
|
+
const availableBalanceLabel = useMemo8(() => {
|
|
6417
7133
|
var _a2, _b2;
|
|
6418
|
-
return
|
|
7134
|
+
return formatUsd2((_b2 = (_a2 = balanceState.availableBalance) != null ? _a2 : balanceState.totalBalance) != null ? _b2 : 0);
|
|
6419
7135
|
}, [balanceState.availableBalance, balanceState.totalBalance]);
|
|
6420
|
-
const reservedBalanceLabel = useMemo7(() => {
|
|
6421
|
-
var _a2;
|
|
6422
|
-
const reserved = (_a2 = balanceState.reservedBalance) != null ? _a2 : 0;
|
|
6423
|
-
return reserved > 0 ? formatUsd(reserved) : void 0;
|
|
6424
|
-
}, [balanceState.reservedBalance]);
|
|
6425
7136
|
const { disabledVenues, isLoading: isAppConfigLoading } = useAppConfig2();
|
|
6426
7137
|
const isKalshiAvailable = getVenueAvailabilityState({
|
|
6427
|
-
venueId:
|
|
7138
|
+
venueId: Venue3.kalshi,
|
|
6428
7139
|
disabledVenues,
|
|
6429
7140
|
isConfigLoading: isAppConfigLoading
|
|
6430
7141
|
}) === "available";
|
|
6431
7142
|
const isPositionsValueLoading = !(balance == null ? void 0 : balance.totalLabel) && balanceState.isLoading;
|
|
6432
7143
|
const isAvailableBalanceLoading = balanceState.isLoading;
|
|
6433
|
-
const resolvedActivities =
|
|
7144
|
+
const resolvedActivities = useMemo8(() => {
|
|
6434
7145
|
if (activities) return activities.filter(isVisibleUserProfileActivity);
|
|
6435
7146
|
const formatTime = isHydrated ? toRelativeTimeLabel : toAbsoluteTimeLabel;
|
|
6436
7147
|
return activityQuery.activities.filter(isVisibleActivityItem).map((item, index) => {
|
|
@@ -6581,7 +7292,7 @@ var UserProfilePage = ({
|
|
|
6581
7292
|
};
|
|
6582
7293
|
});
|
|
6583
7294
|
}, [activities, activityQuery.activities, isHydrated, labels, ordersQuery.orders]);
|
|
6584
|
-
const resolvedOpenOrders =
|
|
7295
|
+
const resolvedOpenOrders = useMemo8(() => {
|
|
6585
7296
|
if (openOrders) return openOrders;
|
|
6586
7297
|
const orderRowsById = /* @__PURE__ */ new Map();
|
|
6587
7298
|
for (const query of openOrderQueries) {
|
|
@@ -6622,30 +7333,30 @@ var UserProfilePage = ({
|
|
|
6622
7333
|
});
|
|
6623
7334
|
});
|
|
6624
7335
|
}, [labels, openOrderQueries, openOrders]);
|
|
6625
|
-
const isOpenOrdersQueryLoading =
|
|
7336
|
+
const isOpenOrdersQueryLoading = useMemo8(
|
|
6626
7337
|
() => openOrderQueries.some((query) => query.isLoading),
|
|
6627
7338
|
[openOrderQueries]
|
|
6628
7339
|
);
|
|
6629
|
-
const hasOpenOrdersQueryError =
|
|
7340
|
+
const hasOpenOrdersQueryError = useMemo8(
|
|
6630
7341
|
() => openOrderQueries.some((query) => query.error),
|
|
6631
7342
|
[openOrderQueries]
|
|
6632
7343
|
);
|
|
6633
|
-
const hasMoreOpenOrdersQuery =
|
|
7344
|
+
const hasMoreOpenOrdersQuery = useMemo8(
|
|
6634
7345
|
() => openOrderQueries.some((query) => query.hasNextPage),
|
|
6635
7346
|
[openOrderQueries]
|
|
6636
7347
|
);
|
|
6637
|
-
const isLoadingMoreOpenOrdersQuery =
|
|
7348
|
+
const isLoadingMoreOpenOrdersQuery = useMemo8(
|
|
6638
7349
|
() => openOrderQueries.some((query) => query.isFetchingNextPage),
|
|
6639
7350
|
[openOrderQueries]
|
|
6640
7351
|
);
|
|
6641
|
-
const handleLoadMoreOpenOrders =
|
|
7352
|
+
const handleLoadMoreOpenOrders = useCallback6(() => {
|
|
6642
7353
|
for (const query of openOrderQueries) {
|
|
6643
7354
|
if (query.hasNextPage) {
|
|
6644
7355
|
void query.fetchNextPage();
|
|
6645
7356
|
}
|
|
6646
7357
|
}
|
|
6647
7358
|
}, [openOrderQueries]);
|
|
6648
|
-
const adaptPositionGroups =
|
|
7359
|
+
const adaptPositionGroups = useCallback6(
|
|
6649
7360
|
(groups) => {
|
|
6650
7361
|
return groups.flatMap((group) => {
|
|
6651
7362
|
var _a2, _b2, _c, _d;
|
|
@@ -6689,9 +7400,9 @@ var UserProfilePage = ({
|
|
|
6689
7400
|
averagePrice: outcome.avgEntryPrice,
|
|
6690
7401
|
currentLabel: currentPriceCents == null ? "\u2014" : `${currentPriceCents}\xA2`,
|
|
6691
7402
|
currentPrice: displayCurrentPrice,
|
|
6692
|
-
valueLabel: displayCurrentValue == null ? "\u2014" :
|
|
7403
|
+
valueLabel: displayCurrentValue == null ? "\u2014" : formatUsd2(displayCurrentValue),
|
|
6693
7404
|
currentValue: displayCurrentValue,
|
|
6694
|
-
pnlLabel: displayPnlValue == null || pnlPercent == null ? "\u2014" : `${pnlPrefix}${
|
|
7405
|
+
pnlLabel: displayPnlValue == null || pnlPercent == null ? "\u2014" : `${pnlPrefix}${formatUsd2(displayPnlValue)} (${pnlPrefix}${pnlPercent}%)`,
|
|
6695
7406
|
pnlValue: displayPnlValue,
|
|
6696
7407
|
pnlPercent: displayPnlPercent,
|
|
6697
7408
|
isPnlPositive: displayPnlValue != null && displayPnlValue >= 0,
|
|
@@ -6699,9 +7410,9 @@ var UserProfilePage = ({
|
|
|
6699
7410
|
marketStatus: group.venueMarket.status,
|
|
6700
7411
|
winner: (_d2 = outcome.winner) != null ? _d2 : null,
|
|
6701
7412
|
resolutionDate: group.resolutionDate,
|
|
6702
|
-
closedTotalTradedLabel:
|
|
7413
|
+
closedTotalTradedLabel: formatUsd2(totalTradedValue),
|
|
6703
7414
|
totalTradedValue,
|
|
6704
|
-
closedAmountWonLabel:
|
|
7415
|
+
closedAmountWonLabel: formatUsd2(finalPayoutValue),
|
|
6705
7416
|
finalPayoutValue,
|
|
6706
7417
|
finalPnlValue,
|
|
6707
7418
|
finalPnlPercent,
|
|
@@ -6715,15 +7426,15 @@ var UserProfilePage = ({
|
|
|
6715
7426
|
},
|
|
6716
7427
|
[]
|
|
6717
7428
|
);
|
|
6718
|
-
const resolvedActivePositions =
|
|
7429
|
+
const resolvedActivePositions = useMemo8(() => {
|
|
6719
7430
|
const source = activePositions != null ? activePositions : adaptPositionGroups(activePositionsQuery.positions);
|
|
6720
7431
|
return source.filter(shouldIncludeByShares);
|
|
6721
7432
|
}, [activePositions, activePositionsQuery.positions, adaptPositionGroups]);
|
|
6722
|
-
const resolvedClosedPositions =
|
|
7433
|
+
const resolvedClosedPositions = useMemo8(() => {
|
|
6723
7434
|
const source = closedPositions != null ? closedPositions : adaptPositionGroups(closedPositionsQuery.positions);
|
|
6724
7435
|
return source.filter(shouldIncludeByShares);
|
|
6725
7436
|
}, [closedPositions, closedPositionsQuery.positions, adaptPositionGroups]);
|
|
6726
|
-
return /* @__PURE__ */
|
|
7437
|
+
return /* @__PURE__ */ jsx19(AggErrorBoundary, { onError, children: /* @__PURE__ */ jsx19(
|
|
6727
7438
|
"section",
|
|
6728
7439
|
{
|
|
6729
7440
|
className: cn(
|
|
@@ -6731,7 +7442,7 @@ var UserProfilePage = ({
|
|
|
6731
7442
|
"w-full mx-auto px-6 lg:px-10 pb-10 max-w-[1440px]",
|
|
6732
7443
|
classNames == null ? void 0 : classNames.root
|
|
6733
7444
|
),
|
|
6734
|
-
children: /* @__PURE__ */
|
|
7445
|
+
children: /* @__PURE__ */ jsxs18(
|
|
6735
7446
|
"div",
|
|
6736
7447
|
{
|
|
6737
7448
|
className: cn(
|
|
@@ -6741,8 +7452,8 @@ var UserProfilePage = ({
|
|
|
6741
7452
|
classNames == null ? void 0 : classNames.topRow
|
|
6742
7453
|
),
|
|
6743
7454
|
children: [
|
|
6744
|
-
/* @__PURE__ */
|
|
6745
|
-
/* @__PURE__ */
|
|
7455
|
+
/* @__PURE__ */ jsxs18("div", { className: "agg-profile-summary grid grid-cols-1 gap-6 lg:grid-cols-[1fr_minmax(300px,420px)] lg:items-stretch lg:gap-8", children: [
|
|
7456
|
+
/* @__PURE__ */ jsx19(
|
|
6746
7457
|
"div",
|
|
6747
7458
|
{
|
|
6748
7459
|
className: cn(
|
|
@@ -6750,7 +7461,7 @@ var UserProfilePage = ({
|
|
|
6750
7461
|
"flex min-w-0 flex-1 flex-col gap-4 sm:gap-6 h-full",
|
|
6751
7462
|
classNames == null ? void 0 : classNames.leftColumn
|
|
6752
7463
|
),
|
|
6753
|
-
children: /* @__PURE__ */
|
|
7464
|
+
children: /* @__PURE__ */ jsx19(
|
|
6754
7465
|
UserInfoCard,
|
|
6755
7466
|
{
|
|
6756
7467
|
user: resolvedUser,
|
|
@@ -6763,7 +7474,7 @@ var UserProfilePage = ({
|
|
|
6763
7474
|
)
|
|
6764
7475
|
}
|
|
6765
7476
|
),
|
|
6766
|
-
/* @__PURE__ */
|
|
7477
|
+
/* @__PURE__ */ jsxs18(
|
|
6767
7478
|
"div",
|
|
6768
7479
|
{
|
|
6769
7480
|
className: cn(
|
|
@@ -6771,7 +7482,7 @@ var UserProfilePage = ({
|
|
|
6771
7482
|
classNames == null ? void 0 : classNames.rightColumn
|
|
6772
7483
|
),
|
|
6773
7484
|
children: [
|
|
6774
|
-
/* @__PURE__ */
|
|
7485
|
+
/* @__PURE__ */ jsxs18(
|
|
6775
7486
|
"div",
|
|
6776
7487
|
{
|
|
6777
7488
|
className: cn(
|
|
@@ -6779,7 +7490,7 @@ var UserProfilePage = ({
|
|
|
6779
7490
|
isKalshiAvailable ? "grid-cols-1 sm:grid-cols-2" : "grid-cols-1"
|
|
6780
7491
|
),
|
|
6781
7492
|
children: [
|
|
6782
|
-
/* @__PURE__ */
|
|
7493
|
+
/* @__PURE__ */ jsx19(
|
|
6783
7494
|
PositionsValueCard,
|
|
6784
7495
|
{
|
|
6785
7496
|
label: labels.userProfile.balance.positionsValue,
|
|
@@ -6787,22 +7498,21 @@ var UserProfilePage = ({
|
|
|
6787
7498
|
isLoading: isPositionsValueLoading
|
|
6788
7499
|
}
|
|
6789
7500
|
),
|
|
6790
|
-
isKalshiAvailable ? /* @__PURE__ */
|
|
7501
|
+
isKalshiAvailable ? /* @__PURE__ */ jsx19(
|
|
6791
7502
|
PositionsValueCard,
|
|
6792
7503
|
{
|
|
6793
7504
|
label: labels.userProfile.balance.kalshiBalance,
|
|
6794
|
-
valueLabel:
|
|
6795
|
-
icon: /* @__PURE__ */
|
|
7505
|
+
valueLabel: formatUsd2((_a = balanceState.kalshiBalance) != null ? _a : 0),
|
|
7506
|
+
icon: /* @__PURE__ */ jsx19(VenueLogo, { venue: Venue3.kalshi, size: "small", className: "size-4" })
|
|
6796
7507
|
}
|
|
6797
7508
|
) : null
|
|
6798
7509
|
]
|
|
6799
7510
|
}
|
|
6800
7511
|
),
|
|
6801
|
-
/* @__PURE__ */
|
|
7512
|
+
/* @__PURE__ */ jsx19(
|
|
6802
7513
|
AvailableBalanceCard,
|
|
6803
7514
|
{
|
|
6804
7515
|
valueLabel: availableBalanceLabel,
|
|
6805
|
-
reservedValueLabel: reservedBalanceLabel,
|
|
6806
7516
|
isLoading: isAvailableBalanceLoading,
|
|
6807
7517
|
chains: ((_b = balanceChainsOverride != null ? balanceChainsOverride : balanceState.availableBalanceBreakdown) != null ? _b : balanceState.balanceBreakdown).map((b) => ({
|
|
6808
7518
|
key: b.key,
|
|
@@ -6810,14 +7520,16 @@ var UserProfilePage = ({
|
|
|
6810
7520
|
balance: b.balance,
|
|
6811
7521
|
accountCount: b.accountCount,
|
|
6812
7522
|
venues: b.venues
|
|
6813
|
-
}))
|
|
7523
|
+
})),
|
|
7524
|
+
manageButtonRef: manageBalancesButtonRef,
|
|
7525
|
+
onManage: () => handleManageBalancesOpenChange(true)
|
|
6814
7526
|
}
|
|
6815
7527
|
)
|
|
6816
7528
|
]
|
|
6817
7529
|
}
|
|
6818
7530
|
)
|
|
6819
7531
|
] }),
|
|
6820
|
-
/* @__PURE__ */
|
|
7532
|
+
/* @__PURE__ */ jsx19(
|
|
6821
7533
|
PositionsActivity,
|
|
6822
7534
|
{
|
|
6823
7535
|
tab,
|
|
@@ -6869,7 +7581,7 @@ var UserProfilePage = ({
|
|
|
6869
7581
|
className: classNames == null ? void 0 : classNames.positionsActivity
|
|
6870
7582
|
}
|
|
6871
7583
|
),
|
|
6872
|
-
/* @__PURE__ */
|
|
7584
|
+
/* @__PURE__ */ jsx19(
|
|
6873
7585
|
ClaimActivityBreakdownModal,
|
|
6874
7586
|
{
|
|
6875
7587
|
activity: selectedClaimActivity,
|
|
@@ -6879,6 +7591,13 @@ var UserProfilePage = ({
|
|
|
6879
7591
|
},
|
|
6880
7592
|
onTransactionSelect: handleClaimTransactionSelect
|
|
6881
7593
|
}
|
|
7594
|
+
),
|
|
7595
|
+
/* @__PURE__ */ jsx19(
|
|
7596
|
+
ManageBalancesModal,
|
|
7597
|
+
{
|
|
7598
|
+
open: isManageBalancesOpen,
|
|
7599
|
+
onOpenChange: handleManageBalancesOpenChange
|
|
7600
|
+
}
|
|
6882
7601
|
)
|
|
6883
7602
|
]
|
|
6884
7603
|
}
|
|
@@ -6894,6 +7613,7 @@ export {
|
|
|
6894
7613
|
EventMarketPage,
|
|
6895
7614
|
useHomePageModals,
|
|
6896
7615
|
HomePage,
|
|
7616
|
+
ManageBalancesModal,
|
|
6897
7617
|
USER_PROFILE_TAB_POSITIONS,
|
|
6898
7618
|
USER_PROFILE_TAB_OPEN_ORDERS,
|
|
6899
7619
|
USER_PROFILE_TAB_ACTIVITY,
|