@agg-build/ui 2.4.9 → 2.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-AHQA3B7D.mjs +947 -0
- package/dist/{chunk-CXSIXL7M.mjs → chunk-AJJ73RM4.mjs} +698 -257
- package/dist/{chunk-TEBAR55W.mjs → chunk-EDQ64EKO.mjs} +339 -1084
- package/dist/{chunk-GWRFSQQK.mjs → chunk-FAU2VOL6.mjs} +1594 -700
- package/dist/{chunk-PTNFXXOV.mjs → chunk-FMYYPNZZ.mjs} +904 -788
- package/dist/{chunk-UH3DUTMG.mjs → chunk-JQKJDSTW.mjs} +1 -1
- package/dist/{chunk-I4X5UNCT.mjs → chunk-XAG432PJ.mjs} +12 -6
- package/dist/events.js +1077 -999
- package/dist/events.mjs +3 -3
- package/dist/index.js +16499 -14884
- package/dist/index.mjs +56 -18
- package/dist/modals.js +1292 -1084
- package/dist/modals.mjs +10 -10
- package/dist/pages.js +4954 -2639
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +905 -788
- package/dist/primitives.mjs +3 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +3383 -1508
- package/dist/trading.mjs +6 -4
- package/dist/types/auth/connect-button-view/connect-button-view.types.d.mts +2 -0
- package/dist/types/auth/connect-button-view/connect-button-view.types.d.ts +2 -0
- package/dist/types/auth/connect-button-view/index.d.mts +1 -1
- package/dist/types/auth/connect-button-view/index.d.ts +1 -1
- package/dist/types/onboarding/steps/connect-kalshi-modal.d.mts +1 -1
- package/dist/types/onboarding/steps/connect-kalshi-modal.d.ts +1 -1
- package/dist/types/pages/user-profile/components/available-balance-card.d.mts +2 -1
- package/dist/types/pages/user-profile/components/available-balance-card.d.ts +2 -1
- package/dist/types/pages/user-profile/components/open-order-row.d.mts +10 -1
- package/dist/types/pages/user-profile/components/open-order-row.d.ts +10 -1
- package/dist/types/pages/user-profile/components/positions-activity.d.mts +4 -1
- package/dist/types/pages/user-profile/components/positions-activity.d.ts +4 -1
- package/dist/types/pages/user-profile/components/positions-value-card.d.mts +4 -2
- package/dist/types/pages/user-profile/components/positions-value-card.d.ts +4 -2
- package/dist/types/pages/user-profile/index.d.mts +2 -2
- package/dist/types/pages/user-profile/index.d.ts +2 -2
- package/dist/types/pages/user-profile/user-profile.types.d.mts +12 -0
- package/dist/types/pages/user-profile/user-profile.types.d.ts +12 -0
- package/dist/types/primitives/calendar/index.d.mts +8 -0
- package/dist/types/primitives/calendar/index.d.ts +8 -0
- package/dist/types/primitives/icon/registry.d.mts +3 -0
- package/dist/types/primitives/icon/registry.d.ts +3 -0
- package/dist/types/primitives/icon/svg/calendar.d.mts +2 -0
- package/dist/types/primitives/icon/svg/calendar.d.ts +2 -0
- package/dist/types/primitives/icon/svg/minus.d.mts +2 -0
- package/dist/types/primitives/icon/svg/minus.d.ts +2 -0
- package/dist/types/primitives/icon/svg/plus.d.mts +2 -0
- package/dist/types/primitives/icon/svg/plus.d.ts +2 -0
- package/dist/types/primitives/index.d.mts +1 -0
- package/dist/types/primitives/index.d.ts +1 -0
- package/dist/types/profile/index.d.mts +1 -1
- package/dist/types/profile/index.d.ts +1 -1
- package/dist/types/profile/profile-modal.types.d.mts +6 -0
- package/dist/types/profile/profile-modal.types.d.ts +6 -0
- package/dist/types/profile/tabs/trading-access-tab.d.mts +3 -1
- package/dist/types/profile/tabs/trading-access-tab.d.ts +3 -1
- package/dist/types/trading/fund-kalshi-modal.d.mts +8 -0
- package/dist/types/trading/fund-kalshi-modal.d.ts +8 -0
- package/dist/types/trading/index.d.mts +1 -0
- package/dist/types/trading/index.d.ts +1 -0
- package/dist/types/trading/place-order/index.d.mts +1 -1
- package/dist/types/trading/place-order/index.d.ts +1 -1
- package/dist/types/trading/place-order/index.place-order.types.d.mts +13 -1
- package/dist/types/trading/place-order/index.place-order.types.d.ts +13 -1
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +18 -1
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +18 -1
- package/package.json +7 -4
- package/dist/chunk-JVRTJQPZ.mjs +0 -59
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
isErrorWithStatus,
|
|
11
11
|
useEventListTabs,
|
|
12
12
|
useEventListTabsHeaderOverflow
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-XAG432PJ.mjs";
|
|
14
14
|
import {
|
|
15
15
|
DEPOSIT_MODAL_OPEN_EVENT,
|
|
16
16
|
PlaceOrder,
|
|
@@ -18,10 +18,10 @@ import {
|
|
|
18
18
|
WITHDRAW_MODAL_OPEN_EVENT,
|
|
19
19
|
useClaimWinnings,
|
|
20
20
|
useResolvedMarketClaim
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-FAU2VOL6.mjs";
|
|
22
22
|
import {
|
|
23
23
|
getDisplayOutcomePrice
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-JQKJDSTW.mjs";
|
|
25
25
|
import {
|
|
26
26
|
AggErrorBoundary,
|
|
27
27
|
Button,
|
|
@@ -52,8 +52,9 @@ import {
|
|
|
52
52
|
resolveTabVenus,
|
|
53
53
|
shortenAddress,
|
|
54
54
|
skeletonViews,
|
|
55
|
-
sortCategoriesForNavigation
|
|
56
|
-
|
|
55
|
+
sortCategoriesForNavigation,
|
|
56
|
+
useOptionalToast
|
|
57
|
+
} from "./chunk-FMYYPNZZ.mjs";
|
|
57
58
|
|
|
58
59
|
// src/pages/home/index.tsx
|
|
59
60
|
import {
|
|
@@ -2969,19 +2970,22 @@ HomePage.displayName = "HomePage";
|
|
|
2969
2970
|
// src/pages/user-profile/index.tsx
|
|
2970
2971
|
import {
|
|
2971
2972
|
computeClosedPositionTotals,
|
|
2973
|
+
getVenueAvailabilityState,
|
|
2972
2974
|
getWalletAddressFromUserProfile,
|
|
2975
|
+
useAppConfig as useAppConfig2,
|
|
2973
2976
|
useAggAuthState,
|
|
2974
2977
|
useAggBalance,
|
|
2975
2978
|
useAggClient,
|
|
2979
|
+
useCancelManagedOrder,
|
|
2976
2980
|
useExecutionOrders,
|
|
2977
2981
|
useExecutionPositions,
|
|
2978
2982
|
useGeoBlock,
|
|
2979
|
-
useLabels as
|
|
2980
|
-
useQueryClient,
|
|
2983
|
+
useLabels as useLabels11,
|
|
2981
2984
|
useSdkUiConfig as useSdkUiConfig5,
|
|
2982
2985
|
useUserActivity
|
|
2983
2986
|
} from "@agg-build/hooks";
|
|
2984
2987
|
import { Venue as Venue2 } from "@agg-build/sdk";
|
|
2988
|
+
import dayjs from "dayjs";
|
|
2985
2989
|
import { useCallback as useCallback5, useEffect as useEffect10, useMemo as useMemo7, useState as useState11 } from "react";
|
|
2986
2990
|
|
|
2987
2991
|
// src/pages/user-profile/chain-display.ts
|
|
@@ -3056,6 +3060,7 @@ var chainIconUrl = (label, key) => {
|
|
|
3056
3060
|
var AvailableBalanceCard = ({
|
|
3057
3061
|
label,
|
|
3058
3062
|
valueLabel,
|
|
3063
|
+
reservedValueLabel,
|
|
3059
3064
|
chains,
|
|
3060
3065
|
isLoading = false,
|
|
3061
3066
|
className
|
|
@@ -3211,7 +3216,8 @@ var AvailableBalanceCard = ({
|
|
|
3211
3216
|
)
|
|
3212
3217
|
}
|
|
3213
3218
|
)
|
|
3214
|
-
] })
|
|
3219
|
+
] }),
|
|
3220
|
+
!isLoading && reservedValueLabel ? /* @__PURE__ */ jsx8("p", { className: "font-agg-sans text-agg-xs leading-agg-4 text-agg-muted-foreground", children: balanceLabels.reservedForOpenOrders(reservedValueLabel) }) : null
|
|
3215
3221
|
]
|
|
3216
3222
|
}
|
|
3217
3223
|
);
|
|
@@ -3347,7 +3353,7 @@ var ClaimActivityBreakdownModal = ({
|
|
|
3347
3353
|
};
|
|
3348
3354
|
|
|
3349
3355
|
// src/pages/user-profile/components/positions-activity.tsx
|
|
3350
|
-
import { optimizedImageUrl as
|
|
3356
|
+
import { optimizedImageUrl as optimizedImageUrl3, useLabels as useLabels9 } from "@agg-build/hooks";
|
|
3351
3357
|
import { Fragment as Fragment4, useEffect as useEffect9, useMemo as useMemo6, useRef as useRef8, useState as useState10 } from "react";
|
|
3352
3358
|
|
|
3353
3359
|
// src/pages/user-profile/user-profile.constants.ts
|
|
@@ -4134,32 +4140,161 @@ var EmptyState = ({ title, description, className }) => {
|
|
|
4134
4140
|
};
|
|
4135
4141
|
EmptyState.displayName = "EmptyState";
|
|
4136
4142
|
|
|
4137
|
-
// src/pages/user-profile/components/
|
|
4143
|
+
// src/pages/user-profile/components/open-order-row.tsx
|
|
4138
4144
|
import { optimizedImageUrl, useLabels as useLabels7 } from "@agg-build/hooks";
|
|
4139
|
-
import {
|
|
4145
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4140
4146
|
var shouldUseNativeLinkNavigation2 = (event) => {
|
|
4141
4147
|
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
|
|
4142
4148
|
};
|
|
4149
|
+
var OpenOrderRow = ({
|
|
4150
|
+
order,
|
|
4151
|
+
href,
|
|
4152
|
+
onClick,
|
|
4153
|
+
onCancel,
|
|
4154
|
+
isCancelling = false,
|
|
4155
|
+
cancelLabel,
|
|
4156
|
+
cancelAriaLabel,
|
|
4157
|
+
limitPriceHeader,
|
|
4158
|
+
filledHeader,
|
|
4159
|
+
totalHeader,
|
|
4160
|
+
expirationHeader
|
|
4161
|
+
}) => {
|
|
4162
|
+
var _a, _b, _c, _d;
|
|
4163
|
+
const labels = useLabels7().userProfile.openOrders;
|
|
4164
|
+
const resolvedCancelLabel = cancelLabel != null ? cancelLabel : labels.cancel;
|
|
4165
|
+
const resolvedCancelAriaLabel = cancelAriaLabel != null ? cancelAriaLabel : labels.cancelOrderAria(order.id);
|
|
4166
|
+
const resolvedLimitPriceHeader = limitPriceHeader != null ? limitPriceHeader : labels.limitPriceHeader;
|
|
4167
|
+
const resolvedFilledHeader = filledHeader != null ? filledHeader : labels.filledHeader;
|
|
4168
|
+
const resolvedTotalHeader = totalHeader != null ? totalHeader : labels.totalHeader;
|
|
4169
|
+
const resolvedExpirationHeader = expirationHeader != null ? expirationHeader : labels.expirationHeader;
|
|
4170
|
+
const handleDivClick = () => {
|
|
4171
|
+
onClick == null ? void 0 : onClick(order);
|
|
4172
|
+
};
|
|
4173
|
+
const handleAnchorClick = (event) => {
|
|
4174
|
+
if (shouldUseNativeLinkNavigation2(event)) return;
|
|
4175
|
+
if (!onClick) return;
|
|
4176
|
+
event.preventDefault();
|
|
4177
|
+
onClick(order);
|
|
4178
|
+
};
|
|
4179
|
+
const handleCancelClick = (event) => {
|
|
4180
|
+
event.preventDefault();
|
|
4181
|
+
event.stopPropagation();
|
|
4182
|
+
onCancel == null ? void 0 : onCancel(order);
|
|
4183
|
+
};
|
|
4184
|
+
const status = order.status.toLowerCase();
|
|
4185
|
+
const isLimitOrder = order.orderType === "limit";
|
|
4186
|
+
const canCancel = status === "open" || status === "partially_filled_open" || status === "cancel_pending" || status === "submitted" && isLimitOrder || status === "pending" && !order.dagRunId;
|
|
4187
|
+
const Wrapper = href ? "a" : "div";
|
|
4188
|
+
const wrapperProps = href ? {
|
|
4189
|
+
href,
|
|
4190
|
+
onClick: handleAnchorClick
|
|
4191
|
+
} : {
|
|
4192
|
+
role: "button",
|
|
4193
|
+
tabIndex: 0,
|
|
4194
|
+
onClick: handleDivClick,
|
|
4195
|
+
onKeyDown: (event) => {
|
|
4196
|
+
if (event.target !== event.currentTarget) return;
|
|
4197
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
4198
|
+
event.preventDefault();
|
|
4199
|
+
handleDivClick();
|
|
4200
|
+
}
|
|
4201
|
+
};
|
|
4202
|
+
return /* @__PURE__ */ jsx12(
|
|
4203
|
+
Wrapper,
|
|
4204
|
+
__spreadProps(__spreadValues({
|
|
4205
|
+
"aria-label": order.title,
|
|
4206
|
+
className: cn(
|
|
4207
|
+
"agg-open-order-row relative block cursor-pointer focus-visible:outline-none",
|
|
4208
|
+
"before:absolute before:-top-2 before:-left-2 before:-bottom-2 before:-right-2 before:z-0",
|
|
4209
|
+
"before:rounded-agg-xl before:bg-agg-secondary-hover before:opacity-0 before:transition-all before:duration-300",
|
|
4210
|
+
"hover:before:opacity-100 focus-visible:before:opacity-100"
|
|
4211
|
+
)
|
|
4212
|
+
}, wrapperProps), {
|
|
4213
|
+
children: /* @__PURE__ */ jsxs11("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: [
|
|
4214
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex min-w-0 flex-1 items-center gap-3 lg:gap-4", children: [
|
|
4215
|
+
/* @__PURE__ */ jsx12("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__ */ jsx12(
|
|
4216
|
+
RemoteImage,
|
|
4217
|
+
{
|
|
4218
|
+
src: optimizedImageUrl(order.thumbnailSrc, 60),
|
|
4219
|
+
alt: "",
|
|
4220
|
+
className: "h-full w-full rounded-agg-sm object-cover"
|
|
4221
|
+
}
|
|
4222
|
+
) }),
|
|
4223
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
|
|
4224
|
+
/* @__PURE__ */ jsx12("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 }),
|
|
4225
|
+
/* @__PURE__ */ jsx12("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__ */ jsx12("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: order.outcomeLabel }) })
|
|
4226
|
+
] })
|
|
4227
|
+
] }),
|
|
4228
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex w-full flex-wrap items-center gap-x-4 gap-y-2 lg:hidden", children: [
|
|
4229
|
+
/* @__PURE__ */ jsx12("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__ */ jsx12("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: order.outcomeLabel }) }),
|
|
4230
|
+
[
|
|
4231
|
+
{ label: resolvedLimitPriceHeader, value: (_a = order.limitPriceLabel) != null ? _a : "\u2014" },
|
|
4232
|
+
{ label: resolvedFilledHeader, value: order.filledLabel },
|
|
4233
|
+
{ label: resolvedTotalHeader, value: order.valueLabel },
|
|
4234
|
+
{ label: resolvedExpirationHeader, value: (_b = order.expirationLabel) != null ? _b : "\u2014" }
|
|
4235
|
+
].map(({ label, value }) => /* @__PURE__ */ jsxs11("div", { className: "flex items-baseline gap-1.5 whitespace-nowrap", children: [
|
|
4236
|
+
/* @__PURE__ */ jsx12("span", { className: "font-agg-sans text-agg-lg leading-agg-7 font-agg-normal text-agg-foreground", children: value }),
|
|
4237
|
+
/* @__PURE__ */ jsx12("span", { className: "font-agg-sans text-[10px] leading-[14px] font-agg-bold uppercase text-agg-muted-foreground", children: label })
|
|
4238
|
+
] }, label))
|
|
4239
|
+
] }),
|
|
4240
|
+
/* @__PURE__ */ jsx12("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" }),
|
|
4241
|
+
/* @__PURE__ */ jsx12("p", { className: "agg-open-order-filled hidden w-[120px] shrink-0 agg-type-body-strong text-agg-foreground lg:block", children: order.filledLabel }),
|
|
4242
|
+
/* @__PURE__ */ jsx12("p", { className: "agg-open-order-value hidden w-[120px] shrink-0 agg-type-body-strong text-agg-foreground lg:block", children: order.valueLabel }),
|
|
4243
|
+
/* @__PURE__ */ jsx12("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" }),
|
|
4244
|
+
/* @__PURE__ */ jsx12(
|
|
4245
|
+
"div",
|
|
4246
|
+
{
|
|
4247
|
+
className: cn(
|
|
4248
|
+
"shrink-0 justify-end",
|
|
4249
|
+
canCancel ? "flex w-full lg:w-[80px]" : "hidden lg:flex lg:w-[80px]"
|
|
4250
|
+
),
|
|
4251
|
+
children: canCancel ? /* @__PURE__ */ jsx12(
|
|
4252
|
+
Button,
|
|
4253
|
+
{
|
|
4254
|
+
variant: "secondary",
|
|
4255
|
+
size: "small",
|
|
4256
|
+
isLoading: isCancelling,
|
|
4257
|
+
disabled: isCancelling,
|
|
4258
|
+
onClick: handleCancelClick,
|
|
4259
|
+
"aria-label": resolvedCancelAriaLabel,
|
|
4260
|
+
className: "w-full lg:w-auto !text-agg-error font-agg-bold",
|
|
4261
|
+
children: resolvedCancelLabel
|
|
4262
|
+
}
|
|
4263
|
+
) : null
|
|
4264
|
+
}
|
|
4265
|
+
)
|
|
4266
|
+
] })
|
|
4267
|
+
})
|
|
4268
|
+
);
|
|
4269
|
+
};
|
|
4270
|
+
OpenOrderRow.displayName = "OpenOrderRow";
|
|
4271
|
+
|
|
4272
|
+
// src/pages/user-profile/components/position-row.tsx
|
|
4273
|
+
import { optimizedImageUrl as optimizedImageUrl2, useLabels as useLabels8 } from "@agg-build/hooks";
|
|
4274
|
+
import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4275
|
+
var shouldUseNativeLinkNavigation3 = (event) => {
|
|
4276
|
+
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
|
|
4277
|
+
};
|
|
4143
4278
|
var toneTextClassName = (tone) => {
|
|
4144
4279
|
if (tone === "positive") return "text-agg-success";
|
|
4145
4280
|
if (tone === "negative") return "text-agg-error";
|
|
4146
4281
|
return "text-agg-muted-foreground";
|
|
4147
4282
|
};
|
|
4148
|
-
var OutcomePill = ({ label }) => /* @__PURE__ */
|
|
4149
|
-
var ResolutionPill = ({ label }) => /* @__PURE__ */
|
|
4283
|
+
var OutcomePill = ({ label }) => /* @__PURE__ */ jsx13("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__ */ jsx13("span", { className: "whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground truncate", children: label }) });
|
|
4284
|
+
var ResolutionPill = ({ label }) => /* @__PURE__ */ jsx13("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__ */ jsx13("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: label }) });
|
|
4150
4285
|
var VenueShares = ({
|
|
4151
4286
|
model,
|
|
4152
4287
|
className,
|
|
4153
4288
|
keyPrefix
|
|
4154
4289
|
}) => {
|
|
4155
4290
|
if (model.venueShareBreakdown.length === 0) return null;
|
|
4156
|
-
return /* @__PURE__ */
|
|
4291
|
+
return /* @__PURE__ */ jsx13("div", { className: cn(className, "gap-x-3 gap-y-2"), children: model.venueShareBreakdown.map((row, index) => /* @__PURE__ */ jsxs12(
|
|
4157
4292
|
"div",
|
|
4158
4293
|
{
|
|
4159
4294
|
className: "flex min-w-0 max-w-full items-center gap-1",
|
|
4160
4295
|
children: [
|
|
4161
|
-
/* @__PURE__ */
|
|
4162
|
-
/* @__PURE__ */
|
|
4296
|
+
/* @__PURE__ */ jsx13(VenueLogo, { venue: row.venue, size: "small", className: "size-4 shrink-0" }),
|
|
4297
|
+
/* @__PURE__ */ jsx13("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: row.sharesLabel })
|
|
4163
4298
|
]
|
|
4164
4299
|
},
|
|
4165
4300
|
`${keyPrefix}-${row.venue}-${row.sharesLabel}-${String(index)}`
|
|
@@ -4171,7 +4306,7 @@ var StatusBadge = ({
|
|
|
4171
4306
|
}) => {
|
|
4172
4307
|
if (status === "lost" || status === "won_claimed") return null;
|
|
4173
4308
|
const isWon = status === "won_unclaimed";
|
|
4174
|
-
return /* @__PURE__ */
|
|
4309
|
+
return /* @__PURE__ */ jsxs12(
|
|
4175
4310
|
"span",
|
|
4176
4311
|
{
|
|
4177
4312
|
className: cn(
|
|
@@ -4180,7 +4315,7 @@ var StatusBadge = ({
|
|
|
4180
4315
|
isWon ? "border-agg-success/50 bg-agg-success/10 text-agg-success" : "border-agg-muted-foreground/30 bg-agg-secondary-hover text-agg-foreground"
|
|
4181
4316
|
),
|
|
4182
4317
|
children: [
|
|
4183
|
-
/* @__PURE__ */
|
|
4318
|
+
/* @__PURE__ */ jsx13(Icon, { name: isWon ? "check-circle" : "hourglass-start", size: "small", className: "size-2.5!" }),
|
|
4184
4319
|
isWon ? labels.won : labels.open
|
|
4185
4320
|
]
|
|
4186
4321
|
}
|
|
@@ -4193,7 +4328,7 @@ var ResultBadge = ({
|
|
|
4193
4328
|
if (status !== "won_claimed" && status !== "lost" && status !== "sold") return null;
|
|
4194
4329
|
const isWon = status === "won_claimed";
|
|
4195
4330
|
const isSold = status === "sold";
|
|
4196
|
-
return /* @__PURE__ */
|
|
4331
|
+
return /* @__PURE__ */ jsxs12(
|
|
4197
4332
|
"span",
|
|
4198
4333
|
{
|
|
4199
4334
|
className: cn(
|
|
@@ -4202,7 +4337,7 @@ var ResultBadge = ({
|
|
|
4202
4337
|
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"
|
|
4203
4338
|
),
|
|
4204
4339
|
children: [
|
|
4205
|
-
/* @__PURE__ */
|
|
4340
|
+
/* @__PURE__ */ jsx13(
|
|
4206
4341
|
Icon,
|
|
4207
4342
|
{
|
|
4208
4343
|
name: isWon ? "check-circle" : isSold ? "hourglass-start" : "cross-circle",
|
|
@@ -4218,27 +4353,27 @@ var ResultBadge = ({
|
|
|
4218
4353
|
var TotalTradedCell = ({
|
|
4219
4354
|
model,
|
|
4220
4355
|
className
|
|
4221
|
-
}) => /* @__PURE__ */
|
|
4356
|
+
}) => /* @__PURE__ */ jsxs12(
|
|
4222
4357
|
"div",
|
|
4223
4358
|
{
|
|
4224
4359
|
className: cn("agg-position-total-traded flex flex-col gap-[2px] whitespace-nowrap", className),
|
|
4225
4360
|
children: [
|
|
4226
|
-
/* @__PURE__ */
|
|
4227
|
-
/* @__PURE__ */
|
|
4361
|
+
/* @__PURE__ */ jsx13("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: model.totalTraded.primaryLabel }),
|
|
4362
|
+
/* @__PURE__ */ jsx13("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: model.totalTraded.averageLabel })
|
|
4228
4363
|
]
|
|
4229
4364
|
}
|
|
4230
4365
|
);
|
|
4231
4366
|
var PositionValueCell = ({
|
|
4232
4367
|
value,
|
|
4233
4368
|
className
|
|
4234
|
-
}) => /* @__PURE__ */
|
|
4369
|
+
}) => /* @__PURE__ */ jsxs12(
|
|
4235
4370
|
"div",
|
|
4236
4371
|
{
|
|
4237
4372
|
className: cn("agg-position-value-cell flex flex-col gap-[2px] whitespace-nowrap", className),
|
|
4238
4373
|
children: [
|
|
4239
|
-
/* @__PURE__ */
|
|
4240
|
-
/* @__PURE__ */
|
|
4241
|
-
/* @__PURE__ */
|
|
4374
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-baseline gap-1.5", children: [
|
|
4375
|
+
/* @__PURE__ */ jsx13("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: value.primaryLabel }),
|
|
4376
|
+
/* @__PURE__ */ jsx13(
|
|
4242
4377
|
"p",
|
|
4243
4378
|
{
|
|
4244
4379
|
className: cn(
|
|
@@ -4249,9 +4384,9 @@ var PositionValueCell = ({
|
|
|
4249
4384
|
}
|
|
4250
4385
|
)
|
|
4251
4386
|
] }),
|
|
4252
|
-
/* @__PURE__ */
|
|
4253
|
-
/* @__PURE__ */
|
|
4254
|
-
/* @__PURE__ */
|
|
4387
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-baseline gap-1.5", children: [
|
|
4388
|
+
/* @__PURE__ */ jsx13("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: value.priceLabel }),
|
|
4389
|
+
/* @__PURE__ */ jsx13(
|
|
4255
4390
|
"p",
|
|
4256
4391
|
{
|
|
4257
4392
|
className: cn(
|
|
@@ -4273,7 +4408,7 @@ var PositionRow = ({
|
|
|
4273
4408
|
onClaim,
|
|
4274
4409
|
isClaiming = false
|
|
4275
4410
|
}) => {
|
|
4276
|
-
const labels =
|
|
4411
|
+
const labels = useLabels8().userProfile.positions;
|
|
4277
4412
|
const model = toPositionRowViewModel(position, {
|
|
4278
4413
|
avgPrefix: labels.avgPrefix,
|
|
4279
4414
|
nowPrefix: labels.nowPrefix,
|
|
@@ -4287,7 +4422,7 @@ var PositionRow = ({
|
|
|
4287
4422
|
void (onClaim == null ? void 0 : onClaim(position));
|
|
4288
4423
|
};
|
|
4289
4424
|
const handleAnchorClick = (event) => {
|
|
4290
|
-
if (
|
|
4425
|
+
if (shouldUseNativeLinkNavigation3(event)) return;
|
|
4291
4426
|
if (!onClick) return;
|
|
4292
4427
|
event.preventDefault();
|
|
4293
4428
|
onClick(position);
|
|
@@ -4314,7 +4449,7 @@ var PositionRow = ({
|
|
|
4314
4449
|
handleDivClick();
|
|
4315
4450
|
}
|
|
4316
4451
|
};
|
|
4317
|
-
return /* @__PURE__ */
|
|
4452
|
+
return /* @__PURE__ */ jsx13(Wrapper, __spreadProps(__spreadValues({ className: sharedClassName }, wrapperProps), { children: /* @__PURE__ */ jsxs12(
|
|
4318
4453
|
"div",
|
|
4319
4454
|
{
|
|
4320
4455
|
className: cn(
|
|
@@ -4322,21 +4457,21 @@ var PositionRow = ({
|
|
|
4322
4457
|
isClosed ? "md:gap-8" : "md:gap-6"
|
|
4323
4458
|
),
|
|
4324
4459
|
children: [
|
|
4325
|
-
/* @__PURE__ */
|
|
4326
|
-
/* @__PURE__ */
|
|
4327
|
-
/* @__PURE__ */
|
|
4460
|
+
/* @__PURE__ */ jsxs12("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: [
|
|
4461
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex min-w-0 flex-1 items-center gap-3 md:gap-4", children: [
|
|
4462
|
+
/* @__PURE__ */ jsx13("div", { className: "agg-position-image flex h-10 w-10 shrink-0 items-center justify-center md:h-15 md:w-15", children: /* @__PURE__ */ jsx13(
|
|
4328
4463
|
RemoteImage,
|
|
4329
4464
|
{
|
|
4330
|
-
src:
|
|
4465
|
+
src: optimizedImageUrl2(model.thumbnailSrc, 60),
|
|
4331
4466
|
alt: "",
|
|
4332
4467
|
className: "h-full w-full rounded-agg-sm object-cover"
|
|
4333
4468
|
}
|
|
4334
4469
|
) }),
|
|
4335
|
-
/* @__PURE__ */
|
|
4336
|
-
/* @__PURE__ */
|
|
4337
|
-
/* @__PURE__ */
|
|
4338
|
-
/* @__PURE__ */
|
|
4339
|
-
/* @__PURE__ */
|
|
4470
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
4471
|
+
/* @__PURE__ */ jsx13("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 }),
|
|
4472
|
+
/* @__PURE__ */ jsxs12("div", { className: "hidden min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-2 pt-1 md:flex", children: [
|
|
4473
|
+
/* @__PURE__ */ jsx13(OutcomePill, { label: model.selectedOutcomeLabel }),
|
|
4474
|
+
/* @__PURE__ */ jsx13(
|
|
4340
4475
|
VenueShares,
|
|
4341
4476
|
{
|
|
4342
4477
|
model,
|
|
@@ -4347,10 +4482,10 @@ var PositionRow = ({
|
|
|
4347
4482
|
] })
|
|
4348
4483
|
] })
|
|
4349
4484
|
] }),
|
|
4350
|
-
/* @__PURE__ */
|
|
4485
|
+
/* @__PURE__ */ jsx13("div", { className: "flex shrink-0 items-center justify-end md:hidden", children: /* @__PURE__ */ jsx13(OutcomePill, { label: model.selectedOutcomeLabel }) })
|
|
4351
4486
|
] }),
|
|
4352
|
-
isClosed ? /* @__PURE__ */
|
|
4353
|
-
/* @__PURE__ */
|
|
4487
|
+
isClosed ? /* @__PURE__ */ jsx13("div", { className: "md:hidden", children: /* @__PURE__ */ jsx13(ResolutionPill, { label: `${labels.resolutionHeader}: ${model.resolutionLabel}` }) }) : null,
|
|
4488
|
+
/* @__PURE__ */ jsx13(
|
|
4354
4489
|
VenueShares,
|
|
4355
4490
|
{
|
|
4356
4491
|
model,
|
|
@@ -4358,14 +4493,14 @@ var PositionRow = ({
|
|
|
4358
4493
|
className: "agg-position-venues flex min-w-0 flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2 md:hidden"
|
|
4359
4494
|
}
|
|
4360
4495
|
),
|
|
4361
|
-
/* @__PURE__ */
|
|
4362
|
-
/* @__PURE__ */
|
|
4363
|
-
/* @__PURE__ */
|
|
4364
|
-
/* @__PURE__ */
|
|
4496
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex w-full items-center justify-between gap-3 md:hidden", children: [
|
|
4497
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex min-w-0 items-center gap-5", children: [
|
|
4498
|
+
/* @__PURE__ */ jsx13(TotalTradedCell, { model }),
|
|
4499
|
+
/* @__PURE__ */ jsx13(PositionValueCell, { value: isClosed ? model.payout : model.currentValue })
|
|
4365
4500
|
] }),
|
|
4366
|
-
isClosed ? /* @__PURE__ */
|
|
4367
|
-
/* @__PURE__ */
|
|
4368
|
-
model.canClaim ? /* @__PURE__ */
|
|
4501
|
+
isClosed ? /* @__PURE__ */ jsx13(ResultBadge, { status: model.positionStatus, labels }) : /* @__PURE__ */ jsxs12("div", { className: "flex shrink-0 flex-col items-start justify-center gap-2", children: [
|
|
4502
|
+
/* @__PURE__ */ jsx13(StatusBadge, { status: model.positionStatus, labels }),
|
|
4503
|
+
model.canClaim ? /* @__PURE__ */ jsxs12(
|
|
4369
4504
|
"button",
|
|
4370
4505
|
{
|
|
4371
4506
|
type: "button",
|
|
@@ -4374,48 +4509,48 @@ var PositionRow = ({
|
|
|
4374
4509
|
disabled: isClaiming,
|
|
4375
4510
|
"aria-busy": isClaiming || void 0,
|
|
4376
4511
|
children: [
|
|
4377
|
-
isClaiming ? /* @__PURE__ */
|
|
4512
|
+
isClaiming ? /* @__PURE__ */ jsx13(LoadingIcon, { size: "small", className: "text-agg-primary" }) : null,
|
|
4378
4513
|
labels.claim
|
|
4379
4514
|
]
|
|
4380
4515
|
}
|
|
4381
4516
|
) : null
|
|
4382
4517
|
] })
|
|
4383
4518
|
] }),
|
|
4384
|
-
isClosed ? /* @__PURE__ */
|
|
4385
|
-
/* @__PURE__ */
|
|
4386
|
-
/* @__PURE__ */
|
|
4519
|
+
isClosed ? /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
4520
|
+
/* @__PURE__ */ jsx13("div", { className: "hidden w-[90px] shrink-0 md:block lg:w-[120px]", children: /* @__PURE__ */ jsx13(ResolutionPill, { label: model.resolutionLabel }) }),
|
|
4521
|
+
/* @__PURE__ */ jsx13(
|
|
4387
4522
|
TotalTradedCell,
|
|
4388
4523
|
{
|
|
4389
4524
|
model,
|
|
4390
4525
|
className: "hidden w-[110px] shrink-0 md:flex lg:w-[130px]"
|
|
4391
4526
|
}
|
|
4392
4527
|
),
|
|
4393
|
-
/* @__PURE__ */
|
|
4528
|
+
/* @__PURE__ */ jsx13(
|
|
4394
4529
|
PositionValueCell,
|
|
4395
4530
|
{
|
|
4396
4531
|
value: model.payout,
|
|
4397
4532
|
className: "hidden w-[130px] shrink-0 md:flex lg:w-[160px]"
|
|
4398
4533
|
}
|
|
4399
4534
|
),
|
|
4400
|
-
/* @__PURE__ */
|
|
4401
|
-
] }) : /* @__PURE__ */
|
|
4402
|
-
/* @__PURE__ */
|
|
4535
|
+
/* @__PURE__ */ jsx13("div", { className: "hidden w-[60px] shrink-0 items-center md:flex", children: /* @__PURE__ */ jsx13(ResultBadge, { status: model.positionStatus, labels }) })
|
|
4536
|
+
] }) : /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
4537
|
+
/* @__PURE__ */ jsx13(
|
|
4403
4538
|
TotalTradedCell,
|
|
4404
4539
|
{
|
|
4405
4540
|
model,
|
|
4406
4541
|
className: "hidden w-[120px] shrink-0 md:flex lg:w-[140px]"
|
|
4407
4542
|
}
|
|
4408
4543
|
),
|
|
4409
|
-
/* @__PURE__ */
|
|
4544
|
+
/* @__PURE__ */ jsx13(
|
|
4410
4545
|
PositionValueCell,
|
|
4411
4546
|
{
|
|
4412
4547
|
value: model.currentValue,
|
|
4413
4548
|
className: "hidden w-[130px] shrink-0 md:flex lg:w-[160px]"
|
|
4414
4549
|
}
|
|
4415
4550
|
),
|
|
4416
|
-
/* @__PURE__ */
|
|
4417
|
-
/* @__PURE__ */
|
|
4418
|
-
model.canClaim ? /* @__PURE__ */
|
|
4551
|
+
/* @__PURE__ */ jsxs12("div", { className: "hidden w-[100px] shrink-0 items-center gap-3 md:flex", children: [
|
|
4552
|
+
/* @__PURE__ */ jsx13(StatusBadge, { status: model.positionStatus, labels }),
|
|
4553
|
+
model.canClaim ? /* @__PURE__ */ jsxs12(
|
|
4419
4554
|
"button",
|
|
4420
4555
|
{
|
|
4421
4556
|
type: "button",
|
|
@@ -4424,14 +4559,14 @@ var PositionRow = ({
|
|
|
4424
4559
|
disabled: isClaiming,
|
|
4425
4560
|
"aria-busy": isClaiming || void 0,
|
|
4426
4561
|
children: [
|
|
4427
|
-
isClaiming ? /* @__PURE__ */
|
|
4562
|
+
isClaiming ? /* @__PURE__ */ jsx13(LoadingIcon, { size: "small", className: "text-agg-primary" }) : null,
|
|
4428
4563
|
labels.claim
|
|
4429
4564
|
]
|
|
4430
4565
|
}
|
|
4431
4566
|
) : null
|
|
4432
4567
|
] })
|
|
4433
4568
|
] }),
|
|
4434
|
-
/* @__PURE__ */
|
|
4569
|
+
/* @__PURE__ */ jsx13("div", { className: "hidden w-5 shrink-0 items-center justify-end md:flex", children: /* @__PURE__ */ jsx13(
|
|
4435
4570
|
Icon,
|
|
4436
4571
|
{
|
|
4437
4572
|
name: "chevron-right",
|
|
@@ -4446,20 +4581,20 @@ var PositionRow = ({
|
|
|
4446
4581
|
PositionRow.displayName = "PositionRow";
|
|
4447
4582
|
|
|
4448
4583
|
// src/pages/user-profile/components/positions-activity.tsx
|
|
4449
|
-
import { Fragment as Fragment5, jsx as
|
|
4450
|
-
var
|
|
4451
|
-
{ value: USER_PROFILE_TAB_POSITIONS, label:
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
{ value: USER_PROFILE_TAB_ACTIVITY, label: "Activity" }
|
|
4584
|
+
import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4585
|
+
var getTabItems = (tabsLabels, showOpenOrders) => [
|
|
4586
|
+
{ value: USER_PROFILE_TAB_POSITIONS, label: tabsLabels.positions },
|
|
4587
|
+
...showOpenOrders ? [{ value: USER_PROFILE_TAB_OPEN_ORDERS, label: tabsLabels.openOrders }] : [],
|
|
4588
|
+
{ value: USER_PROFILE_TAB_ACTIVITY, label: tabsLabels.activity }
|
|
4455
4589
|
];
|
|
4456
|
-
var TabRowsSkeleton = ({ ariaLabel }) => /* @__PURE__ */
|
|
4457
|
-
/* @__PURE__ */
|
|
4458
|
-
index < acc.length - 1 ? /* @__PURE__ */
|
|
4590
|
+
var TabRowsSkeleton = ({ ariaLabel }) => /* @__PURE__ */ jsx14("div", { role: "status", "aria-label": ariaLabel, className: "flex flex-col gap-3 sm:gap-4", children: Array.from({ length: 3 }).map((_, index, acc) => /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
4591
|
+
/* @__PURE__ */ jsx14("div", { className: "h-14 rounded-agg-sm bg-agg-secondary-hover/80 sm:h-16" }, index),
|
|
4592
|
+
index < acc.length - 1 ? /* @__PURE__ */ jsx14("div", { className: "agg-position-divider h-px w-full shrink-0 bg-agg-separator", "aria-hidden": true }) : null
|
|
4459
4593
|
] }, index)) });
|
|
4460
4594
|
var PositionsActivity = ({
|
|
4461
4595
|
activePositions = [],
|
|
4462
4596
|
closedPositions = [],
|
|
4597
|
+
openOrders = [],
|
|
4463
4598
|
activities = [],
|
|
4464
4599
|
onPositionClick,
|
|
4465
4600
|
getPositionHref,
|
|
@@ -4467,10 +4602,16 @@ var PositionsActivity = ({
|
|
|
4467
4602
|
claimingPositionKeys,
|
|
4468
4603
|
onActivityClick,
|
|
4469
4604
|
getActivityHref,
|
|
4605
|
+
onOpenOrderClick,
|
|
4606
|
+
getOpenOrderHref,
|
|
4607
|
+
onCancelOrder,
|
|
4608
|
+
cancellingOrderIds,
|
|
4470
4609
|
isLoadingPositions = false,
|
|
4471
4610
|
isLoadingActivities = false,
|
|
4611
|
+
isLoadingOpenOrders = false,
|
|
4472
4612
|
positionsError = false,
|
|
4473
4613
|
activitiesError = false,
|
|
4614
|
+
openOrdersError = false,
|
|
4474
4615
|
hasMoreActivePositions = false,
|
|
4475
4616
|
isLoadingMoreActivePositions = false,
|
|
4476
4617
|
onLoadMoreActivePositions,
|
|
@@ -4481,18 +4622,30 @@ var PositionsActivity = ({
|
|
|
4481
4622
|
hasMoreActivities = false,
|
|
4482
4623
|
isLoadingMoreActivities = false,
|
|
4483
4624
|
onLoadMoreActivities,
|
|
4625
|
+
hasMoreOpenOrders = false,
|
|
4626
|
+
isLoadingMoreOpenOrders = false,
|
|
4627
|
+
onLoadMoreOpenOrders,
|
|
4628
|
+
showOpenOrders = false,
|
|
4484
4629
|
tab,
|
|
4485
4630
|
onTabChange,
|
|
4486
4631
|
initialPositionFilter = "active",
|
|
4487
4632
|
className
|
|
4488
4633
|
}) => {
|
|
4489
|
-
const
|
|
4634
|
+
const userProfileLabels = useLabels9().userProfile;
|
|
4635
|
+
const positionsLabels = userProfileLabels.positions;
|
|
4636
|
+
const openOrdersLabels = userProfileLabels.openOrders;
|
|
4637
|
+
const tabItems = useMemo6(
|
|
4638
|
+
() => getTabItems(userProfileLabels.tabs, showOpenOrders),
|
|
4639
|
+
[showOpenOrders, userProfileLabels.tabs]
|
|
4640
|
+
);
|
|
4490
4641
|
const isTabControlled = tab !== void 0;
|
|
4491
4642
|
const [internalActiveTab, setInternalActiveTab] = useState10(
|
|
4492
4643
|
tab != null ? tab : USER_PROFILE_TAB_POSITIONS
|
|
4493
4644
|
);
|
|
4494
|
-
const
|
|
4645
|
+
const requestedActiveTab = isTabControlled ? tab : internalActiveTab;
|
|
4646
|
+
const activeTab = requestedActiveTab === USER_PROFILE_TAB_OPEN_ORDERS && !showOpenOrders ? USER_PROFILE_TAB_POSITIONS : requestedActiveTab;
|
|
4495
4647
|
const handleTabChange = (next) => {
|
|
4648
|
+
if (next === USER_PROFILE_TAB_OPEN_ORDERS && !showOpenOrders) return;
|
|
4496
4649
|
if (!isTabControlled) setInternalActiveTab(next);
|
|
4497
4650
|
onTabChange == null ? void 0 : onTabChange(next);
|
|
4498
4651
|
};
|
|
@@ -4503,9 +4656,11 @@ var PositionsActivity = ({
|
|
|
4503
4656
|
() => /* @__PURE__ */ new Set()
|
|
4504
4657
|
);
|
|
4505
4658
|
const positionsLoadMoreRef = useRef8(null);
|
|
4659
|
+
const openOrdersLoadMoreRef = useRef8(null);
|
|
4506
4660
|
const activitiesLoadMoreRef = useRef8(null);
|
|
4507
4661
|
const rowsScrollRef = useRef8(null);
|
|
4508
4662
|
const isPositionsTab = activeTab === USER_PROFILE_TAB_POSITIONS;
|
|
4663
|
+
const isOpenOrdersTab = activeTab === USER_PROFILE_TAB_OPEN_ORDERS;
|
|
4509
4664
|
const isActivityTab = activeTab === USER_PROFILE_TAB_ACTIVITY;
|
|
4510
4665
|
const isClosedPositionsFilter = isPositionsTab && positionFilter === "closed";
|
|
4511
4666
|
const positionsForCurrentFilter = useMemo6(() => {
|
|
@@ -4616,7 +4771,29 @@ var PositionsActivity = ({
|
|
|
4616
4771
|
isLoadingMoreActivities,
|
|
4617
4772
|
onLoadMoreActivities
|
|
4618
4773
|
]);
|
|
4619
|
-
|
|
4774
|
+
useEffect9(() => {
|
|
4775
|
+
if (!isOpenOrdersTab || !hasMoreOpenOrders) return;
|
|
4776
|
+
const target = openOrdersLoadMoreRef.current;
|
|
4777
|
+
if (!target || !onLoadMoreOpenOrders) return;
|
|
4778
|
+
const observer = new IntersectionObserver(
|
|
4779
|
+
(entries) => {
|
|
4780
|
+
const entry = entries[0];
|
|
4781
|
+
if (!(entry == null ? void 0 : entry.isIntersecting)) return;
|
|
4782
|
+
if (isLoadingOpenOrders || isLoadingMoreOpenOrders || !hasMoreOpenOrders) return;
|
|
4783
|
+
onLoadMoreOpenOrders();
|
|
4784
|
+
},
|
|
4785
|
+
{ root: rowsScrollRef.current, rootMargin: "60px 0px" }
|
|
4786
|
+
);
|
|
4787
|
+
observer.observe(target);
|
|
4788
|
+
return () => observer.disconnect();
|
|
4789
|
+
}, [
|
|
4790
|
+
hasMoreOpenOrders,
|
|
4791
|
+
isLoadingMoreOpenOrders,
|
|
4792
|
+
isLoadingOpenOrders,
|
|
4793
|
+
isOpenOrdersTab,
|
|
4794
|
+
onLoadMoreOpenOrders
|
|
4795
|
+
]);
|
|
4796
|
+
return /* @__PURE__ */ jsxs13(
|
|
4620
4797
|
"div",
|
|
4621
4798
|
{
|
|
4622
4799
|
className: cn(
|
|
@@ -4625,7 +4802,7 @@ var PositionsActivity = ({
|
|
|
4625
4802
|
className
|
|
4626
4803
|
),
|
|
4627
4804
|
children: [
|
|
4628
|
-
/* @__PURE__ */
|
|
4805
|
+
/* @__PURE__ */ jsx14(
|
|
4629
4806
|
Tabs,
|
|
4630
4807
|
{
|
|
4631
4808
|
items: tabItems,
|
|
@@ -4639,7 +4816,7 @@ var PositionsActivity = ({
|
|
|
4639
4816
|
}
|
|
4640
4817
|
}
|
|
4641
4818
|
),
|
|
4642
|
-
/* @__PURE__ */
|
|
4819
|
+
/* @__PURE__ */ jsxs13(
|
|
4643
4820
|
"div",
|
|
4644
4821
|
{
|
|
4645
4822
|
className: cn(
|
|
@@ -4647,12 +4824,12 @@ var PositionsActivity = ({
|
|
|
4647
4824
|
isPositionsTab ? "pt-4 md:pt-6" : "pt-0 md:pt-6"
|
|
4648
4825
|
),
|
|
4649
4826
|
children: [
|
|
4650
|
-
isPositionsTab ? /* @__PURE__ */
|
|
4651
|
-
/* @__PURE__ */
|
|
4827
|
+
isPositionsTab ? /* @__PURE__ */ jsxs13("div", { className: "agg-toolbar flex flex-row items-start gap-3 px-4 sm:gap-5 sm:px-6", children: [
|
|
4828
|
+
/* @__PURE__ */ jsx14("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) => {
|
|
4652
4829
|
const isActive = filter.value === positionFilter;
|
|
4653
|
-
return /* @__PURE__ */
|
|
4654
|
-
idx > 0 ? /* @__PURE__ */
|
|
4655
|
-
/* @__PURE__ */
|
|
4830
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex flex-1 items-stretch", children: [
|
|
4831
|
+
idx > 0 ? /* @__PURE__ */ jsx14("div", { className: "w-px bg-agg-separator", "aria-hidden": true }) : null,
|
|
4832
|
+
/* @__PURE__ */ jsx14(
|
|
4656
4833
|
"button",
|
|
4657
4834
|
{
|
|
4658
4835
|
type: "button",
|
|
@@ -4667,7 +4844,7 @@ var PositionsActivity = ({
|
|
|
4667
4844
|
)
|
|
4668
4845
|
] }, filter.value);
|
|
4669
4846
|
}) }),
|
|
4670
|
-
/* @__PURE__ */
|
|
4847
|
+
/* @__PURE__ */ jsxs13(
|
|
4671
4848
|
"div",
|
|
4672
4849
|
{
|
|
4673
4850
|
className: "agg-position-search relative flex w-full min-w-0 flex-1",
|
|
@@ -4678,9 +4855,9 @@ var PositionsActivity = ({
|
|
|
4678
4855
|
setIsSearchFocused(false);
|
|
4679
4856
|
},
|
|
4680
4857
|
children: [
|
|
4681
|
-
/* @__PURE__ */
|
|
4682
|
-
/* @__PURE__ */
|
|
4683
|
-
/* @__PURE__ */
|
|
4858
|
+
/* @__PURE__ */ jsx14("label", { className: "flex w-full min-w-0 flex-1", children: /* @__PURE__ */ jsxs13("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: [
|
|
4859
|
+
/* @__PURE__ */ jsx14(Icon, { name: "search", size: "small", className: "shrink-0 text-agg-muted-foreground" }),
|
|
4860
|
+
/* @__PURE__ */ jsx14(
|
|
4684
4861
|
"input",
|
|
4685
4862
|
{
|
|
4686
4863
|
value: searchValue,
|
|
@@ -4695,7 +4872,7 @@ var PositionsActivity = ({
|
|
|
4695
4872
|
}
|
|
4696
4873
|
)
|
|
4697
4874
|
] }) }),
|
|
4698
|
-
isSearchFocused && searchValue.trim() ? /* @__PURE__ */
|
|
4875
|
+
isSearchFocused && searchValue.trim() ? /* @__PURE__ */ jsx14("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__ */ jsx14(
|
|
4699
4876
|
"ul",
|
|
4700
4877
|
{
|
|
4701
4878
|
className: "agg-position-search-results-list m-0 flex list-none flex-col p-0",
|
|
@@ -4708,26 +4885,26 @@ var PositionsActivity = ({
|
|
|
4708
4885
|
setIsSearchFocused(false);
|
|
4709
4886
|
onPositionClick == null ? void 0 : onPositionClick(item.raw);
|
|
4710
4887
|
};
|
|
4711
|
-
const innerContent = /* @__PURE__ */
|
|
4712
|
-
/* @__PURE__ */
|
|
4713
|
-
/* @__PURE__ */
|
|
4888
|
+
const innerContent = /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
4889
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
|
|
4890
|
+
/* @__PURE__ */ jsx14(
|
|
4714
4891
|
"img",
|
|
4715
4892
|
{
|
|
4716
|
-
src:
|
|
4893
|
+
src: optimizedImageUrl3(item.thumbnailSrc, 48),
|
|
4717
4894
|
alt: "",
|
|
4718
4895
|
className: "size-12 shrink-0 rounded-agg-lg object-cover"
|
|
4719
4896
|
}
|
|
4720
4897
|
),
|
|
4721
|
-
/* @__PURE__ */
|
|
4722
|
-
/* @__PURE__ */
|
|
4723
|
-
/* @__PURE__ */
|
|
4724
|
-
/* @__PURE__ */
|
|
4725
|
-
/* @__PURE__ */
|
|
4726
|
-
/* @__PURE__ */
|
|
4898
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
4899
|
+
/* @__PURE__ */ jsx14("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 }),
|
|
4900
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex min-w-0 items-center gap-2 text-agg-muted-foreground", children: [
|
|
4901
|
+
/* @__PURE__ */ jsx14("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 }),
|
|
4902
|
+
/* @__PURE__ */ jsx14("span", { className: "text-agg-muted-foreground", "aria-hidden": true, children: "\xB7" }),
|
|
4903
|
+
/* @__PURE__ */ jsx14("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 })
|
|
4727
4904
|
] })
|
|
4728
4905
|
] })
|
|
4729
4906
|
] }),
|
|
4730
|
-
/* @__PURE__ */
|
|
4907
|
+
/* @__PURE__ */ jsx14(
|
|
4731
4908
|
Icon,
|
|
4732
4909
|
{
|
|
4733
4910
|
name: "chevron-right",
|
|
@@ -4736,7 +4913,7 @@ var PositionsActivity = ({
|
|
|
4736
4913
|
}
|
|
4737
4914
|
)
|
|
4738
4915
|
] });
|
|
4739
|
-
return /* @__PURE__ */
|
|
4916
|
+
return /* @__PURE__ */ jsx14(
|
|
4740
4917
|
"li",
|
|
4741
4918
|
{
|
|
4742
4919
|
role: "presentation",
|
|
@@ -4744,7 +4921,7 @@ var PositionsActivity = ({
|
|
|
4744
4921
|
"agg-position-search-result-item",
|
|
4745
4922
|
index > 0 && "border-t border-agg-separator"
|
|
4746
4923
|
),
|
|
4747
|
-
children: itemHref ? /* @__PURE__ */
|
|
4924
|
+
children: itemHref ? /* @__PURE__ */ jsx14(
|
|
4748
4925
|
"a",
|
|
4749
4926
|
{
|
|
4750
4927
|
href: itemHref,
|
|
@@ -4759,7 +4936,7 @@ var PositionsActivity = ({
|
|
|
4759
4936
|
},
|
|
4760
4937
|
children: innerContent
|
|
4761
4938
|
}
|
|
4762
|
-
) : /* @__PURE__ */
|
|
4939
|
+
) : /* @__PURE__ */ jsx14(
|
|
4763
4940
|
"button",
|
|
4764
4941
|
{
|
|
4765
4942
|
type: "button",
|
|
@@ -4773,34 +4950,42 @@ var PositionsActivity = ({
|
|
|
4773
4950
|
);
|
|
4774
4951
|
})
|
|
4775
4952
|
}
|
|
4776
|
-
) : /* @__PURE__ */
|
|
4953
|
+
) : /* @__PURE__ */ jsx14("div", { className: "px-5 py-6 font-agg-sans text-agg-sm leading-agg-5 text-agg-muted-foreground", children: positionsLabels.noResults }) }) : null
|
|
4777
4954
|
]
|
|
4778
4955
|
}
|
|
4779
4956
|
)
|
|
4780
4957
|
] }) : null,
|
|
4781
|
-
/* @__PURE__ */
|
|
4782
|
-
/* @__PURE__ */
|
|
4783
|
-
isPositionsTab && filteredPositions.length > 0 ? isClosedPositionsFilter ? /* @__PURE__ */
|
|
4784
|
-
/* @__PURE__ */
|
|
4785
|
-
/* @__PURE__ */
|
|
4786
|
-
/* @__PURE__ */
|
|
4787
|
-
/* @__PURE__ */
|
|
4788
|
-
/* @__PURE__ */
|
|
4789
|
-
/* @__PURE__ */
|
|
4790
|
-
] }) : /* @__PURE__ */
|
|
4791
|
-
/* @__PURE__ */
|
|
4792
|
-
/* @__PURE__ */
|
|
4793
|
-
/* @__PURE__ */
|
|
4794
|
-
/* @__PURE__ */
|
|
4795
|
-
/* @__PURE__ */
|
|
4958
|
+
/* @__PURE__ */ jsxs13("div", { className: "agg-positions-table-wrapper flex w-full gap-0 flex-col", children: [
|
|
4959
|
+
/* @__PURE__ */ jsxs13("div", { className: "w-full px-4 sm:px-6", children: [
|
|
4960
|
+
isPositionsTab && filteredPositions.length > 0 ? isClosedPositionsFilter ? /* @__PURE__ */ jsxs13("div", { className: "hidden items-start gap-8 px-0 md:flex", children: [
|
|
4961
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: positionsLabels.marketHeader }),
|
|
4962
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-user-profile-table-header w-[90px] shrink-0 lg:w-[120px]", children: positionsLabels.resolutionHeader }),
|
|
4963
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-user-profile-table-header w-[110px] shrink-0 lg:w-[130px]", children: positionsLabels.totalTradedHeader }),
|
|
4964
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-user-profile-table-header w-[130px] shrink-0 lg:w-[160px]", children: positionsLabels.payoutHeader }),
|
|
4965
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-user-profile-table-header w-[60px] shrink-0", children: positionsLabels.resultHeader }),
|
|
4966
|
+
/* @__PURE__ */ jsx14("span", { className: "hidden w-5 shrink-0 sm:block", "aria-hidden": true })
|
|
4967
|
+
] }) : /* @__PURE__ */ jsxs13("div", { className: "hidden items-start gap-6 px-0 md:flex", children: [
|
|
4968
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: positionsLabels.marketHeader }),
|
|
4969
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-user-profile-table-header w-[120px] shrink-0 lg:w-[140px]", children: positionsLabels.totalTradedHeader }),
|
|
4970
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-user-profile-table-header w-[130px] shrink-0 lg:w-[160px]", children: positionsLabels.currentValueHeader }),
|
|
4971
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-user-profile-table-header w-[100px] shrink-0", children: positionsLabels.statusHeader }),
|
|
4972
|
+
/* @__PURE__ */ jsx14("span", { className: "hidden w-5 shrink-0 sm:block", "aria-hidden": true })
|
|
4973
|
+
] }) : null,
|
|
4974
|
+
isOpenOrdersTab && openOrders.length > 0 ? /* @__PURE__ */ jsxs13("div", { className: "hidden items-start gap-6 px-0 lg:flex", children: [
|
|
4975
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: openOrdersLabels.marketHeader }),
|
|
4976
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-user-profile-table-header w-[120px] shrink-0", children: openOrdersLabels.limitPriceHeader }),
|
|
4977
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-user-profile-table-header w-[120px] shrink-0", children: openOrdersLabels.filledHeader }),
|
|
4978
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-user-profile-table-header w-[120px] shrink-0", children: openOrdersLabels.totalHeader }),
|
|
4979
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-user-profile-table-header w-[140px] shrink-0", children: openOrdersLabels.expirationHeader }),
|
|
4980
|
+
/* @__PURE__ */ jsx14("span", { className: "w-[80px] shrink-0", "aria-hidden": true })
|
|
4796
4981
|
] }) : null,
|
|
4797
|
-
isActivityTab && filteredActivities.length > 0 ? /* @__PURE__ */
|
|
4798
|
-
/* @__PURE__ */
|
|
4799
|
-
/* @__PURE__ */
|
|
4800
|
-
/* @__PURE__ */
|
|
4982
|
+
isActivityTab && filteredActivities.length > 0 ? /* @__PURE__ */ jsxs13("div", { className: "hidden items-start gap-6 px-0 md:flex", children: [
|
|
4983
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-user-profile-table-header w-22 shrink-0", children: "Type" }),
|
|
4984
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: "Market" }),
|
|
4985
|
+
/* @__PURE__ */ jsx14("p", { className: "agg-user-profile-table-header w-[120px] shrink-0 text-right", children: "Amount" })
|
|
4801
4986
|
] }) : null
|
|
4802
4987
|
] }),
|
|
4803
|
-
/* @__PURE__ */
|
|
4988
|
+
/* @__PURE__ */ jsx14(
|
|
4804
4989
|
"div",
|
|
4805
4990
|
{
|
|
4806
4991
|
ref: rowsScrollRef,
|
|
@@ -4812,8 +4997,8 @@ var PositionsActivity = ({
|
|
|
4812
4997
|
"[&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-agg-muted-foreground/50",
|
|
4813
4998
|
"[&::-webkit-scrollbar-thumb:hover]:bg-agg-muted-foreground/70"
|
|
4814
4999
|
),
|
|
4815
|
-
children: isPositionsTab ? /* @__PURE__ */
|
|
4816
|
-
isLoadingPositions && filteredPositions.length === 0 ? /* @__PURE__ */
|
|
5000
|
+
children: isPositionsTab ? /* @__PURE__ */ jsxs13("div", { className: "agg-portfolio-list flex flex-col gap-5", children: [
|
|
5001
|
+
isLoadingPositions && filteredPositions.length === 0 ? /* @__PURE__ */ jsx14(TabRowsSkeleton, { ariaLabel: "Loading positions" }) : positionsError && filteredPositions.length === 0 ? /* @__PURE__ */ jsx14(
|
|
4817
5002
|
EmptyState,
|
|
4818
5003
|
{
|
|
4819
5004
|
title: "Unable to load positions",
|
|
@@ -4821,15 +5006,15 @@ var PositionsActivity = ({
|
|
|
4821
5006
|
}
|
|
4822
5007
|
) : filteredPositions.length > 0 ? filteredPositions.map((position, index) => {
|
|
4823
5008
|
var _a;
|
|
4824
|
-
return /* @__PURE__ */
|
|
4825
|
-
index > 0 ? /* @__PURE__ */
|
|
5009
|
+
return /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
5010
|
+
index > 0 ? /* @__PURE__ */ jsx14(
|
|
4826
5011
|
"div",
|
|
4827
5012
|
{
|
|
4828
5013
|
className: "agg-position-divider h-px w-full shrink-0 bg-agg-separator",
|
|
4829
5014
|
"aria-hidden": true
|
|
4830
5015
|
}
|
|
4831
5016
|
) : null,
|
|
4832
|
-
/* @__PURE__ */
|
|
5017
|
+
/* @__PURE__ */ jsx14(
|
|
4833
5018
|
PositionRow,
|
|
4834
5019
|
{
|
|
4835
5020
|
position,
|
|
@@ -4843,15 +5028,15 @@ var PositionsActivity = ({
|
|
|
4843
5028
|
}
|
|
4844
5029
|
)
|
|
4845
5030
|
] }, position.id);
|
|
4846
|
-
}) : /* @__PURE__ */
|
|
5031
|
+
}) : /* @__PURE__ */ jsx14(
|
|
4847
5032
|
EmptyState,
|
|
4848
5033
|
{
|
|
4849
5034
|
title: "No positions yet",
|
|
4850
5035
|
description: "Your open trades will appear here once you place an order."
|
|
4851
5036
|
}
|
|
4852
5037
|
),
|
|
4853
|
-
isLoadingMorePositions ? /* @__PURE__ */
|
|
4854
|
-
hasMorePositions ? /* @__PURE__ */
|
|
5038
|
+
isLoadingMorePositions ? /* @__PURE__ */ jsx14(TabRowsSkeleton, { ariaLabel: "Loading more positions" }) : null,
|
|
5039
|
+
hasMorePositions ? /* @__PURE__ */ jsx14(
|
|
4855
5040
|
"div",
|
|
4856
5041
|
{
|
|
4857
5042
|
ref: positionsLoadMoreRef,
|
|
@@ -4859,22 +5044,69 @@ var PositionsActivity = ({
|
|
|
4859
5044
|
"aria-hidden": true
|
|
4860
5045
|
}
|
|
4861
5046
|
) : null
|
|
4862
|
-
] }) : /* @__PURE__ */
|
|
4863
|
-
|
|
5047
|
+
] }) : isOpenOrdersTab ? /* @__PURE__ */ jsxs13("div", { className: "agg-open-orders-list flex flex-col gap-5", children: [
|
|
5048
|
+
isLoadingOpenOrders && openOrders.length === 0 ? /* @__PURE__ */ jsx14(TabRowsSkeleton, { ariaLabel: openOrdersLabels.loading }) : openOrdersError && openOrders.length === 0 ? /* @__PURE__ */ jsx14(
|
|
5049
|
+
EmptyState,
|
|
5050
|
+
{
|
|
5051
|
+
title: openOrdersLabels.errorTitle,
|
|
5052
|
+
description: openOrdersLabels.errorDescription
|
|
5053
|
+
}
|
|
5054
|
+
) : openOrders.length > 0 ? openOrders.map((order, index) => /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
5055
|
+
index > 0 ? /* @__PURE__ */ jsx14(
|
|
5056
|
+
"div",
|
|
5057
|
+
{
|
|
5058
|
+
className: "agg-open-order-divider h-px w-full shrink-0 bg-agg-separator",
|
|
5059
|
+
"aria-hidden": true
|
|
5060
|
+
}
|
|
5061
|
+
) : null,
|
|
5062
|
+
/* @__PURE__ */ jsx14(
|
|
5063
|
+
OpenOrderRow,
|
|
5064
|
+
{
|
|
5065
|
+
order,
|
|
5066
|
+
href: getOpenOrderHref == null ? void 0 : getOpenOrderHref(order),
|
|
5067
|
+
onClick: onOpenOrderClick,
|
|
5068
|
+
onCancel: onCancelOrder,
|
|
5069
|
+
isCancelling: Boolean(cancellingOrderIds == null ? void 0 : cancellingOrderIds[order.id]),
|
|
5070
|
+
cancelLabel: openOrdersLabels.cancel,
|
|
5071
|
+
cancelAriaLabel: openOrdersLabels.cancelOrderAria(order.id),
|
|
5072
|
+
limitPriceHeader: openOrdersLabels.limitPriceHeader,
|
|
5073
|
+
filledHeader: openOrdersLabels.filledHeader,
|
|
5074
|
+
totalHeader: openOrdersLabels.totalHeader,
|
|
5075
|
+
expirationHeader: openOrdersLabels.expirationHeader
|
|
5076
|
+
}
|
|
5077
|
+
)
|
|
5078
|
+
] }, order.id)) : /* @__PURE__ */ jsx14(
|
|
5079
|
+
EmptyState,
|
|
5080
|
+
{
|
|
5081
|
+
title: openOrdersLabels.emptyTitle,
|
|
5082
|
+
description: openOrdersLabels.emptyDescription
|
|
5083
|
+
}
|
|
5084
|
+
),
|
|
5085
|
+
isLoadingMoreOpenOrders ? /* @__PURE__ */ jsx14(TabRowsSkeleton, { ariaLabel: openOrdersLabels.loadingMore }) : null,
|
|
5086
|
+
hasMoreOpenOrders ? /* @__PURE__ */ jsx14(
|
|
5087
|
+
"div",
|
|
5088
|
+
{
|
|
5089
|
+
ref: openOrdersLoadMoreRef,
|
|
5090
|
+
className: "agg-open-orders-sentinel h-px w-full",
|
|
5091
|
+
"aria-hidden": true
|
|
5092
|
+
}
|
|
5093
|
+
) : null
|
|
5094
|
+
] }) : /* @__PURE__ */ jsxs13("div", { className: "agg-activity-list flex flex-col gap-5", children: [
|
|
5095
|
+
isLoadingActivities && filteredActivities.length === 0 ? /* @__PURE__ */ jsx14(TabRowsSkeleton, { ariaLabel: "Loading activity" }) : activitiesError && filteredActivities.length === 0 ? /* @__PURE__ */ jsx14(
|
|
4864
5096
|
EmptyState,
|
|
4865
5097
|
{
|
|
4866
5098
|
title: "Unable to load activity",
|
|
4867
5099
|
description: "Please try again in a moment."
|
|
4868
5100
|
}
|
|
4869
|
-
) : filteredActivities.length > 0 ? filteredActivities.map((activity, index) => /* @__PURE__ */
|
|
4870
|
-
index > 0 ? /* @__PURE__ */
|
|
5101
|
+
) : filteredActivities.length > 0 ? filteredActivities.map((activity, index) => /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
5102
|
+
index > 0 ? /* @__PURE__ */ jsx14(
|
|
4871
5103
|
"div",
|
|
4872
5104
|
{
|
|
4873
5105
|
className: "agg-activity-divider h-px w-full shrink-0 bg-agg-separator",
|
|
4874
5106
|
"aria-hidden": true
|
|
4875
5107
|
}
|
|
4876
5108
|
) : null,
|
|
4877
|
-
/* @__PURE__ */
|
|
5109
|
+
/* @__PURE__ */ jsx14(
|
|
4878
5110
|
ActivityRow,
|
|
4879
5111
|
{
|
|
4880
5112
|
activity,
|
|
@@ -4882,15 +5114,15 @@ var PositionsActivity = ({
|
|
|
4882
5114
|
onClick: onActivityClick
|
|
4883
5115
|
}
|
|
4884
5116
|
)
|
|
4885
|
-
] }, activity.id)) : /* @__PURE__ */
|
|
5117
|
+
] }, activity.id)) : /* @__PURE__ */ jsx14(
|
|
4886
5118
|
EmptyState,
|
|
4887
5119
|
{
|
|
4888
5120
|
title: "No activity yet",
|
|
4889
5121
|
description: "Your trading activity will appear here."
|
|
4890
5122
|
}
|
|
4891
5123
|
),
|
|
4892
|
-
isLoadingMoreActivities ? /* @__PURE__ */
|
|
4893
|
-
hasMoreActivities ? /* @__PURE__ */
|
|
5124
|
+
isLoadingMoreActivities ? /* @__PURE__ */ jsx14(TabRowsSkeleton, { ariaLabel: "Loading more activity" }) : null,
|
|
5125
|
+
hasMoreActivities ? /* @__PURE__ */ jsx14(
|
|
4894
5126
|
"div",
|
|
4895
5127
|
{
|
|
4896
5128
|
ref: activitiesLoadMoreRef,
|
|
@@ -4912,14 +5144,15 @@ var PositionsActivity = ({
|
|
|
4912
5144
|
PositionsActivity.displayName = "PositionsActivity";
|
|
4913
5145
|
|
|
4914
5146
|
// src/pages/user-profile/components/positions-value-card.tsx
|
|
4915
|
-
import { jsx as
|
|
5147
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4916
5148
|
var PositionsValueCard = ({
|
|
4917
|
-
label
|
|
5149
|
+
label,
|
|
4918
5150
|
valueLabel,
|
|
4919
5151
|
isLoading = false,
|
|
4920
|
-
className
|
|
5152
|
+
className,
|
|
5153
|
+
icon
|
|
4921
5154
|
}) => {
|
|
4922
|
-
return /* @__PURE__ */
|
|
5155
|
+
return /* @__PURE__ */ jsxs14(
|
|
4923
5156
|
"div",
|
|
4924
5157
|
{
|
|
4925
5158
|
className: cn(
|
|
@@ -4928,8 +5161,8 @@ var PositionsValueCard = ({
|
|
|
4928
5161
|
className
|
|
4929
5162
|
),
|
|
4930
5163
|
children: [
|
|
4931
|
-
/* @__PURE__ */
|
|
4932
|
-
/* @__PURE__ */
|
|
5164
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
|
|
5165
|
+
icon != null ? icon : /* @__PURE__ */ jsx15(
|
|
4933
5166
|
"svg",
|
|
4934
5167
|
{
|
|
4935
5168
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -4937,18 +5170,19 @@ var PositionsValueCard = ({
|
|
|
4937
5170
|
height: "16",
|
|
4938
5171
|
viewBox: "0 0 16 16",
|
|
4939
5172
|
fill: "none",
|
|
4940
|
-
|
|
5173
|
+
"aria-hidden": "true",
|
|
5174
|
+
children: /* @__PURE__ */ jsx15(
|
|
4941
5175
|
"path",
|
|
4942
5176
|
{
|
|
4943
5177
|
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",
|
|
4944
|
-
|
|
5178
|
+
className: "fill-agg-muted-foreground"
|
|
4945
5179
|
}
|
|
4946
5180
|
)
|
|
4947
5181
|
}
|
|
4948
5182
|
),
|
|
4949
|
-
/* @__PURE__ */
|
|
5183
|
+
/* @__PURE__ */ jsx15("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children: label })
|
|
4950
5184
|
] }),
|
|
4951
|
-
/* @__PURE__ */
|
|
5185
|
+
/* @__PURE__ */ jsx15("div", { className: "agg-portfolio-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: isLoading ? /* @__PURE__ */ jsx15("div", { role: "status", "aria-label": "Loading positions value", children: /* @__PURE__ */ jsx15(SkeletonBlock, { className: "h-8 w-24 rounded-agg-sm" }) }) : valueLabel })
|
|
4952
5186
|
]
|
|
4953
5187
|
}
|
|
4954
5188
|
);
|
|
@@ -4977,7 +5211,7 @@ var buildAggTxExplorerHref = (chainId, txHash) => {
|
|
|
4977
5211
|
};
|
|
4978
5212
|
|
|
4979
5213
|
// src/pages/user-profile/components/user-info-card.tsx
|
|
4980
|
-
import { optimizedImageUrl as
|
|
5214
|
+
import { optimizedImageUrl as optimizedImageUrl4, useLabels as useLabels10 } from "@agg-build/hooks";
|
|
4981
5215
|
|
|
4982
5216
|
// src/primitives/conditional-wrapper.tsx
|
|
4983
5217
|
var ConditionalWrapper = ({
|
|
@@ -4988,9 +5222,9 @@ var ConditionalWrapper = ({
|
|
|
4988
5222
|
ConditionalWrapper.displayName = "ConditionalWrapper";
|
|
4989
5223
|
|
|
4990
5224
|
// src/pages/user-profile/components/default-avatar.tsx
|
|
4991
|
-
import { jsx as
|
|
5225
|
+
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4992
5226
|
var DefaultAvatar = ({ className }) => {
|
|
4993
|
-
return /* @__PURE__ */
|
|
5227
|
+
return /* @__PURE__ */ jsxs15(
|
|
4994
5228
|
"svg",
|
|
4995
5229
|
{
|
|
4996
5230
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5001,15 +5235,15 @@ var DefaultAvatar = ({ className }) => {
|
|
|
5001
5235
|
className: cn("shrink-0 text-agg-muted-foreground", className),
|
|
5002
5236
|
"aria-hidden": true,
|
|
5003
5237
|
children: [
|
|
5004
|
-
/* @__PURE__ */
|
|
5005
|
-
/* @__PURE__ */
|
|
5238
|
+
/* @__PURE__ */ jsxs15("g", { clipPath: "url(#clip0_default_avatar)", children: [
|
|
5239
|
+
/* @__PURE__ */ jsx16(
|
|
5006
5240
|
"path",
|
|
5007
5241
|
{
|
|
5008
5242
|
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",
|
|
5009
5243
|
fill: "var(--agg-color-secondary-hover)"
|
|
5010
5244
|
}
|
|
5011
5245
|
),
|
|
5012
|
-
/* @__PURE__ */
|
|
5246
|
+
/* @__PURE__ */ jsx16(
|
|
5013
5247
|
"path",
|
|
5014
5248
|
{
|
|
5015
5249
|
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",
|
|
@@ -5017,7 +5251,7 @@ var DefaultAvatar = ({ className }) => {
|
|
|
5017
5251
|
fillOpacity: "0.12"
|
|
5018
5252
|
}
|
|
5019
5253
|
),
|
|
5020
|
-
/* @__PURE__ */
|
|
5254
|
+
/* @__PURE__ */ jsx16(
|
|
5021
5255
|
"path",
|
|
5022
5256
|
{
|
|
5023
5257
|
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",
|
|
@@ -5026,7 +5260,7 @@ var DefaultAvatar = ({ className }) => {
|
|
|
5026
5260
|
}
|
|
5027
5261
|
)
|
|
5028
5262
|
] }),
|
|
5029
|
-
/* @__PURE__ */
|
|
5263
|
+
/* @__PURE__ */ jsx16("defs", { children: /* @__PURE__ */ jsx16("clipPath", { id: "clip0_default_avatar", children: /* @__PURE__ */ jsx16("rect", { width: "120", height: "120", fill: "white" }) }) })
|
|
5030
5264
|
]
|
|
5031
5265
|
}
|
|
5032
5266
|
);
|
|
@@ -5034,7 +5268,7 @@ var DefaultAvatar = ({ className }) => {
|
|
|
5034
5268
|
DefaultAvatar.displayName = "DefaultAvatar";
|
|
5035
5269
|
|
|
5036
5270
|
// src/pages/user-profile/components/user-info-card.tsx
|
|
5037
|
-
import { jsx as
|
|
5271
|
+
import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5038
5272
|
var UserInfoCard = ({
|
|
5039
5273
|
user,
|
|
5040
5274
|
onEditProfile,
|
|
@@ -5044,10 +5278,10 @@ var UserInfoCard = ({
|
|
|
5044
5278
|
className
|
|
5045
5279
|
}) => {
|
|
5046
5280
|
var _a;
|
|
5047
|
-
const labels =
|
|
5281
|
+
const labels = useLabels10();
|
|
5048
5282
|
const wallets = (_a = user.connectedWallets) != null ? _a : [];
|
|
5049
5283
|
const hasWallets = wallets.length > 0;
|
|
5050
|
-
return /* @__PURE__ */
|
|
5284
|
+
return /* @__PURE__ */ jsxs16(
|
|
5051
5285
|
"div",
|
|
5052
5286
|
{
|
|
5053
5287
|
className: cn(
|
|
@@ -5056,26 +5290,26 @@ var UserInfoCard = ({
|
|
|
5056
5290
|
className
|
|
5057
5291
|
),
|
|
5058
5292
|
children: [
|
|
5059
|
-
/* @__PURE__ */
|
|
5060
|
-
/* @__PURE__ */
|
|
5293
|
+
/* @__PURE__ */ jsxs16("div", { className: "agg-profile-header flex w-full flex-row flex-wrap items-center gap-4 sm:gap-5 pt-5", children: [
|
|
5294
|
+
/* @__PURE__ */ jsx17("div", { className: "agg-profile-avatar shrink-0", children: user.avatarUrl ? /* @__PURE__ */ jsx17(
|
|
5061
5295
|
RemoteImage,
|
|
5062
5296
|
{
|
|
5063
|
-
src:
|
|
5297
|
+
src: optimizedImageUrl4(user.avatarUrl, 120),
|
|
5064
5298
|
alt: user.username,
|
|
5065
5299
|
className: "h-20 w-20 rounded-full object-cover sm:h-[120px] sm:w-[120px]"
|
|
5066
5300
|
}
|
|
5067
|
-
) : /* @__PURE__ */
|
|
5068
|
-
/* @__PURE__ */
|
|
5069
|
-
/* @__PURE__ */
|
|
5070
|
-
/* @__PURE__ */
|
|
5071
|
-
/* @__PURE__ */
|
|
5072
|
-
user.socialLinks && user.socialLinks.length > 0 ? /* @__PURE__ */
|
|
5301
|
+
) : /* @__PURE__ */ jsx17(DefaultAvatar, { className: "h-20 w-20 rounded-full sm:h-[120px] sm:w-[120px]" }) }),
|
|
5302
|
+
/* @__PURE__ */ jsxs16("div", { className: "agg-profile-details flex min-w-0 w-full flex-1 flex-col gap-3 sm:gap-4", children: [
|
|
5303
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center justify-between gap-3 sm:gap-4", children: [
|
|
5304
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
5305
|
+
/* @__PURE__ */ jsx17("h2", { className: "truncate text-[22px] leading-7 font-agg-bold text-agg-foreground sm:agg-type-heading", children: user.username }),
|
|
5306
|
+
user.socialLinks && user.socialLinks.length > 0 ? /* @__PURE__ */ jsx17("div", { className: "agg-profile-social-links flex items-center gap-2", children: user.socialLinks.map((social) => {
|
|
5073
5307
|
const iconName = social.platform === "twitter" ? "twitter" : social.platform === "discord" ? "discord" : "telegram";
|
|
5074
|
-
const iconNode = /* @__PURE__ */
|
|
5308
|
+
const iconNode = /* @__PURE__ */ jsx17("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__ */ jsx17(Icon, { name: iconName, size: "small", className: "text-agg-foreground" }) });
|
|
5075
5309
|
if (!social.handle) {
|
|
5076
|
-
return /* @__PURE__ */
|
|
5310
|
+
return /* @__PURE__ */ jsx17("span", { children: iconNode }, `${social.platform}-icon`);
|
|
5077
5311
|
}
|
|
5078
|
-
return /* @__PURE__ */
|
|
5312
|
+
return /* @__PURE__ */ jsx17(
|
|
5079
5313
|
"a",
|
|
5080
5314
|
{
|
|
5081
5315
|
href: social.handle,
|
|
@@ -5088,55 +5322,55 @@ var UserInfoCard = ({
|
|
|
5088
5322
|
);
|
|
5089
5323
|
}) }) : null
|
|
5090
5324
|
] }),
|
|
5091
|
-
onEditProfile ? /* @__PURE__ */
|
|
5325
|
+
onEditProfile ? /* @__PURE__ */ jsxs16(
|
|
5092
5326
|
"button",
|
|
5093
5327
|
{
|
|
5094
5328
|
type: "button",
|
|
5095
5329
|
onClick: onEditProfile,
|
|
5096
5330
|
className: "hidden sm:flex shrink-0 cursor-pointer items-center gap-1.5 bg-transparent text-agg-primary hover:opacity-80",
|
|
5097
5331
|
children: [
|
|
5098
|
-
/* @__PURE__ */
|
|
5099
|
-
/* @__PURE__ */
|
|
5332
|
+
/* @__PURE__ */ jsx17(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
|
|
5333
|
+
/* @__PURE__ */ jsx17("span", { className: "text-agg-base font-agg-bold leading-6", children: "Edit" })
|
|
5100
5334
|
]
|
|
5101
5335
|
}
|
|
5102
5336
|
) : null
|
|
5103
5337
|
] }),
|
|
5104
|
-
hasWallets || !!user.socialHandle ? /* @__PURE__ */
|
|
5338
|
+
hasWallets || !!user.socialHandle ? /* @__PURE__ */ jsxs16("div", { className: "agg-profile-accounts flex w-full flex-col gap-2.5 sm:gap-3", children: [
|
|
5105
5339
|
wallets.map((wallet, idx) => {
|
|
5106
5340
|
const chainLower = wallet.chain.toLowerCase();
|
|
5107
5341
|
const iconName = chainLower === "solana" || chainLower === "svm" ? "solana" : "ethereum";
|
|
5108
|
-
return /* @__PURE__ */
|
|
5342
|
+
return /* @__PURE__ */ jsxs16(
|
|
5109
5343
|
"div",
|
|
5110
5344
|
{
|
|
5111
5345
|
className: "flex min-w-0 flex-wrap items-center gap-2 sm:gap-3",
|
|
5112
5346
|
children: [
|
|
5113
|
-
/* @__PURE__ */
|
|
5114
|
-
/* @__PURE__ */
|
|
5347
|
+
/* @__PURE__ */ jsx17("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx17(Icon, { name: iconName, size: "small", className: "text-agg-foreground" }) }),
|
|
5348
|
+
/* @__PURE__ */ jsx17("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 })
|
|
5115
5349
|
]
|
|
5116
5350
|
},
|
|
5117
5351
|
`wallet-${idx}`
|
|
5118
5352
|
);
|
|
5119
5353
|
}),
|
|
5120
|
-
user.socialHandle ? /* @__PURE__ */
|
|
5354
|
+
user.socialHandle ? /* @__PURE__ */ jsx17("div", { className: "flex min-w-0 items-center gap-2 sm:gap-3", children: /* @__PURE__ */ jsx17("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
|
|
5121
5355
|
] }) : null
|
|
5122
5356
|
] })
|
|
5123
5357
|
] }),
|
|
5124
|
-
(onDeposit || onWithdraw) && /* @__PURE__ */
|
|
5125
|
-
onDeposit ? /* @__PURE__ */
|
|
5358
|
+
(onDeposit || onWithdraw) && /* @__PURE__ */ jsxs16("div", { className: "agg-profile-actions flex w-full flex-1 items-center gap-3 py-5", children: [
|
|
5359
|
+
onDeposit ? /* @__PURE__ */ jsx17(
|
|
5126
5360
|
ConditionalWrapper,
|
|
5127
5361
|
{
|
|
5128
5362
|
condition: isDepositBlocked,
|
|
5129
|
-
wrapper: (children) => /* @__PURE__ */
|
|
5363
|
+
wrapper: (children) => /* @__PURE__ */ jsx17(
|
|
5130
5364
|
Tooltip,
|
|
5131
5365
|
{
|
|
5132
|
-
content: /* @__PURE__ */
|
|
5366
|
+
content: /* @__PURE__ */ jsx17("p", { className: "text-center", children: labels.auth.depositGeoBlocked }),
|
|
5133
5367
|
size: "small",
|
|
5134
5368
|
side: "bottom",
|
|
5135
5369
|
sideOffset: 4,
|
|
5136
5370
|
children
|
|
5137
5371
|
}
|
|
5138
5372
|
),
|
|
5139
|
-
children: /* @__PURE__ */
|
|
5373
|
+
children: /* @__PURE__ */ jsx17(
|
|
5140
5374
|
Button,
|
|
5141
5375
|
__spreadProps(__spreadValues({
|
|
5142
5376
|
variant: "primary",
|
|
@@ -5148,7 +5382,7 @@ var UserInfoCard = ({
|
|
|
5148
5382
|
)
|
|
5149
5383
|
}
|
|
5150
5384
|
) : null,
|
|
5151
|
-
onWithdraw ? /* @__PURE__ */
|
|
5385
|
+
onWithdraw ? /* @__PURE__ */ jsx17(
|
|
5152
5386
|
Button,
|
|
5153
5387
|
{
|
|
5154
5388
|
variant: "secondary",
|
|
@@ -5158,15 +5392,15 @@ var UserInfoCard = ({
|
|
|
5158
5392
|
children: labels.auth.withdraw
|
|
5159
5393
|
}
|
|
5160
5394
|
) : null,
|
|
5161
|
-
onEditProfile ? /* @__PURE__ */
|
|
5395
|
+
onEditProfile ? /* @__PURE__ */ jsxs16(
|
|
5162
5396
|
"button",
|
|
5163
5397
|
{
|
|
5164
5398
|
type: "button",
|
|
5165
5399
|
onClick: onEditProfile,
|
|
5166
5400
|
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",
|
|
5167
5401
|
children: [
|
|
5168
|
-
/* @__PURE__ */
|
|
5169
|
-
/* @__PURE__ */
|
|
5402
|
+
/* @__PURE__ */ jsx17(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
|
|
5403
|
+
/* @__PURE__ */ jsx17("span", { className: "text-agg-sm font-agg-bold leading-5", children: "Edit" })
|
|
5170
5404
|
]
|
|
5171
5405
|
}
|
|
5172
5406
|
) : null
|
|
@@ -5178,7 +5412,7 @@ var UserInfoCard = ({
|
|
|
5178
5412
|
UserInfoCard.displayName = "UserInfoCard";
|
|
5179
5413
|
|
|
5180
5414
|
// src/pages/user-profile/index.tsx
|
|
5181
|
-
import { jsx as
|
|
5415
|
+
import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5182
5416
|
var currencyFormatter = new Intl.NumberFormat("en-US", {
|
|
5183
5417
|
style: "currency",
|
|
5184
5418
|
currency: "USD",
|
|
@@ -5202,6 +5436,9 @@ var twoDecimalUsdFormatter = new Intl.NumberFormat("en-US", {
|
|
|
5202
5436
|
minimumFractionDigits: 2,
|
|
5203
5437
|
maximumFractionDigits: 2
|
|
5204
5438
|
});
|
|
5439
|
+
var limitPriceCentsFormatter = new Intl.NumberFormat("en-US", {
|
|
5440
|
+
maximumFractionDigits: 1
|
|
5441
|
+
});
|
|
5205
5442
|
var DEFAULT_TOKEN_DECIMALS = 6;
|
|
5206
5443
|
var LEGACY_TWELVE_DECIMAL_SCALE = BigInt("1000000000000");
|
|
5207
5444
|
var TOKEN_DECIMALS_BY_SYMBOL = {
|
|
@@ -5241,6 +5478,29 @@ var formatScaledNumberTwoDecimals = (value) => {
|
|
|
5241
5478
|
if (parsed == null) return "0.00";
|
|
5242
5479
|
return twoDecimalNumberFormatter.format(parsed);
|
|
5243
5480
|
};
|
|
5481
|
+
var formatLimitPriceLabel = (value) => {
|
|
5482
|
+
const parsed = parseRawMicroValue(value);
|
|
5483
|
+
if (parsed == null) return void 0;
|
|
5484
|
+
return `${limitPriceCentsFormatter.format(parsed * 100)}\xA2`;
|
|
5485
|
+
};
|
|
5486
|
+
var formatOpenOrderExpirationLabel = ({
|
|
5487
|
+
timeInForce,
|
|
5488
|
+
expiresAt,
|
|
5489
|
+
goodTilCanceledLabel,
|
|
5490
|
+
expiredLabel
|
|
5491
|
+
}) => {
|
|
5492
|
+
if (timeInForce === "GTC") return goodTilCanceledLabel;
|
|
5493
|
+
if (!expiresAt) return void 0;
|
|
5494
|
+
const expiration = dayjs(expiresAt);
|
|
5495
|
+
if (!expiration.isValid()) return void 0;
|
|
5496
|
+
const now = dayjs();
|
|
5497
|
+
const remainingMinutes = expiration.diff(now, "minute", true);
|
|
5498
|
+
if (remainingMinutes <= 0) return expiredLabel;
|
|
5499
|
+
if (remainingMinutes < 60) return `${Math.ceil(remainingMinutes)}m`;
|
|
5500
|
+
const remainingHours = expiration.diff(now, "hour", true);
|
|
5501
|
+
if (remainingHours < 24) return `${Math.ceil(remainingHours)}h`;
|
|
5502
|
+
return `${Math.ceil(expiration.diff(now, "day", true))}d`;
|
|
5503
|
+
};
|
|
5244
5504
|
var getTokenDecimals = (tokenSymbol, chainId) => {
|
|
5245
5505
|
var _a;
|
|
5246
5506
|
const normalizedSymbol = tokenSymbol.trim().toUpperCase();
|
|
@@ -5374,8 +5634,21 @@ var OPEN_ORDER_STATUSES = /* @__PURE__ */ new Set([
|
|
|
5374
5634
|
"signing",
|
|
5375
5635
|
"pending_bridge",
|
|
5376
5636
|
"submitting",
|
|
5377
|
-
"submitted"
|
|
5637
|
+
"submitted",
|
|
5638
|
+
"open",
|
|
5639
|
+
"partially_filled_open",
|
|
5640
|
+
"cancel_pending"
|
|
5378
5641
|
]);
|
|
5642
|
+
var OPEN_ORDER_QUERY_STATUSES = [
|
|
5643
|
+
"pending",
|
|
5644
|
+
"signing",
|
|
5645
|
+
"pending_bridge",
|
|
5646
|
+
"submitting",
|
|
5647
|
+
"submitted",
|
|
5648
|
+
"open",
|
|
5649
|
+
"partially_filled_open",
|
|
5650
|
+
"cancel_pending"
|
|
5651
|
+
];
|
|
5379
5652
|
var SHOW_SOLD_POSITIONS = false;
|
|
5380
5653
|
var SOLD_POSITION_SHARES_THRESHOLD = 0.1;
|
|
5381
5654
|
var isOpenOrderStatus = (status) => OPEN_ORDER_STATUSES.has(status.toLowerCase());
|
|
@@ -5452,7 +5725,8 @@ var isVisibleActivityItem = (item) => {
|
|
|
5452
5725
|
if (item.type === "trade") {
|
|
5453
5726
|
const tradeItem = item;
|
|
5454
5727
|
if (isOpenOrderStatus(tradeItem.status)) return false;
|
|
5455
|
-
|
|
5728
|
+
const normalizedStatus = tradeItem.status.toLowerCase();
|
|
5729
|
+
if ((normalizedStatus === "failed" || TRANSFER_CANCELED_STATUSES.has(normalizedStatus)) && ((_a = parseRawMicroValue(tradeItem.filledAmountRaw)) != null ? _a : 0) <= 0)
|
|
5456
5730
|
return false;
|
|
5457
5731
|
}
|
|
5458
5732
|
return true;
|
|
@@ -5610,6 +5884,7 @@ var UserProfilePage = ({
|
|
|
5610
5884
|
onActivityClick,
|
|
5611
5885
|
getActivityHref,
|
|
5612
5886
|
onOpenOrderClick,
|
|
5887
|
+
getOpenOrderHref,
|
|
5613
5888
|
onCancelOrder,
|
|
5614
5889
|
cancellingOrderIds,
|
|
5615
5890
|
isLoadingPositions,
|
|
@@ -5634,6 +5909,7 @@ var UserProfilePage = ({
|
|
|
5634
5909
|
classNames,
|
|
5635
5910
|
onError
|
|
5636
5911
|
}) => {
|
|
5912
|
+
var _a, _b;
|
|
5637
5913
|
const [isHydrated, setIsHydrated] = useState11(false);
|
|
5638
5914
|
useEffect10(() => {
|
|
5639
5915
|
setIsHydrated(true);
|
|
@@ -5641,12 +5917,14 @@ var UserProfilePage = ({
|
|
|
5641
5917
|
const { user: currentUser, isAuthenticated } = useAggAuthState();
|
|
5642
5918
|
const { isDepositBlocked } = useGeoBlock();
|
|
5643
5919
|
const balanceState = useAggBalance();
|
|
5644
|
-
const
|
|
5645
|
-
const labels = useLabels10();
|
|
5920
|
+
const labels = useLabels11();
|
|
5646
5921
|
const {
|
|
5922
|
+
features: { showLimitOrders },
|
|
5647
5923
|
trading: { executionMode: configuredExecutionMode }
|
|
5648
5924
|
} = useSdkUiConfig5();
|
|
5649
|
-
const
|
|
5925
|
+
const client = useAggClient();
|
|
5926
|
+
const cancelOrderMutation = useCancelManagedOrder();
|
|
5927
|
+
const toastContext = useOptionalToast();
|
|
5650
5928
|
const [internalCancellingIds, setInternalCancellingIds] = useState11({});
|
|
5651
5929
|
const { claim: startClaim, claimingKeys } = useClaimWinnings({
|
|
5652
5930
|
onClaim,
|
|
@@ -5657,9 +5935,9 @@ var UserProfilePage = ({
|
|
|
5657
5935
|
const [profileUser, setProfileUser] = useState11(void 0);
|
|
5658
5936
|
const shouldUseHookData = !user;
|
|
5659
5937
|
const connectedVenues = useMemo7(() => {
|
|
5660
|
-
var
|
|
5938
|
+
var _a2;
|
|
5661
5939
|
if (!shouldUseHookData) return [];
|
|
5662
|
-
const fromBalance = (
|
|
5940
|
+
const fromBalance = (_a2 = balanceState.connectedVenues) != null ? _a2 : [];
|
|
5663
5941
|
return [...new Set(fromBalance)].sort((a, b) => a.localeCompare(b));
|
|
5664
5942
|
}, [balanceState, shouldUseHookData]);
|
|
5665
5943
|
const [positionFilter, setPositionFilter] = useState11(initialPositionFilter);
|
|
@@ -5691,8 +5969,79 @@ var UserProfilePage = ({
|
|
|
5691
5969
|
const ordersQuery = useExecutionOrders({
|
|
5692
5970
|
enabled: shouldUseHookData && isAuthenticated,
|
|
5693
5971
|
limit: 25,
|
|
5972
|
+
mode: queryExecutionMode,
|
|
5973
|
+
refetchIntervalMs: 5e3
|
|
5974
|
+
});
|
|
5975
|
+
const pendingOpenOrdersQuery = useExecutionOrders({
|
|
5976
|
+
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
5977
|
+
status: OPEN_ORDER_QUERY_STATUSES[0],
|
|
5978
|
+
limit: 25,
|
|
5979
|
+
mode: queryExecutionMode
|
|
5980
|
+
});
|
|
5981
|
+
const signingOpenOrdersQuery = useExecutionOrders({
|
|
5982
|
+
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
5983
|
+
status: OPEN_ORDER_QUERY_STATUSES[1],
|
|
5984
|
+
limit: 25,
|
|
5694
5985
|
mode: queryExecutionMode
|
|
5695
5986
|
});
|
|
5987
|
+
const pendingBridgeOpenOrdersQuery = useExecutionOrders({
|
|
5988
|
+
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
5989
|
+
status: OPEN_ORDER_QUERY_STATUSES[2],
|
|
5990
|
+
limit: 25,
|
|
5991
|
+
mode: queryExecutionMode
|
|
5992
|
+
});
|
|
5993
|
+
const submittingOpenOrdersQuery = useExecutionOrders({
|
|
5994
|
+
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
5995
|
+
status: OPEN_ORDER_QUERY_STATUSES[3],
|
|
5996
|
+
limit: 25,
|
|
5997
|
+
mode: queryExecutionMode
|
|
5998
|
+
});
|
|
5999
|
+
const submittedOpenOrdersQuery = useExecutionOrders({
|
|
6000
|
+
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
6001
|
+
status: OPEN_ORDER_QUERY_STATUSES[4],
|
|
6002
|
+
limit: 25,
|
|
6003
|
+
mode: queryExecutionMode
|
|
6004
|
+
});
|
|
6005
|
+
const openOpenOrdersQuery = useExecutionOrders({
|
|
6006
|
+
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
6007
|
+
status: OPEN_ORDER_QUERY_STATUSES[5],
|
|
6008
|
+
limit: 25,
|
|
6009
|
+
mode: queryExecutionMode
|
|
6010
|
+
});
|
|
6011
|
+
const partiallyFilledOpenOrdersQuery = useExecutionOrders({
|
|
6012
|
+
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
6013
|
+
status: OPEN_ORDER_QUERY_STATUSES[6],
|
|
6014
|
+
limit: 25,
|
|
6015
|
+
mode: queryExecutionMode
|
|
6016
|
+
});
|
|
6017
|
+
const cancelPendingOpenOrdersQuery = useExecutionOrders({
|
|
6018
|
+
enabled: shouldUseHookData && isAuthenticated && !openOrders,
|
|
6019
|
+
status: OPEN_ORDER_QUERY_STATUSES[7],
|
|
6020
|
+
limit: 25,
|
|
6021
|
+
mode: queryExecutionMode
|
|
6022
|
+
});
|
|
6023
|
+
const openOrderQueries = useMemo7(
|
|
6024
|
+
() => [
|
|
6025
|
+
pendingOpenOrdersQuery,
|
|
6026
|
+
signingOpenOrdersQuery,
|
|
6027
|
+
pendingBridgeOpenOrdersQuery,
|
|
6028
|
+
submittingOpenOrdersQuery,
|
|
6029
|
+
submittedOpenOrdersQuery,
|
|
6030
|
+
openOpenOrdersQuery,
|
|
6031
|
+
partiallyFilledOpenOrdersQuery,
|
|
6032
|
+
cancelPendingOpenOrdersQuery
|
|
6033
|
+
],
|
|
6034
|
+
[
|
|
6035
|
+
cancelPendingOpenOrdersQuery,
|
|
6036
|
+
openOpenOrdersQuery,
|
|
6037
|
+
partiallyFilledOpenOrdersQuery,
|
|
6038
|
+
pendingBridgeOpenOrdersQuery,
|
|
6039
|
+
pendingOpenOrdersQuery,
|
|
6040
|
+
signingOpenOrdersQuery,
|
|
6041
|
+
submittedOpenOrdersQuery,
|
|
6042
|
+
submittingOpenOrdersQuery
|
|
6043
|
+
]
|
|
6044
|
+
);
|
|
5696
6045
|
const activityQuery = useUserActivity({
|
|
5697
6046
|
enabled: shouldUseHookData && isAuthenticated,
|
|
5698
6047
|
limit: 25
|
|
@@ -5705,24 +6054,37 @@ var UserProfilePage = ({
|
|
|
5705
6054
|
}
|
|
5706
6055
|
setInternalCancellingIds((prev) => __spreadProps(__spreadValues({}, prev), { [order.id]: true }));
|
|
5707
6056
|
try {
|
|
5708
|
-
yield
|
|
5709
|
-
|
|
6057
|
+
const cancellationResult = yield cancelOrderMutation.mutateAsync(order.id);
|
|
6058
|
+
const isCancellationPending = cancellationResult.status === "cancel_pending";
|
|
6059
|
+
toastContext == null ? void 0 : toastContext.toast(
|
|
6060
|
+
isCancellationPending ? labels.notifications.order.cancelPendingMessage : labels.notifications.order.cancelledMessage,
|
|
6061
|
+
{
|
|
6062
|
+
title: isCancellationPending ? labels.notifications.order.cancelPendingTitle : labels.notifications.order.cancelledTitle,
|
|
6063
|
+
tone: "success"
|
|
6064
|
+
}
|
|
6065
|
+
);
|
|
6066
|
+
} catch (error) {
|
|
6067
|
+
const errorReason = error instanceof Error ? error.message : void 0;
|
|
6068
|
+
toastContext == null ? void 0 : toastContext.toast(labels.notifications.order.cancelFailedMessage(errorReason), {
|
|
6069
|
+
title: labels.notifications.order.cancelFailedTitle,
|
|
6070
|
+
tone: "error"
|
|
6071
|
+
});
|
|
5710
6072
|
} finally {
|
|
5711
6073
|
setInternalCancellingIds((prev) => {
|
|
5712
|
-
var
|
|
5713
|
-
const
|
|
6074
|
+
var _a2;
|
|
6075
|
+
const _b2 = prev, { [_a2 = order.id]: _removed } = _b2, rest = __objRest(_b2, [__restKey(_a2)]);
|
|
5714
6076
|
return rest;
|
|
5715
6077
|
});
|
|
5716
6078
|
}
|
|
5717
6079
|
}),
|
|
5718
|
-
[
|
|
6080
|
+
[cancelOrderMutation, labels.notifications.order, onCancelOrder, toastContext]
|
|
5719
6081
|
);
|
|
5720
6082
|
const handleClaimPosition = useCallback5(
|
|
5721
6083
|
(position) => {
|
|
5722
|
-
var
|
|
6084
|
+
var _a2, _b2;
|
|
5723
6085
|
return startClaim({
|
|
5724
|
-
claimKey: (
|
|
5725
|
-
winningOutcomeIds: (
|
|
6086
|
+
claimKey: (_a2 = position.marketId) != null ? _a2 : position.id,
|
|
6087
|
+
winningOutcomeIds: (_b2 = position.winningOutcomeIds) != null ? _b2 : [],
|
|
5726
6088
|
payload: position
|
|
5727
6089
|
});
|
|
5728
6090
|
},
|
|
@@ -5764,22 +6126,22 @@ var UserProfilePage = ({
|
|
|
5764
6126
|
};
|
|
5765
6127
|
}, [client, currentUser, isAuthenticated, shouldUseHookData]);
|
|
5766
6128
|
const resolvedUser = useMemo7(() => {
|
|
5767
|
-
var
|
|
6129
|
+
var _a2, _b2, _c, _d, _e, _f;
|
|
5768
6130
|
if (user) return user;
|
|
5769
6131
|
const fullUser = profileUser != null ? profileUser : currentUser;
|
|
5770
6132
|
const walletAddress = getWalletAddressFromUserProfile(fullUser);
|
|
5771
6133
|
const fallbackUsername = walletAddress && shortenAddress(walletAddress) || "username";
|
|
5772
|
-
const twitterAccount = (
|
|
6134
|
+
const twitterAccount = (_a2 = fullUser == null ? void 0 : fullUser.accounts) == null ? void 0 : _a2.find(
|
|
5773
6135
|
(account) => String(account.provider).toLowerCase() === "twitter"
|
|
5774
6136
|
);
|
|
5775
|
-
const normalizedTwitterHandle = (
|
|
6137
|
+
const normalizedTwitterHandle = (_b2 = twitterAccount == null ? void 0 : twitterAccount.providerAccountId) == null ? void 0 : _b2.replace(/^@/, "");
|
|
5776
6138
|
const walletAccounts = (_d = (_c = fullUser == null ? void 0 : fullUser.accounts) == null ? void 0 : _c.filter((a) => a.provider === "wallet" || a.provider === "solana_wallet")) != null ? _d : [];
|
|
5777
6139
|
const connectedWallets = walletAccounts.map((a) => {
|
|
5778
|
-
var
|
|
6140
|
+
var _a3;
|
|
5779
6141
|
const chain = a.provider === "solana_wallet" ? "solana" : "evm";
|
|
5780
6142
|
return {
|
|
5781
6143
|
chain,
|
|
5782
|
-
displayAddress: (
|
|
6144
|
+
displayAddress: (_a3 = shortenAddress(a.providerAccountId, { chain })) != null ? _a3 : a.providerAccountId
|
|
5783
6145
|
};
|
|
5784
6146
|
});
|
|
5785
6147
|
return {
|
|
@@ -5806,24 +6168,35 @@ var UserProfilePage = ({
|
|
|
5806
6168
|
}));
|
|
5807
6169
|
}, [_venueBalances, balanceState.balanceBreakdown]);
|
|
5808
6170
|
const positionsValueLabel = useMemo7(() => {
|
|
5809
|
-
var
|
|
6171
|
+
var _a2;
|
|
5810
6172
|
if (balance == null ? void 0 : balance.totalLabel) return balance.totalLabel;
|
|
5811
6173
|
const managed = balanceState.managedBalances;
|
|
5812
|
-
const positions = (
|
|
6174
|
+
const positions = (_a2 = managed == null ? void 0 : managed.positions) != null ? _a2 : [];
|
|
5813
6175
|
const positionsValueTotal = positions.reduce((sum, p) => sum + (Number(p.balance) || 0), 0);
|
|
5814
6176
|
return formatUsd(positionsValueTotal);
|
|
5815
6177
|
}, [balance, balanceState]);
|
|
5816
6178
|
const availableBalanceLabel = useMemo7(() => {
|
|
5817
|
-
var
|
|
5818
|
-
return formatUsd((
|
|
5819
|
-
}, [balanceState.totalBalance]);
|
|
6179
|
+
var _a2, _b2;
|
|
6180
|
+
return formatUsd((_b2 = (_a2 = balanceState.availableBalance) != null ? _a2 : balanceState.totalBalance) != null ? _b2 : 0);
|
|
6181
|
+
}, [balanceState.availableBalance, balanceState.totalBalance]);
|
|
6182
|
+
const reservedBalanceLabel = useMemo7(() => {
|
|
6183
|
+
var _a2;
|
|
6184
|
+
const reserved = (_a2 = balanceState.reservedBalance) != null ? _a2 : 0;
|
|
6185
|
+
return reserved > 0 ? formatUsd(reserved) : void 0;
|
|
6186
|
+
}, [balanceState.reservedBalance]);
|
|
6187
|
+
const { disabledVenues, isLoading: isAppConfigLoading } = useAppConfig2();
|
|
6188
|
+
const isKalshiAvailable = getVenueAvailabilityState({
|
|
6189
|
+
venueId: Venue2.kalshi,
|
|
6190
|
+
disabledVenues,
|
|
6191
|
+
isConfigLoading: isAppConfigLoading
|
|
6192
|
+
}) === "available";
|
|
5820
6193
|
const isPositionsValueLoading = !(balance == null ? void 0 : balance.totalLabel) && balanceState.isLoading;
|
|
5821
6194
|
const isAvailableBalanceLoading = balanceState.isLoading;
|
|
5822
6195
|
const resolvedActivities = useMemo7(() => {
|
|
5823
6196
|
if (activities) return activities.filter(isVisibleUserProfileActivity);
|
|
5824
6197
|
const formatTime = isHydrated ? toRelativeTimeLabel : toAbsoluteTimeLabel;
|
|
5825
6198
|
return activityQuery.activities.filter(isVisibleActivityItem).map((item, index) => {
|
|
5826
|
-
var
|
|
6199
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G;
|
|
5827
6200
|
const timeLabel = formatTime(getRuntimeActivityCreatedAt(item));
|
|
5828
6201
|
if (item.type === "trade") {
|
|
5829
6202
|
const tradeItem = item;
|
|
@@ -5832,7 +6205,7 @@ var UserProfilePage = ({
|
|
|
5832
6205
|
const status = normalizeTradeStatus(tradeItem.status);
|
|
5833
6206
|
const isFailed = tradeItem.status.toLowerCase() === "failed";
|
|
5834
6207
|
const hasError = hasActivityError(tradeItem);
|
|
5835
|
-
const eventId = (
|
|
6208
|
+
const eventId = (_b2 = (_a2 = tradeItem.venueMarket) == null ? void 0 : _a2.venueEventId) != null ? _b2 : void 0;
|
|
5836
6209
|
const marketId = (_d = (_c = tradeItem.venueMarket) == null ? void 0 : _c.id) != null ? _d : void 0;
|
|
5837
6210
|
const marketQuestion = (_g = (_f = (_e = tradeItem.venueMarket) == null ? void 0 : _e.question) != null ? _f : tradeItem.marketQuestion) != null ? _g : "Market";
|
|
5838
6211
|
const outcomeLabel = (_l = (_k = (_j = (_h = tradeItem.venueMarketOutcome) == null ? void 0 : _h.title) != null ? _j : (_i = tradeItem.venueMarketOutcome) == null ? void 0 : _i.label) != null ? _k : tradeItem.outcomeLabel) != null ? _l : "";
|
|
@@ -5972,35 +6345,82 @@ var UserProfilePage = ({
|
|
|
5972
6345
|
}, [activities, activityQuery.activities, isHydrated, labels, ordersQuery.orders]);
|
|
5973
6346
|
const resolvedOpenOrders = useMemo7(() => {
|
|
5974
6347
|
if (openOrders) return openOrders;
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
6348
|
+
const orderRowsById = /* @__PURE__ */ new Map();
|
|
6349
|
+
for (const query of openOrderQueries) {
|
|
6350
|
+
for (const order of query.orders) {
|
|
6351
|
+
orderRowsById.set(order.id, order);
|
|
6352
|
+
}
|
|
6353
|
+
}
|
|
6354
|
+
return Array.from(orderRowsById.values()).filter((order) => isOpenOrderStatus(order.status)).sort(
|
|
6355
|
+
(a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
|
|
6356
|
+
).map((order) => {
|
|
6357
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
6358
|
+
const isLimitOrder = order.orderType === "limit" || order.limitSizeRaw != null;
|
|
6359
|
+
const filledRaw = isLimitOrder ? order.filledSizeRaw : order.filledAmountRaw;
|
|
6360
|
+
const totalRaw = isLimitOrder ? order.limitSizeRaw : order.amountRaw;
|
|
6361
|
+
const totalCostRaw = isLimitOrder ? (_a2 = order.reservedCostRaw) != null ? _a2 : order.amountRaw : order.amountRaw;
|
|
6362
|
+
const limitPriceLabel = formatLimitPriceLabel(order.limitPriceRaw);
|
|
6363
|
+
const expirationLabel = formatOpenOrderExpirationLabel({
|
|
6364
|
+
timeInForce: order.timeInForce,
|
|
6365
|
+
expiresAt: order.expiresAt,
|
|
6366
|
+
goodTilCanceledLabel: labels.userProfile.openOrders.goodTilCanceled,
|
|
6367
|
+
expiredLabel: labels.userProfile.openOrders.expired
|
|
6368
|
+
});
|
|
6369
|
+
return __spreadProps(__spreadValues(__spreadProps(__spreadValues({
|
|
5978
6370
|
id: order.id,
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
6371
|
+
eventId: (_c = (_b2 = order.venueMarket) == null ? void 0 : _b2.venueEventId) != null ? _c : void 0,
|
|
6372
|
+
marketId: (_e = (_d = order.venueMarket) == null ? void 0 : _d.id) != null ? _e : void 0,
|
|
6373
|
+
thumbnailSrc: (_g = (_f = order.venueMarket) == null ? void 0 : _f.image) != null ? _g : fallbackThumbnailSrc,
|
|
6374
|
+
title: ((_h = order.venueMarket) == null ? void 0 : _h.question) || "Market",
|
|
6375
|
+
outcomeLabel: ((_i = order.venueMarketOutcome) == null ? void 0 : _i.title) || ((_j = order.venueMarketOutcome) == null ? void 0 : _j.label) || "Outcome",
|
|
6376
|
+
venue: order.venue
|
|
6377
|
+
}, limitPriceLabel ? { limitPriceLabel } : {}), {
|
|
6378
|
+
filledLabel: `${formatScaledNumberTwoDecimals(filledRaw != null ? filledRaw : "0")}/${formatScaledNumberTwoDecimals(totalRaw)}`,
|
|
6379
|
+
valueLabel: formatFilledUsdTwoDecimals(totalCostRaw)
|
|
6380
|
+
}), expirationLabel ? { expirationLabel } : {}), {
|
|
5985
6381
|
status: order.status,
|
|
5986
|
-
|
|
5987
|
-
|
|
6382
|
+
orderType: isLimitOrder ? "limit" : "market",
|
|
6383
|
+
dagRunId: (_k = order.dagRunId) != null ? _k : null
|
|
6384
|
+
});
|
|
5988
6385
|
});
|
|
5989
|
-
}, [
|
|
6386
|
+
}, [labels, openOrderQueries, openOrders]);
|
|
6387
|
+
const isOpenOrdersQueryLoading = useMemo7(
|
|
6388
|
+
() => openOrderQueries.some((query) => query.isLoading),
|
|
6389
|
+
[openOrderQueries]
|
|
6390
|
+
);
|
|
6391
|
+
const hasOpenOrdersQueryError = useMemo7(
|
|
6392
|
+
() => openOrderQueries.some((query) => query.error),
|
|
6393
|
+
[openOrderQueries]
|
|
6394
|
+
);
|
|
6395
|
+
const hasMoreOpenOrdersQuery = useMemo7(
|
|
6396
|
+
() => openOrderQueries.some((query) => query.hasNextPage),
|
|
6397
|
+
[openOrderQueries]
|
|
6398
|
+
);
|
|
6399
|
+
const isLoadingMoreOpenOrdersQuery = useMemo7(
|
|
6400
|
+
() => openOrderQueries.some((query) => query.isFetchingNextPage),
|
|
6401
|
+
[openOrderQueries]
|
|
6402
|
+
);
|
|
6403
|
+
const handleLoadMoreOpenOrders = useCallback5(() => {
|
|
6404
|
+
for (const query of openOrderQueries) {
|
|
6405
|
+
if (query.hasNextPage) {
|
|
6406
|
+
void query.fetchNextPage();
|
|
6407
|
+
}
|
|
6408
|
+
}
|
|
6409
|
+
}, [openOrderQueries]);
|
|
5990
6410
|
const adaptPositionGroups = useCallback5(
|
|
5991
6411
|
(groups) => {
|
|
5992
6412
|
return groups.flatMap((group) => {
|
|
5993
|
-
var
|
|
6413
|
+
var _a2, _b2, _c, _d;
|
|
5994
6414
|
const closedTotals = computeClosedPositionTotals(group);
|
|
5995
6415
|
const winningOutcome = group.venueMarket.venueMarketOutcomes.find(
|
|
5996
6416
|
(outcome) => outcome.winner === true
|
|
5997
6417
|
);
|
|
5998
|
-
const winningOutcomeLabel = (
|
|
6418
|
+
const winningOutcomeLabel = (_b2 = (_a2 = winningOutcome == null ? void 0 : winningOutcome.title) != null ? _a2 : winningOutcome == null ? void 0 : winningOutcome.label) != null ? _b2 : null;
|
|
5999
6419
|
const venueEventId = (_c = group.venueMarket.venueEventId) != null ? _c : void 0;
|
|
6000
6420
|
const eventId = (_d = group.eventId) != null ? _d : venueEventId;
|
|
6001
6421
|
const marketId = group.targetMarketId;
|
|
6002
6422
|
return group.venueMarket.venueMarketOutcomes.map((outcome) => {
|
|
6003
|
-
var
|
|
6423
|
+
var _a3, _b3, _c2, _d2;
|
|
6004
6424
|
const isResolved = group.venueMarket.status === "resolved";
|
|
6005
6425
|
const isUnpriced = outcome.priceSource === "entry";
|
|
6006
6426
|
const averagePriceCents = Math.round(outcome.avgEntryPrice * 100);
|
|
@@ -6018,10 +6438,10 @@ var UserProfilePage = ({
|
|
|
6018
6438
|
const pnlPercent = displayPnlPercent == null ? null : displayPnlPercent.toFixed(2);
|
|
6019
6439
|
const winningOutcomeIds = outcome.winner === true ? outcome.venueBreakdown.map((breakdown) => breakdown.venueMarketOutcomeId) : [];
|
|
6020
6440
|
return {
|
|
6021
|
-
id: `${group.targetMarketId}-${outcome.label}-${(
|
|
6441
|
+
id: `${group.targetMarketId}-${outcome.label}-${(_a3 = outcome.title) != null ? _a3 : ""}`,
|
|
6022
6442
|
eventId,
|
|
6023
6443
|
marketId,
|
|
6024
|
-
thumbnailSrc: (
|
|
6444
|
+
thumbnailSrc: (_b3 = group.venueMarket.image) != null ? _b3 : fallbackThumbnailSrc,
|
|
6025
6445
|
title: group.venueMarket.question,
|
|
6026
6446
|
outcomeLabel: ((_c2 = outcome.title) == null ? void 0 : _c2.trim()) || outcome.label,
|
|
6027
6447
|
resolutionLabel: winningOutcomeLabel,
|
|
@@ -6065,7 +6485,7 @@ var UserProfilePage = ({
|
|
|
6065
6485
|
const source = closedPositions != null ? closedPositions : adaptPositionGroups(closedPositionsQuery.positions);
|
|
6066
6486
|
return source.filter(shouldIncludeByShares);
|
|
6067
6487
|
}, [closedPositions, closedPositionsQuery.positions, adaptPositionGroups]);
|
|
6068
|
-
return /* @__PURE__ */
|
|
6488
|
+
return /* @__PURE__ */ jsx18(AggErrorBoundary, { onError, children: /* @__PURE__ */ jsx18(
|
|
6069
6489
|
"section",
|
|
6070
6490
|
{
|
|
6071
6491
|
className: cn(
|
|
@@ -6073,7 +6493,7 @@ var UserProfilePage = ({
|
|
|
6073
6493
|
"w-full mx-auto px-6 lg:px-10 pb-10 max-w-[1440px]",
|
|
6074
6494
|
classNames == null ? void 0 : classNames.root
|
|
6075
6495
|
),
|
|
6076
|
-
children: /* @__PURE__ */
|
|
6496
|
+
children: /* @__PURE__ */ jsxs17(
|
|
6077
6497
|
"div",
|
|
6078
6498
|
{
|
|
6079
6499
|
className: cn(
|
|
@@ -6083,8 +6503,8 @@ var UserProfilePage = ({
|
|
|
6083
6503
|
classNames == null ? void 0 : classNames.topRow
|
|
6084
6504
|
),
|
|
6085
6505
|
children: [
|
|
6086
|
-
/* @__PURE__ */
|
|
6087
|
-
/* @__PURE__ */
|
|
6506
|
+
/* @__PURE__ */ jsxs17("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: [
|
|
6507
|
+
/* @__PURE__ */ jsx18(
|
|
6088
6508
|
"div",
|
|
6089
6509
|
{
|
|
6090
6510
|
className: cn(
|
|
@@ -6092,7 +6512,7 @@ var UserProfilePage = ({
|
|
|
6092
6512
|
"flex min-w-0 flex-1 flex-col gap-4 sm:gap-6 h-full",
|
|
6093
6513
|
classNames == null ? void 0 : classNames.leftColumn
|
|
6094
6514
|
),
|
|
6095
|
-
children: /* @__PURE__ */
|
|
6515
|
+
children: /* @__PURE__ */ jsx18(
|
|
6096
6516
|
UserInfoCard,
|
|
6097
6517
|
{
|
|
6098
6518
|
user: resolvedUser,
|
|
@@ -6105,7 +6525,7 @@ var UserProfilePage = ({
|
|
|
6105
6525
|
)
|
|
6106
6526
|
}
|
|
6107
6527
|
),
|
|
6108
|
-
/* @__PURE__ */
|
|
6528
|
+
/* @__PURE__ */ jsxs17(
|
|
6109
6529
|
"div",
|
|
6110
6530
|
{
|
|
6111
6531
|
className: cn(
|
|
@@ -6113,19 +6533,40 @@ var UserProfilePage = ({
|
|
|
6113
6533
|
classNames == null ? void 0 : classNames.rightColumn
|
|
6114
6534
|
),
|
|
6115
6535
|
children: [
|
|
6116
|
-
/* @__PURE__ */
|
|
6117
|
-
|
|
6536
|
+
/* @__PURE__ */ jsxs17(
|
|
6537
|
+
"div",
|
|
6118
6538
|
{
|
|
6119
|
-
|
|
6120
|
-
|
|
6539
|
+
className: cn(
|
|
6540
|
+
"grid gap-4",
|
|
6541
|
+
isKalshiAvailable ? "grid-cols-1 sm:grid-cols-2" : "grid-cols-1"
|
|
6542
|
+
),
|
|
6543
|
+
children: [
|
|
6544
|
+
/* @__PURE__ */ jsx18(
|
|
6545
|
+
PositionsValueCard,
|
|
6546
|
+
{
|
|
6547
|
+
label: labels.userProfile.balance.positionsValue,
|
|
6548
|
+
valueLabel: positionsValueLabel,
|
|
6549
|
+
isLoading: isPositionsValueLoading
|
|
6550
|
+
}
|
|
6551
|
+
),
|
|
6552
|
+
isKalshiAvailable ? /* @__PURE__ */ jsx18(
|
|
6553
|
+
PositionsValueCard,
|
|
6554
|
+
{
|
|
6555
|
+
label: labels.userProfile.balance.kalshiBalance,
|
|
6556
|
+
valueLabel: formatUsd((_a = balanceState.kalshiBalance) != null ? _a : 0),
|
|
6557
|
+
icon: /* @__PURE__ */ jsx18(VenueLogo, { venue: Venue2.kalshi, size: "small", className: "size-4" })
|
|
6558
|
+
}
|
|
6559
|
+
) : null
|
|
6560
|
+
]
|
|
6121
6561
|
}
|
|
6122
6562
|
),
|
|
6123
|
-
/* @__PURE__ */
|
|
6563
|
+
/* @__PURE__ */ jsx18(
|
|
6124
6564
|
AvailableBalanceCard,
|
|
6125
6565
|
{
|
|
6126
6566
|
valueLabel: availableBalanceLabel,
|
|
6567
|
+
reservedValueLabel: reservedBalanceLabel,
|
|
6127
6568
|
isLoading: isAvailableBalanceLoading,
|
|
6128
|
-
chains: (balanceChainsOverride != null ? balanceChainsOverride : balanceState.balanceBreakdown).map((b) => ({
|
|
6569
|
+
chains: ((_b = balanceChainsOverride != null ? balanceChainsOverride : balanceState.availableBalanceBreakdown) != null ? _b : balanceState.balanceBreakdown).map((b) => ({
|
|
6129
6570
|
key: b.key,
|
|
6130
6571
|
label: b.label,
|
|
6131
6572
|
balance: b.balance,
|
|
@@ -6138,11 +6579,12 @@ var UserProfilePage = ({
|
|
|
6138
6579
|
}
|
|
6139
6580
|
)
|
|
6140
6581
|
] }),
|
|
6141
|
-
/* @__PURE__ */
|
|
6582
|
+
/* @__PURE__ */ jsx18(
|
|
6142
6583
|
PositionsActivity,
|
|
6143
6584
|
{
|
|
6144
6585
|
tab,
|
|
6145
6586
|
onTabChange,
|
|
6587
|
+
showOpenOrders: showLimitOrders,
|
|
6146
6588
|
activePositions: resolvedActivePositions,
|
|
6147
6589
|
closedPositions: resolvedClosedPositions,
|
|
6148
6590
|
activities: resolvedActivities,
|
|
@@ -6157,14 +6599,15 @@ var UserProfilePage = ({
|
|
|
6157
6599
|
return getActivityHref == null ? void 0 : getActivityHref(activity);
|
|
6158
6600
|
},
|
|
6159
6601
|
onOpenOrderClick,
|
|
6602
|
+
getOpenOrderHref,
|
|
6160
6603
|
onCancelOrder: handleCancelOrder,
|
|
6161
6604
|
cancellingOrderIds: cancellingOrderIds != null ? cancellingOrderIds : internalCancellingIds,
|
|
6162
6605
|
isLoadingPositions: isLoadingPositions != null ? isLoadingPositions : !!shouldUseHookData && (positionFilter === "active" ? activePositionsQuery.isLoading : closedPositionsQuery.isLoading),
|
|
6163
6606
|
isLoadingActivities: isLoadingActivities != null ? isLoadingActivities : !!shouldUseHookData && activityQuery.isLoading,
|
|
6164
|
-
isLoadingOpenOrders: isLoadingOpenOrders != null ? isLoadingOpenOrders : !!shouldUseHookData &&
|
|
6607
|
+
isLoadingOpenOrders: isLoadingOpenOrders != null ? isLoadingOpenOrders : !!shouldUseHookData && isOpenOrdersQueryLoading,
|
|
6165
6608
|
positionsError: positionsError != null ? positionsError : !!shouldUseHookData && (positionFilter === "active" ? !!activePositionsQuery.error : !!closedPositionsQuery.error),
|
|
6166
6609
|
activitiesError: activitiesError != null ? activitiesError : !!shouldUseHookData && !!activityQuery.error,
|
|
6167
|
-
openOrdersError: openOrdersError != null ? openOrdersError : !!shouldUseHookData &&
|
|
6610
|
+
openOrdersError: openOrdersError != null ? openOrdersError : !!shouldUseHookData && hasOpenOrdersQueryError,
|
|
6168
6611
|
hasMoreActivePositions: hasMoreActivePositions != null ? hasMoreActivePositions : !!shouldUseHookData && !!activePositionsQuery.hasNextPage,
|
|
6169
6612
|
isLoadingMoreActivePositions: isLoadingMoreActivePositions != null ? isLoadingMoreActivePositions : !!shouldUseHookData && !!activePositionsQuery.isFetchingNextPage,
|
|
6170
6613
|
onLoadMoreActivePositions: onLoadMoreActivePositions != null ? onLoadMoreActivePositions : shouldUseHookData && activePositionsQuery.hasNextPage ? () => {
|
|
@@ -6182,15 +6625,13 @@ var UserProfilePage = ({
|
|
|
6182
6625
|
onLoadMoreActivities: onLoadMoreActivities != null ? onLoadMoreActivities : shouldUseHookData && activityQuery.hasNextPage ? () => {
|
|
6183
6626
|
void activityQuery.fetchNextPage();
|
|
6184
6627
|
} : void 0,
|
|
6185
|
-
hasMoreOpenOrders: hasMoreOpenOrders != null ? hasMoreOpenOrders : !!shouldUseHookData &&
|
|
6186
|
-
isLoadingMoreOpenOrders: isLoadingMoreOpenOrders != null ? isLoadingMoreOpenOrders : !!shouldUseHookData &&
|
|
6187
|
-
onLoadMoreOpenOrders: onLoadMoreOpenOrders != null ? onLoadMoreOpenOrders : shouldUseHookData &&
|
|
6188
|
-
void ordersQuery.fetchNextPage();
|
|
6189
|
-
} : void 0,
|
|
6628
|
+
hasMoreOpenOrders: hasMoreOpenOrders != null ? hasMoreOpenOrders : !!shouldUseHookData && hasMoreOpenOrdersQuery,
|
|
6629
|
+
isLoadingMoreOpenOrders: isLoadingMoreOpenOrders != null ? isLoadingMoreOpenOrders : !!shouldUseHookData && isLoadingMoreOpenOrdersQuery,
|
|
6630
|
+
onLoadMoreOpenOrders: onLoadMoreOpenOrders != null ? onLoadMoreOpenOrders : shouldUseHookData && hasMoreOpenOrdersQuery ? handleLoadMoreOpenOrders : void 0,
|
|
6190
6631
|
className: classNames == null ? void 0 : classNames.positionsActivity
|
|
6191
6632
|
}
|
|
6192
6633
|
),
|
|
6193
|
-
/* @__PURE__ */
|
|
6634
|
+
/* @__PURE__ */ jsx18(
|
|
6194
6635
|
ClaimActivityBreakdownModal,
|
|
6195
6636
|
{
|
|
6196
6637
|
activity: selectedClaimActivity,
|