@agg-build/ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +287 -0
- package/dist/chunk-2QJXRRYP.mjs +37 -0
- package/dist/chunk-6NS7D73S.mjs +8811 -0
- package/dist/chunk-75IGOQ4N.mjs +3415 -0
- package/dist/chunk-C7T56TJR.mjs +748 -0
- package/dist/chunk-CGNDMLQL.mjs +3813 -0
- package/dist/chunk-DMKKNK76.mjs +3742 -0
- package/dist/chunk-I2WBGEWK.mjs +4512 -0
- package/dist/chunk-KHHFHXXD.mjs +1 -0
- package/dist/events.d.mts +1 -0
- package/dist/events.d.ts +1 -0
- package/dist/events.js +11414 -0
- package/dist/events.mjs +41 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +25520 -0
- package/dist/index.mjs +978 -0
- package/dist/modals.d.mts +1 -0
- package/dist/modals.d.ts +1 -0
- package/dist/modals.js +7743 -0
- package/dist/modals.mjs +36 -0
- package/dist/pages.d.mts +1 -0
- package/dist/pages.d.ts +1 -0
- package/dist/pages.js +20230 -0
- package/dist/pages.mjs +33 -0
- package/dist/primitives.d.mts +1 -0
- package/dist/primitives.d.ts +1 -0
- package/dist/primitives.js +8599 -0
- package/dist/primitives.mjs +179 -0
- package/dist/styles.css +2 -0
- package/dist/tailwind.css +2 -0
- package/dist/trading.d.mts +1 -0
- package/dist/trading.d.ts +1 -0
- package/dist/trading.js +8658 -0
- package/dist/trading.mjs +49 -0
- package/dist/types/auth/connect-button-view/connect-button-view.constants.d.mts +30 -0
- package/dist/types/auth/connect-button-view/connect-button-view.constants.d.ts +30 -0
- package/dist/types/auth/connect-button-view/connect-button-view.types.d.mts +115 -0
- package/dist/types/auth/connect-button-view/connect-button-view.types.d.ts +115 -0
- package/dist/types/auth/connect-button-view/index.d.mts +7 -0
- package/dist/types/auth/connect-button-view/index.d.ts +7 -0
- package/dist/types/auth/index.d.mts +1 -0
- package/dist/types/auth/index.d.ts +1 -0
- package/dist/types/constants.d.mts +5 -0
- package/dist/types/constants.d.ts +5 -0
- package/dist/types/deposit/components/DepositQRCode.d.mts +12 -0
- package/dist/types/deposit/components/DepositQRCode.d.ts +12 -0
- package/dist/types/deposit/deposit-modal.constants.d.mts +10 -0
- package/dist/types/deposit/deposit-modal.constants.d.ts +10 -0
- package/dist/types/deposit/deposit-modal.types.d.mts +233 -0
- package/dist/types/deposit/deposit-modal.types.d.ts +233 -0
- package/dist/types/deposit/index.d.mts +22 -0
- package/dist/types/deposit/index.d.ts +22 -0
- package/dist/types/deposit/steps/card-deposit.d.mts +17 -0
- package/dist/types/deposit/steps/card-deposit.d.ts +17 -0
- package/dist/types/deposit/steps/card-payment-pending.d.mts +7 -0
- package/dist/types/deposit/steps/card-payment-pending.d.ts +7 -0
- package/dist/types/deposit/steps/card-provider.d.mts +14 -0
- package/dist/types/deposit/steps/card-provider.d.ts +14 -0
- package/dist/types/deposit/steps/card-purchase-success.d.mts +7 -0
- package/dist/types/deposit/steps/card-purchase-success.d.ts +7 -0
- package/dist/types/deposit/steps/card-widget.d.mts +6 -0
- package/dist/types/deposit/steps/card-widget.d.ts +6 -0
- package/dist/types/deposit/steps/crypto-transfer.d.mts +19 -0
- package/dist/types/deposit/steps/crypto-transfer.d.ts +19 -0
- package/dist/types/deposit/steps/deposit-method.d.mts +12 -0
- package/dist/types/deposit/steps/deposit-method.d.ts +12 -0
- package/dist/types/deposit/steps/venue-selection.d.mts +7 -0
- package/dist/types/deposit/steps/venue-selection.d.ts +7 -0
- package/dist/types/deposit/steps/wallet-form.d.mts +24 -0
- package/dist/types/deposit/steps/wallet-form.d.ts +24 -0
- package/dist/types/deposit/steps/wallet-processing.d.mts +7 -0
- package/dist/types/deposit/steps/wallet-processing.d.ts +7 -0
- package/dist/types/deposit/steps/wallet-success.d.mts +7 -0
- package/dist/types/deposit/steps/wallet-success.d.ts +7 -0
- package/dist/types/events/index.d.mts +5 -0
- package/dist/types/events/index.d.ts +5 -0
- package/dist/types/events/item/event-list-item.constants.d.mts +1 -0
- package/dist/types/events/item/event-list-item.constants.d.ts +1 -0
- package/dist/types/events/item/event-list-item.types.d.mts +71 -0
- package/dist/types/events/item/event-list-item.types.d.ts +71 -0
- package/dist/types/events/item/event-list-item.utils.d.mts +46 -0
- package/dist/types/events/item/event-list-item.utils.d.ts +46 -0
- package/dist/types/events/item/index.d.mts +6 -0
- package/dist/types/events/item/index.d.ts +6 -0
- package/dist/types/events/item-details/event-list-item-details-market-selector.d.mts +10 -0
- package/dist/types/events/item-details/event-list-item-details-market-selector.d.ts +10 -0
- package/dist/types/events/item-details/event-list-item-details.constants.d.mts +3 -0
- package/dist/types/events/item-details/event-list-item-details.constants.d.ts +3 -0
- package/dist/types/events/item-details/event-list-item-details.types.d.mts +116 -0
- package/dist/types/events/item-details/event-list-item-details.types.d.ts +116 -0
- package/dist/types/events/item-details/event-list-item-details.utils.d.mts +75 -0
- package/dist/types/events/item-details/event-list-item-details.utils.d.ts +75 -0
- package/dist/types/events/item-details/index.d.mts +8 -0
- package/dist/types/events/item-details/index.d.ts +8 -0
- package/dist/types/events/item-details/settlement-summary.d.mts +9 -0
- package/dist/types/events/item-details/settlement-summary.d.ts +9 -0
- package/dist/types/events/list/event-list-tabs.d.mts +44 -0
- package/dist/types/events/list/event-list-tabs.d.ts +44 -0
- package/dist/types/events/list/event-list.constants.d.mts +4 -0
- package/dist/types/events/list/event-list.constants.d.ts +4 -0
- package/dist/types/events/list/event-list.types.d.mts +48 -0
- package/dist/types/events/list/event-list.types.d.ts +48 -0
- package/dist/types/events/list/event-list.utils.d.mts +19 -0
- package/dist/types/events/list/event-list.utils.d.ts +19 -0
- package/dist/types/events/list/index.d.mts +6 -0
- package/dist/types/events/list/index.d.ts +6 -0
- package/dist/types/events/market-details/index.d.mts +12 -0
- package/dist/types/events/market-details/index.d.ts +12 -0
- package/dist/types/events/market-details/market-details-outcome-button.d.mts +13 -0
- package/dist/types/events/market-details/market-details-outcome-button.d.ts +13 -0
- package/dist/types/events/market-details/market-details.constants.d.mts +9 -0
- package/dist/types/events/market-details/market-details.constants.d.ts +9 -0
- package/dist/types/events/market-details/market-details.types.d.mts +143 -0
- package/dist/types/events/market-details/market-details.types.d.ts +143 -0
- package/dist/types/events/market-details/market-details.utils.d.mts +72 -0
- package/dist/types/events/market-details/market-details.utils.d.ts +72 -0
- package/dist/types/events/market-details/orderbook-aggregation.d.mts +30 -0
- package/dist/types/events/market-details/orderbook-aggregation.d.ts +30 -0
- package/dist/types/events/orderbook/index.d.mts +11 -0
- package/dist/types/events/orderbook/index.d.ts +11 -0
- package/dist/types/events/orderbook/orderbook-with-states.d.mts +35 -0
- package/dist/types/events/orderbook/orderbook-with-states.d.ts +35 -0
- package/dist/types/events/orderbook/orderbook.constants.d.mts +10 -0
- package/dist/types/events/orderbook/orderbook.constants.d.ts +10 -0
- package/dist/types/events/orderbook/orderbook.types.d.mts +65 -0
- package/dist/types/events/orderbook/orderbook.types.d.ts +65 -0
- package/dist/types/events/orderbook/orderbook.utils.d.mts +13 -0
- package/dist/types/events/orderbook/orderbook.utils.d.ts +13 -0
- package/dist/types/events/orderbook/use-center-orderbook-spread.d.mts +13 -0
- package/dist/types/events/orderbook/use-center-orderbook-spread.d.ts +13 -0
- package/dist/types/events/shared/chart-venue-selection.d.mts +20 -0
- package/dist/types/events/shared/chart-venue-selection.d.ts +20 -0
- package/dist/types/events/shared/event-trading-state.utils.d.mts +14 -0
- package/dist/types/events/shared/event-trading-state.utils.d.ts +14 -0
- package/dist/types/events/shared/venue-market-cluster.d.mts +11 -0
- package/dist/types/events/shared/venue-market-cluster.d.ts +11 -0
- package/dist/types/geo-block-banner/index.d.mts +12 -0
- package/dist/types/geo-block-banner/index.d.ts +12 -0
- package/dist/types/geo-block-modal/geo-block-modal.types.d.mts +13 -0
- package/dist/types/geo-block-modal/geo-block-modal.types.d.ts +13 -0
- package/dist/types/geo-block-modal/index.d.mts +6 -0
- package/dist/types/geo-block-modal/index.d.ts +6 -0
- package/dist/types/index.d.mts +10 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/modals/index.d.mts +6 -0
- package/dist/types/modals/index.d.ts +6 -0
- package/dist/types/onboarding/index.d.mts +11 -0
- package/dist/types/onboarding/index.d.ts +11 -0
- package/dist/types/onboarding/onboarding-modal.constants.d.mts +10 -0
- package/dist/types/onboarding/onboarding-modal.constants.d.ts +10 -0
- package/dist/types/onboarding/onboarding-modal.types.d.mts +76 -0
- package/dist/types/onboarding/onboarding-modal.types.d.ts +76 -0
- package/dist/types/onboarding/steps/connect-accounts.d.mts +5 -0
- package/dist/types/onboarding/steps/connect-accounts.d.ts +5 -0
- package/dist/types/onboarding/steps/connect-kalshi-modal.d.mts +5 -0
- package/dist/types/onboarding/steps/connect-kalshi-modal.d.ts +5 -0
- package/dist/types/onboarding/steps/connect-onchain-modal.d.mts +5 -0
- package/dist/types/onboarding/steps/connect-onchain-modal.d.ts +5 -0
- package/dist/types/onboarding/steps/how-it-works.d.mts +5 -0
- package/dist/types/onboarding/steps/how-it-works.d.ts +5 -0
- package/dist/types/onboarding/steps/profile-setup.d.mts +5 -0
- package/dist/types/onboarding/steps/profile-setup.d.ts +5 -0
- package/dist/types/pages/event-market/event-market.types.d.mts +84 -0
- package/dist/types/pages/event-market/event-market.types.d.ts +84 -0
- package/dist/types/pages/event-market/event-market.utils.d.mts +14 -0
- package/dist/types/pages/event-market/event-market.utils.d.ts +14 -0
- package/dist/types/pages/event-market/index.d.mts +8 -0
- package/dist/types/pages/event-market/index.d.ts +8 -0
- package/dist/types/pages/home/home.constants.d.mts +6 -0
- package/dist/types/pages/home/home.constants.d.ts +6 -0
- package/dist/types/pages/home/home.types.d.mts +85 -0
- package/dist/types/pages/home/home.types.d.ts +85 -0
- package/dist/types/pages/home/home.utils.d.mts +7 -0
- package/dist/types/pages/home/home.utils.d.ts +7 -0
- package/dist/types/pages/home/index.d.mts +9 -0
- package/dist/types/pages/home/index.d.ts +9 -0
- package/dist/types/pages/home/use-home-page-modals.d.mts +32 -0
- package/dist/types/pages/home/use-home-page-modals.d.ts +32 -0
- package/dist/types/pages/home/use-scroll-restoration.d.mts +17 -0
- package/dist/types/pages/home/use-scroll-restoration.d.ts +17 -0
- package/dist/types/pages/index.d.mts +4 -0
- package/dist/types/pages/index.d.ts +4 -0
- package/dist/types/pages/user-profile/chain-display.d.mts +1 -0
- package/dist/types/pages/user-profile/chain-display.d.ts +1 -0
- package/dist/types/pages/user-profile/components/activity-row.d.mts +11 -0
- package/dist/types/pages/user-profile/components/activity-row.d.ts +11 -0
- package/dist/types/pages/user-profile/components/available-balance-card.d.mts +18 -0
- package/dist/types/pages/user-profile/components/available-balance-card.d.ts +18 -0
- package/dist/types/pages/user-profile/components/balance-display.d.mts +10 -0
- package/dist/types/pages/user-profile/components/balance-display.d.ts +10 -0
- package/dist/types/pages/user-profile/components/balances-card.d.mts +12 -0
- package/dist/types/pages/user-profile/components/balances-card.d.ts +12 -0
- package/dist/types/pages/user-profile/components/default-avatar.d.mts +8 -0
- package/dist/types/pages/user-profile/components/default-avatar.d.ts +8 -0
- package/dist/types/pages/user-profile/components/empty-state.d.mts +10 -0
- package/dist/types/pages/user-profile/components/empty-state.d.ts +10 -0
- package/dist/types/pages/user-profile/components/open-order-row.d.mts +12 -0
- package/dist/types/pages/user-profile/components/open-order-row.d.ts +12 -0
- package/dist/types/pages/user-profile/components/position-row.d.mts +15 -0
- package/dist/types/pages/user-profile/components/position-row.d.ts +15 -0
- package/dist/types/pages/user-profile/components/positions-activity.d.mts +51 -0
- package/dist/types/pages/user-profile/components/positions-activity.d.ts +51 -0
- package/dist/types/pages/user-profile/components/positions-value-card.d.mts +10 -0
- package/dist/types/pages/user-profile/components/positions-value-card.d.ts +10 -0
- package/dist/types/pages/user-profile/components/user-info-card.d.mts +15 -0
- package/dist/types/pages/user-profile/components/user-info-card.d.ts +15 -0
- package/dist/types/pages/user-profile/index.d.mts +10 -0
- package/dist/types/pages/user-profile/index.d.ts +10 -0
- package/dist/types/pages/user-profile/user-profile.constants.d.mts +9 -0
- package/dist/types/pages/user-profile/user-profile.constants.d.ts +9 -0
- package/dist/types/pages/user-profile/user-profile.types.d.mts +281 -0
- package/dist/types/pages/user-profile/user-profile.types.d.ts +281 -0
- package/dist/types/primitives/agg-logo/agg-logo.constants.d.mts +3 -0
- package/dist/types/primitives/agg-logo/agg-logo.constants.d.ts +3 -0
- package/dist/types/primitives/agg-logo/agg-logo.types.d.mts +2 -0
- package/dist/types/primitives/agg-logo/agg-logo.types.d.ts +2 -0
- package/dist/types/primitives/agg-logo/agg-logo.utils.d.mts +2 -0
- package/dist/types/primitives/agg-logo/agg-logo.utils.d.ts +2 -0
- package/dist/types/primitives/agg-logo/index.d.mts +7 -0
- package/dist/types/primitives/agg-logo/index.d.ts +7 -0
- package/dist/types/primitives/autocomplete-select/autocomplete-select.constants.d.mts +1 -0
- package/dist/types/primitives/autocomplete-select/autocomplete-select.constants.d.ts +1 -0
- package/dist/types/primitives/autocomplete-select/autocomplete-select.types.d.mts +26 -0
- package/dist/types/primitives/autocomplete-select/autocomplete-select.types.d.ts +26 -0
- package/dist/types/primitives/autocomplete-select/autocomplete-select.utils.d.mts +7 -0
- package/dist/types/primitives/autocomplete-select/autocomplete-select.utils.d.ts +7 -0
- package/dist/types/primitives/autocomplete-select/index.d.mts +7 -0
- package/dist/types/primitives/autocomplete-select/index.d.ts +7 -0
- package/dist/types/primitives/badge/badge.constants.d.mts +4 -0
- package/dist/types/primitives/badge/badge.constants.d.ts +4 -0
- package/dist/types/primitives/badge/badge.types.d.mts +27 -0
- package/dist/types/primitives/badge/badge.types.d.ts +27 -0
- package/dist/types/primitives/badge/badge.utils.d.mts +11 -0
- package/dist/types/primitives/badge/badge.utils.d.ts +11 -0
- package/dist/types/primitives/badge/index.d.mts +8 -0
- package/dist/types/primitives/badge/index.d.ts +8 -0
- package/dist/types/primitives/button/button.constants.d.mts +6 -0
- package/dist/types/primitives/button/button.constants.d.ts +6 -0
- package/dist/types/primitives/button/button.types.d.mts +18 -0
- package/dist/types/primitives/button/button.types.d.ts +18 -0
- package/dist/types/primitives/button/button.utils.d.mts +12 -0
- package/dist/types/primitives/button/button.utils.d.ts +12 -0
- package/dist/types/primitives/button/index.d.mts +7 -0
- package/dist/types/primitives/button/index.d.ts +7 -0
- package/dist/types/primitives/card/card.constants.d.mts +4 -0
- package/dist/types/primitives/card/card.constants.d.ts +4 -0
- package/dist/types/primitives/card/card.types.d.mts +8 -0
- package/dist/types/primitives/card/card.types.d.ts +8 -0
- package/dist/types/primitives/card/card.utils.d.mts +8 -0
- package/dist/types/primitives/card/card.utils.d.ts +8 -0
- package/dist/types/primitives/card/index.d.mts +6 -0
- package/dist/types/primitives/card/index.d.ts +6 -0
- package/dist/types/primitives/chart/chart-type-switch.constants.d.mts +2 -0
- package/dist/types/primitives/chart/chart-type-switch.constants.d.ts +2 -0
- package/dist/types/primitives/chart/chart-type-switch.d.mts +7 -0
- package/dist/types/primitives/chart/chart-type-switch.d.ts +7 -0
- package/dist/types/primitives/chart/chart-type-switch.types.d.mts +9 -0
- package/dist/types/primitives/chart/chart-type-switch.types.d.ts +9 -0
- package/dist/types/primitives/chart/chart-type-switch.utils.d.mts +13 -0
- package/dist/types/primitives/chart/chart-type-switch.utils.d.ts +13 -0
- package/dist/types/primitives/chart/chart.constants.d.mts +5 -0
- package/dist/types/primitives/chart/chart.constants.d.ts +5 -0
- package/dist/types/primitives/chart/chart.types.d.mts +59 -0
- package/dist/types/primitives/chart/chart.types.d.ts +59 -0
- package/dist/types/primitives/chart/chart.utils.d.mts +35 -0
- package/dist/types/primitives/chart/chart.utils.d.ts +35 -0
- package/dist/types/primitives/chart/index.d.mts +7 -0
- package/dist/types/primitives/chart/index.d.ts +7 -0
- package/dist/types/primitives/conditional-wrapper.d.mts +11 -0
- package/dist/types/primitives/conditional-wrapper.d.ts +11 -0
- package/dist/types/primitives/currency-input/currency-input.constants.d.mts +6 -0
- package/dist/types/primitives/currency-input/currency-input.constants.d.ts +6 -0
- package/dist/types/primitives/currency-input/currency-input.types.d.mts +36 -0
- package/dist/types/primitives/currency-input/currency-input.types.d.ts +36 -0
- package/dist/types/primitives/currency-input/currency-input.utils.d.mts +10 -0
- package/dist/types/primitives/currency-input/currency-input.utils.d.ts +10 -0
- package/dist/types/primitives/currency-input/index.d.mts +7 -0
- package/dist/types/primitives/currency-input/index.d.ts +7 -0
- package/dist/types/primitives/error-boundary/index.d.mts +24 -0
- package/dist/types/primitives/error-boundary/index.d.ts +24 -0
- package/dist/types/primitives/footer/agg-build-logo.d.mts +16 -0
- package/dist/types/primitives/footer/agg-build-logo.d.ts +16 -0
- package/dist/types/primitives/footer/footer.constants.d.mts +3 -0
- package/dist/types/primitives/footer/footer.constants.d.ts +3 -0
- package/dist/types/primitives/footer/footer.types.d.mts +25 -0
- package/dist/types/primitives/footer/footer.types.d.ts +25 -0
- package/dist/types/primitives/footer/index.d.mts +8 -0
- package/dist/types/primitives/footer/index.d.ts +8 -0
- package/dist/types/primitives/header/agg-logo.d.mts +2 -0
- package/dist/types/primitives/header/agg-logo.d.ts +2 -0
- package/dist/types/primitives/header/header.constants.d.mts +2 -0
- package/dist/types/primitives/header/header.constants.d.ts +2 -0
- package/dist/types/primitives/header/header.types.d.mts +42 -0
- package/dist/types/primitives/header/header.types.d.ts +42 -0
- package/dist/types/primitives/header/header.utils.d.mts +12 -0
- package/dist/types/primitives/header/header.utils.d.ts +12 -0
- package/dist/types/primitives/header/index.d.mts +8 -0
- package/dist/types/primitives/header/index.d.ts +8 -0
- package/dist/types/primitives/icon/icon.constants.d.mts +2 -0
- package/dist/types/primitives/icon/icon.constants.d.ts +2 -0
- package/dist/types/primitives/icon/icon.types.d.mts +12 -0
- package/dist/types/primitives/icon/icon.types.d.ts +12 -0
- package/dist/types/primitives/icon/icon.utils.d.mts +3 -0
- package/dist/types/primitives/icon/icon.utils.d.ts +3 -0
- package/dist/types/primitives/icon/index.d.mts +68 -0
- package/dist/types/primitives/icon/index.d.ts +68 -0
- package/dist/types/primitives/icon/registry.d.mts +286 -0
- package/dist/types/primitives/icon/registry.d.ts +286 -0
- package/dist/types/primitives/icon/svg/activity-chart.d.mts +5 -0
- package/dist/types/primitives/icon/svg/activity-chart.d.ts +5 -0
- package/dist/types/primitives/icon/svg/activity.d.mts +5 -0
- package/dist/types/primitives/icon/svg/activity.d.ts +5 -0
- package/dist/types/primitives/icon/svg/apple.d.mts +5 -0
- package/dist/types/primitives/icon/svg/apple.d.ts +5 -0
- package/dist/types/primitives/icon/svg/arbitrum.d.mts +5 -0
- package/dist/types/primitives/icon/svg/arbitrum.d.ts +5 -0
- package/dist/types/primitives/icon/svg/arrow-right.d.mts +5 -0
- package/dist/types/primitives/icon/svg/arrow-right.d.ts +5 -0
- package/dist/types/primitives/icon/svg/arrow-trend-up.d.mts +5 -0
- package/dist/types/primitives/icon/svg/arrow-trend-up.d.ts +5 -0
- package/dist/types/primitives/icon/svg/arrows-to-dot.d.mts +5 -0
- package/dist/types/primitives/icon/svg/arrows-to-dot.d.ts +5 -0
- package/dist/types/primitives/icon/svg/badge-check-thin.d.mts +5 -0
- package/dist/types/primitives/icon/svg/badge-check-thin.d.ts +5 -0
- package/dist/types/primitives/icon/svg/bank.d.mts +5 -0
- package/dist/types/primitives/icon/svg/bank.d.ts +5 -0
- package/dist/types/primitives/icon/svg/base.d.mts +5 -0
- package/dist/types/primitives/icon/svg/base.d.ts +5 -0
- package/dist/types/primitives/icon/svg/best-prices.d.mts +5 -0
- package/dist/types/primitives/icon/svg/best-prices.d.ts +5 -0
- package/dist/types/primitives/icon/svg/bnb.d.mts +5 -0
- package/dist/types/primitives/icon/svg/bnb.d.ts +5 -0
- package/dist/types/primitives/icon/svg/bolt.d.mts +5 -0
- package/dist/types/primitives/icon/svg/bolt.d.ts +5 -0
- package/dist/types/primitives/icon/svg/chart-candlestick.d.mts +5 -0
- package/dist/types/primitives/icon/svg/chart-candlestick.d.ts +5 -0
- package/dist/types/primitives/icon/svg/chart-line.d.mts +5 -0
- package/dist/types/primitives/icon/svg/chart-line.d.ts +5 -0
- package/dist/types/primitives/icon/svg/check-badge.d.mts +5 -0
- package/dist/types/primitives/icon/svg/check-badge.d.ts +5 -0
- package/dist/types/primitives/icon/svg/check-circle.d.mts +5 -0
- package/dist/types/primitives/icon/svg/check-circle.d.ts +5 -0
- package/dist/types/primitives/icon/svg/chevron-down-thin.d.mts +6 -0
- package/dist/types/primitives/icon/svg/chevron-down-thin.d.ts +6 -0
- package/dist/types/primitives/icon/svg/chevron-down.d.mts +5 -0
- package/dist/types/primitives/icon/svg/chevron-down.d.ts +5 -0
- package/dist/types/primitives/icon/svg/chevron-left.d.mts +5 -0
- package/dist/types/primitives/icon/svg/chevron-left.d.ts +5 -0
- package/dist/types/primitives/icon/svg/chevron-right.d.mts +5 -0
- package/dist/types/primitives/icon/svg/chevron-right.d.ts +5 -0
- package/dist/types/primitives/icon/svg/chevron-up.d.mts +5 -0
- package/dist/types/primitives/icon/svg/chevron-up.d.ts +5 -0
- package/dist/types/primitives/icon/svg/close.d.mts +5 -0
- package/dist/types/primitives/icon/svg/close.d.ts +5 -0
- package/dist/types/primitives/icon/svg/copy.d.mts +5 -0
- package/dist/types/primitives/icon/svg/copy.d.ts +5 -0
- package/dist/types/primitives/icon/svg/create-account.d.mts +5 -0
- package/dist/types/primitives/icon/svg/create-account.d.ts +5 -0
- package/dist/types/primitives/icon/svg/credit-card.d.mts +5 -0
- package/dist/types/primitives/icon/svg/credit-card.d.ts +5 -0
- package/dist/types/primitives/icon/svg/cross-circle.d.mts +5 -0
- package/dist/types/primitives/icon/svg/cross-circle.d.ts +5 -0
- package/dist/types/primitives/icon/svg/disconnect.d.mts +5 -0
- package/dist/types/primitives/icon/svg/disconnect.d.ts +5 -0
- package/dist/types/primitives/icon/svg/discord.d.mts +5 -0
- package/dist/types/primitives/icon/svg/discord.d.ts +5 -0
- package/dist/types/primitives/icon/svg/document.d.mts +5 -0
- package/dist/types/primitives/icon/svg/document.d.ts +5 -0
- package/dist/types/primitives/icon/svg/dots-horizontal.d.mts +5 -0
- package/dist/types/primitives/icon/svg/dots-horizontal.d.ts +5 -0
- package/dist/types/primitives/icon/svg/download.d.mts +5 -0
- package/dist/types/primitives/icon/svg/download.d.ts +5 -0
- package/dist/types/primitives/icon/svg/email.d.mts +5 -0
- package/dist/types/primitives/icon/svg/email.d.ts +5 -0
- package/dist/types/primitives/icon/svg/error-filled.d.mts +5 -0
- package/dist/types/primitives/icon/svg/error-filled.d.ts +5 -0
- package/dist/types/primitives/icon/svg/ethereum.d.mts +5 -0
- package/dist/types/primitives/icon/svg/ethereum.d.ts +5 -0
- package/dist/types/primitives/icon/svg/external-link.d.mts +5 -0
- package/dist/types/primitives/icon/svg/external-link.d.ts +5 -0
- package/dist/types/primitives/icon/svg/google.d.mts +5 -0
- package/dist/types/primitives/icon/svg/google.d.ts +5 -0
- package/dist/types/primitives/icon/svg/image.d.mts +5 -0
- package/dist/types/primitives/icon/svg/image.d.ts +5 -0
- package/dist/types/primitives/icon/svg/info.d.mts +5 -0
- package/dist/types/primitives/icon/svg/info.d.ts +5 -0
- package/dist/types/primitives/icon/svg/internet-security.d.mts +5 -0
- package/dist/types/primitives/icon/svg/internet-security.d.ts +5 -0
- package/dist/types/primitives/icon/svg/link-accounts.d.mts +5 -0
- package/dist/types/primitives/icon/svg/link-accounts.d.ts +5 -0
- package/dist/types/primitives/icon/svg/paper-plane.d.mts +5 -0
- package/dist/types/primitives/icon/svg/paper-plane.d.ts +5 -0
- package/dist/types/primitives/icon/svg/pencil.d.mts +5 -0
- package/dist/types/primitives/icon/svg/pencil.d.ts +5 -0
- package/dist/types/primitives/icon/svg/play-square.d.mts +5 -0
- package/dist/types/primitives/icon/svg/play-square.d.ts +5 -0
- package/dist/types/primitives/icon/svg/polygon.d.mts +5 -0
- package/dist/types/primitives/icon/svg/polygon.d.ts +5 -0
- package/dist/types/primitives/icon/svg/profile-about-tab.d.mts +6 -0
- package/dist/types/primitives/icon/svg/profile-about-tab.d.ts +6 -0
- package/dist/types/primitives/icon/svg/profile-accounts-wallets-tab.d.mts +6 -0
- package/dist/types/primitives/icon/svg/profile-accounts-wallets-tab.d.ts +6 -0
- package/dist/types/primitives/icon/svg/profile.d.mts +5 -0
- package/dist/types/primitives/icon/svg/profile.d.ts +5 -0
- package/dist/types/primitives/icon/svg/quotes-warning.d.mts +6 -0
- package/dist/types/primitives/icon/svg/quotes-warning.d.ts +6 -0
- package/dist/types/primitives/icon/svg/recenter.d.mts +5 -0
- package/dist/types/primitives/icon/svg/recenter.d.ts +5 -0
- package/dist/types/primitives/icon/svg/revenue-alt.d.mts +5 -0
- package/dist/types/primitives/icon/svg/revenue-alt.d.ts +5 -0
- package/dist/types/primitives/icon/svg/search.d.mts +5 -0
- package/dist/types/primitives/icon/svg/search.d.ts +5 -0
- package/dist/types/primitives/icon/svg/shield-trust.d.mts +5 -0
- package/dist/types/primitives/icon/svg/shield-trust.d.ts +5 -0
- package/dist/types/primitives/icon/svg/solana.d.mts +5 -0
- package/dist/types/primitives/icon/svg/solana.d.ts +5 -0
- package/dist/types/primitives/icon/svg/sparkles-filled.d.mts +5 -0
- package/dist/types/primitives/icon/svg/sparkles-filled.d.ts +5 -0
- package/dist/types/primitives/icon/svg/stay-in-control.d.mts +5 -0
- package/dist/types/primitives/icon/svg/stay-in-control.d.ts +5 -0
- package/dist/types/primitives/icon/svg/success-check.d.mts +5 -0
- package/dist/types/primitives/icon/svg/success-check.d.ts +5 -0
- package/dist/types/primitives/icon/svg/telegram.d.mts +5 -0
- package/dist/types/primitives/icon/svg/telegram.d.ts +5 -0
- package/dist/types/primitives/icon/svg/triangle-down.d.mts +5 -0
- package/dist/types/primitives/icon/svg/triangle-down.d.ts +5 -0
- package/dist/types/primitives/icon/svg/triangle-up-filled.d.mts +5 -0
- package/dist/types/primitives/icon/svg/triangle-up-filled.d.ts +5 -0
- package/dist/types/primitives/icon/svg/triangle-up.d.mts +5 -0
- package/dist/types/primitives/icon/svg/triangle-up.d.ts +5 -0
- package/dist/types/primitives/icon/svg/twitter.d.mts +5 -0
- package/dist/types/primitives/icon/svg/twitter.d.ts +5 -0
- package/dist/types/primitives/icon/svg/upload.d.mts +5 -0
- package/dist/types/primitives/icon/svg/upload.d.ts +5 -0
- package/dist/types/primitives/icon/svg/usdc.d.mts +5 -0
- package/dist/types/primitives/icon/svg/usdc.d.ts +5 -0
- package/dist/types/primitives/icon/svg/user-trust.d.mts +5 -0
- package/dist/types/primitives/icon/svg/user-trust.d.ts +5 -0
- package/dist/types/primitives/icon/svg/wallet-avatar.d.mts +5 -0
- package/dist/types/primitives/icon/svg/wallet-avatar.d.ts +5 -0
- package/dist/types/primitives/icon/svg/wallet-filled.d.mts +5 -0
- package/dist/types/primitives/icon/svg/wallet-filled.d.ts +5 -0
- package/dist/types/primitives/icon/svg/wallet.d.mts +5 -0
- package/dist/types/primitives/icon/svg/wallet.d.ts +5 -0
- package/dist/types/primitives/icon/svg/warning-filled.d.mts +5 -0
- package/dist/types/primitives/icon/svg/warning-filled.d.ts +5 -0
- package/dist/types/primitives/icon/svg/warning.d.mts +5 -0
- package/dist/types/primitives/icon/svg/warning.d.ts +5 -0
- package/dist/types/primitives/icon/types.d.mts +6 -0
- package/dist/types/primitives/icon/types.d.ts +6 -0
- package/dist/types/primitives/index.d.mts +25 -0
- package/dist/types/primitives/index.d.ts +25 -0
- package/dist/types/primitives/inline-alert/index.d.mts +7 -0
- package/dist/types/primitives/inline-alert/index.d.ts +7 -0
- package/dist/types/primitives/inline-alert/inline-alert.constants.d.mts +7 -0
- package/dist/types/primitives/inline-alert/inline-alert.constants.d.ts +7 -0
- package/dist/types/primitives/inline-alert/inline-alert.types.d.mts +24 -0
- package/dist/types/primitives/inline-alert/inline-alert.types.d.ts +24 -0
- package/dist/types/primitives/inline-alert/inline-alert.utils.d.mts +10 -0
- package/dist/types/primitives/inline-alert/inline-alert.utils.d.ts +10 -0
- package/dist/types/primitives/loading-icon/index.d.mts +7 -0
- package/dist/types/primitives/loading-icon/index.d.ts +7 -0
- package/dist/types/primitives/loading-icon/loading-icon.constants.d.mts +11 -0
- package/dist/types/primitives/loading-icon/loading-icon.constants.d.ts +11 -0
- package/dist/types/primitives/loading-icon/loading-icon.types.d.mts +15 -0
- package/dist/types/primitives/loading-icon/loading-icon.types.d.ts +15 -0
- package/dist/types/primitives/loading-icon/loading-icon.utils.d.mts +5 -0
- package/dist/types/primitives/loading-icon/loading-icon.utils.d.ts +5 -0
- package/dist/types/primitives/modal/index.d.mts +11 -0
- package/dist/types/primitives/modal/index.d.ts +11 -0
- package/dist/types/primitives/modal/modal.constants.d.mts +2 -0
- package/dist/types/primitives/modal/modal.constants.d.ts +2 -0
- package/dist/types/primitives/modal/modal.types.d.mts +78 -0
- package/dist/types/primitives/modal/modal.types.d.ts +78 -0
- package/dist/types/primitives/modal/modal.utils.d.mts +8 -0
- package/dist/types/primitives/modal/modal.utils.d.ts +8 -0
- package/dist/types/primitives/number-value.d.mts +12 -0
- package/dist/types/primitives/number-value.d.ts +12 -0
- package/dist/types/primitives/remote-image/index.d.mts +7 -0
- package/dist/types/primitives/remote-image/index.d.ts +7 -0
- package/dist/types/primitives/remote-image/remote-image.constants.d.mts +4 -0
- package/dist/types/primitives/remote-image/remote-image.constants.d.ts +4 -0
- package/dist/types/primitives/remote-image/remote-image.types.d.mts +28 -0
- package/dist/types/primitives/remote-image/remote-image.types.d.ts +28 -0
- package/dist/types/primitives/remote-image/remote-image.utils.d.mts +4 -0
- package/dist/types/primitives/remote-image/remote-image.utils.d.ts +4 -0
- package/dist/types/primitives/search/index.d.mts +7 -0
- package/dist/types/primitives/search/index.d.ts +7 -0
- package/dist/types/primitives/search/search-empty-icon.d.mts +5 -0
- package/dist/types/primitives/search/search-empty-icon.d.ts +5 -0
- package/dist/types/primitives/search/search.constants.d.mts +3 -0
- package/dist/types/primitives/search/search.constants.d.ts +3 -0
- package/dist/types/primitives/search/search.types.d.mts +57 -0
- package/dist/types/primitives/search/search.types.d.ts +57 -0
- package/dist/types/primitives/search/search.utils.d.mts +4 -0
- package/dist/types/primitives/search/search.utils.d.ts +4 -0
- package/dist/types/primitives/select/index.d.mts +7 -0
- package/dist/types/primitives/select/index.d.ts +7 -0
- package/dist/types/primitives/select/select.constants.d.mts +1 -0
- package/dist/types/primitives/select/select.constants.d.ts +1 -0
- package/dist/types/primitives/select/select.types.d.mts +25 -0
- package/dist/types/primitives/select/select.types.d.ts +25 -0
- package/dist/types/primitives/select/select.utils.d.mts +9 -0
- package/dist/types/primitives/select/select.utils.d.ts +9 -0
- package/dist/types/primitives/skeleton/index.d.mts +8 -0
- package/dist/types/primitives/skeleton/index.d.ts +8 -0
- package/dist/types/primitives/skeleton/skeleton-block.d.mts +8 -0
- package/dist/types/primitives/skeleton/skeleton-block.d.ts +8 -0
- package/dist/types/primitives/skeleton/skeleton.constants.d.mts +1 -0
- package/dist/types/primitives/skeleton/skeleton.constants.d.ts +1 -0
- package/dist/types/primitives/skeleton/skeleton.types.d.mts +27 -0
- package/dist/types/primitives/skeleton/skeleton.types.d.ts +27 -0
- package/dist/types/primitives/skeleton/skeleton.utils.d.mts +3 -0
- package/dist/types/primitives/skeleton/skeleton.utils.d.ts +3 -0
- package/dist/types/primitives/skeleton/views/event-list-item-details-skeleton-view.d.mts +5 -0
- package/dist/types/primitives/skeleton/views/event-list-item-details-skeleton-view.d.ts +5 -0
- package/dist/types/primitives/skeleton/views/event-list-item-skeleton-view.d.mts +9 -0
- package/dist/types/primitives/skeleton/views/event-list-item-skeleton-view.d.ts +9 -0
- package/dist/types/primitives/skeleton/views/event-list-skeleton-view.d.mts +5 -0
- package/dist/types/primitives/skeleton/views/event-list-skeleton-view.d.ts +5 -0
- package/dist/types/primitives/skeleton/views/market-details-skeleton-view.d.mts +12 -0
- package/dist/types/primitives/skeleton/views/market-details-skeleton-view.d.ts +12 -0
- package/dist/types/primitives/skeleton/views/place-order-skeleton-view.d.mts +5 -0
- package/dist/types/primitives/skeleton/views/place-order-skeleton-view.d.ts +5 -0
- package/dist/types/primitives/skeleton/views/search-skeleton-view.d.mts +5 -0
- package/dist/types/primitives/skeleton/views/search-skeleton-view.d.ts +5 -0
- package/dist/types/primitives/skeleton/views/settlement-skeleton-view.d.mts +5 -0
- package/dist/types/primitives/skeleton/views/settlement-skeleton-view.d.ts +5 -0
- package/dist/types/primitives/skeleton/views/user-profile-overview-skeleton-view.d.mts +5 -0
- package/dist/types/primitives/skeleton/views/user-profile-overview-skeleton-view.d.ts +5 -0
- package/dist/types/primitives/skeleton/views/user-profile-positions-activity-skeleton-view.d.mts +5 -0
- package/dist/types/primitives/skeleton/views/user-profile-positions-activity-skeleton-view.d.ts +5 -0
- package/dist/types/primitives/state-message/index.d.mts +7 -0
- package/dist/types/primitives/state-message/index.d.ts +7 -0
- package/dist/types/primitives/state-message/state-message.constants.d.mts +1 -0
- package/dist/types/primitives/state-message/state-message.constants.d.ts +1 -0
- package/dist/types/primitives/state-message/state-message.types.d.mts +24 -0
- package/dist/types/primitives/state-message/state-message.types.d.ts +24 -0
- package/dist/types/primitives/state-message/state-message.utils.d.mts +4 -0
- package/dist/types/primitives/state-message/state-message.utils.d.ts +4 -0
- package/dist/types/primitives/switch-button/index.d.mts +7 -0
- package/dist/types/primitives/switch-button/index.d.ts +7 -0
- package/dist/types/primitives/switch-button/switch-button.constants.d.mts +5 -0
- package/dist/types/primitives/switch-button/switch-button.constants.d.ts +5 -0
- package/dist/types/primitives/switch-button/switch-button.types.d.mts +19 -0
- package/dist/types/primitives/switch-button/switch-button.types.d.ts +19 -0
- package/dist/types/primitives/switch-button/switch-button.utils.d.mts +7 -0
- package/dist/types/primitives/switch-button/switch-button.utils.d.ts +7 -0
- package/dist/types/primitives/tabs/index.d.mts +7 -0
- package/dist/types/primitives/tabs/index.d.ts +7 -0
- package/dist/types/primitives/tabs/tabs.constants.d.mts +1 -0
- package/dist/types/primitives/tabs/tabs.constants.d.ts +1 -0
- package/dist/types/primitives/tabs/tabs.types.d.mts +36 -0
- package/dist/types/primitives/tabs/tabs.types.d.ts +36 -0
- package/dist/types/primitives/tabs/tabs.utils.d.mts +15 -0
- package/dist/types/primitives/tabs/tabs.utils.d.ts +15 -0
- package/dist/types/primitives/tooltip/index.d.mts +7 -0
- package/dist/types/primitives/tooltip/index.d.ts +7 -0
- package/dist/types/primitives/tooltip/tooltip.constants.d.mts +3 -0
- package/dist/types/primitives/tooltip/tooltip.constants.d.ts +3 -0
- package/dist/types/primitives/tooltip/tooltip.types.d.mts +27 -0
- package/dist/types/primitives/tooltip/tooltip.types.d.ts +27 -0
- package/dist/types/primitives/tooltip/tooltip.utils.d.mts +7 -0
- package/dist/types/primitives/tooltip/tooltip.utils.d.ts +7 -0
- package/dist/types/primitives/typography/index.d.mts +8 -0
- package/dist/types/primitives/typography/index.d.ts +8 -0
- package/dist/types/primitives/typography/typography.constants.d.mts +3 -0
- package/dist/types/primitives/typography/typography.constants.d.ts +3 -0
- package/dist/types/primitives/typography/typography.types.d.mts +12 -0
- package/dist/types/primitives/typography/typography.types.d.ts +12 -0
- package/dist/types/primitives/typography/typography.utils.d.mts +6 -0
- package/dist/types/primitives/typography/typography.utils.d.ts +6 -0
- package/dist/types/primitives/venue-logo/index.d.mts +9 -0
- package/dist/types/primitives/venue-logo/index.d.ts +9 -0
- package/dist/types/primitives/venue-logo/logo-props.d.mts +10 -0
- package/dist/types/primitives/venue-logo/logo-props.d.ts +10 -0
- package/dist/types/primitives/venue-logo/svg/default-venue.d.mts +2 -0
- package/dist/types/primitives/venue-logo/svg/default-venue.d.ts +2 -0
- package/dist/types/primitives/venue-logo/svg/logo-hyperliquid.d.mts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-hyperliquid.d.ts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-kalshi.d.mts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-kalshi.d.ts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-limitless.d.mts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-limitless.d.ts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-myriad.d.mts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-myriad.d.ts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-opinion.d.mts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-opinion.d.ts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-polymarket.d.mts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-polymarket.d.ts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-predict.d.mts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-predict.d.ts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-probable.d.mts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-probable.d.ts +5 -0
- package/dist/types/primitives/venue-logo/venue-logo.constants.d.mts +17 -0
- package/dist/types/primitives/venue-logo/venue-logo.constants.d.ts +17 -0
- package/dist/types/primitives/venue-logo/venue-logo.types.d.mts +24 -0
- package/dist/types/primitives/venue-logo/venue-logo.types.d.ts +24 -0
- package/dist/types/primitives/venue-logo/venue-logo.utils.d.mts +13 -0
- package/dist/types/primitives/venue-logo/venue-logo.utils.d.ts +13 -0
- package/dist/types/profile/index.d.mts +6 -0
- package/dist/types/profile/index.d.ts +6 -0
- package/dist/types/profile/profile-modal.constants.d.mts +17 -0
- package/dist/types/profile/profile-modal.constants.d.ts +17 -0
- package/dist/types/profile/profile-modal.types.d.mts +84 -0
- package/dist/types/profile/profile-modal.types.d.ts +84 -0
- package/dist/types/profile/tabs/about-tab.d.mts +18 -0
- package/dist/types/profile/tabs/about-tab.d.ts +18 -0
- package/dist/types/profile/tabs/accounts-wallets-tab.d.mts +33 -0
- package/dist/types/profile/tabs/accounts-wallets-tab.d.ts +33 -0
- package/dist/types/shared/constants.d.mts +33 -0
- package/dist/types/shared/constants.d.ts +33 -0
- package/dist/types/shared/deposit-modal-events.d.mts +4 -0
- package/dist/types/shared/deposit-modal-events.d.ts +4 -0
- package/dist/types/shared/query-error.d.mts +2 -0
- package/dist/types/shared/query-error.d.ts +2 -0
- package/dist/types/shared/types.d.mts +1 -0
- package/dist/types/shared/types.d.ts +1 -0
- package/dist/types/shared/utils.d.mts +15 -0
- package/dist/types/shared/utils.d.ts +15 -0
- package/dist/types/trading/index.d.mts +7 -0
- package/dist/types/trading/index.d.ts +7 -0
- package/dist/types/trading/place-order/index.d.mts +10 -0
- package/dist/types/trading/place-order/index.d.ts +10 -0
- package/dist/types/trading/place-order/index.place-order.constants.d.mts +18 -0
- package/dist/types/trading/place-order/index.place-order.constants.d.ts +18 -0
- package/dist/types/trading/place-order/index.place-order.failure.d.mts +14 -0
- package/dist/types/trading/place-order/index.place-order.failure.d.ts +14 -0
- package/dist/types/trading/place-order/index.place-order.success.d.mts +12 -0
- package/dist/types/trading/place-order/index.place-order.success.d.ts +12 -0
- package/dist/types/trading/place-order/index.place-order.types.d.mts +192 -0
- package/dist/types/trading/place-order/index.place-order.types.d.ts +192 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +100 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +100 -0
- package/dist/types/trading/settlement/index.d.mts +12 -0
- package/dist/types/trading/settlement/index.d.ts +12 -0
- package/dist/types/trading/settlement/settlement-details.d.mts +8 -0
- package/dist/types/trading/settlement/settlement-details.d.ts +8 -0
- package/dist/types/trading/settlement/settlement-details.utils.d.mts +7 -0
- package/dist/types/trading/settlement/settlement-details.utils.d.ts +7 -0
- package/dist/types/trading/trading-context/index.d.mts +2 -0
- package/dist/types/trading/trading-context/index.d.ts +2 -0
- package/dist/types/trading/types.d.mts +82 -0
- package/dist/types/trading/types.d.ts +82 -0
- package/dist/types/trading/use-kalshi-kyc-flow.d.mts +22 -0
- package/dist/types/trading/use-kalshi-kyc-flow.d.ts +22 -0
- package/dist/types/trading/utils.d.mts +16 -0
- package/dist/types/trading/utils.d.ts +16 -0
- package/dist/types/withdraw/index.d.mts +6 -0
- package/dist/types/withdraw/index.d.ts +6 -0
- package/dist/types/withdraw/steps/withdraw-amount.d.mts +17 -0
- package/dist/types/withdraw/steps/withdraw-amount.d.ts +17 -0
- package/dist/types/withdraw/steps/withdraw-method.d.mts +6 -0
- package/dist/types/withdraw/steps/withdraw-method.d.ts +6 -0
- package/dist/types/withdraw/steps/withdraw-provider.d.mts +10 -0
- package/dist/types/withdraw/steps/withdraw-provider.d.ts +10 -0
- package/dist/types/withdraw/steps/withdraw-success.d.mts +7 -0
- package/dist/types/withdraw/steps/withdraw-success.d.ts +7 -0
- package/dist/types/withdraw/withdraw-modal.constants.d.mts +5 -0
- package/dist/types/withdraw/withdraw-modal.constants.d.ts +5 -0
- package/dist/types/withdraw/withdraw-modal.types.d.mts +64 -0
- package/dist/types/withdraw/withdraw-modal.types.d.ts +64 -0
- package/package.json +128 -0
|
@@ -0,0 +1,3415 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
EventList,
|
|
4
|
+
EventListItem,
|
|
5
|
+
EventListItemDetails,
|
|
6
|
+
EventListTabs,
|
|
7
|
+
MarketDetails,
|
|
8
|
+
MarketDetailsList,
|
|
9
|
+
isErrorWithStatus,
|
|
10
|
+
useEventListTabs,
|
|
11
|
+
useEventListTabsHeaderOverflow
|
|
12
|
+
} from "./chunk-I2WBGEWK.mjs";
|
|
13
|
+
import {
|
|
14
|
+
DEPOSIT_MODAL_OPEN_EVENT,
|
|
15
|
+
PlaceOrder,
|
|
16
|
+
SettlementDetails,
|
|
17
|
+
WITHDRAW_MODAL_OPEN_EVENT
|
|
18
|
+
} from "./chunk-CGNDMLQL.mjs";
|
|
19
|
+
import {
|
|
20
|
+
AggErrorBoundary,
|
|
21
|
+
Button,
|
|
22
|
+
CloseIcon,
|
|
23
|
+
DEFAULT_EVENTS_LIMIT,
|
|
24
|
+
Header,
|
|
25
|
+
Icon,
|
|
26
|
+
LoadingIcon,
|
|
27
|
+
Modal,
|
|
28
|
+
RemoteImage,
|
|
29
|
+
Search,
|
|
30
|
+
SearchEmptyIcon,
|
|
31
|
+
Skeleton,
|
|
32
|
+
StateMessage,
|
|
33
|
+
Tabs,
|
|
34
|
+
Tooltip,
|
|
35
|
+
Typography,
|
|
36
|
+
VenueLogo,
|
|
37
|
+
__async,
|
|
38
|
+
__objRest,
|
|
39
|
+
__pow,
|
|
40
|
+
__restKey,
|
|
41
|
+
__spreadProps,
|
|
42
|
+
__spreadValues,
|
|
43
|
+
cn,
|
|
44
|
+
filterOpenEvents,
|
|
45
|
+
resolveTabVenus,
|
|
46
|
+
venueLogoNames
|
|
47
|
+
} from "./chunk-6NS7D73S.mjs";
|
|
48
|
+
|
|
49
|
+
// src/pages/home/index.tsx
|
|
50
|
+
import {
|
|
51
|
+
useAppConfig,
|
|
52
|
+
useCategories,
|
|
53
|
+
useEventListState,
|
|
54
|
+
useLabels as useLabels2,
|
|
55
|
+
useSdkUiConfig,
|
|
56
|
+
useSearch
|
|
57
|
+
} from "@agg-build/hooks";
|
|
58
|
+
import { VENUES } from "@agg-build/sdk";
|
|
59
|
+
import { useCallback as useCallback2, useEffect as useEffect2, useMemo, useRef as useRef2, useState as useState4 } from "react";
|
|
60
|
+
|
|
61
|
+
// src/pages/event-market/index.tsx
|
|
62
|
+
import {
|
|
63
|
+
resolveEventTradingState,
|
|
64
|
+
resolveMarketTradingState,
|
|
65
|
+
useEnrichedVenueEvent,
|
|
66
|
+
useEventTradingContext,
|
|
67
|
+
useLabels
|
|
68
|
+
} from "@agg-build/hooks";
|
|
69
|
+
import * as Dialog from "@radix-ui/react-dialog";
|
|
70
|
+
import { useState } from "react";
|
|
71
|
+
|
|
72
|
+
// src/pages/event-market/event-market.utils.ts
|
|
73
|
+
var EVENT_MARKET_PAGE_STICKY_HEADER_OFFSET_PX = 48;
|
|
74
|
+
var EVENT_MARKET_PAGE_STICKY_SPACING_PX = 32;
|
|
75
|
+
var EVENT_MARKET_PAGE_STICKY_TOP_PX = EVENT_MARKET_PAGE_STICKY_HEADER_OFFSET_PX + EVENT_MARKET_PAGE_STICKY_SPACING_PX;
|
|
76
|
+
var EVENT_MARKET_PAGE_STICKY_TOP_CSS_VAR = "--agg-event-market-sidebar-top";
|
|
77
|
+
var EVENT_MARKET_PAGE_STICKY_SPACING_CSS_VAR = "--agg-event-market-sidebar-spacing";
|
|
78
|
+
var toCssLength = (value, fallback) => {
|
|
79
|
+
if (typeof value === "number") {
|
|
80
|
+
return `${value}px`;
|
|
81
|
+
}
|
|
82
|
+
return value != null ? value : `${fallback}px`;
|
|
83
|
+
};
|
|
84
|
+
var deriveSpacingFromTop = (top) => {
|
|
85
|
+
if (typeof top !== "number") {
|
|
86
|
+
return void 0;
|
|
87
|
+
}
|
|
88
|
+
return Math.max(top - EVENT_MARKET_PAGE_STICKY_HEADER_OFFSET_PX, 0);
|
|
89
|
+
};
|
|
90
|
+
var resolveEventMarketPageStickyState = ({
|
|
91
|
+
stickyOrderPanel
|
|
92
|
+
}) => {
|
|
93
|
+
var _a, _b;
|
|
94
|
+
const isEnabled = (_a = stickyOrderPanel == null ? void 0 : stickyOrderPanel.enabled) != null ? _a : Boolean(stickyOrderPanel);
|
|
95
|
+
if (!isEnabled) {
|
|
96
|
+
return {
|
|
97
|
+
contentClassName: cn(),
|
|
98
|
+
sidebarClassName: cn("py-4 sm:py-6 md:py-8"),
|
|
99
|
+
placeOrder: "",
|
|
100
|
+
mainClassName: cn("py-4 sm:py-6 md:py-8"),
|
|
101
|
+
style: {}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
contentClassName: cn("lg:items-stretch!"),
|
|
106
|
+
sidebarClassName: cn(
|
|
107
|
+
"py-4 sm:py-6 md:py-8",
|
|
108
|
+
"lg:self-start lg:sticky lg:top-[var(--agg-event-market-sidebar-top)] lg:max-h-[calc(100dvh-var(--agg-event-market-sidebar-top))] lg:overflow-y-auto lg:overscroll-contain",
|
|
109
|
+
stickyOrderPanel == null ? void 0 : stickyOrderPanel.className
|
|
110
|
+
),
|
|
111
|
+
placeOrder: "",
|
|
112
|
+
mainClassName: cn("py-4 sm:py-6 md:py-8"),
|
|
113
|
+
style: {
|
|
114
|
+
[EVENT_MARKET_PAGE_STICKY_TOP_CSS_VAR]: toCssLength(
|
|
115
|
+
stickyOrderPanel == null ? void 0 : stickyOrderPanel.top,
|
|
116
|
+
EVENT_MARKET_PAGE_STICKY_TOP_PX
|
|
117
|
+
),
|
|
118
|
+
[EVENT_MARKET_PAGE_STICKY_SPACING_CSS_VAR]: toCssLength(
|
|
119
|
+
(_b = stickyOrderPanel == null ? void 0 : stickyOrderPanel.spacing) != null ? _b : deriveSpacingFromTop(stickyOrderPanel == null ? void 0 : stickyOrderPanel.top),
|
|
120
|
+
EVENT_MARKET_PAGE_STICKY_SPACING_PX
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// src/pages/event-market/index.tsx
|
|
127
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
128
|
+
var resolveDesktopTradePlaceOrderClassNames = (classNames) => {
|
|
129
|
+
const resolvedClassNames = {
|
|
130
|
+
body: classNames == null ? void 0 : classNames.tradeBody,
|
|
131
|
+
content: classNames == null ? void 0 : classNames.tradeContent,
|
|
132
|
+
footer: classNames == null ? void 0 : classNames.tradeFooter,
|
|
133
|
+
header: classNames == null ? void 0 : classNames.tradeHeader
|
|
134
|
+
};
|
|
135
|
+
if (!Object.values(resolvedClassNames).some(Boolean)) {
|
|
136
|
+
return void 0;
|
|
137
|
+
}
|
|
138
|
+
return resolvedClassNames;
|
|
139
|
+
};
|
|
140
|
+
var resolveMobileTradePlaceOrderClassNames = (classNames) => {
|
|
141
|
+
return {
|
|
142
|
+
root: "rounded-t-agg-2xl rounded-b-none md:rounded-agg-2xl md:rounded-b-agg-2xl",
|
|
143
|
+
body: cn("flex h-full min-h-0 flex-col", classNames == null ? void 0 : classNames.tradeBody, classNames == null ? void 0 : classNames.mobileTradeBody),
|
|
144
|
+
content: cn(
|
|
145
|
+
"min-h-0 flex-1 overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
146
|
+
classNames == null ? void 0 : classNames.tradeContent,
|
|
147
|
+
classNames == null ? void 0 : classNames.mobileTradeContent
|
|
148
|
+
),
|
|
149
|
+
footer: cn(classNames == null ? void 0 : classNames.tradeFooter, classNames == null ? void 0 : classNames.mobileTradeFooter),
|
|
150
|
+
header: cn(
|
|
151
|
+
"sticky top-0 z-10 bg-agg-secondary",
|
|
152
|
+
classNames == null ? void 0 : classNames.tradeHeader,
|
|
153
|
+
classNames == null ? void 0 : classNames.mobileTradeHeader
|
|
154
|
+
)
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
var EventMarketPageMobileTrade = ({
|
|
158
|
+
classNames,
|
|
159
|
+
eventTradingState,
|
|
160
|
+
showPlaceOrder = true,
|
|
161
|
+
resolvedClaim
|
|
162
|
+
}) => {
|
|
163
|
+
var _a;
|
|
164
|
+
const labels = useLabels();
|
|
165
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
166
|
+
const tradingContext = useEventTradingContext();
|
|
167
|
+
const selectedMarketState = resolveMarketTradingState((_a = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _a : null);
|
|
168
|
+
if (!showPlaceOrder) {
|
|
169
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
170
|
+
}
|
|
171
|
+
if (eventTradingState.isTradingDisabled || selectedMarketState.isTradingDisabled) {
|
|
172
|
+
return /* @__PURE__ */ jsx("div", { className: "agg-mobile-trade-readonly lg:hidden", children: /* @__PURE__ */ jsx(
|
|
173
|
+
PlaceOrder,
|
|
174
|
+
{
|
|
175
|
+
eventTradingState,
|
|
176
|
+
resolvedClaim,
|
|
177
|
+
className: cn("agg-mobile-trade-panel w-full overflow-hidden", classNames == null ? void 0 : classNames.mobileTrade),
|
|
178
|
+
classNames: resolveMobileTradePlaceOrderClassNames(classNames)
|
|
179
|
+
}
|
|
180
|
+
) });
|
|
181
|
+
}
|
|
182
|
+
const handleOpen = () => {
|
|
183
|
+
setIsOpen(true);
|
|
184
|
+
};
|
|
185
|
+
const handleOpenChange = (nextOpen) => {
|
|
186
|
+
setIsOpen(nextOpen);
|
|
187
|
+
};
|
|
188
|
+
const handleClose = () => {
|
|
189
|
+
setIsOpen(false);
|
|
190
|
+
};
|
|
191
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
192
|
+
/* @__PURE__ */ jsx(
|
|
193
|
+
"div",
|
|
194
|
+
{
|
|
195
|
+
className: cn(
|
|
196
|
+
"agg-mobile-trade-cta",
|
|
197
|
+
"fixed inset-x-0 bottom-0 z-100 flex justify-end p-4 lg:hidden",
|
|
198
|
+
classNames == null ? void 0 : classNames.mobileTradeCta
|
|
199
|
+
),
|
|
200
|
+
children: /* @__PURE__ */ jsx(
|
|
201
|
+
Button,
|
|
202
|
+
{
|
|
203
|
+
size: "large",
|
|
204
|
+
className: "agg-mobile-trade-trigger min-w-[168px] shadow-agg-modal",
|
|
205
|
+
"aria-label": labels.trading.confirmOrder,
|
|
206
|
+
onClick: (e) => {
|
|
207
|
+
e.stopPropagation();
|
|
208
|
+
e.preventDefault();
|
|
209
|
+
handleOpen();
|
|
210
|
+
},
|
|
211
|
+
children: labels.trading.confirmOrder
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
}
|
|
215
|
+
),
|
|
216
|
+
/* @__PURE__ */ jsx(Modal, { open: isOpen, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs(
|
|
217
|
+
Modal.Container,
|
|
218
|
+
{
|
|
219
|
+
classNames: {
|
|
220
|
+
content: "items-end p-0 sm:items-center sm:p-4",
|
|
221
|
+
container: cn(
|
|
222
|
+
"agg-mobile-trade-modal",
|
|
223
|
+
"w-full border-0 bg-transparent shadow-none",
|
|
224
|
+
classNames == null ? void 0 : classNames.mobileTradeModal
|
|
225
|
+
)
|
|
226
|
+
},
|
|
227
|
+
children: [
|
|
228
|
+
/* @__PURE__ */ jsx(Dialog.Title, { className: "sr-only", children: labels.trading.confirmOrder }),
|
|
229
|
+
/* @__PURE__ */ jsx(Dialog.Description, { className: "sr-only", children: labels.trading.disclaimer }),
|
|
230
|
+
/* @__PURE__ */ jsx("div", { className: "agg-mobile-trade-handle relative flex w-full flex-col items-center sm:hidden", children: /* @__PURE__ */ jsx(
|
|
231
|
+
"button",
|
|
232
|
+
{
|
|
233
|
+
type: "button",
|
|
234
|
+
className: "absolute right-3 top-4 z-100 flex cursor-pointer items-center justify-center rounded-full p-1 text-agg-muted-foreground hover:text-agg-foreground",
|
|
235
|
+
"aria-label": labels.common.close,
|
|
236
|
+
onClick: handleClose,
|
|
237
|
+
children: /* @__PURE__ */ jsx(CloseIcon, { className: "h-5 w-5" })
|
|
238
|
+
}
|
|
239
|
+
) }),
|
|
240
|
+
/* @__PURE__ */ jsx(
|
|
241
|
+
PlaceOrder,
|
|
242
|
+
{
|
|
243
|
+
eventTradingState,
|
|
244
|
+
className: cn(
|
|
245
|
+
"agg-mobile-trade-panel w-full overflow-hidden rounded-t-agg-2xl sm:rounded-agg-xl",
|
|
246
|
+
classNames == null ? void 0 : classNames.mobileTrade
|
|
247
|
+
),
|
|
248
|
+
classNames: resolveMobileTradePlaceOrderClassNames(classNames),
|
|
249
|
+
onClose: handleClose
|
|
250
|
+
}
|
|
251
|
+
)
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
) })
|
|
255
|
+
] });
|
|
256
|
+
};
|
|
257
|
+
var EventMarketPageUnavailableState = ({
|
|
258
|
+
ariaLabel: _ariaLabel
|
|
259
|
+
}) => {
|
|
260
|
+
const labels = useLabels();
|
|
261
|
+
return /* @__PURE__ */ jsx(
|
|
262
|
+
StateMessage,
|
|
263
|
+
{
|
|
264
|
+
title: labels.eventMarketPage.unavailableTitle,
|
|
265
|
+
description: labels.eventMarketPage.unavailableDescription,
|
|
266
|
+
icon: /* @__PURE__ */ jsx(Icon, { name: "quotes-warning", className: "h-12 w-12" }),
|
|
267
|
+
classNames: {
|
|
268
|
+
root: "min-h-[calc(100vh-5rem)]!"
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
);
|
|
272
|
+
};
|
|
273
|
+
var EventMarketPageNotFoundState = ({
|
|
274
|
+
ariaLabel: _ariaLabel
|
|
275
|
+
}) => {
|
|
276
|
+
const labels = useLabels();
|
|
277
|
+
return /* @__PURE__ */ jsx(
|
|
278
|
+
StateMessage,
|
|
279
|
+
{
|
|
280
|
+
title: labels.eventItemDetails.notFoundTitle,
|
|
281
|
+
description: labels.eventItemDetails.notFoundDescription,
|
|
282
|
+
icon: /* @__PURE__ */ jsx(SearchEmptyIcon, {}),
|
|
283
|
+
classNames: { root: "min-h-[320px] md:min-h-[360px]" }
|
|
284
|
+
}
|
|
285
|
+
);
|
|
286
|
+
};
|
|
287
|
+
var EventMarketPageLoadingState = ({
|
|
288
|
+
settlement: _settlement,
|
|
289
|
+
classNames,
|
|
290
|
+
stickyOrderPanel
|
|
291
|
+
}) => {
|
|
292
|
+
const stickyOrderPanelState = resolveEventMarketPageStickyState({
|
|
293
|
+
stickyOrderPanel
|
|
294
|
+
});
|
|
295
|
+
return /* @__PURE__ */ jsx(
|
|
296
|
+
"section",
|
|
297
|
+
{
|
|
298
|
+
className: cn(
|
|
299
|
+
"agg-event-market-page",
|
|
300
|
+
"w-full mx-auto max-w-[1360px] px-6 lg:px-10 pb-10",
|
|
301
|
+
classNames == null ? void 0 : classNames.root
|
|
302
|
+
),
|
|
303
|
+
children: /* @__PURE__ */ jsxs(
|
|
304
|
+
"div",
|
|
305
|
+
{
|
|
306
|
+
className: cn(
|
|
307
|
+
"agg-page-content",
|
|
308
|
+
"flex w-full flex-col gap-6 lg:flex-row lg:items-start lg:gap-8",
|
|
309
|
+
stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.contentClassName,
|
|
310
|
+
classNames == null ? void 0 : classNames.content
|
|
311
|
+
),
|
|
312
|
+
style: stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.style,
|
|
313
|
+
children: [
|
|
314
|
+
/* @__PURE__ */ jsxs(
|
|
315
|
+
"div",
|
|
316
|
+
{
|
|
317
|
+
className: cn(
|
|
318
|
+
"agg-page-main flex min-w-0 flex-1 flex-col gap-6 pb-10",
|
|
319
|
+
stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.mainClassName,
|
|
320
|
+
classNames == null ? void 0 : classNames.main
|
|
321
|
+
),
|
|
322
|
+
children: [
|
|
323
|
+
/* @__PURE__ */ jsx(
|
|
324
|
+
EventListItemDetails,
|
|
325
|
+
{
|
|
326
|
+
isLoading: true,
|
|
327
|
+
classNames: {
|
|
328
|
+
root: cn("agg-event-hero", classNames == null ? void 0 : classNames.hero)
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
),
|
|
332
|
+
/* @__PURE__ */ jsxs("div", { className: cn("agg-market-list flex flex-col gap-3", classNames == null ? void 0 : classNames.markets), children: [
|
|
333
|
+
/* @__PURE__ */ jsx(MarketDetails, { isLoading: true, isOpened: true, classNames: { root: "w-full" } }),
|
|
334
|
+
/* @__PURE__ */ jsx(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } }),
|
|
335
|
+
/* @__PURE__ */ jsx(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } })
|
|
336
|
+
] })
|
|
337
|
+
]
|
|
338
|
+
}
|
|
339
|
+
),
|
|
340
|
+
/* @__PURE__ */ jsx(
|
|
341
|
+
"aside",
|
|
342
|
+
{
|
|
343
|
+
className: cn(
|
|
344
|
+
"agg-sidebar",
|
|
345
|
+
"hidden w-full shrink-0 lg:block lg:w-[343px] lg:shrink-0",
|
|
346
|
+
stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.sidebarClassName,
|
|
347
|
+
classNames == null ? void 0 : classNames.sidebar
|
|
348
|
+
),
|
|
349
|
+
children: /* @__PURE__ */ jsx(
|
|
350
|
+
PlaceOrder,
|
|
351
|
+
{
|
|
352
|
+
isLoading: true,
|
|
353
|
+
className: cn(stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.placeOrder, classNames == null ? void 0 : classNames.trade),
|
|
354
|
+
classNames: resolveDesktopTradePlaceOrderClassNames(classNames)
|
|
355
|
+
}
|
|
356
|
+
)
|
|
357
|
+
}
|
|
358
|
+
)
|
|
359
|
+
]
|
|
360
|
+
}
|
|
361
|
+
)
|
|
362
|
+
}
|
|
363
|
+
);
|
|
364
|
+
};
|
|
365
|
+
var EventMarketPageContent = ({
|
|
366
|
+
event,
|
|
367
|
+
defaultMarketId,
|
|
368
|
+
defaultOutcomeId,
|
|
369
|
+
classNames,
|
|
370
|
+
ariaLabel,
|
|
371
|
+
showPlaceOrder,
|
|
372
|
+
stickyOrderPanel,
|
|
373
|
+
resolvedClaim
|
|
374
|
+
}) => {
|
|
375
|
+
const eventTradingState = resolveEventTradingState(event);
|
|
376
|
+
const stickyOrderPanelState = resolveEventMarketPageStickyState({
|
|
377
|
+
stickyOrderPanel
|
|
378
|
+
});
|
|
379
|
+
if (!event || !event.venueMarkets.length) {
|
|
380
|
+
return /* @__PURE__ */ jsx(EventMarketPageUnavailableState, { ariaLabel });
|
|
381
|
+
}
|
|
382
|
+
return /* @__PURE__ */ jsxs(
|
|
383
|
+
"section",
|
|
384
|
+
{
|
|
385
|
+
className: cn(
|
|
386
|
+
"agg-event-market-page",
|
|
387
|
+
"w-full mx-auto max-w-[1360px] px-6 lg:px-10 pb-10",
|
|
388
|
+
classNames == null ? void 0 : classNames.root
|
|
389
|
+
),
|
|
390
|
+
"aria-label": ariaLabel != null ? ariaLabel : event.title,
|
|
391
|
+
children: [
|
|
392
|
+
/* @__PURE__ */ jsxs(
|
|
393
|
+
"div",
|
|
394
|
+
{
|
|
395
|
+
className: cn(
|
|
396
|
+
"agg-page-content",
|
|
397
|
+
"flex w-full flex-col gap-6 lg:flex-row lg:items-start lg:gap-8",
|
|
398
|
+
stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.contentClassName,
|
|
399
|
+
classNames == null ? void 0 : classNames.content
|
|
400
|
+
),
|
|
401
|
+
style: stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.style,
|
|
402
|
+
children: [
|
|
403
|
+
/* @__PURE__ */ jsxs(
|
|
404
|
+
"div",
|
|
405
|
+
{
|
|
406
|
+
className: cn(
|
|
407
|
+
"agg-page-main flex min-w-0 flex-1 flex-col gap-6 pb-10",
|
|
408
|
+
stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.mainClassName,
|
|
409
|
+
classNames == null ? void 0 : classNames.main
|
|
410
|
+
),
|
|
411
|
+
children: [
|
|
412
|
+
/* @__PURE__ */ jsx(
|
|
413
|
+
EventListItemDetails,
|
|
414
|
+
{
|
|
415
|
+
event,
|
|
416
|
+
defaultMarketId,
|
|
417
|
+
defaultOutcomeId,
|
|
418
|
+
eventTradingState,
|
|
419
|
+
classNames: {
|
|
420
|
+
root: cn("agg-event-hero", classNames == null ? void 0 : classNames.hero)
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
),
|
|
424
|
+
/* @__PURE__ */ jsx(
|
|
425
|
+
MarketDetailsList,
|
|
426
|
+
{
|
|
427
|
+
eventId: event.id,
|
|
428
|
+
markets: eventTradingState.displayMarkets,
|
|
429
|
+
eventTradingState,
|
|
430
|
+
live: true,
|
|
431
|
+
classNames: { root: "agg-market-list", item: "agg-market-list-item" }
|
|
432
|
+
}
|
|
433
|
+
),
|
|
434
|
+
showPlaceOrder !== false && eventTradingState.isTradingDisabled ? /* @__PURE__ */ jsx("div", { className: "lg:hidden", children: /* @__PURE__ */ jsx(
|
|
435
|
+
PlaceOrder,
|
|
436
|
+
{
|
|
437
|
+
eventTradingState,
|
|
438
|
+
resolvedClaim,
|
|
439
|
+
className: cn(
|
|
440
|
+
"agg-mobile-trade-panel w-full overflow-hidden",
|
|
441
|
+
classNames == null ? void 0 : classNames.mobileTrade
|
|
442
|
+
),
|
|
443
|
+
classNames: resolveMobileTradePlaceOrderClassNames(classNames)
|
|
444
|
+
}
|
|
445
|
+
) }) : null,
|
|
446
|
+
/* @__PURE__ */ jsx(SettlementDetails, { eventId: event.id, className: classNames == null ? void 0 : classNames.settlement })
|
|
447
|
+
]
|
|
448
|
+
}
|
|
449
|
+
),
|
|
450
|
+
/* @__PURE__ */ jsx(
|
|
451
|
+
"aside",
|
|
452
|
+
{
|
|
453
|
+
className: cn(
|
|
454
|
+
"agg-sidebar hidden w-full lg:block lg:max-w-[360px] lg:shrink-0",
|
|
455
|
+
stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.sidebarClassName,
|
|
456
|
+
classNames == null ? void 0 : classNames.sidebar
|
|
457
|
+
),
|
|
458
|
+
children: showPlaceOrder !== false ? /* @__PURE__ */ jsx(
|
|
459
|
+
PlaceOrder,
|
|
460
|
+
{
|
|
461
|
+
eventTradingState,
|
|
462
|
+
resolvedClaim,
|
|
463
|
+
className: cn(stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.placeOrder, classNames == null ? void 0 : classNames.trade),
|
|
464
|
+
classNames: resolveDesktopTradePlaceOrderClassNames(classNames)
|
|
465
|
+
}
|
|
466
|
+
) : null
|
|
467
|
+
}
|
|
468
|
+
)
|
|
469
|
+
]
|
|
470
|
+
}
|
|
471
|
+
),
|
|
472
|
+
!eventTradingState.isTradingDisabled ? /* @__PURE__ */ jsx(
|
|
473
|
+
EventMarketPageMobileTrade,
|
|
474
|
+
{
|
|
475
|
+
classNames,
|
|
476
|
+
eventTradingState,
|
|
477
|
+
showPlaceOrder,
|
|
478
|
+
resolvedClaim
|
|
479
|
+
}
|
|
480
|
+
) : null
|
|
481
|
+
]
|
|
482
|
+
}
|
|
483
|
+
);
|
|
484
|
+
};
|
|
485
|
+
var EventMarketPage = (props) => {
|
|
486
|
+
var _a;
|
|
487
|
+
const hasEventProp = "event" in props && !!props.event;
|
|
488
|
+
const {
|
|
489
|
+
event: fetchedEvent,
|
|
490
|
+
error: eventError,
|
|
491
|
+
isLoading: isFetchingEvent
|
|
492
|
+
} = useEnrichedVenueEvent({
|
|
493
|
+
eventId: hasEventProp ? "" : (_a = props.eventId) != null ? _a : "",
|
|
494
|
+
enabled: !props.isLoading && !hasEventProp && !!props.eventId
|
|
495
|
+
});
|
|
496
|
+
const content = (() => {
|
|
497
|
+
if (props.isLoading) {
|
|
498
|
+
return /* @__PURE__ */ jsx(
|
|
499
|
+
EventMarketPageLoadingState,
|
|
500
|
+
{
|
|
501
|
+
settlement: props.settlement,
|
|
502
|
+
classNames: props.classNames,
|
|
503
|
+
stickyOrderPanel: props.stickyOrderPanel
|
|
504
|
+
}
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
if ("event" in props && props.event) {
|
|
508
|
+
return /* @__PURE__ */ jsx(EventMarketPageContent, __spreadProps(__spreadValues({}, props), { event: props.event }));
|
|
509
|
+
}
|
|
510
|
+
if (isFetchingEvent) {
|
|
511
|
+
return /* @__PURE__ */ jsx(
|
|
512
|
+
EventMarketPageLoadingState,
|
|
513
|
+
{
|
|
514
|
+
settlement: props.settlement,
|
|
515
|
+
classNames: props.classNames,
|
|
516
|
+
stickyOrderPanel: props.stickyOrderPanel
|
|
517
|
+
}
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
if (!fetchedEvent) {
|
|
521
|
+
if (isErrorWithStatus(eventError, 404)) {
|
|
522
|
+
return /* @__PURE__ */ jsx(EventMarketPageNotFoundState, { ariaLabel: props.ariaLabel });
|
|
523
|
+
}
|
|
524
|
+
return /* @__PURE__ */ jsx(EventMarketPageUnavailableState, { ariaLabel: props.ariaLabel });
|
|
525
|
+
}
|
|
526
|
+
return /* @__PURE__ */ jsx(EventMarketPageContent, __spreadProps(__spreadValues({}, props), { event: fetchedEvent }));
|
|
527
|
+
})();
|
|
528
|
+
return /* @__PURE__ */ jsx(AggErrorBoundary, { onError: props.onError, children: content });
|
|
529
|
+
};
|
|
530
|
+
EventMarketPage.displayName = "EventMarketPage";
|
|
531
|
+
|
|
532
|
+
// src/pages/home/home.constants.ts
|
|
533
|
+
var ALL_CATEGORIES_TAB_VALUE = "trending";
|
|
534
|
+
var DEFAULT_CATEGORIES_LIMIT = 100;
|
|
535
|
+
var DEFAULT_ALL_CATEGORY_TAB_LABEL = "Trending";
|
|
536
|
+
var getDefaultEventSectionItems = (labels) => {
|
|
537
|
+
return [
|
|
538
|
+
{
|
|
539
|
+
id: "top-markets",
|
|
540
|
+
title: labels.home.topMarkets,
|
|
541
|
+
limit: DEFAULT_EVENTS_LIMIT
|
|
542
|
+
}
|
|
543
|
+
];
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
// src/pages/home/home.utils.ts
|
|
547
|
+
var resolveCategoryTabs = (categories, allCategoryTabLabel) => {
|
|
548
|
+
const seenCategoryIds = /* @__PURE__ */ new Set();
|
|
549
|
+
const tabs = [
|
|
550
|
+
{
|
|
551
|
+
value: ALL_CATEGORIES_TAB_VALUE,
|
|
552
|
+
label: allCategoryTabLabel,
|
|
553
|
+
iconName: "arrow-trend-up"
|
|
554
|
+
}
|
|
555
|
+
];
|
|
556
|
+
const categoryTabs = [];
|
|
557
|
+
for (const category of categories) {
|
|
558
|
+
if (seenCategoryIds.has(category.id)) continue;
|
|
559
|
+
seenCategoryIds.add(category.id);
|
|
560
|
+
categoryTabs.push({
|
|
561
|
+
value: category.id,
|
|
562
|
+
label: category.name.trim().toLowerCase(),
|
|
563
|
+
categoryIds: [category.id]
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
categoryTabs.sort((a, b) => {
|
|
567
|
+
const aIsOther = a.label === "other" ? 1 : 0;
|
|
568
|
+
const bIsOther = b.label === "other" ? 1 : 0;
|
|
569
|
+
return aIsOther - bIsOther;
|
|
570
|
+
});
|
|
571
|
+
return [...tabs, ...categoryTabs];
|
|
572
|
+
};
|
|
573
|
+
var resolveInitialTabValue = (tabs, defaultActiveTab) => {
|
|
574
|
+
var _a, _b;
|
|
575
|
+
if (defaultActiveTab) {
|
|
576
|
+
const hasDefaultTab = tabs.some((tab) => tab.value === defaultActiveTab);
|
|
577
|
+
if (hasDefaultTab) return defaultActiveTab;
|
|
578
|
+
}
|
|
579
|
+
return (_b = (_a = tabs[0]) == null ? void 0 : _a.value) != null ? _b : ALL_CATEGORIES_TAB_VALUE;
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
// src/pages/home/use-scroll-restoration.ts
|
|
583
|
+
import { useLayoutEffect, useRef, useState as useState2 } from "react";
|
|
584
|
+
function useScrollRestoration({
|
|
585
|
+
enabled,
|
|
586
|
+
scrollY,
|
|
587
|
+
isReady
|
|
588
|
+
}) {
|
|
589
|
+
const restoredRef = useRef(false);
|
|
590
|
+
const [isRestoring, setIsRestoring] = useState2(enabled && scrollY > 0);
|
|
591
|
+
useLayoutEffect(() => {
|
|
592
|
+
if (!enabled || restoredRef.current) return;
|
|
593
|
+
if (!isReady) return;
|
|
594
|
+
restoredRef.current = true;
|
|
595
|
+
window.scrollTo(0, scrollY);
|
|
596
|
+
requestAnimationFrame(() => {
|
|
597
|
+
setIsRestoring(false);
|
|
598
|
+
});
|
|
599
|
+
}, [enabled, isReady, scrollY]);
|
|
600
|
+
return { isRestoring };
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
// src/pages/home/use-home-page-modals.ts
|
|
604
|
+
import { useCallback, useEffect, useState as useState3 } from "react";
|
|
605
|
+
var useHomePageModals = () => {
|
|
606
|
+
const [profileOpen, setProfileOpen] = useState3(false);
|
|
607
|
+
const [depositOpen, setDepositOpen] = useState3(false);
|
|
608
|
+
const [withdrawOpen, setWithdrawOpen] = useState3(false);
|
|
609
|
+
const onProfileClick = useCallback(() => setProfileOpen(true), []);
|
|
610
|
+
const onDepositClick = useCallback(() => setDepositOpen(true), []);
|
|
611
|
+
const onWithdrawClick = useCallback(() => setWithdrawOpen(true), []);
|
|
612
|
+
useEffect(() => {
|
|
613
|
+
if (typeof window === "undefined") return;
|
|
614
|
+
window.addEventListener(DEPOSIT_MODAL_OPEN_EVENT, onDepositClick);
|
|
615
|
+
window.addEventListener(WITHDRAW_MODAL_OPEN_EVENT, onWithdrawClick);
|
|
616
|
+
return () => {
|
|
617
|
+
window.removeEventListener(DEPOSIT_MODAL_OPEN_EVENT, onDepositClick);
|
|
618
|
+
window.removeEventListener(WITHDRAW_MODAL_OPEN_EVENT, onWithdrawClick);
|
|
619
|
+
};
|
|
620
|
+
}, [onDepositClick, onWithdrawClick]);
|
|
621
|
+
return {
|
|
622
|
+
profileModal: { open: profileOpen, onOpenChange: setProfileOpen },
|
|
623
|
+
depositModal: { open: depositOpen, onOpenChange: setDepositOpen },
|
|
624
|
+
withdrawModal: { open: withdrawOpen, onOpenChange: setWithdrawOpen },
|
|
625
|
+
connectButtonHandlers: {
|
|
626
|
+
onProfileClick,
|
|
627
|
+
onDepositClick,
|
|
628
|
+
onWithdrawClick
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
// src/pages/home/index.tsx
|
|
634
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
635
|
+
var MIN_SEARCH_LENGTH = 3;
|
|
636
|
+
var SEARCH_DEBOUNCE_MS = 300;
|
|
637
|
+
var SEARCH_RESULTS_LIMIT = 20;
|
|
638
|
+
var MOBILE_HOME_SEARCH_MEDIA_QUERY = "(max-width: 767px)";
|
|
639
|
+
var HomeSearchResults = ({
|
|
640
|
+
activeTabValue,
|
|
641
|
+
query,
|
|
642
|
+
resolvedTabs,
|
|
643
|
+
getEventHref,
|
|
644
|
+
getMarketHref,
|
|
645
|
+
className,
|
|
646
|
+
onEventClick,
|
|
647
|
+
onMarketClick
|
|
648
|
+
}) => {
|
|
649
|
+
const labels = useLabels2();
|
|
650
|
+
const { search: searchConfig } = useSdkUiConfig();
|
|
651
|
+
const { disabledVenues } = useAppConfig();
|
|
652
|
+
const [activeVenueTabValue, setActiveVenueTabValue] = useState4("matched");
|
|
653
|
+
const eventListTabs = useEventListTabs();
|
|
654
|
+
const { headerRef, titleRef, shouldUseSelectOverflow } = useEventListTabsHeaderOverflow(eventListTabs);
|
|
655
|
+
const visibleVenues = useMemo(
|
|
656
|
+
() => disabledVenues.length === 0 ? void 0 : VENUES.filter(
|
|
657
|
+
(v) => !disabledVenues.includes(v)
|
|
658
|
+
),
|
|
659
|
+
[disabledVenues]
|
|
660
|
+
);
|
|
661
|
+
const activeVenueTab = useMemo(() => {
|
|
662
|
+
return eventListTabs.find((tab) => tab.value === activeVenueTabValue);
|
|
663
|
+
}, [activeVenueTabValue, eventListTabs]);
|
|
664
|
+
const activeCategoryTab = useMemo(() => {
|
|
665
|
+
return resolvedTabs.find((tab) => tab.value === activeTabValue);
|
|
666
|
+
}, [activeTabValue, resolvedTabs]);
|
|
667
|
+
const activeVenues = resolveTabVenus(activeVenueTab, visibleVenues);
|
|
668
|
+
const {
|
|
669
|
+
data: searchResults,
|
|
670
|
+
isLoading,
|
|
671
|
+
isError,
|
|
672
|
+
fetchNextPage,
|
|
673
|
+
hasNextPage,
|
|
674
|
+
isFetchingNextPage,
|
|
675
|
+
isPlaceholderData
|
|
676
|
+
} = useSearch({
|
|
677
|
+
q: query,
|
|
678
|
+
type: "events",
|
|
679
|
+
categoryIds: activeTabValue === ALL_CATEGORIES_TAB_VALUE ? void 0 : activeCategoryTab == null ? void 0 : activeCategoryTab.categoryIds,
|
|
680
|
+
limit: SEARCH_RESULTS_LIMIT
|
|
681
|
+
});
|
|
682
|
+
const openEvents = useMemo(() => {
|
|
683
|
+
let filtered = filterOpenEvents(searchResults);
|
|
684
|
+
if (activeVenues == null ? void 0 : activeVenues.length) {
|
|
685
|
+
filtered = filtered.filter((e) => activeVenues.includes(e.venue));
|
|
686
|
+
}
|
|
687
|
+
return filtered;
|
|
688
|
+
}, [searchResults, activeVenues]);
|
|
689
|
+
const loadMoreRef = useRef2(null);
|
|
690
|
+
useEffect2(() => {
|
|
691
|
+
if (!hasNextPage) return;
|
|
692
|
+
const target = loadMoreRef.current;
|
|
693
|
+
if (!target) return;
|
|
694
|
+
const observer = new IntersectionObserver(
|
|
695
|
+
(entries) => {
|
|
696
|
+
const entry = entries[0];
|
|
697
|
+
if (!(entry == null ? void 0 : entry.isIntersecting)) return;
|
|
698
|
+
if (isLoading || isFetchingNextPage || !hasNextPage) return;
|
|
699
|
+
void fetchNextPage();
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
rootMargin: "320px 0px"
|
|
703
|
+
}
|
|
704
|
+
);
|
|
705
|
+
observer.observe(target);
|
|
706
|
+
return () => {
|
|
707
|
+
observer.disconnect();
|
|
708
|
+
};
|
|
709
|
+
}, [fetchNextPage, hasNextPage, isFetchingNextPage, isLoading]);
|
|
710
|
+
const resultsTitle = labels.search.resultsSummary(
|
|
711
|
+
hasNextPage ? `${openEvents.length}+` : `${openEvents.length}`,
|
|
712
|
+
query
|
|
713
|
+
);
|
|
714
|
+
const loadingPlaceholderCount = isFetchingNextPage ? 6 : 0;
|
|
715
|
+
const shouldRenderPaginationLoadingItems = hasNextPage;
|
|
716
|
+
if (isLoading && !isPlaceholderData) {
|
|
717
|
+
return /* @__PURE__ */ jsx2(Skeleton, { view: "event-list", ariaLabel: labels.search.loadingResults, className });
|
|
718
|
+
}
|
|
719
|
+
return /* @__PURE__ */ jsxs2("section", { className: cn("agg-search-results-section flex w-full flex-col gap-5", className), children: [
|
|
720
|
+
/* @__PURE__ */ jsxs2(
|
|
721
|
+
"header",
|
|
722
|
+
{
|
|
723
|
+
ref: headerRef,
|
|
724
|
+
className: cn(
|
|
725
|
+
"agg-search-results-header",
|
|
726
|
+
"flex flex-col w-full items-start justify-between",
|
|
727
|
+
"gap-2 sm:flex-row sm:items-center sm:gap-4"
|
|
728
|
+
),
|
|
729
|
+
children: [
|
|
730
|
+
/* @__PURE__ */ jsx2("div", { ref: titleRef, className: "agg-search-results-title min-w-32", children: /* @__PURE__ */ jsx2(Typography, { as: "h2", variant: "title", className: "truncate first-letter:uppercase", children: resultsTitle }) }),
|
|
731
|
+
/* @__PURE__ */ jsx2(
|
|
732
|
+
EventListTabs,
|
|
733
|
+
{
|
|
734
|
+
ariaLabel: labels.eventList.tabsAria(resultsTitle),
|
|
735
|
+
className: "agg-search-results-tabs",
|
|
736
|
+
activeTab: activeVenueTabValue,
|
|
737
|
+
onTabChange: setActiveVenueTabValue,
|
|
738
|
+
overflowBehavior: shouldUseSelectOverflow ? "select" : void 0
|
|
739
|
+
}
|
|
740
|
+
)
|
|
741
|
+
]
|
|
742
|
+
}
|
|
743
|
+
),
|
|
744
|
+
/* @__PURE__ */ jsxs2(
|
|
745
|
+
"div",
|
|
746
|
+
{
|
|
747
|
+
className: cn(
|
|
748
|
+
"agg-event-list-grid grid grid-cols-[repeat(auto-fill,minmax(240px,1fr))] md:grid-cols-[repeat(auto-fill,minmax(360px,1fr))] gap-4 transition-opacity duration-200",
|
|
749
|
+
isPlaceholderData && "opacity-60"
|
|
750
|
+
),
|
|
751
|
+
children: [
|
|
752
|
+
openEvents.map((event) => /* @__PURE__ */ jsx2(
|
|
753
|
+
EventListItem,
|
|
754
|
+
{
|
|
755
|
+
event,
|
|
756
|
+
classNames: {
|
|
757
|
+
root: "agg-event-list-item w-full min-w-0 max-w-none"
|
|
758
|
+
},
|
|
759
|
+
href: getEventHref == null ? void 0 : getEventHref(event),
|
|
760
|
+
onEventClick: (selectedEvent) => {
|
|
761
|
+
var _a;
|
|
762
|
+
if (!selectedEvent) return;
|
|
763
|
+
if (onEventClick) {
|
|
764
|
+
onEventClick(selectedEvent);
|
|
765
|
+
} else {
|
|
766
|
+
(_a = searchConfig.onSelect) == null ? void 0 : _a.call(searchConfig, selectedEvent);
|
|
767
|
+
}
|
|
768
|
+
},
|
|
769
|
+
onMarketClick,
|
|
770
|
+
getMarketHref
|
|
771
|
+
},
|
|
772
|
+
event.id
|
|
773
|
+
)),
|
|
774
|
+
shouldRenderPaginationLoadingItems ? Array.from({ length: loadingPlaceholderCount }).map((_, index) => /* @__PURE__ */ jsx2(
|
|
775
|
+
EventListItem,
|
|
776
|
+
{
|
|
777
|
+
isLoading: true,
|
|
778
|
+
classNames: {
|
|
779
|
+
root: "agg-event-list-item w-full min-w-0 max-w-none"
|
|
780
|
+
}
|
|
781
|
+
},
|
|
782
|
+
`search-results-loading-${index}`
|
|
783
|
+
)) : null,
|
|
784
|
+
!isError && openEvents.length === 0 ? /* @__PURE__ */ jsx2("div", { className: "col-span-full w-full", children: /* @__PURE__ */ jsx2(
|
|
785
|
+
StateMessage,
|
|
786
|
+
{
|
|
787
|
+
title: labels.eventList.emptyTitle,
|
|
788
|
+
description: labels.eventList.emptyDescription,
|
|
789
|
+
classNames: {
|
|
790
|
+
title: "!text-agg-base leading-agg-6",
|
|
791
|
+
description: "!text-agg-sm leading-agg-5"
|
|
792
|
+
},
|
|
793
|
+
icon: /* @__PURE__ */ jsx2(Icon, { name: "search-empty" })
|
|
794
|
+
}
|
|
795
|
+
) }) : null,
|
|
796
|
+
isError ? /* @__PURE__ */ jsx2(
|
|
797
|
+
StateMessage,
|
|
798
|
+
{
|
|
799
|
+
title: labels.eventList.errorTitle,
|
|
800
|
+
description: labels.eventList.errorDescription,
|
|
801
|
+
icon: /* @__PURE__ */ jsx2(Icon, { name: "warning" })
|
|
802
|
+
}
|
|
803
|
+
) : null
|
|
804
|
+
]
|
|
805
|
+
}
|
|
806
|
+
),
|
|
807
|
+
hasNextPage ? /* @__PURE__ */ jsx2("div", { ref: loadMoreRef, className: "agg-search-results-sentinel h-px w-full", "aria-hidden": true }) : null
|
|
808
|
+
] });
|
|
809
|
+
};
|
|
810
|
+
var HomePage = ({
|
|
811
|
+
tabs,
|
|
812
|
+
defaultActiveTab,
|
|
813
|
+
onTabChange: _onTabChange,
|
|
814
|
+
eventSectionItems,
|
|
815
|
+
classNames,
|
|
816
|
+
categoriesLimit = DEFAULT_CATEGORIES_LIMIT,
|
|
817
|
+
allCategoryTabLabel = DEFAULT_ALL_CATEGORY_TAB_LABEL,
|
|
818
|
+
actions,
|
|
819
|
+
withHeader = true,
|
|
820
|
+
onEventClick: onEventClickProp,
|
|
821
|
+
onSeeAllEvents: onSeeAllEventsProp,
|
|
822
|
+
onMarketClick: onMarketClickProp,
|
|
823
|
+
getMarketHref,
|
|
824
|
+
getEventHref,
|
|
825
|
+
onError,
|
|
826
|
+
stickyOrderPanel
|
|
827
|
+
}) => {
|
|
828
|
+
var _a, _b, _c, _d;
|
|
829
|
+
const labels = useLabels2();
|
|
830
|
+
const {
|
|
831
|
+
search: {
|
|
832
|
+
value: searchValue,
|
|
833
|
+
result: selectedEvent,
|
|
834
|
+
isShowingAllResults,
|
|
835
|
+
onChange: onSearchChange,
|
|
836
|
+
onSelect: onSelectEventInternal
|
|
837
|
+
}
|
|
838
|
+
} = useSdkUiConfig();
|
|
839
|
+
const { capture, consume } = useEventListState();
|
|
840
|
+
const [snapshot] = useState4(() => consume());
|
|
841
|
+
const eventListStateRef = useRef2(null);
|
|
842
|
+
const handleSelectEvent = useCallback2(
|
|
843
|
+
(event) => {
|
|
844
|
+
var _a2, _b2, _c2, _d2;
|
|
845
|
+
capture({
|
|
846
|
+
categoryTab: activeTabValueRef.current,
|
|
847
|
+
venueTab: (_b2 = (_a2 = eventListStateRef.current) == null ? void 0 : _a2.venueTab) != null ? _b2 : null,
|
|
848
|
+
scrollY: typeof window !== "undefined" ? window.scrollY : 0,
|
|
849
|
+
loadedPageCount: (_d2 = (_c2 = eventListStateRef.current) == null ? void 0 : _c2.loadedPageCount) != null ? _d2 : 1
|
|
850
|
+
});
|
|
851
|
+
if (onEventClickProp) {
|
|
852
|
+
onEventClickProp(event);
|
|
853
|
+
return;
|
|
854
|
+
}
|
|
855
|
+
onSelectEventInternal == null ? void 0 : onSelectEventInternal(event);
|
|
856
|
+
},
|
|
857
|
+
[capture, onEventClickProp, onSelectEventInternal]
|
|
858
|
+
);
|
|
859
|
+
const hasCustomTabs = !!tabs && tabs.length > 0;
|
|
860
|
+
const normalizedSearchValue = searchValue.trim();
|
|
861
|
+
const [stickySelectedEvent, setStickySelectedEvent] = useState4(
|
|
862
|
+
selectedEvent
|
|
863
|
+
);
|
|
864
|
+
const [debouncedSearchValue, setDebouncedSearchValue] = useState4(() => {
|
|
865
|
+
return normalizedSearchValue.length >= MIN_SEARCH_LENGTH ? normalizedSearchValue : "";
|
|
866
|
+
});
|
|
867
|
+
const [isMobileSearchViewport, setIsMobileSearchViewport] = useState4(false);
|
|
868
|
+
useEffect2(() => {
|
|
869
|
+
if (typeof window === "undefined") return;
|
|
870
|
+
const mediaQueryList = window.matchMedia(MOBILE_HOME_SEARCH_MEDIA_QUERY);
|
|
871
|
+
const handleMediaQueryChange = (event) => {
|
|
872
|
+
setIsMobileSearchViewport(event.matches);
|
|
873
|
+
};
|
|
874
|
+
handleMediaQueryChange(mediaQueryList);
|
|
875
|
+
if (typeof mediaQueryList.addEventListener === "function") {
|
|
876
|
+
mediaQueryList.addEventListener("change", handleMediaQueryChange);
|
|
877
|
+
return () => {
|
|
878
|
+
mediaQueryList.removeEventListener("change", handleMediaQueryChange);
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
mediaQueryList.addListener(handleMediaQueryChange);
|
|
882
|
+
return () => {
|
|
883
|
+
mediaQueryList.removeListener(handleMediaQueryChange);
|
|
884
|
+
};
|
|
885
|
+
}, []);
|
|
886
|
+
useEffect2(() => {
|
|
887
|
+
if (normalizedSearchValue.length < MIN_SEARCH_LENGTH) {
|
|
888
|
+
setDebouncedSearchValue("");
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
891
|
+
const timeoutId = window.setTimeout(() => {
|
|
892
|
+
setDebouncedSearchValue(normalizedSearchValue);
|
|
893
|
+
}, SEARCH_DEBOUNCE_MS);
|
|
894
|
+
return () => {
|
|
895
|
+
window.clearTimeout(timeoutId);
|
|
896
|
+
};
|
|
897
|
+
}, [normalizedSearchValue]);
|
|
898
|
+
useEffect2(() => {
|
|
899
|
+
if (selectedEvent) {
|
|
900
|
+
setStickySelectedEvent(selectedEvent);
|
|
901
|
+
return;
|
|
902
|
+
}
|
|
903
|
+
if (!normalizedSearchValue && !isShowingAllResults) {
|
|
904
|
+
setStickySelectedEvent(null);
|
|
905
|
+
}
|
|
906
|
+
}, [isShowingAllResults, normalizedSearchValue, selectedEvent]);
|
|
907
|
+
const resolvedSelectedEvent = selectedEvent != null ? selectedEvent : stickySelectedEvent;
|
|
908
|
+
const resolvedAllCategoryTabLabel = allCategoryTabLabel === DEFAULT_ALL_CATEGORY_TAB_LABEL ? labels.home.trending : allCategoryTabLabel;
|
|
909
|
+
const { categories } = useCategories({
|
|
910
|
+
limit: categoriesLimit,
|
|
911
|
+
enabled: !hasCustomTabs
|
|
912
|
+
});
|
|
913
|
+
const categoryTabs = useMemo(() => {
|
|
914
|
+
return resolveCategoryTabs(categories, resolvedAllCategoryTabLabel);
|
|
915
|
+
}, [categories, resolvedAllCategoryTabLabel]);
|
|
916
|
+
const resolvedTabs = useMemo(() => {
|
|
917
|
+
if (hasCustomTabs && tabs) return tabs;
|
|
918
|
+
return categoryTabs;
|
|
919
|
+
}, [categoryTabs, hasCustomTabs, tabs]);
|
|
920
|
+
const resolvedEventSectionItems = eventSectionItems && eventSectionItems.length > 0 ? eventSectionItems : getDefaultEventSectionItems(labels);
|
|
921
|
+
const [activeTabValue, setActiveTabValue] = useState4(() => {
|
|
922
|
+
if (snapshot == null ? void 0 : snapshot.categoryTab) {
|
|
923
|
+
return snapshot.categoryTab;
|
|
924
|
+
}
|
|
925
|
+
return resolveInitialTabValue(resolvedTabs, defaultActiveTab);
|
|
926
|
+
});
|
|
927
|
+
const activeTabValueRef = useRef2(activeTabValue);
|
|
928
|
+
activeTabValueRef.current = activeTabValue;
|
|
929
|
+
useEffect2(() => {
|
|
930
|
+
setActiveTabValue((currentValue) => {
|
|
931
|
+
const hasCurrentValue = resolvedTabs.some((tab) => tab.value === currentValue);
|
|
932
|
+
if (hasCurrentValue) return currentValue;
|
|
933
|
+
return resolveInitialTabValue(resolvedTabs, defaultActiveTab);
|
|
934
|
+
});
|
|
935
|
+
}, [defaultActiveTab, resolvedTabs]);
|
|
936
|
+
const tabsItems = useMemo(() => {
|
|
937
|
+
return resolvedTabs.map((tab) => {
|
|
938
|
+
const isActive = tab.value === activeTabValue;
|
|
939
|
+
return {
|
|
940
|
+
value: tab.value,
|
|
941
|
+
label: tab.label,
|
|
942
|
+
icon: tab.iconName ? /* @__PURE__ */ jsx2(
|
|
943
|
+
Icon,
|
|
944
|
+
{
|
|
945
|
+
name: tab.iconName,
|
|
946
|
+
size: "small",
|
|
947
|
+
color: isActive ? "var(--agg-color-primary)" : "var(--agg-color-foreground)"
|
|
948
|
+
}
|
|
949
|
+
) : void 0,
|
|
950
|
+
disabled: tab.disabled
|
|
951
|
+
};
|
|
952
|
+
});
|
|
953
|
+
}, [activeTabValue, resolvedTabs]);
|
|
954
|
+
const activeTab = useMemo(() => {
|
|
955
|
+
return resolvedTabs.find((tab) => tab.value === activeTabValue);
|
|
956
|
+
}, [activeTabValue, resolvedTabs]);
|
|
957
|
+
const resolvedSectionItems = useMemo(() => {
|
|
958
|
+
var _a2, _b2, _c2;
|
|
959
|
+
if (activeTabValue === ALL_CATEGORIES_TAB_VALUE) {
|
|
960
|
+
return resolvedEventSectionItems;
|
|
961
|
+
}
|
|
962
|
+
return [
|
|
963
|
+
{
|
|
964
|
+
id: (_b2 = (_a2 = resolvedEventSectionItems[0]) == null ? void 0 : _a2.id) != null ? _b2 : "top-markets",
|
|
965
|
+
title: (_c2 = activeTab == null ? void 0 : activeTab.label) != null ? _c2 : activeTabValue,
|
|
966
|
+
limit: DEFAULT_EVENTS_LIMIT,
|
|
967
|
+
maxVisibleItems: void 0,
|
|
968
|
+
search: activeTab == null ? void 0 : activeTab.search,
|
|
969
|
+
categoryIds: activeTab == null ? void 0 : activeTab.categoryIds
|
|
970
|
+
}
|
|
971
|
+
];
|
|
972
|
+
}, [activeTab, activeTabValue, resolvedEventSectionItems]);
|
|
973
|
+
const handleTabChange = (value) => {
|
|
974
|
+
setActiveTabValue(value);
|
|
975
|
+
_onTabChange == null ? void 0 : _onTabChange(value);
|
|
976
|
+
};
|
|
977
|
+
const handleLogoClick = () => {
|
|
978
|
+
onSearchChange == null ? void 0 : onSearchChange("");
|
|
979
|
+
};
|
|
980
|
+
const shouldRenderMobileSearch = isMobileSearchViewport && !resolvedSelectedEvent;
|
|
981
|
+
const isScrollRestorationReady = !!snapshot && !isShowingAllResults && !resolvedSelectedEvent && ((_b = (_a = eventListStateRef.current) == null ? void 0 : _a.loadedPageCount) != null ? _b : 0) >= ((_c = snapshot.loadedPageCount) != null ? _c : 1);
|
|
982
|
+
useScrollRestoration({
|
|
983
|
+
enabled: !!snapshot && snapshot.scrollY > 0,
|
|
984
|
+
scrollY: (_d = snapshot == null ? void 0 : snapshot.scrollY) != null ? _d : 0,
|
|
985
|
+
isReady: isScrollRestorationReady
|
|
986
|
+
});
|
|
987
|
+
return /* @__PURE__ */ jsx2(AggErrorBoundary, { onError, children: /* @__PURE__ */ jsxs2("section", { className: cn("agg-home-page flex w-full flex-col", classNames == null ? void 0 : classNames.root), children: [
|
|
988
|
+
withHeader ? /* @__PURE__ */ jsx2(
|
|
989
|
+
Header,
|
|
990
|
+
{
|
|
991
|
+
search: isMobileSearchViewport ? null : void 0,
|
|
992
|
+
searchProps: { onSeeAllEvents: onSeeAllEventsProp },
|
|
993
|
+
actions,
|
|
994
|
+
onLogoClick: handleLogoClick
|
|
995
|
+
}
|
|
996
|
+
) : null,
|
|
997
|
+
!resolvedSelectedEvent && !isShowingAllResults ? /* @__PURE__ */ jsx2(
|
|
998
|
+
"header",
|
|
999
|
+
{
|
|
1000
|
+
className: cn(
|
|
1001
|
+
"agg-page-header",
|
|
1002
|
+
"w-full bg-agg-secondary border-b border-agg-separator h-[60px]",
|
|
1003
|
+
classNames == null ? void 0 : classNames.header
|
|
1004
|
+
),
|
|
1005
|
+
children: /* @__PURE__ */ jsx2("div", { className: "mx-auto h-full w-full max-w-[1360px] px-6 lg:px-10", children: /* @__PURE__ */ jsx2(
|
|
1006
|
+
Tabs,
|
|
1007
|
+
{
|
|
1008
|
+
ariaLabel: labels.home.categoryTabsAria,
|
|
1009
|
+
variant: "underline",
|
|
1010
|
+
className: cn("w-full", classNames == null ? void 0 : classNames.tabs),
|
|
1011
|
+
classNames: { tabList: "!h-[60px]" },
|
|
1012
|
+
items: tabsItems,
|
|
1013
|
+
value: activeTabValue,
|
|
1014
|
+
onChange: handleTabChange
|
|
1015
|
+
}
|
|
1016
|
+
) })
|
|
1017
|
+
}
|
|
1018
|
+
) : null,
|
|
1019
|
+
resolvedSelectedEvent ? /* @__PURE__ */ jsx2(EventMarketPage, { eventId: resolvedSelectedEvent.id, stickyOrderPanel }) : /* @__PURE__ */ jsxs2(
|
|
1020
|
+
"div",
|
|
1021
|
+
{
|
|
1022
|
+
className: cn(
|
|
1023
|
+
"w-full mx-auto px-6 lg:px-10 max-w-[1360px]",
|
|
1024
|
+
"pt-4 sm:pt-6 md:pt-8 pb-10"
|
|
1025
|
+
),
|
|
1026
|
+
children: [
|
|
1027
|
+
shouldRenderMobileSearch ? /* @__PURE__ */ jsx2("div", { className: "agg-page-mobile-search w-full py-4 md:hidden ", children: /* @__PURE__ */ jsx2(Search, { onSeeAllEvents: onSeeAllEventsProp }) }) : null,
|
|
1028
|
+
/* @__PURE__ */ jsx2(
|
|
1029
|
+
"main",
|
|
1030
|
+
{
|
|
1031
|
+
className: cn(
|
|
1032
|
+
"agg-page-content",
|
|
1033
|
+
"flex w-full flex-col gap-4 sm:gap-6 md:gap-10 mb-10",
|
|
1034
|
+
classNames == null ? void 0 : classNames.sections
|
|
1035
|
+
),
|
|
1036
|
+
children: isShowingAllResults && debouncedSearchValue ? /* @__PURE__ */ jsx2(
|
|
1037
|
+
HomeSearchResults,
|
|
1038
|
+
{
|
|
1039
|
+
activeTabValue,
|
|
1040
|
+
query: debouncedSearchValue,
|
|
1041
|
+
resolvedTabs,
|
|
1042
|
+
onEventClick: onEventClickProp,
|
|
1043
|
+
onMarketClick: onMarketClickProp,
|
|
1044
|
+
getMarketHref,
|
|
1045
|
+
getEventHref
|
|
1046
|
+
}
|
|
1047
|
+
) : resolvedSectionItems.map((eventSectionItem, sectionIndex) => {
|
|
1048
|
+
var _a2, _b2, _c2, _d2;
|
|
1049
|
+
return /* @__PURE__ */ jsx2(
|
|
1050
|
+
"div",
|
|
1051
|
+
{
|
|
1052
|
+
className: "agg-home-section",
|
|
1053
|
+
children: /* @__PURE__ */ jsx2(
|
|
1054
|
+
EventList,
|
|
1055
|
+
__spreadValues({
|
|
1056
|
+
title: eventSectionItem.title,
|
|
1057
|
+
limit: DEFAULT_EVENTS_LIMIT,
|
|
1058
|
+
maxVisibleItems: eventSectionItem.maxVisibleItems,
|
|
1059
|
+
search: (_b2 = eventSectionItem.search) != null ? _b2 : activeTab == null ? void 0 : activeTab.search,
|
|
1060
|
+
categoryIds: (_c2 = eventSectionItem.categoryIds) != null ? _c2 : activeTab == null ? void 0 : activeTab.categoryIds,
|
|
1061
|
+
getEventHref,
|
|
1062
|
+
getMarketHref,
|
|
1063
|
+
onEventClick: (event) => {
|
|
1064
|
+
if (!event) return;
|
|
1065
|
+
handleSelectEvent(event);
|
|
1066
|
+
},
|
|
1067
|
+
onMarketClick: onMarketClickProp
|
|
1068
|
+
}, sectionIndex === 0 ? {
|
|
1069
|
+
stateRef: eventListStateRef,
|
|
1070
|
+
initialVenueTab: (_d2 = snapshot == null ? void 0 : snapshot.venueTab) != null ? _d2 : void 0,
|
|
1071
|
+
initialLoadedPageCount: snapshot == null ? void 0 : snapshot.loadedPageCount
|
|
1072
|
+
} : void 0)
|
|
1073
|
+
)
|
|
1074
|
+
},
|
|
1075
|
+
`${(_a2 = eventSectionItem.id) != null ? _a2 : eventSectionItem.title}-${sectionIndex}`
|
|
1076
|
+
);
|
|
1077
|
+
})
|
|
1078
|
+
}
|
|
1079
|
+
)
|
|
1080
|
+
]
|
|
1081
|
+
}
|
|
1082
|
+
)
|
|
1083
|
+
] }) });
|
|
1084
|
+
};
|
|
1085
|
+
HomePage.displayName = "HomePage";
|
|
1086
|
+
|
|
1087
|
+
// src/pages/user-profile/index.tsx
|
|
1088
|
+
import {
|
|
1089
|
+
computeClosedPositionTotals,
|
|
1090
|
+
getWalletAddressFromUserProfile,
|
|
1091
|
+
useAggAuthState,
|
|
1092
|
+
useAggBalance,
|
|
1093
|
+
useAggClient,
|
|
1094
|
+
useDepositAddresses,
|
|
1095
|
+
useExecutionOrders,
|
|
1096
|
+
useExecutionPositions,
|
|
1097
|
+
useGeoBlock,
|
|
1098
|
+
useLabels as useLabels6,
|
|
1099
|
+
useQueryClient,
|
|
1100
|
+
useUserActivity
|
|
1101
|
+
} from "@agg-build/hooks";
|
|
1102
|
+
import { Venue } from "@agg-build/sdk";
|
|
1103
|
+
import { useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo3, useState as useState6 } from "react";
|
|
1104
|
+
|
|
1105
|
+
// src/pages/user-profile/chain-display.ts
|
|
1106
|
+
var CHAIN_ID_TO_LABEL = {
|
|
1107
|
+
"1": "Ethereum",
|
|
1108
|
+
"10": "Optimism",
|
|
1109
|
+
"56": "BNB Chain",
|
|
1110
|
+
"137": "Polygon",
|
|
1111
|
+
"324": "zkSync Era",
|
|
1112
|
+
"8453": "Base",
|
|
1113
|
+
"42161": "Arbitrum",
|
|
1114
|
+
"792703809": "Solana"
|
|
1115
|
+
};
|
|
1116
|
+
var formatChainIdLabel = (chainId) => {
|
|
1117
|
+
var _a;
|
|
1118
|
+
if (chainId === null || chainId === void 0) return "";
|
|
1119
|
+
const key = String(chainId).trim();
|
|
1120
|
+
if (!key) return "";
|
|
1121
|
+
return (_a = CHAIN_ID_TO_LABEL[key]) != null ? _a : `Chain ${key}`;
|
|
1122
|
+
};
|
|
1123
|
+
|
|
1124
|
+
// src/pages/user-profile/components/available-balance-card.tsx
|
|
1125
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1126
|
+
var CHAIN_ID_TO_ICON = {
|
|
1127
|
+
"1": "ethereum",
|
|
1128
|
+
"10": "ethereum",
|
|
1129
|
+
// Optimism (EVM)
|
|
1130
|
+
"56": "ethereum",
|
|
1131
|
+
// BNB Chain (EVM)
|
|
1132
|
+
"137": "polygon",
|
|
1133
|
+
"324": "ethereum",
|
|
1134
|
+
// zkSync (EVM)
|
|
1135
|
+
"8453": "base",
|
|
1136
|
+
"42161": "arbitrum",
|
|
1137
|
+
"792703809": "solana"
|
|
1138
|
+
};
|
|
1139
|
+
var chainIconName = (label, key) => {
|
|
1140
|
+
if (key && CHAIN_ID_TO_ICON[key]) return CHAIN_ID_TO_ICON[key];
|
|
1141
|
+
const k = label.trim().toLowerCase();
|
|
1142
|
+
if (k.includes("polygon")) return "polygon";
|
|
1143
|
+
if (k.includes("solana")) return "solana";
|
|
1144
|
+
if (k.includes("base")) return "base";
|
|
1145
|
+
if (k.includes("arbitrum")) return "arbitrum";
|
|
1146
|
+
if (k.includes("optimism")) return "ethereum";
|
|
1147
|
+
if (k.includes("bnb")) return "ethereum";
|
|
1148
|
+
if (k.includes("zksync")) return "ethereum";
|
|
1149
|
+
if (k.includes("ethereum") || k.includes("eth")) return "ethereum";
|
|
1150
|
+
return void 0;
|
|
1151
|
+
};
|
|
1152
|
+
var venueNameSet = new Set(venueLogoNames);
|
|
1153
|
+
var isKnownVenueName = (venue) => {
|
|
1154
|
+
return venueNameSet.has(venue);
|
|
1155
|
+
};
|
|
1156
|
+
var getDisplayVenues = (venues) => {
|
|
1157
|
+
if (!Array.isArray(venues) || venues.length === 0) return [];
|
|
1158
|
+
return venues.filter(isKnownVenueName);
|
|
1159
|
+
};
|
|
1160
|
+
var AvailableBalanceCard = ({
|
|
1161
|
+
label = "Available Balance",
|
|
1162
|
+
valueLabel,
|
|
1163
|
+
chains,
|
|
1164
|
+
className
|
|
1165
|
+
}) => {
|
|
1166
|
+
return /* @__PURE__ */ jsxs3(
|
|
1167
|
+
"div",
|
|
1168
|
+
{
|
|
1169
|
+
className: cn(
|
|
1170
|
+
"group/agg-balance-panel",
|
|
1171
|
+
"flex flex-col gap-3 rounded-agg-xl border border-agg-separator bg-agg-secondary p-5",
|
|
1172
|
+
className
|
|
1173
|
+
),
|
|
1174
|
+
children: [
|
|
1175
|
+
/* @__PURE__ */ jsx3("div", { className: "agg-balance-header flex items-center justify-between gap-3", children: /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2", children: [
|
|
1176
|
+
/* @__PURE__ */ jsx3(
|
|
1177
|
+
"svg",
|
|
1178
|
+
{
|
|
1179
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1180
|
+
width: "16",
|
|
1181
|
+
height: "16",
|
|
1182
|
+
viewBox: "0 0 16 16",
|
|
1183
|
+
fill: "none",
|
|
1184
|
+
"aria-hidden": "true",
|
|
1185
|
+
focusable: "false",
|
|
1186
|
+
children: /* @__PURE__ */ jsx3(
|
|
1187
|
+
"path",
|
|
1188
|
+
{
|
|
1189
|
+
d: "M14 4.00065H3.33333C2.76067 4.00065 2.21867 3.75265 1.84333 3.33465C2.21 2.92532 2.74267 2.66732 3.33333 2.66732H15.3333C15.702 2.66732 16 2.36865 16 2.00065C16 1.63265 15.702 1.33398 15.3333 1.33398H3.33333C1.49267 1.33398 0 2.82665 0 4.66732V11.334C0 13.1747 1.49267 14.6673 3.33333 14.6673H14C15.1047 14.6673 16 13.772 16 12.6673V6.00065C16 4.89598 15.1047 4.00065 14 4.00065ZM14.6667 12.6673C14.6667 13.0347 14.368 13.334 14 13.334H3.33333C2.23067 13.334 1.33333 12.4367 1.33333 11.334V4.66598C1.90267 5.09198 2.60267 5.33398 3.33333 5.33398H14C14.368 5.33398 14.6667 5.63332 14.6667 6.00065V12.6673ZM13.3333 9.33399C13.3333 9.70199 13.0347 10.0007 12.6667 10.0007C12.2987 10.0007 12 9.70199 12 9.33399C12 8.96599 12.2987 8.66732 12.6667 8.66732C13.0347 8.66732 13.3333 8.96599 13.3333 9.33399Z",
|
|
1190
|
+
fill: "#9D9FAF"
|
|
1191
|
+
}
|
|
1192
|
+
)
|
|
1193
|
+
}
|
|
1194
|
+
),
|
|
1195
|
+
/* @__PURE__ */ jsx3("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children: label })
|
|
1196
|
+
] }) }),
|
|
1197
|
+
/* @__PURE__ */ jsxs3("div", { className: "agg-balance-summary flex items-center justify-between gap-3", children: [
|
|
1198
|
+
/* @__PURE__ */ jsx3("div", { className: "agg-balance-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: valueLabel }),
|
|
1199
|
+
/* @__PURE__ */ jsx3(
|
|
1200
|
+
Tooltip,
|
|
1201
|
+
{
|
|
1202
|
+
"aria-label": "Balance by network",
|
|
1203
|
+
size: "medium",
|
|
1204
|
+
side: "bottom",
|
|
1205
|
+
content: /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-4 items-start justify-start", children: [
|
|
1206
|
+
/* @__PURE__ */ jsx3("div", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: "Balance by network" }),
|
|
1207
|
+
/* @__PURE__ */ jsx3("div", { role: "list", className: "agg-balance-list flex flex-col gap-3 w-full", children: chains.map((row) => {
|
|
1208
|
+
const icon = chainIconName(row.label, row.key);
|
|
1209
|
+
return /* @__PURE__ */ jsxs3(
|
|
1210
|
+
"div",
|
|
1211
|
+
{
|
|
1212
|
+
role: "listitem",
|
|
1213
|
+
className: "agg-balance-row flex items-center justify-between gap-3 w-full",
|
|
1214
|
+
children: [
|
|
1215
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
1216
|
+
icon ? /* @__PURE__ */ jsx3("span", { className: "flex h-4 w-4 items-center justify-center rounded-[4px]", children: /* @__PURE__ */ jsx3(Icon, { name: icon, size: "small", className: "text-agg-foreground" }) }) : /* @__PURE__ */ jsx3("span", { className: "flex h-4 w-4 items-center justify-center rounded-[4px] border border-agg-separator text-[10px] leading-3 text-agg-muted-foreground", children: row.label.slice(0, 2).toUpperCase() }),
|
|
1217
|
+
/* @__PURE__ */ jsx3("span", { className: "truncate font-agg-sans text-agg-sm leading-5 font-agg-normal text-agg-foreground", children: row.label })
|
|
1218
|
+
] }),
|
|
1219
|
+
/* @__PURE__ */ jsx3("span", { className: "w-[100px] shrink-0 whitespace-nowrap text-right tabular-nums font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground", children: row.balance.toLocaleString("en-US", {
|
|
1220
|
+
style: "currency",
|
|
1221
|
+
currency: "USD",
|
|
1222
|
+
minimumFractionDigits: Number.isInteger(row.balance) ? 0 : 1,
|
|
1223
|
+
maximumFractionDigits: 2
|
|
1224
|
+
}) }),
|
|
1225
|
+
/* @__PURE__ */ jsx3("div", { className: "flex w-12 shrink-0 items-center justify-end gap-1 empty:hidden", children: getDisplayVenues(row.venues).slice(0, 2).map((venue, venueIndex) => /* @__PURE__ */ jsx3(
|
|
1226
|
+
VenueLogo,
|
|
1227
|
+
{
|
|
1228
|
+
venue,
|
|
1229
|
+
size: "small",
|
|
1230
|
+
className: "size-4 shrink-0"
|
|
1231
|
+
},
|
|
1232
|
+
`${row.key}-${venue}-${String(venueIndex)}`
|
|
1233
|
+
)) })
|
|
1234
|
+
]
|
|
1235
|
+
},
|
|
1236
|
+
row.key
|
|
1237
|
+
);
|
|
1238
|
+
}) }),
|
|
1239
|
+
/* @__PURE__ */ jsx3("div", { className: "agg-balance-note rounded-agg-lg bg-agg-secondary-hover p-3", children: /* @__PURE__ */ jsx3("p", { className: "font-agg-sans text-agg-xs leading-agg-4 font-agg-normal text-agg-foreground", children: "Funds are stored across networks. We handle routing automatically, but keeping funds on the right network enables faster trades and lower fees. When depositing, you can choose your preferred network." }) })
|
|
1240
|
+
] }),
|
|
1241
|
+
children: /* @__PURE__ */ jsxs3(
|
|
1242
|
+
"button",
|
|
1243
|
+
{
|
|
1244
|
+
type: "button",
|
|
1245
|
+
"aria-label": "Balance by network",
|
|
1246
|
+
className: "agg-balance-trigger flex min-h-[20px] min-w-[20px] items-center gap-1 rounded-[6px] border-0 bg-agg-secondary-hover p-1.5",
|
|
1247
|
+
children: [
|
|
1248
|
+
(chains.slice(0, 4).length > 0 ? chains.slice(0, 4) : [{ key: "placeholder", label: "", balance: 0, accountCount: 0 }]).map((row) => {
|
|
1249
|
+
const icon = chainIconName(row.label, row.key);
|
|
1250
|
+
return icon ? /* @__PURE__ */ jsx3(
|
|
1251
|
+
"span",
|
|
1252
|
+
{
|
|
1253
|
+
className: "relative z-0 flex h-4 w-4 items-center justify-center rounded-[4px] bg-agg-secondary",
|
|
1254
|
+
children: /* @__PURE__ */ jsx3(Icon, { name: icon, size: "small", className: "text-agg-foreground" })
|
|
1255
|
+
},
|
|
1256
|
+
`icon-${row.key}`
|
|
1257
|
+
) : /* @__PURE__ */ jsx3(
|
|
1258
|
+
"span",
|
|
1259
|
+
{
|
|
1260
|
+
className: "relative z-0 flex h-4 w-4 items-center justify-center rounded-[4px] bg-agg-secondary text-[10px] leading-3 text-agg-muted-foreground",
|
|
1261
|
+
children: row.label ? row.label.slice(0, 2).toUpperCase() : ""
|
|
1262
|
+
},
|
|
1263
|
+
`icon-${row.key}`
|
|
1264
|
+
);
|
|
1265
|
+
}),
|
|
1266
|
+
chains.length > 4 ? /* @__PURE__ */ jsxs3("span", { className: "relative z-0 flex h-4 w-4 items-center justify-center rounded-[4px] bg-agg-secondary font-agg-sans text-[10px] leading-3 text-agg-muted-foreground", children: [
|
|
1267
|
+
"+",
|
|
1268
|
+
chains.length - 4
|
|
1269
|
+
] }) : null
|
|
1270
|
+
]
|
|
1271
|
+
}
|
|
1272
|
+
)
|
|
1273
|
+
}
|
|
1274
|
+
)
|
|
1275
|
+
] })
|
|
1276
|
+
]
|
|
1277
|
+
}
|
|
1278
|
+
);
|
|
1279
|
+
};
|
|
1280
|
+
AvailableBalanceCard.displayName = "AvailableBalanceCard";
|
|
1281
|
+
|
|
1282
|
+
// src/pages/user-profile/components/positions-activity.tsx
|
|
1283
|
+
import { optimizedImageUrl as optimizedImageUrl2, useLabels as useLabels4 } from "@agg-build/hooks";
|
|
1284
|
+
import { Fragment as Fragment4, useEffect as useEffect3, useMemo as useMemo2, useRef as useRef3, useState as useState5 } from "react";
|
|
1285
|
+
|
|
1286
|
+
// src/pages/user-profile/user-profile.constants.ts
|
|
1287
|
+
var USER_PROFILE_TAB_POSITIONS = "positions";
|
|
1288
|
+
var USER_PROFILE_TAB_OPEN_ORDERS = "open-orders";
|
|
1289
|
+
var USER_PROFILE_TAB_ACTIVITY = "activity";
|
|
1290
|
+
var USER_PROFILE_POSITION_FILTERS = [
|
|
1291
|
+
{ value: "active", label: "Active" },
|
|
1292
|
+
{ value: "closed", label: "Closed" }
|
|
1293
|
+
];
|
|
1294
|
+
|
|
1295
|
+
// src/pages/user-profile/components/activity-row.tsx
|
|
1296
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1297
|
+
var shouldUseNativeLinkNavigation = (event) => {
|
|
1298
|
+
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
|
|
1299
|
+
};
|
|
1300
|
+
var RowWrapper = ({ className, href, onClick, children }) => {
|
|
1301
|
+
if (href) {
|
|
1302
|
+
return /* @__PURE__ */ jsx4(
|
|
1303
|
+
"a",
|
|
1304
|
+
{
|
|
1305
|
+
href,
|
|
1306
|
+
className,
|
|
1307
|
+
onClick: (event) => {
|
|
1308
|
+
if (shouldUseNativeLinkNavigation(event)) return;
|
|
1309
|
+
event.preventDefault();
|
|
1310
|
+
onClick();
|
|
1311
|
+
},
|
|
1312
|
+
children
|
|
1313
|
+
}
|
|
1314
|
+
);
|
|
1315
|
+
}
|
|
1316
|
+
return /* @__PURE__ */ jsx4("button", { type: "button", className, onClick, children });
|
|
1317
|
+
};
|
|
1318
|
+
var TRANSFER_ICON = {
|
|
1319
|
+
withdrawal: "upload",
|
|
1320
|
+
deposit: "download",
|
|
1321
|
+
bridge: "arrows-to-dot",
|
|
1322
|
+
user_op: "wallet"
|
|
1323
|
+
};
|
|
1324
|
+
var resolveToneClasses = (activity) => {
|
|
1325
|
+
const hasError = !!activity.isFailed || !!activity.hasError;
|
|
1326
|
+
if (!hasError) {
|
|
1327
|
+
return {
|
|
1328
|
+
primary: "text-agg-foreground",
|
|
1329
|
+
amount: "text-agg-foreground",
|
|
1330
|
+
meta: "text-agg-muted-foreground"
|
|
1331
|
+
};
|
|
1332
|
+
}
|
|
1333
|
+
return {
|
|
1334
|
+
primary: "text-agg-error",
|
|
1335
|
+
amount: "text-agg-error",
|
|
1336
|
+
meta: "text-agg-error"
|
|
1337
|
+
};
|
|
1338
|
+
};
|
|
1339
|
+
var AmountTimeStack = ({
|
|
1340
|
+
amountLabel,
|
|
1341
|
+
timeLabel,
|
|
1342
|
+
tone,
|
|
1343
|
+
mobile
|
|
1344
|
+
}) => /* @__PURE__ */ jsxs4(
|
|
1345
|
+
"div",
|
|
1346
|
+
{
|
|
1347
|
+
className: cn(
|
|
1348
|
+
"flex flex-col items-end justify-center gap-1 whitespace-nowrap",
|
|
1349
|
+
mobile ? "sm:hidden" : "hidden sm:flex sm:w-[120px] sm:shrink-0"
|
|
1350
|
+
),
|
|
1351
|
+
children: [
|
|
1352
|
+
/* @__PURE__ */ jsx4(
|
|
1353
|
+
"p",
|
|
1354
|
+
{
|
|
1355
|
+
className: cn(
|
|
1356
|
+
"agg-activity-amount font-agg-sans font-agg-bold",
|
|
1357
|
+
mobile ? "text-agg-sm leading-agg-5" : "text-agg-base leading-agg-6",
|
|
1358
|
+
tone.amount
|
|
1359
|
+
),
|
|
1360
|
+
children: amountLabel
|
|
1361
|
+
}
|
|
1362
|
+
),
|
|
1363
|
+
/* @__PURE__ */ jsx4(
|
|
1364
|
+
"p",
|
|
1365
|
+
{
|
|
1366
|
+
className: cn(
|
|
1367
|
+
"agg-activity-time font-agg-sans font-agg-normal",
|
|
1368
|
+
mobile ? "text-agg-2xs leading-agg-14" : "text-agg-base leading-agg-6",
|
|
1369
|
+
tone.meta
|
|
1370
|
+
),
|
|
1371
|
+
children: timeLabel
|
|
1372
|
+
}
|
|
1373
|
+
)
|
|
1374
|
+
]
|
|
1375
|
+
}
|
|
1376
|
+
);
|
|
1377
|
+
var TradeTypeCell = ({
|
|
1378
|
+
activity,
|
|
1379
|
+
tone
|
|
1380
|
+
}) => /* @__PURE__ */ jsxs4("div", { className: "hidden w-22 shrink-0 items-center gap-3 sm:flex", children: [
|
|
1381
|
+
/* @__PURE__ */ jsx4(VenueLogo, { venue: activity.venue, size: "small", className: "shrink-0" }),
|
|
1382
|
+
/* @__PURE__ */ jsx4(
|
|
1383
|
+
"p",
|
|
1384
|
+
{
|
|
1385
|
+
className: cn(
|
|
1386
|
+
"agg-activity-type w-15 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
|
|
1387
|
+
tone.primary
|
|
1388
|
+
),
|
|
1389
|
+
children: activity.type
|
|
1390
|
+
}
|
|
1391
|
+
)
|
|
1392
|
+
] });
|
|
1393
|
+
var TransferTypeCell = ({
|
|
1394
|
+
activity,
|
|
1395
|
+
tone
|
|
1396
|
+
}) => /* @__PURE__ */ jsxs4("div", { className: "hidden w-[88px] shrink-0 items-center gap-3 sm:flex", children: [
|
|
1397
|
+
/* @__PURE__ */ jsx4(
|
|
1398
|
+
Icon,
|
|
1399
|
+
{
|
|
1400
|
+
name: TRANSFER_ICON[activity.kind],
|
|
1401
|
+
size: "small",
|
|
1402
|
+
className: "shrink-0 text-agg-foreground"
|
|
1403
|
+
}
|
|
1404
|
+
),
|
|
1405
|
+
/* @__PURE__ */ jsx4(
|
|
1406
|
+
"p",
|
|
1407
|
+
{
|
|
1408
|
+
className: cn(
|
|
1409
|
+
"agg-activity-type w-15 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
|
|
1410
|
+
tone.primary
|
|
1411
|
+
),
|
|
1412
|
+
children: activity.type
|
|
1413
|
+
}
|
|
1414
|
+
)
|
|
1415
|
+
] });
|
|
1416
|
+
var TradeOutcomeShares = ({
|
|
1417
|
+
activity,
|
|
1418
|
+
tone
|
|
1419
|
+
}) => /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1420
|
+
/* @__PURE__ */ jsx4("span", { className: "agg-activity-outcome inline-flex items-center justify-center gap-1.5 rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ jsx4(
|
|
1421
|
+
"span",
|
|
1422
|
+
{
|
|
1423
|
+
className: cn(
|
|
1424
|
+
"font-agg-sans text-agg-sm leading-agg-5 font-agg-normal whitespace-nowrap",
|
|
1425
|
+
tone.primary
|
|
1426
|
+
),
|
|
1427
|
+
children: activity.outcomeLabel
|
|
1428
|
+
}
|
|
1429
|
+
) }),
|
|
1430
|
+
/* @__PURE__ */ jsx4(
|
|
1431
|
+
"span",
|
|
1432
|
+
{
|
|
1433
|
+
className: cn(
|
|
1434
|
+
"agg-activity-shares font-agg-sans text-agg-sm leading-agg-5 font-agg-normal whitespace-nowrap",
|
|
1435
|
+
tone.primary
|
|
1436
|
+
),
|
|
1437
|
+
children: activity.sharesLabel
|
|
1438
|
+
}
|
|
1439
|
+
)
|
|
1440
|
+
] });
|
|
1441
|
+
var TradeRow = ({
|
|
1442
|
+
activity,
|
|
1443
|
+
className,
|
|
1444
|
+
href,
|
|
1445
|
+
onClick
|
|
1446
|
+
}) => {
|
|
1447
|
+
const tone = resolveToneClasses(activity);
|
|
1448
|
+
return /* @__PURE__ */ jsx4(RowWrapper, { className: cn(className), href, onClick, children: /* @__PURE__ */ jsxs4(
|
|
1449
|
+
"div",
|
|
1450
|
+
{
|
|
1451
|
+
className: cn(
|
|
1452
|
+
"flex w-full flex-col gap-3 text-left transition-colors sm:min-h-16 sm:flex-row sm:items-center",
|
|
1453
|
+
"relative z-10"
|
|
1454
|
+
),
|
|
1455
|
+
children: [
|
|
1456
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex w-full items-center justify-between sm:hidden", children: [
|
|
1457
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
1458
|
+
/* @__PURE__ */ jsx4(VenueLogo, { venue: activity.venue, size: "small", className: "size-5 shrink-0" }),
|
|
1459
|
+
/* @__PURE__ */ jsx4(
|
|
1460
|
+
"p",
|
|
1461
|
+
{
|
|
1462
|
+
className: cn(
|
|
1463
|
+
"agg-activity-type font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
|
|
1464
|
+
tone.primary
|
|
1465
|
+
),
|
|
1466
|
+
children: activity.type
|
|
1467
|
+
}
|
|
1468
|
+
)
|
|
1469
|
+
] }),
|
|
1470
|
+
/* @__PURE__ */ jsx4("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsx4(TradeOutcomeShares, { activity, tone }) })
|
|
1471
|
+
] }),
|
|
1472
|
+
/* @__PURE__ */ jsx4(TradeTypeCell, { activity, tone }),
|
|
1473
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex w-full items-center justify-between sm:contents", children: [
|
|
1474
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
|
|
1475
|
+
/* @__PURE__ */ jsx4("div", { className: "agg-activity-image flex h-15 w-15 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx4(
|
|
1476
|
+
RemoteImage,
|
|
1477
|
+
{
|
|
1478
|
+
src: activity.thumbnailSrc,
|
|
1479
|
+
alt: "",
|
|
1480
|
+
className: "h-full w-full rounded-agg-lg",
|
|
1481
|
+
classNames: { placeholder: "rounded-agg-lg" }
|
|
1482
|
+
}
|
|
1483
|
+
) }),
|
|
1484
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
|
|
1485
|
+
/* @__PURE__ */ jsx4(
|
|
1486
|
+
"p",
|
|
1487
|
+
{
|
|
1488
|
+
className: cn(
|
|
1489
|
+
"agg-activity-market min-w-0 overflow-hidden font-agg-sans text-agg-sm leading-agg-5 font-agg-bold [display:-webkit-box] [-webkit-line-clamp:2] [-webkit-box-orient:vertical] sm:text-agg-base sm:leading-agg-6 sm:whitespace-nowrap sm:text-ellipsis sm:[-webkit-line-clamp:1] sm:[display:block]",
|
|
1490
|
+
tone.primary
|
|
1491
|
+
),
|
|
1492
|
+
children: activity.title
|
|
1493
|
+
}
|
|
1494
|
+
),
|
|
1495
|
+
/* @__PURE__ */ jsx4("div", { className: "hidden flex-wrap items-center gap-2 sm:flex sm:gap-3", children: /* @__PURE__ */ jsx4(TradeOutcomeShares, { activity, tone }) })
|
|
1496
|
+
] })
|
|
1497
|
+
] }),
|
|
1498
|
+
/* @__PURE__ */ jsx4(
|
|
1499
|
+
AmountTimeStack,
|
|
1500
|
+
{
|
|
1501
|
+
amountLabel: activity.amountLabel,
|
|
1502
|
+
timeLabel: activity.timeLabel,
|
|
1503
|
+
tone,
|
|
1504
|
+
mobile: true
|
|
1505
|
+
}
|
|
1506
|
+
)
|
|
1507
|
+
] }),
|
|
1508
|
+
/* @__PURE__ */ jsx4(
|
|
1509
|
+
AmountTimeStack,
|
|
1510
|
+
{
|
|
1511
|
+
amountLabel: activity.amountLabel,
|
|
1512
|
+
timeLabel: activity.timeLabel,
|
|
1513
|
+
tone
|
|
1514
|
+
}
|
|
1515
|
+
)
|
|
1516
|
+
]
|
|
1517
|
+
}
|
|
1518
|
+
) });
|
|
1519
|
+
};
|
|
1520
|
+
var TransferRow = ({
|
|
1521
|
+
activity,
|
|
1522
|
+
className,
|
|
1523
|
+
onClick
|
|
1524
|
+
}) => {
|
|
1525
|
+
const tone = resolveToneClasses(activity);
|
|
1526
|
+
const isDeposit = activity.kind === "deposit";
|
|
1527
|
+
const transferIconName = TRANSFER_ICON[activity.kind];
|
|
1528
|
+
return /* @__PURE__ */ jsx4("button", { type: "button", className, onClick, children: /* @__PURE__ */ jsxs4(
|
|
1529
|
+
"div",
|
|
1530
|
+
{
|
|
1531
|
+
className: cn(
|
|
1532
|
+
"flex w-full flex-col gap-3 text-left transition-colors sm:min-h-16 sm:flex-row sm:items-center",
|
|
1533
|
+
"relative z-10"
|
|
1534
|
+
),
|
|
1535
|
+
children: [
|
|
1536
|
+
/* @__PURE__ */ jsx4(TransferTypeCell, { activity, tone }),
|
|
1537
|
+
/* @__PURE__ */ jsx4("div", { className: "flex w-full items-center justify-between sm:hidden", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
1538
|
+
/* @__PURE__ */ jsx4(Icon, { name: transferIconName, size: "small", className: "shrink-0 text-agg-foreground" }),
|
|
1539
|
+
/* @__PURE__ */ jsx4(
|
|
1540
|
+
"p",
|
|
1541
|
+
{
|
|
1542
|
+
className: cn(
|
|
1543
|
+
"font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
|
|
1544
|
+
tone.primary
|
|
1545
|
+
),
|
|
1546
|
+
children: activity.type
|
|
1547
|
+
}
|
|
1548
|
+
)
|
|
1549
|
+
] }) }),
|
|
1550
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex w-full items-center justify-between sm:contents", children: [
|
|
1551
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
|
|
1552
|
+
/* @__PURE__ */ jsx4("div", { className: "agg-activity-deposit-square hidden h-15 w-15 shrink-0 items-center justify-center rounded-agg-lg bg-agg-secondary-hover sm:flex", children: isDeposit ? /* @__PURE__ */ jsx4(Icon, { name: "badge-check-thin", size: "medium", className: "text-agg-muted-foreground" }) : /* @__PURE__ */ jsx4(Icon, { name: transferIconName, size: "medium", className: "text-agg-foreground" }) }),
|
|
1553
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-1", children: [
|
|
1554
|
+
/* @__PURE__ */ jsx4(
|
|
1555
|
+
"p",
|
|
1556
|
+
{
|
|
1557
|
+
className: cn(
|
|
1558
|
+
"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-bold sm:text-agg-base sm:leading-agg-6",
|
|
1559
|
+
tone.primary
|
|
1560
|
+
),
|
|
1561
|
+
children: isDeposit ? "Successful deposit" : activity.title
|
|
1562
|
+
}
|
|
1563
|
+
),
|
|
1564
|
+
/* @__PURE__ */ jsx4(
|
|
1565
|
+
"p",
|
|
1566
|
+
{
|
|
1567
|
+
className: cn(
|
|
1568
|
+
"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
|
|
1569
|
+
tone.meta
|
|
1570
|
+
),
|
|
1571
|
+
children: activity.subtitleLabel
|
|
1572
|
+
}
|
|
1573
|
+
)
|
|
1574
|
+
] })
|
|
1575
|
+
] }),
|
|
1576
|
+
/* @__PURE__ */ jsx4(
|
|
1577
|
+
AmountTimeStack,
|
|
1578
|
+
{
|
|
1579
|
+
amountLabel: activity.amountLabel,
|
|
1580
|
+
timeLabel: activity.timeLabel,
|
|
1581
|
+
tone,
|
|
1582
|
+
mobile: true
|
|
1583
|
+
}
|
|
1584
|
+
)
|
|
1585
|
+
] }),
|
|
1586
|
+
/* @__PURE__ */ jsx4(
|
|
1587
|
+
AmountTimeStack,
|
|
1588
|
+
{
|
|
1589
|
+
amountLabel: activity.amountLabel,
|
|
1590
|
+
timeLabel: activity.timeLabel,
|
|
1591
|
+
tone
|
|
1592
|
+
}
|
|
1593
|
+
)
|
|
1594
|
+
]
|
|
1595
|
+
}
|
|
1596
|
+
) });
|
|
1597
|
+
};
|
|
1598
|
+
var ActivityRow = ({ activity, href, onClick }) => {
|
|
1599
|
+
const handleClick = () => {
|
|
1600
|
+
onClick == null ? void 0 : onClick(activity);
|
|
1601
|
+
};
|
|
1602
|
+
const sharedClassName = cn(
|
|
1603
|
+
"agg-activity-row",
|
|
1604
|
+
"relative cursor-pointer block",
|
|
1605
|
+
"before:absolute before:-top-2 before:-left-2 before:-bottom-2 before:-right-2 before:z-0",
|
|
1606
|
+
"before:transition-all before:duration-300 before:opacity-0 hover:before:opacity-100",
|
|
1607
|
+
"before:bg-agg-secondary-hover before:rounded-agg-xl"
|
|
1608
|
+
);
|
|
1609
|
+
if (activity.kind === "trade") {
|
|
1610
|
+
return /* @__PURE__ */ jsx4(TradeRow, { activity, className: sharedClassName, href, onClick: handleClick });
|
|
1611
|
+
}
|
|
1612
|
+
return /* @__PURE__ */ jsx4(TransferRow, { activity, className: sharedClassName, onClick: handleClick });
|
|
1613
|
+
};
|
|
1614
|
+
ActivityRow.displayName = "ActivityRow";
|
|
1615
|
+
|
|
1616
|
+
// src/pages/user-profile/components/empty-state.tsx
|
|
1617
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1618
|
+
var EmptyState = ({ title, description, className }) => {
|
|
1619
|
+
return /* @__PURE__ */ jsx5(
|
|
1620
|
+
"div",
|
|
1621
|
+
{
|
|
1622
|
+
className: cn("flex flex-col items-center justify-center gap-8 p-10", className),
|
|
1623
|
+
role: "status",
|
|
1624
|
+
"aria-live": "polite",
|
|
1625
|
+
children: /* @__PURE__ */ jsxs5("div", { className: "flex flex-col items-center gap-5", children: [
|
|
1626
|
+
/* @__PURE__ */ jsx5(SearchEmptyIcon, { className: "h-10 w-10 text-agg-muted-foreground", "aria-hidden": true }),
|
|
1627
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex flex-col items-center gap-1 text-center text-agg-foreground", children: [
|
|
1628
|
+
/* @__PURE__ */ jsx5("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold", children: title }),
|
|
1629
|
+
description ? /* @__PURE__ */ jsx5("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal", children: description }) : null
|
|
1630
|
+
] })
|
|
1631
|
+
] })
|
|
1632
|
+
}
|
|
1633
|
+
);
|
|
1634
|
+
};
|
|
1635
|
+
EmptyState.displayName = "EmptyState";
|
|
1636
|
+
|
|
1637
|
+
// src/pages/user-profile/components/position-row.tsx
|
|
1638
|
+
import { optimizedImageUrl, useLabels as useLabels3 } from "@agg-build/hooks";
|
|
1639
|
+
import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1640
|
+
var resolveBadge = (position, labels) => {
|
|
1641
|
+
if (position.marketStatus === "resolved") {
|
|
1642
|
+
if (position.winner === true) return { label: labels.won, tone: "won" };
|
|
1643
|
+
if (position.winner === false) return { label: labels.lost, tone: "lost" };
|
|
1644
|
+
return { label: labels.resolved, tone: "resolved" };
|
|
1645
|
+
}
|
|
1646
|
+
if (position.marketStatus === "closed") {
|
|
1647
|
+
return { label: labels.marketClosed, tone: "market-closed" };
|
|
1648
|
+
}
|
|
1649
|
+
if (position.status === "closed") {
|
|
1650
|
+
return { label: labels.closed, tone: "closed" };
|
|
1651
|
+
}
|
|
1652
|
+
return null;
|
|
1653
|
+
};
|
|
1654
|
+
var isMarketResolved = (position) => position.marketStatus === "resolved";
|
|
1655
|
+
var badgeToneClass = (tone) => {
|
|
1656
|
+
switch (tone) {
|
|
1657
|
+
case "won":
|
|
1658
|
+
return "bg-agg-success/10 text-agg-success";
|
|
1659
|
+
case "lost":
|
|
1660
|
+
return "bg-agg-error/10 text-agg-error";
|
|
1661
|
+
case "resolved":
|
|
1662
|
+
case "market-closed":
|
|
1663
|
+
case "closed":
|
|
1664
|
+
return "bg-agg-secondary-hover text-agg-muted-foreground";
|
|
1665
|
+
}
|
|
1666
|
+
};
|
|
1667
|
+
var resolveClosedReturnToneClass = (position) => {
|
|
1668
|
+
var _a;
|
|
1669
|
+
if (!isMarketResolved(position)) return "text-agg-muted-foreground";
|
|
1670
|
+
if (position.winner === true) return "text-agg-success";
|
|
1671
|
+
if (position.winner === false) return "text-agg-error";
|
|
1672
|
+
const returnLabel = ((_a = position.closedReturnLabel) != null ? _a : "").trim();
|
|
1673
|
+
if (returnLabel.startsWith("+")) return "text-agg-success";
|
|
1674
|
+
if (returnLabel.startsWith("-")) return "text-agg-error";
|
|
1675
|
+
return "text-agg-muted-foreground";
|
|
1676
|
+
};
|
|
1677
|
+
var shouldUseNativeLinkNavigation2 = (event) => {
|
|
1678
|
+
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
|
|
1679
|
+
};
|
|
1680
|
+
var OutcomePill = ({ label }) => /* @__PURE__ */ jsx6("span", { className: "agg-position-outcome inline-flex items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ jsx6("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: label }) });
|
|
1681
|
+
var PositionBadgeNode = ({ badge }) => {
|
|
1682
|
+
if (!badge) return null;
|
|
1683
|
+
return /* @__PURE__ */ jsx6(
|
|
1684
|
+
"span",
|
|
1685
|
+
{
|
|
1686
|
+
className: cn(
|
|
1687
|
+
"agg-position-badge inline-flex items-center rounded-full px-3 py-[4px]",
|
|
1688
|
+
"font-agg-sans text-agg-xs leading-agg-4 font-agg-normal whitespace-nowrap",
|
|
1689
|
+
badgeToneClass(badge.tone)
|
|
1690
|
+
),
|
|
1691
|
+
children: badge.label
|
|
1692
|
+
}
|
|
1693
|
+
);
|
|
1694
|
+
};
|
|
1695
|
+
var VenueShares = ({
|
|
1696
|
+
position,
|
|
1697
|
+
className,
|
|
1698
|
+
keyPrefix
|
|
1699
|
+
}) => /* @__PURE__ */ jsx6("div", { className, children: position.venueShareBreakdown.map((row, index) => /* @__PURE__ */ jsxs6(
|
|
1700
|
+
"div",
|
|
1701
|
+
{
|
|
1702
|
+
className: "flex items-center gap-1",
|
|
1703
|
+
children: [
|
|
1704
|
+
/* @__PURE__ */ jsx6(VenueLogo, { venue: row.venue, size: "small", className: "size-4 shrink-0" }),
|
|
1705
|
+
/* @__PURE__ */ jsx6("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: row.sharesLabel })
|
|
1706
|
+
]
|
|
1707
|
+
},
|
|
1708
|
+
`${keyPrefix}-${row.venue}-${row.sharesLabel}-${String(index)}`
|
|
1709
|
+
)) });
|
|
1710
|
+
var ClosedResultBadge = ({
|
|
1711
|
+
position,
|
|
1712
|
+
labels
|
|
1713
|
+
}) => {
|
|
1714
|
+
if (!isMarketResolved(position)) return null;
|
|
1715
|
+
if (position.winner == null) return null;
|
|
1716
|
+
const isWon = position.winner === true;
|
|
1717
|
+
return /* @__PURE__ */ jsxs6(
|
|
1718
|
+
"span",
|
|
1719
|
+
{
|
|
1720
|
+
className: cn(
|
|
1721
|
+
"inline-flex items-center gap-1 rounded-[4px] border px-2 py-[2px]",
|
|
1722
|
+
isWon ? "border-agg-success/50 bg-agg-success/10 text-agg-success" : "border-agg-error/50 bg-agg-error/10 text-agg-error"
|
|
1723
|
+
),
|
|
1724
|
+
children: [
|
|
1725
|
+
/* @__PURE__ */ jsx6(Icon, { name: isWon ? "check-circle" : "cross-circle", size: "small", className: "size-2.5" }),
|
|
1726
|
+
/* @__PURE__ */ jsx6("span", { className: "font-agg-sans text-[10px] leading-agg-14 font-agg-bold uppercase", children: isWon ? labels.won : labels.lost })
|
|
1727
|
+
]
|
|
1728
|
+
}
|
|
1729
|
+
);
|
|
1730
|
+
};
|
|
1731
|
+
var ClosedClaimState = ({
|
|
1732
|
+
claimStatus,
|
|
1733
|
+
onClaim,
|
|
1734
|
+
isClaiming,
|
|
1735
|
+
labels
|
|
1736
|
+
}) => {
|
|
1737
|
+
if (claimStatus === "eligible") {
|
|
1738
|
+
return /* @__PURE__ */ jsxs6(
|
|
1739
|
+
"button",
|
|
1740
|
+
{
|
|
1741
|
+
type: "button",
|
|
1742
|
+
className: "inline-flex h-8 items-center justify-center gap-1 rounded-agg-full bg-agg-primary px-4 font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-white cursor-pointer disabled:cursor-not-allowed disabled:opacity-80",
|
|
1743
|
+
onClick: (event) => {
|
|
1744
|
+
event.preventDefault();
|
|
1745
|
+
event.stopPropagation();
|
|
1746
|
+
onClaim == null ? void 0 : onClaim();
|
|
1747
|
+
},
|
|
1748
|
+
disabled: isClaiming,
|
|
1749
|
+
"aria-busy": isClaiming || void 0,
|
|
1750
|
+
children: [
|
|
1751
|
+
isClaiming ? /* @__PURE__ */ jsx6(LoadingIcon, { size: "small", className: "text-white" }) : null,
|
|
1752
|
+
/* @__PURE__ */ jsx6("span", { children: labels.claim })
|
|
1753
|
+
]
|
|
1754
|
+
}
|
|
1755
|
+
);
|
|
1756
|
+
}
|
|
1757
|
+
if (claimStatus === "pending") {
|
|
1758
|
+
return /* @__PURE__ */ jsx6("span", { className: "font-agg-sans text-agg-xs leading-agg-4 font-agg-bold uppercase text-agg-muted-foreground", children: labels.pending });
|
|
1759
|
+
}
|
|
1760
|
+
if (claimStatus === "redeemed") {
|
|
1761
|
+
return /* @__PURE__ */ jsx6("span", { className: "font-agg-sans text-agg-xs leading-agg-4 font-agg-bold uppercase text-agg-muted-foreground", children: labels.claimed });
|
|
1762
|
+
}
|
|
1763
|
+
return null;
|
|
1764
|
+
};
|
|
1765
|
+
var PositionRow = ({
|
|
1766
|
+
position,
|
|
1767
|
+
variant,
|
|
1768
|
+
href,
|
|
1769
|
+
onClick,
|
|
1770
|
+
onClaim,
|
|
1771
|
+
isClaiming = false
|
|
1772
|
+
}) => {
|
|
1773
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1774
|
+
const labels = useLabels3().userProfile.positions;
|
|
1775
|
+
const resolvedVariant = variant != null ? variant : position.status === "closed" ? "closed" : "active";
|
|
1776
|
+
const isClosed = resolvedVariant === "closed";
|
|
1777
|
+
const badge = resolveBadge(position, labels);
|
|
1778
|
+
const mobileValueLabel = isClosed ? (_a = position.closedAmountWonLabel) != null ? _a : position.valueLabel : position.valueLabel;
|
|
1779
|
+
const mobileSecondaryLabel = isClosed ? (_b = position.closedReturnLabel) != null ? _b : position.pnlLabel : position.pnlLabel;
|
|
1780
|
+
const closedReturnToneClass = resolveClosedReturnToneClass(position);
|
|
1781
|
+
const mobileSecondaryToneClass = isClosed ? closedReturnToneClass : position.isPnlPositive ? "text-agg-success" : "text-agg-error";
|
|
1782
|
+
const handleAnchorClick = (event) => {
|
|
1783
|
+
if (shouldUseNativeLinkNavigation2(event)) return;
|
|
1784
|
+
if (!onClick) return;
|
|
1785
|
+
event.preventDefault();
|
|
1786
|
+
onClick(position);
|
|
1787
|
+
};
|
|
1788
|
+
const handleAnchorAuxClick = (event) => {
|
|
1789
|
+
if (event.button !== 1) return;
|
|
1790
|
+
};
|
|
1791
|
+
const handleDivClick = () => {
|
|
1792
|
+
onClick == null ? void 0 : onClick(position);
|
|
1793
|
+
};
|
|
1794
|
+
const sharedClassName = cn(
|
|
1795
|
+
"agg-position-row",
|
|
1796
|
+
"relative cursor-pointer block",
|
|
1797
|
+
"before:absolute before:-top-2 before:-left-2 before:-bottom-2 before:-right-2 before:z-0",
|
|
1798
|
+
"before:transition-all before:duration-300 before:opacity-0 hover:before:opacity-100",
|
|
1799
|
+
"before:bg-agg-secondary-hover before:rounded-agg-xl"
|
|
1800
|
+
);
|
|
1801
|
+
const Wrapper = href ? "a" : "div";
|
|
1802
|
+
const wrapperProps = href ? {
|
|
1803
|
+
href,
|
|
1804
|
+
onClick: handleAnchorClick,
|
|
1805
|
+
onAuxClick: handleAnchorAuxClick
|
|
1806
|
+
} : {
|
|
1807
|
+
role: "button",
|
|
1808
|
+
tabIndex: 0,
|
|
1809
|
+
onClick: handleDivClick,
|
|
1810
|
+
onKeyDown: (event) => {
|
|
1811
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
1812
|
+
event.preventDefault();
|
|
1813
|
+
handleDivClick();
|
|
1814
|
+
}
|
|
1815
|
+
};
|
|
1816
|
+
return /* @__PURE__ */ jsx6(Wrapper, __spreadProps(__spreadValues({ className: sharedClassName }, wrapperProps), { children: /* @__PURE__ */ jsxs6(
|
|
1817
|
+
"div",
|
|
1818
|
+
{
|
|
1819
|
+
className: cn(
|
|
1820
|
+
"flex w-full flex-col gap-3 text-left transition-colors md:min-h-16 md:flex-row md:items-center",
|
|
1821
|
+
isClosed ? "md:gap-10" : "md:gap-6",
|
|
1822
|
+
"relative z-10"
|
|
1823
|
+
),
|
|
1824
|
+
children: [
|
|
1825
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex w-full items-center justify-between gap-3 md:w-auto md:flex-1 md:min-w-0 md:justify-start md:gap-4", children: [
|
|
1826
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex min-w-0 flex-1 items-center gap-3 md:gap-4", children: [
|
|
1827
|
+
/* @__PURE__ */ jsx6("div", { className: "agg-position-image flex h-10 w-10 shrink-0 items-center justify-center md:h-15 md:w-15", children: /* @__PURE__ */ jsx6(
|
|
1828
|
+
RemoteImage,
|
|
1829
|
+
{
|
|
1830
|
+
src: optimizedImageUrl(position.thumbnailSrc, 60),
|
|
1831
|
+
alt: "",
|
|
1832
|
+
className: "h-full w-full rounded-agg-sm object-cover"
|
|
1833
|
+
}
|
|
1834
|
+
) }),
|
|
1835
|
+
/* @__PURE__ */ jsxs6("div", { className: "min-w-0 flex flex-1 flex-col", children: [
|
|
1836
|
+
/* @__PURE__ */ jsx6("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:text-agg-base md:leading-agg-6 md:whitespace-nowrap md:text-ellipsis md:[-webkit-line-clamp:1] md:[display:block]", children: position.title }),
|
|
1837
|
+
/* @__PURE__ */ jsxs6("div", { className: "hidden min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-2 pt-1 md:flex", children: [
|
|
1838
|
+
/* @__PURE__ */ jsx6(OutcomePill, { label: position.outcomeLabel }),
|
|
1839
|
+
/* @__PURE__ */ jsx6(
|
|
1840
|
+
VenueShares,
|
|
1841
|
+
{
|
|
1842
|
+
position,
|
|
1843
|
+
keyPrefix: "desktop",
|
|
1844
|
+
className: "agg-position-venues flex min-w-0 flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2"
|
|
1845
|
+
}
|
|
1846
|
+
)
|
|
1847
|
+
] })
|
|
1848
|
+
] })
|
|
1849
|
+
] }),
|
|
1850
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-end justify-center gap-1 whitespace-nowrap md:hidden", children: [
|
|
1851
|
+
/* @__PURE__ */ jsx6("p", { className: "agg-position-value font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground", children: mobileValueLabel }),
|
|
1852
|
+
/* @__PURE__ */ jsx6(
|
|
1853
|
+
"p",
|
|
1854
|
+
{
|
|
1855
|
+
className: cn(
|
|
1856
|
+
"agg-position-pnl font-agg-sans text-agg-xs leading-agg-4 font-agg-normal",
|
|
1857
|
+
mobileSecondaryToneClass
|
|
1858
|
+
),
|
|
1859
|
+
children: mobileSecondaryLabel
|
|
1860
|
+
}
|
|
1861
|
+
)
|
|
1862
|
+
] })
|
|
1863
|
+
] }),
|
|
1864
|
+
isClosed ? /* @__PURE__ */ jsxs6("div", { className: "flex w-full items-center gap-3 md:hidden", children: [
|
|
1865
|
+
/* @__PURE__ */ jsx6(OutcomePill, { label: position.outcomeLabel }),
|
|
1866
|
+
/* @__PURE__ */ jsx6(PositionBadgeNode, { badge }),
|
|
1867
|
+
/* @__PURE__ */ jsxs6("div", { className: "ml-auto flex items-baseline gap-3", children: [
|
|
1868
|
+
/* @__PURE__ */ jsx6("span", { className: "font-agg-sans text-agg-lg leading-agg-7 font-agg-normal text-agg-foreground", children: (_c = position.closedTotalTradedLabel) != null ? _c : position.valueLabel }),
|
|
1869
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1.5", children: [
|
|
1870
|
+
/* @__PURE__ */ jsx6("span", { className: "font-agg-sans text-agg-lg leading-agg-7 font-agg-normal text-agg-foreground", children: (_d = position.closedAmountWonLabel) != null ? _d : position.valueLabel }),
|
|
1871
|
+
/* @__PURE__ */ jsx6(ClosedResultBadge, { position, labels })
|
|
1872
|
+
] })
|
|
1873
|
+
] })
|
|
1874
|
+
] }) : /* @__PURE__ */ jsxs6("div", { className: "flex w-full items-baseline gap-3 md:hidden", children: [
|
|
1875
|
+
/* @__PURE__ */ jsx6(OutcomePill, { label: position.outcomeLabel }),
|
|
1876
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-3", children: [
|
|
1877
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-baseline gap-1.5", children: [
|
|
1878
|
+
/* @__PURE__ */ jsx6("span", { className: "font-agg-sans text-agg-lg leading-agg-7 font-agg-normal text-agg-foreground", children: position.averageLabel }),
|
|
1879
|
+
/* @__PURE__ */ jsx6("span", { className: "inline-flex md:hidden font-agg-sans text-agg-2xs leading-agg-14 font-agg-bold uppercase text-agg-muted-foreground", children: "AVG." }),
|
|
1880
|
+
/* @__PURE__ */ jsx6("span", { className: "hidden md:inline-flex font-agg-sans text-agg-2xs leading-agg-14 font-agg-bold uppercase text-agg-muted-foreground", children: "Average" })
|
|
1881
|
+
] }),
|
|
1882
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-baseline gap-1.5", children: [
|
|
1883
|
+
/* @__PURE__ */ jsx6("span", { className: "font-agg-sans text-agg-lg leading-agg-7 font-agg-normal text-agg-foreground", children: position.currentLabel }),
|
|
1884
|
+
/* @__PURE__ */ jsx6("span", { className: "inline-flex md:hidden font-agg-sans text-agg-2xs leading-agg-14 font-agg-bold uppercase text-agg-muted-foreground", children: "CUR." }),
|
|
1885
|
+
/* @__PURE__ */ jsx6("span", { className: "hidden md:inline-flex font-agg-sans text-agg-2xs leading-agg-14 font-agg-bold uppercase text-agg-muted-foreground", children: "Current" })
|
|
1886
|
+
] })
|
|
1887
|
+
] })
|
|
1888
|
+
] }),
|
|
1889
|
+
/* @__PURE__ */ jsx6(
|
|
1890
|
+
VenueShares,
|
|
1891
|
+
{
|
|
1892
|
+
position,
|
|
1893
|
+
keyPrefix: "mobile",
|
|
1894
|
+
className: "agg-position-venues flex min-w-0 flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2 md:hidden"
|
|
1895
|
+
}
|
|
1896
|
+
),
|
|
1897
|
+
isClosed ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
1898
|
+
/* @__PURE__ */ jsx6("p", { className: "hidden w-[160px] shrink-0 text-agg-base leading-agg-6 font-agg-bold text-agg-foreground md:block", children: (_e = position.closedTotalTradedLabel) != null ? _e : position.valueLabel }),
|
|
1899
|
+
/* @__PURE__ */ jsxs6("div", { className: "hidden w-[160px] shrink-0 flex-col items-start gap-1 md:flex", children: [
|
|
1900
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
|
|
1901
|
+
/* @__PURE__ */ jsx6("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: (_f = position.closedAmountWonLabel) != null ? _f : position.valueLabel }),
|
|
1902
|
+
/* @__PURE__ */ jsx6(ClosedResultBadge, { position, labels })
|
|
1903
|
+
] }),
|
|
1904
|
+
/* @__PURE__ */ jsx6(
|
|
1905
|
+
"p",
|
|
1906
|
+
{
|
|
1907
|
+
className: cn(
|
|
1908
|
+
"font-agg-sans text-agg-base leading-agg-6 font-agg-normal",
|
|
1909
|
+
closedReturnToneClass
|
|
1910
|
+
),
|
|
1911
|
+
children: (_g = position.closedReturnLabel) != null ? _g : position.pnlLabel
|
|
1912
|
+
}
|
|
1913
|
+
)
|
|
1914
|
+
] }),
|
|
1915
|
+
/* @__PURE__ */ jsx6("div", { className: "hidden min-w-[72px] shrink-0 items-center justify-center md:flex", children: /* @__PURE__ */ jsx6(
|
|
1916
|
+
ClosedClaimState,
|
|
1917
|
+
{
|
|
1918
|
+
claimStatus: position.closedClaimStatus,
|
|
1919
|
+
onClaim: onClaim ? () => void onClaim(position) : void 0,
|
|
1920
|
+
isClaiming,
|
|
1921
|
+
labels
|
|
1922
|
+
}
|
|
1923
|
+
) }),
|
|
1924
|
+
/* @__PURE__ */ jsx6("div", { className: "hidden w-11 shrink-0 items-center justify-end md:flex", children: /* @__PURE__ */ jsx6(
|
|
1925
|
+
Icon,
|
|
1926
|
+
{
|
|
1927
|
+
name: "chevron-right",
|
|
1928
|
+
size: "small",
|
|
1929
|
+
className: "size-5 shrink-0 text-agg-muted-foreground"
|
|
1930
|
+
}
|
|
1931
|
+
) })
|
|
1932
|
+
] }) : /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
1933
|
+
/* @__PURE__ */ jsx6("p", { className: "agg-position-average hidden w-[80px] shrink-0 agg-type-title text-agg-foreground md:block", children: position.averageLabel }),
|
|
1934
|
+
/* @__PURE__ */ jsx6("p", { className: "agg-position-current hidden w-[80px] shrink-0 agg-type-title text-agg-foreground md:block", children: position.currentLabel }),
|
|
1935
|
+
/* @__PURE__ */ jsxs6("div", { className: "hidden w-[120px] shrink-0 flex-col items-end justify-center gap-1 whitespace-nowrap md:flex", children: [
|
|
1936
|
+
/* @__PURE__ */ jsx6("p", { className: "agg-position-value font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: position.valueLabel }),
|
|
1937
|
+
/* @__PURE__ */ jsx6(
|
|
1938
|
+
"p",
|
|
1939
|
+
{
|
|
1940
|
+
className: cn(
|
|
1941
|
+
"agg-position-pnl font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
|
|
1942
|
+
position.isPnlPositive ? "text-agg-success" : "text-agg-error"
|
|
1943
|
+
),
|
|
1944
|
+
children: position.pnlLabel
|
|
1945
|
+
}
|
|
1946
|
+
)
|
|
1947
|
+
] }),
|
|
1948
|
+
/* @__PURE__ */ jsx6("div", { className: "hidden w-11 shrink-0 items-center justify-end md:flex", children: /* @__PURE__ */ jsx6(
|
|
1949
|
+
Icon,
|
|
1950
|
+
{
|
|
1951
|
+
name: "chevron-right",
|
|
1952
|
+
size: "small",
|
|
1953
|
+
className: "size-5 shrink-0 text-agg-muted-foreground"
|
|
1954
|
+
}
|
|
1955
|
+
) })
|
|
1956
|
+
] })
|
|
1957
|
+
]
|
|
1958
|
+
}
|
|
1959
|
+
) }));
|
|
1960
|
+
};
|
|
1961
|
+
PositionRow.displayName = "PositionRow";
|
|
1962
|
+
|
|
1963
|
+
// src/pages/user-profile/components/positions-activity.tsx
|
|
1964
|
+
import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1965
|
+
var tabItems = [
|
|
1966
|
+
{ value: USER_PROFILE_TAB_POSITIONS, label: "Positions" },
|
|
1967
|
+
// Open orders is intentionally hidden from the user-profile tab group.
|
|
1968
|
+
// Restore by re-adding USER_PROFILE_TAB_OPEN_ORDERS here and the renderer below.
|
|
1969
|
+
{ value: USER_PROFILE_TAB_ACTIVITY, label: "Activity" }
|
|
1970
|
+
];
|
|
1971
|
+
var TabRowsSkeleton = ({ ariaLabel }) => /* @__PURE__ */ jsx7("div", { role: "status", "aria-label": ariaLabel, className: "flex flex-col gap-3 sm:gap-4", children: Array.from({ length: 3 }).map((_, index, acc) => /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
1972
|
+
/* @__PURE__ */ jsx7("div", { className: "h-14 rounded-agg-sm bg-agg-secondary-hover/80 sm:h-16" }, index),
|
|
1973
|
+
index < acc.length - 1 ? /* @__PURE__ */ jsx7("div", { className: "agg-position-divider h-px w-full shrink-0 bg-agg-separator", "aria-hidden": true }) : null
|
|
1974
|
+
] }, index)) });
|
|
1975
|
+
var PositionsActivity = ({
|
|
1976
|
+
activePositions = [],
|
|
1977
|
+
closedPositions = [],
|
|
1978
|
+
activities = [],
|
|
1979
|
+
onPositionClick,
|
|
1980
|
+
getPositionHref,
|
|
1981
|
+
onClaim,
|
|
1982
|
+
claimingPositionKeys,
|
|
1983
|
+
onActivityClick,
|
|
1984
|
+
getActivityHref,
|
|
1985
|
+
isLoadingPositions = false,
|
|
1986
|
+
isLoadingActivities = false,
|
|
1987
|
+
positionsError = false,
|
|
1988
|
+
activitiesError = false,
|
|
1989
|
+
hasMoreActivePositions = false,
|
|
1990
|
+
isLoadingMoreActivePositions = false,
|
|
1991
|
+
onLoadMoreActivePositions,
|
|
1992
|
+
hasMoreClosedPositions = false,
|
|
1993
|
+
isLoadingMoreClosedPositions = false,
|
|
1994
|
+
onLoadMoreClosedPositions,
|
|
1995
|
+
onPositionFilterChange,
|
|
1996
|
+
hasMoreActivities = false,
|
|
1997
|
+
isLoadingMoreActivities = false,
|
|
1998
|
+
onLoadMoreActivities,
|
|
1999
|
+
tab,
|
|
2000
|
+
onTabChange,
|
|
2001
|
+
initialPositionFilter = "active",
|
|
2002
|
+
className
|
|
2003
|
+
}) => {
|
|
2004
|
+
const positionsLabels = useLabels4().userProfile.positions;
|
|
2005
|
+
const isTabControlled = tab !== void 0;
|
|
2006
|
+
const [internalActiveTab, setInternalActiveTab] = useState5(
|
|
2007
|
+
tab != null ? tab : USER_PROFILE_TAB_POSITIONS
|
|
2008
|
+
);
|
|
2009
|
+
const activeTab = isTabControlled ? tab : internalActiveTab;
|
|
2010
|
+
const handleTabChange = (next) => {
|
|
2011
|
+
if (!isTabControlled) setInternalActiveTab(next);
|
|
2012
|
+
onTabChange == null ? void 0 : onTabChange(next);
|
|
2013
|
+
};
|
|
2014
|
+
const [positionFilter, setPositionFilter] = useState5(initialPositionFilter);
|
|
2015
|
+
const [searchValue, setSearchValue] = useState5("");
|
|
2016
|
+
const [isSearchFocused, setIsSearchFocused] = useState5(false);
|
|
2017
|
+
const positionsLoadMoreRef = useRef3(null);
|
|
2018
|
+
const activitiesLoadMoreRef = useRef3(null);
|
|
2019
|
+
const rowsScrollRef = useRef3(null);
|
|
2020
|
+
const isPositionsTab = activeTab === USER_PROFILE_TAB_POSITIONS;
|
|
2021
|
+
const isActivityTab = activeTab === USER_PROFILE_TAB_ACTIVITY;
|
|
2022
|
+
const isClosedPositionsFilter = isPositionsTab && positionFilter === "closed";
|
|
2023
|
+
const positionsForCurrentFilter = positionFilter === "active" ? activePositions : closedPositions;
|
|
2024
|
+
const filteredPositions = useMemo2(() => {
|
|
2025
|
+
if (!searchValue.trim()) return positionsForCurrentFilter;
|
|
2026
|
+
const q = searchValue.toLowerCase();
|
|
2027
|
+
return positionsForCurrentFilter.filter((p) => p.title.toLowerCase().includes(q));
|
|
2028
|
+
}, [positionsForCurrentFilter, searchValue]);
|
|
2029
|
+
const handlePositionFilterChange = (filter) => {
|
|
2030
|
+
setPositionFilter(filter);
|
|
2031
|
+
onPositionFilterChange == null ? void 0 : onPositionFilterChange(filter);
|
|
2032
|
+
};
|
|
2033
|
+
const hasMorePositions = positionFilter === "active" ? hasMoreActivePositions : hasMoreClosedPositions;
|
|
2034
|
+
const isLoadingMorePositions = positionFilter === "active" ? isLoadingMoreActivePositions : isLoadingMoreClosedPositions;
|
|
2035
|
+
const loadMorePositions = positionFilter === "active" ? onLoadMoreActivePositions : onLoadMoreClosedPositions;
|
|
2036
|
+
const filteredActivities = activities;
|
|
2037
|
+
const searchResults = useMemo2(() => {
|
|
2038
|
+
if (!isPositionsTab || !searchValue.trim()) return [];
|
|
2039
|
+
return filteredPositions.slice(0, 5).map((position) => ({
|
|
2040
|
+
id: position.id,
|
|
2041
|
+
title: position.title,
|
|
2042
|
+
thumbnailSrc: position.thumbnailSrc,
|
|
2043
|
+
metaPrimary: position.outcomeLabel,
|
|
2044
|
+
metaSecondary: position.valueLabel,
|
|
2045
|
+
raw: position
|
|
2046
|
+
}));
|
|
2047
|
+
}, [filteredPositions, isPositionsTab, searchValue]);
|
|
2048
|
+
const handleSearchChange = (event) => {
|
|
2049
|
+
setSearchValue(event.target.value);
|
|
2050
|
+
};
|
|
2051
|
+
useEffect3(() => {
|
|
2052
|
+
if (isPositionsTab) return;
|
|
2053
|
+
setIsSearchFocused(false);
|
|
2054
|
+
}, [isPositionsTab]);
|
|
2055
|
+
useEffect3(() => {
|
|
2056
|
+
if (!isPositionsTab || !hasMorePositions) return;
|
|
2057
|
+
const target = positionsLoadMoreRef.current;
|
|
2058
|
+
if (!target || !loadMorePositions) return;
|
|
2059
|
+
const observer = new IntersectionObserver(
|
|
2060
|
+
(entries) => {
|
|
2061
|
+
const entry = entries[0];
|
|
2062
|
+
if (!(entry == null ? void 0 : entry.isIntersecting)) return;
|
|
2063
|
+
if (isLoadingPositions || isLoadingMorePositions || !hasMorePositions) return;
|
|
2064
|
+
loadMorePositions();
|
|
2065
|
+
},
|
|
2066
|
+
{ root: rowsScrollRef.current, rootMargin: "60px 0px" }
|
|
2067
|
+
);
|
|
2068
|
+
observer.observe(target);
|
|
2069
|
+
return () => observer.disconnect();
|
|
2070
|
+
}, [
|
|
2071
|
+
hasMorePositions,
|
|
2072
|
+
isLoadingMorePositions,
|
|
2073
|
+
isLoadingPositions,
|
|
2074
|
+
isPositionsTab,
|
|
2075
|
+
loadMorePositions
|
|
2076
|
+
]);
|
|
2077
|
+
useEffect3(() => {
|
|
2078
|
+
if (!isActivityTab || !hasMoreActivities) return;
|
|
2079
|
+
const target = activitiesLoadMoreRef.current;
|
|
2080
|
+
if (!target || !onLoadMoreActivities) return;
|
|
2081
|
+
const observer = new IntersectionObserver(
|
|
2082
|
+
(entries) => {
|
|
2083
|
+
const entry = entries[0];
|
|
2084
|
+
if (!(entry == null ? void 0 : entry.isIntersecting)) return;
|
|
2085
|
+
if (isLoadingActivities || isLoadingMoreActivities || !hasMoreActivities) return;
|
|
2086
|
+
onLoadMoreActivities();
|
|
2087
|
+
},
|
|
2088
|
+
{ root: rowsScrollRef.current, rootMargin: "60px 0px" }
|
|
2089
|
+
);
|
|
2090
|
+
observer.observe(target);
|
|
2091
|
+
return () => observer.disconnect();
|
|
2092
|
+
}, [
|
|
2093
|
+
hasMoreActivities,
|
|
2094
|
+
isActivityTab,
|
|
2095
|
+
isLoadingActivities,
|
|
2096
|
+
isLoadingMoreActivities,
|
|
2097
|
+
onLoadMoreActivities
|
|
2098
|
+
]);
|
|
2099
|
+
return /* @__PURE__ */ jsxs7(
|
|
2100
|
+
"div",
|
|
2101
|
+
{
|
|
2102
|
+
className: cn(
|
|
2103
|
+
"group/agg-positions-activity",
|
|
2104
|
+
"flex flex-col items-start overflow-clip rounded-agg-xl border border-agg-separator bg-agg-secondary",
|
|
2105
|
+
className
|
|
2106
|
+
),
|
|
2107
|
+
children: [
|
|
2108
|
+
/* @__PURE__ */ jsx7(
|
|
2109
|
+
Tabs,
|
|
2110
|
+
{
|
|
2111
|
+
items: tabItems,
|
|
2112
|
+
value: activeTab,
|
|
2113
|
+
onChange: handleTabChange,
|
|
2114
|
+
variant: "underline",
|
|
2115
|
+
className: "w-full [&>div]:w-full",
|
|
2116
|
+
classNames: {
|
|
2117
|
+
tabList: "h-[3.75rem] min-h-[3.75rem] max-h-[3.75rem] w-full min-w-0 justify-start gap-0 px-0 [&>button]:text-agg-base [&>button]:leading-agg-6 [&>button]:font-agg-normal [&>button]:min-w-0 [&>button]:justify-center",
|
|
2118
|
+
tabTrigger: "h-full gap-[6px] px-3 py-3 font-agg-normal"
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
),
|
|
2122
|
+
/* @__PURE__ */ jsxs7(
|
|
2123
|
+
"div",
|
|
2124
|
+
{
|
|
2125
|
+
className: cn(
|
|
2126
|
+
"agg-positions-activity-body flex w-full gap-2 md:gap-6 flex-col",
|
|
2127
|
+
isPositionsTab ? "pt-4 md:pt-6" : "pt-0 md:pt-6"
|
|
2128
|
+
),
|
|
2129
|
+
children: [
|
|
2130
|
+
isPositionsTab ? /* @__PURE__ */ jsxs7("div", { className: "agg-toolbar flex flex-col items-start gap-3 sm:flex-row sm:gap-5 px-4 sm:px-6", children: [
|
|
2131
|
+
/* @__PURE__ */ jsx7("div", { className: "agg-position-filters flex h-11 w-full shrink-0 items-stretch overflow-clip rounded-agg-sm border border-agg-separator sm:h-10 sm:w-auto sm:min-w-[200px] sm:max-w-[270px]", children: USER_PROFILE_POSITION_FILTERS.map((filter, idx) => {
|
|
2132
|
+
const isActive = filter.value === positionFilter;
|
|
2133
|
+
return /* @__PURE__ */ jsxs7("div", { className: "flex flex-1 items-stretch", children: [
|
|
2134
|
+
idx > 0 ? /* @__PURE__ */ jsx7("div", { className: "w-px bg-agg-separator", "aria-hidden": true }) : null,
|
|
2135
|
+
/* @__PURE__ */ jsx7(
|
|
2136
|
+
"button",
|
|
2137
|
+
{
|
|
2138
|
+
type: "button",
|
|
2139
|
+
onClick: () => handlePositionFilterChange(filter.value),
|
|
2140
|
+
className: cn(
|
|
2141
|
+
"agg-position-filter-trigger",
|
|
2142
|
+
"flex flex-1 cursor-pointer items-center justify-center px-3 py-3 font-agg-sans text-agg-sm leading-agg-5 sm:px-4 sm:text-agg-base sm:leading-agg-6",
|
|
2143
|
+
isActive ? "bg-agg-secondary-hover font-agg-bold text-agg-primary" : "bg-agg-secondary font-agg-normal text-agg-foreground hover:bg-agg-secondary-hover"
|
|
2144
|
+
),
|
|
2145
|
+
children: filter.label
|
|
2146
|
+
}
|
|
2147
|
+
)
|
|
2148
|
+
] }, filter.value);
|
|
2149
|
+
}) }),
|
|
2150
|
+
/* @__PURE__ */ jsxs7(
|
|
2151
|
+
"div",
|
|
2152
|
+
{
|
|
2153
|
+
className: "agg-position-search relative flex w-full min-w-0 flex-1",
|
|
2154
|
+
onFocusCapture: () => setIsSearchFocused(true),
|
|
2155
|
+
onBlurCapture: (event) => {
|
|
2156
|
+
const next = event.relatedTarget;
|
|
2157
|
+
if (next && event.currentTarget.contains(next)) return;
|
|
2158
|
+
setIsSearchFocused(false);
|
|
2159
|
+
},
|
|
2160
|
+
children: [
|
|
2161
|
+
/* @__PURE__ */ jsx7("label", { className: "flex w-full min-w-0 flex-1", children: /* @__PURE__ */ jsxs7("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: [
|
|
2162
|
+
/* @__PURE__ */ jsx7(Icon, { name: "search", size: "small", className: "shrink-0 text-agg-muted-foreground" }),
|
|
2163
|
+
/* @__PURE__ */ jsx7(
|
|
2164
|
+
"input",
|
|
2165
|
+
{
|
|
2166
|
+
value: searchValue,
|
|
2167
|
+
onChange: handleSearchChange,
|
|
2168
|
+
placeholder: "Search...",
|
|
2169
|
+
className: cn(
|
|
2170
|
+
"h-6 w-full min-w-0 border-0 bg-transparent p-0",
|
|
2171
|
+
"font-agg-sans text-agg-base leading-agg-6 font-agg-normal text-agg-foreground",
|
|
2172
|
+
"placeholder:text-agg-muted-foreground",
|
|
2173
|
+
"outline-none focus:outline-none"
|
|
2174
|
+
)
|
|
2175
|
+
}
|
|
2176
|
+
)
|
|
2177
|
+
] }) }),
|
|
2178
|
+
isSearchFocused && searchValue.trim() ? /* @__PURE__ */ jsx7("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__ */ jsx7(
|
|
2179
|
+
"ul",
|
|
2180
|
+
{
|
|
2181
|
+
className: "agg-position-search-results-list m-0 flex list-none flex-col p-0",
|
|
2182
|
+
role: "listbox",
|
|
2183
|
+
"aria-label": "Position search results",
|
|
2184
|
+
children: searchResults.map((item, index) => {
|
|
2185
|
+
const itemHref = getPositionHref == null ? void 0 : getPositionHref(item.raw);
|
|
2186
|
+
const sharedClassName = "agg-position-search-result group flex w-full items-center gap-6 px-5 py-4 text-left hover:bg-agg-secondary-hover focus-visible:outline-none focus-visible:bg-agg-secondary-hover cursor-pointer";
|
|
2187
|
+
const handleResultClick = () => {
|
|
2188
|
+
setIsSearchFocused(false);
|
|
2189
|
+
onPositionClick == null ? void 0 : onPositionClick(item.raw);
|
|
2190
|
+
};
|
|
2191
|
+
const innerContent = /* @__PURE__ */ jsxs7(Fragment5, { children: [
|
|
2192
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
|
|
2193
|
+
/* @__PURE__ */ jsx7(
|
|
2194
|
+
"img",
|
|
2195
|
+
{
|
|
2196
|
+
src: optimizedImageUrl2(item.thumbnailSrc, 48),
|
|
2197
|
+
alt: "",
|
|
2198
|
+
className: "size-12 shrink-0 rounded-agg-lg object-cover"
|
|
2199
|
+
}
|
|
2200
|
+
),
|
|
2201
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
2202
|
+
/* @__PURE__ */ jsx7("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 }),
|
|
2203
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex min-w-0 items-center gap-2 text-agg-muted-foreground", children: [
|
|
2204
|
+
/* @__PURE__ */ jsx7("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 }),
|
|
2205
|
+
/* @__PURE__ */ jsx7("span", { className: "text-agg-muted-foreground", "aria-hidden": true, children: "\xB7" }),
|
|
2206
|
+
/* @__PURE__ */ jsx7("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 })
|
|
2207
|
+
] })
|
|
2208
|
+
] })
|
|
2209
|
+
] }),
|
|
2210
|
+
/* @__PURE__ */ jsx7(
|
|
2211
|
+
Icon,
|
|
2212
|
+
{
|
|
2213
|
+
name: "chevron-right",
|
|
2214
|
+
size: "medium",
|
|
2215
|
+
className: "h-5 w-5 shrink-0 text-agg-muted-foreground"
|
|
2216
|
+
}
|
|
2217
|
+
)
|
|
2218
|
+
] });
|
|
2219
|
+
return /* @__PURE__ */ jsx7(
|
|
2220
|
+
"li",
|
|
2221
|
+
{
|
|
2222
|
+
role: "presentation",
|
|
2223
|
+
className: cn(
|
|
2224
|
+
"agg-position-search-result-item",
|
|
2225
|
+
index > 0 && "border-t border-agg-separator"
|
|
2226
|
+
),
|
|
2227
|
+
children: itemHref ? /* @__PURE__ */ jsx7(
|
|
2228
|
+
"a",
|
|
2229
|
+
{
|
|
2230
|
+
href: itemHref,
|
|
2231
|
+
className: sharedClassName,
|
|
2232
|
+
onClick: (event) => {
|
|
2233
|
+
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1) {
|
|
2234
|
+
setIsSearchFocused(false);
|
|
2235
|
+
return;
|
|
2236
|
+
}
|
|
2237
|
+
event.preventDefault();
|
|
2238
|
+
handleResultClick();
|
|
2239
|
+
},
|
|
2240
|
+
children: innerContent
|
|
2241
|
+
}
|
|
2242
|
+
) : /* @__PURE__ */ jsx7(
|
|
2243
|
+
"button",
|
|
2244
|
+
{
|
|
2245
|
+
type: "button",
|
|
2246
|
+
className: sharedClassName,
|
|
2247
|
+
onClick: handleResultClick,
|
|
2248
|
+
children: innerContent
|
|
2249
|
+
}
|
|
2250
|
+
)
|
|
2251
|
+
},
|
|
2252
|
+
item.id
|
|
2253
|
+
);
|
|
2254
|
+
})
|
|
2255
|
+
}
|
|
2256
|
+
) : /* @__PURE__ */ jsx7("div", { className: "px-5 py-6 font-agg-sans text-agg-sm leading-agg-5 text-agg-muted-foreground", children: "No results" }) }) : null
|
|
2257
|
+
]
|
|
2258
|
+
}
|
|
2259
|
+
)
|
|
2260
|
+
] }) : null,
|
|
2261
|
+
/* @__PURE__ */ jsxs7("div", { className: "agg-positions-table-wrapper flex w-full gap-0 flex-col", children: [
|
|
2262
|
+
/* @__PURE__ */ jsxs7("div", { className: "w-full px-4 sm:px-6", children: [
|
|
2263
|
+
isPositionsTab && filteredPositions.length > 0 ? isClosedPositionsFilter ? /* @__PURE__ */ jsxs7("div", { className: "hidden items-start gap-10 px-0 md:flex", children: [
|
|
2264
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: "Market" }),
|
|
2265
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[160px] shrink-0", children: positionsLabels.totalTradedHeader }),
|
|
2266
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[160px] shrink-0", children: positionsLabels.amountWonHeader }),
|
|
2267
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header min-w-[72px] shrink-0 text-center", children: positionsLabels.claimHeader }),
|
|
2268
|
+
/* @__PURE__ */ jsx7("span", { className: "hidden w-11 shrink-0 sm:block", "aria-hidden": true })
|
|
2269
|
+
] }) : /* @__PURE__ */ jsxs7("div", { className: "hidden items-start gap-6 px-0 md:flex", children: [
|
|
2270
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: "Market" }),
|
|
2271
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[80px] shrink-0", children: "Average" }),
|
|
2272
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[80px] shrink-0", children: "Current" }),
|
|
2273
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[120px] shrink-0 text-right", children: "Value" }),
|
|
2274
|
+
/* @__PURE__ */ jsx7("span", { className: "hidden w-11 shrink-0 sm:block", "aria-hidden": true })
|
|
2275
|
+
] }) : null,
|
|
2276
|
+
isActivityTab && filteredActivities.length > 0 ? /* @__PURE__ */ jsxs7("div", { className: "hidden items-start gap-6 px-0 md:flex", children: [
|
|
2277
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-22 shrink-0", children: "Type" }),
|
|
2278
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: "Market" }),
|
|
2279
|
+
/* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[120px] shrink-0 text-right", children: "Amount" })
|
|
2280
|
+
] }) : null
|
|
2281
|
+
] }),
|
|
2282
|
+
/* @__PURE__ */ jsx7(
|
|
2283
|
+
"div",
|
|
2284
|
+
{
|
|
2285
|
+
ref: rowsScrollRef,
|
|
2286
|
+
className: cn(
|
|
2287
|
+
"agg-rows-scroll max-h-120 overflow-y-auto p-4 sm:p-6",
|
|
2288
|
+
"[scrollbar-color:rgba(157,159,175,0.7)_transparent] [scrollbar-width:thin]",
|
|
2289
|
+
"[&::-webkit-scrollbar]:w-2",
|
|
2290
|
+
"[&::-webkit-scrollbar-track]:bg-transparent",
|
|
2291
|
+
"[&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-agg-muted-foreground/50",
|
|
2292
|
+
"[&::-webkit-scrollbar-thumb:hover]:bg-agg-muted-foreground/70"
|
|
2293
|
+
),
|
|
2294
|
+
children: isPositionsTab ? /* @__PURE__ */ jsxs7("div", { className: "agg-portfolio-list flex flex-col gap-5", children: [
|
|
2295
|
+
isLoadingPositions && filteredPositions.length === 0 ? /* @__PURE__ */ jsx7(TabRowsSkeleton, { ariaLabel: "Loading positions" }) : positionsError && filteredPositions.length === 0 ? /* @__PURE__ */ jsx7(
|
|
2296
|
+
EmptyState,
|
|
2297
|
+
{
|
|
2298
|
+
title: "Unable to load positions",
|
|
2299
|
+
description: "Please try again in a moment."
|
|
2300
|
+
}
|
|
2301
|
+
) : filteredPositions.length > 0 ? filteredPositions.map((position, index) => {
|
|
2302
|
+
var _a;
|
|
2303
|
+
return /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
2304
|
+
index > 0 ? /* @__PURE__ */ jsx7(
|
|
2305
|
+
"div",
|
|
2306
|
+
{
|
|
2307
|
+
className: "agg-position-divider h-px w-full shrink-0 bg-agg-separator",
|
|
2308
|
+
"aria-hidden": true
|
|
2309
|
+
}
|
|
2310
|
+
) : null,
|
|
2311
|
+
/* @__PURE__ */ jsx7(
|
|
2312
|
+
PositionRow,
|
|
2313
|
+
{
|
|
2314
|
+
position,
|
|
2315
|
+
variant: positionFilter,
|
|
2316
|
+
href: getPositionHref == null ? void 0 : getPositionHref(position),
|
|
2317
|
+
onClick: onPositionClick,
|
|
2318
|
+
onClaim,
|
|
2319
|
+
isClaiming: Boolean(
|
|
2320
|
+
claimingPositionKeys == null ? void 0 : claimingPositionKeys[(_a = position.marketId) != null ? _a : position.id]
|
|
2321
|
+
)
|
|
2322
|
+
}
|
|
2323
|
+
)
|
|
2324
|
+
] }, position.id);
|
|
2325
|
+
}) : /* @__PURE__ */ jsx7(
|
|
2326
|
+
EmptyState,
|
|
2327
|
+
{
|
|
2328
|
+
title: "No positions yet",
|
|
2329
|
+
description: "Your open trades will appear here once you place an order."
|
|
2330
|
+
}
|
|
2331
|
+
),
|
|
2332
|
+
isLoadingMorePositions ? /* @__PURE__ */ jsx7(TabRowsSkeleton, { ariaLabel: "Loading more positions" }) : null,
|
|
2333
|
+
hasMorePositions ? /* @__PURE__ */ jsx7(
|
|
2334
|
+
"div",
|
|
2335
|
+
{
|
|
2336
|
+
ref: positionsLoadMoreRef,
|
|
2337
|
+
className: "agg-portfolio-sentinel h-px w-full",
|
|
2338
|
+
"aria-hidden": true
|
|
2339
|
+
}
|
|
2340
|
+
) : null
|
|
2341
|
+
] }) : /* @__PURE__ */ jsxs7("div", { className: "agg-activity-list flex flex-col gap-5", children: [
|
|
2342
|
+
isLoadingActivities && filteredActivities.length === 0 ? /* @__PURE__ */ jsx7(TabRowsSkeleton, { ariaLabel: "Loading activity" }) : activitiesError && filteredActivities.length === 0 ? /* @__PURE__ */ jsx7(
|
|
2343
|
+
EmptyState,
|
|
2344
|
+
{
|
|
2345
|
+
title: "Unable to load activity",
|
|
2346
|
+
description: "Please try again in a moment."
|
|
2347
|
+
}
|
|
2348
|
+
) : filteredActivities.length > 0 ? filteredActivities.map((activity, index) => /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
2349
|
+
index > 0 ? /* @__PURE__ */ jsx7(
|
|
2350
|
+
"div",
|
|
2351
|
+
{
|
|
2352
|
+
className: "agg-activity-divider h-px w-full shrink-0 bg-agg-separator",
|
|
2353
|
+
"aria-hidden": true
|
|
2354
|
+
}
|
|
2355
|
+
) : null,
|
|
2356
|
+
/* @__PURE__ */ jsx7(
|
|
2357
|
+
ActivityRow,
|
|
2358
|
+
{
|
|
2359
|
+
activity,
|
|
2360
|
+
href: getActivityHref == null ? void 0 : getActivityHref(activity),
|
|
2361
|
+
onClick: onActivityClick
|
|
2362
|
+
}
|
|
2363
|
+
)
|
|
2364
|
+
] }, activity.id)) : /* @__PURE__ */ jsx7(
|
|
2365
|
+
EmptyState,
|
|
2366
|
+
{
|
|
2367
|
+
title: "No activity yet",
|
|
2368
|
+
description: "Your trading activity will appear here."
|
|
2369
|
+
}
|
|
2370
|
+
),
|
|
2371
|
+
isLoadingMoreActivities ? /* @__PURE__ */ jsx7(TabRowsSkeleton, { ariaLabel: "Loading more activity" }) : null,
|
|
2372
|
+
hasMoreActivities ? /* @__PURE__ */ jsx7(
|
|
2373
|
+
"div",
|
|
2374
|
+
{
|
|
2375
|
+
ref: activitiesLoadMoreRef,
|
|
2376
|
+
className: "agg-activity-sentinel h-px w-full",
|
|
2377
|
+
"aria-hidden": true
|
|
2378
|
+
}
|
|
2379
|
+
) : null
|
|
2380
|
+
] })
|
|
2381
|
+
}
|
|
2382
|
+
)
|
|
2383
|
+
] })
|
|
2384
|
+
]
|
|
2385
|
+
}
|
|
2386
|
+
)
|
|
2387
|
+
]
|
|
2388
|
+
}
|
|
2389
|
+
);
|
|
2390
|
+
};
|
|
2391
|
+
PositionsActivity.displayName = "PositionsActivity";
|
|
2392
|
+
|
|
2393
|
+
// src/pages/user-profile/components/positions-value-card.tsx
|
|
2394
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2395
|
+
var PositionsValueCard = ({
|
|
2396
|
+
label = "Positions Value",
|
|
2397
|
+
valueLabel,
|
|
2398
|
+
className
|
|
2399
|
+
}) => {
|
|
2400
|
+
return /* @__PURE__ */ jsxs8(
|
|
2401
|
+
"div",
|
|
2402
|
+
{
|
|
2403
|
+
className: cn(
|
|
2404
|
+
"group/agg-portfolio-summary",
|
|
2405
|
+
"flex flex-col gap-3 rounded-agg-xl border border-agg-separator bg-agg-secondary p-5",
|
|
2406
|
+
className
|
|
2407
|
+
),
|
|
2408
|
+
children: [
|
|
2409
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
|
|
2410
|
+
/* @__PURE__ */ jsx8(
|
|
2411
|
+
"svg",
|
|
2412
|
+
{
|
|
2413
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2414
|
+
width: "16",
|
|
2415
|
+
height: "16",
|
|
2416
|
+
viewBox: "0 0 16 16",
|
|
2417
|
+
fill: "none",
|
|
2418
|
+
children: /* @__PURE__ */ jsx8(
|
|
2419
|
+
"path",
|
|
2420
|
+
{
|
|
2421
|
+
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",
|
|
2422
|
+
fill: "#9D9FAF"
|
|
2423
|
+
}
|
|
2424
|
+
)
|
|
2425
|
+
}
|
|
2426
|
+
),
|
|
2427
|
+
/* @__PURE__ */ jsx8("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children: label })
|
|
2428
|
+
] }),
|
|
2429
|
+
/* @__PURE__ */ jsx8("div", { className: "agg-portfolio-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: valueLabel })
|
|
2430
|
+
]
|
|
2431
|
+
}
|
|
2432
|
+
);
|
|
2433
|
+
};
|
|
2434
|
+
PositionsValueCard.displayName = "PositionsValueCard";
|
|
2435
|
+
|
|
2436
|
+
// src/pages/user-profile/components/user-info-card.tsx
|
|
2437
|
+
import { optimizedImageUrl as optimizedImageUrl3, useLabels as useLabels5 } from "@agg-build/hooks";
|
|
2438
|
+
|
|
2439
|
+
// src/primitives/conditional-wrapper.tsx
|
|
2440
|
+
var ConditionalWrapper = ({
|
|
2441
|
+
condition,
|
|
2442
|
+
wrapper,
|
|
2443
|
+
children
|
|
2444
|
+
}) => condition ? wrapper(children) : children;
|
|
2445
|
+
ConditionalWrapper.displayName = "ConditionalWrapper";
|
|
2446
|
+
|
|
2447
|
+
// src/pages/user-profile/components/default-avatar.tsx
|
|
2448
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2449
|
+
var DefaultAvatar = ({ className }) => {
|
|
2450
|
+
return /* @__PURE__ */ jsxs9(
|
|
2451
|
+
"svg",
|
|
2452
|
+
{
|
|
2453
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2454
|
+
width: "120",
|
|
2455
|
+
height: "120",
|
|
2456
|
+
viewBox: "0 0 120 120",
|
|
2457
|
+
fill: "none",
|
|
2458
|
+
className: cn("shrink-0 text-agg-muted-foreground", className),
|
|
2459
|
+
"aria-hidden": true,
|
|
2460
|
+
children: [
|
|
2461
|
+
/* @__PURE__ */ jsxs9("g", { clipPath: "url(#clip0_default_avatar)", children: [
|
|
2462
|
+
/* @__PURE__ */ jsx9(
|
|
2463
|
+
"path",
|
|
2464
|
+
{
|
|
2465
|
+
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",
|
|
2466
|
+
fill: "var(--agg-color-secondary-hover)"
|
|
2467
|
+
}
|
|
2468
|
+
),
|
|
2469
|
+
/* @__PURE__ */ jsx9(
|
|
2470
|
+
"path",
|
|
2471
|
+
{
|
|
2472
|
+
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",
|
|
2473
|
+
fill: "currentColor",
|
|
2474
|
+
fillOpacity: "0.12"
|
|
2475
|
+
}
|
|
2476
|
+
),
|
|
2477
|
+
/* @__PURE__ */ jsx9(
|
|
2478
|
+
"path",
|
|
2479
|
+
{
|
|
2480
|
+
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",
|
|
2481
|
+
fill: "currentColor",
|
|
2482
|
+
fillOpacity: "0.35"
|
|
2483
|
+
}
|
|
2484
|
+
)
|
|
2485
|
+
] }),
|
|
2486
|
+
/* @__PURE__ */ jsx9("defs", { children: /* @__PURE__ */ jsx9("clipPath", { id: "clip0_default_avatar", children: /* @__PURE__ */ jsx9("rect", { width: "120", height: "120", fill: "white" }) }) })
|
|
2487
|
+
]
|
|
2488
|
+
}
|
|
2489
|
+
);
|
|
2490
|
+
};
|
|
2491
|
+
DefaultAvatar.displayName = "DefaultAvatar";
|
|
2492
|
+
|
|
2493
|
+
// src/pages/user-profile/components/user-info-card.tsx
|
|
2494
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2495
|
+
var UserInfoCard = ({
|
|
2496
|
+
user,
|
|
2497
|
+
onEditProfile,
|
|
2498
|
+
onDeposit,
|
|
2499
|
+
onWithdraw,
|
|
2500
|
+
isDepositBlocked = false,
|
|
2501
|
+
className
|
|
2502
|
+
}) => {
|
|
2503
|
+
var _a;
|
|
2504
|
+
const labels = useLabels5();
|
|
2505
|
+
const wallets = (_a = user.connectedWallets) != null ? _a : [];
|
|
2506
|
+
const hasWallets = wallets.length > 0;
|
|
2507
|
+
return /* @__PURE__ */ jsxs10(
|
|
2508
|
+
"div",
|
|
2509
|
+
{
|
|
2510
|
+
className: cn(
|
|
2511
|
+
"group/agg-profile-card",
|
|
2512
|
+
"flex h-full flex-col items-start justify-stretch rounded-agg-xl border border-agg-separator bg-agg-secondary px-5",
|
|
2513
|
+
className
|
|
2514
|
+
),
|
|
2515
|
+
children: [
|
|
2516
|
+
/* @__PURE__ */ jsxs10("div", { className: "agg-profile-header flex w-full flex-row flex-wrap items-start gap-4 sm:gap-5 pt-5", children: [
|
|
2517
|
+
/* @__PURE__ */ jsx10("div", { className: "agg-profile-avatar shrink-0", children: user.avatarUrl ? /* @__PURE__ */ jsx10(
|
|
2518
|
+
RemoteImage,
|
|
2519
|
+
{
|
|
2520
|
+
src: optimizedImageUrl3(user.avatarUrl, 120),
|
|
2521
|
+
alt: user.username,
|
|
2522
|
+
className: "h-20 w-20 rounded-full object-cover sm:h-[120px] sm:w-[120px]"
|
|
2523
|
+
}
|
|
2524
|
+
) : /* @__PURE__ */ jsx10(DefaultAvatar, { className: "h-20 w-20 rounded-full sm:h-[120px] sm:w-[120px]" }) }),
|
|
2525
|
+
/* @__PURE__ */ jsxs10("div", { className: "agg-profile-details flex min-w-0 w-full flex-1 flex-col gap-3 sm:gap-4", children: [
|
|
2526
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap items-center justify-between gap-3 sm:gap-4", children: [
|
|
2527
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
2528
|
+
/* @__PURE__ */ jsx10("h2", { className: "truncate text-[22px] leading-7 font-agg-bold text-agg-foreground sm:agg-type-heading", children: user.username }),
|
|
2529
|
+
user.socialLinks && user.socialLinks.length > 0 ? /* @__PURE__ */ jsx10("div", { className: "agg-profile-social-links flex items-center gap-2", children: user.socialLinks.map((social) => {
|
|
2530
|
+
const iconName = social.platform === "twitter" ? "twitter" : social.platform === "discord" ? "discord" : "telegram";
|
|
2531
|
+
const iconNode = /* @__PURE__ */ jsx10("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__ */ jsx10(Icon, { name: iconName, size: "small", className: "text-agg-foreground" }) });
|
|
2532
|
+
if (!social.handle) {
|
|
2533
|
+
return /* @__PURE__ */ jsx10("span", { children: iconNode }, `${social.platform}-icon`);
|
|
2534
|
+
}
|
|
2535
|
+
return /* @__PURE__ */ jsx10(
|
|
2536
|
+
"a",
|
|
2537
|
+
{
|
|
2538
|
+
href: social.handle,
|
|
2539
|
+
target: "_blank",
|
|
2540
|
+
rel: "noreferrer noopener",
|
|
2541
|
+
"aria-label": `${social.platform} profile`,
|
|
2542
|
+
children: iconNode
|
|
2543
|
+
},
|
|
2544
|
+
`${social.platform}-${social.handle}`
|
|
2545
|
+
);
|
|
2546
|
+
}) }) : null
|
|
2547
|
+
] }),
|
|
2548
|
+
onEditProfile ? /* @__PURE__ */ jsxs10(
|
|
2549
|
+
"button",
|
|
2550
|
+
{
|
|
2551
|
+
type: "button",
|
|
2552
|
+
onClick: onEditProfile,
|
|
2553
|
+
className: "hidden sm:flex shrink-0 cursor-pointer items-center gap-1.5 bg-transparent text-agg-primary hover:opacity-80",
|
|
2554
|
+
children: [
|
|
2555
|
+
/* @__PURE__ */ jsx10(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
|
|
2556
|
+
/* @__PURE__ */ jsx10("span", { className: "text-agg-base font-agg-bold leading-6", children: "Edit" })
|
|
2557
|
+
]
|
|
2558
|
+
}
|
|
2559
|
+
) : null
|
|
2560
|
+
] }),
|
|
2561
|
+
hasWallets || !!user.socialHandle ? /* @__PURE__ */ jsxs10("div", { className: "agg-profile-accounts flex w-full flex-col gap-2.5 sm:gap-3", children: [
|
|
2562
|
+
wallets.map((wallet, idx) => {
|
|
2563
|
+
const chainLower = wallet.chain.toLowerCase();
|
|
2564
|
+
const iconName = chainLower === "solana" || chainLower === "svm" ? "solana" : "ethereum";
|
|
2565
|
+
return /* @__PURE__ */ jsxs10(
|
|
2566
|
+
"div",
|
|
2567
|
+
{
|
|
2568
|
+
className: "flex min-w-0 flex-wrap items-center gap-2 sm:gap-3",
|
|
2569
|
+
children: [
|
|
2570
|
+
/* @__PURE__ */ jsx10("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx10(Icon, { name: iconName, size: "small", className: "text-agg-foreground" }) }),
|
|
2571
|
+
/* @__PURE__ */ jsx10("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 })
|
|
2572
|
+
]
|
|
2573
|
+
},
|
|
2574
|
+
`wallet-${idx}`
|
|
2575
|
+
);
|
|
2576
|
+
}),
|
|
2577
|
+
user.socialHandle ? /* @__PURE__ */ jsx10("div", { className: "flex min-w-0 items-center gap-2 sm:gap-3", children: /* @__PURE__ */ jsx10("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
|
|
2578
|
+
] }) : null
|
|
2579
|
+
] })
|
|
2580
|
+
] }),
|
|
2581
|
+
(onDeposit || onWithdraw) && /* @__PURE__ */ jsxs10("div", { className: "agg-profile-actions flex w-full flex-1 items-center gap-3 py-5", children: [
|
|
2582
|
+
onDeposit ? /* @__PURE__ */ jsx10(
|
|
2583
|
+
ConditionalWrapper,
|
|
2584
|
+
{
|
|
2585
|
+
condition: isDepositBlocked,
|
|
2586
|
+
wrapper: (children) => /* @__PURE__ */ jsx10(
|
|
2587
|
+
Tooltip,
|
|
2588
|
+
{
|
|
2589
|
+
content: /* @__PURE__ */ jsx10("p", { className: "text-center", children: labels.auth.depositGeoBlocked }),
|
|
2590
|
+
size: "small",
|
|
2591
|
+
side: "bottom",
|
|
2592
|
+
children
|
|
2593
|
+
}
|
|
2594
|
+
),
|
|
2595
|
+
children: /* @__PURE__ */ jsx10(
|
|
2596
|
+
Button,
|
|
2597
|
+
__spreadProps(__spreadValues({
|
|
2598
|
+
variant: "primary",
|
|
2599
|
+
size: "medium"
|
|
2600
|
+
}, isDepositBlocked ? { disabled: true } : { onClick: onDeposit }), {
|
|
2601
|
+
className: "min-w-0 flex-1 min-h-10",
|
|
2602
|
+
children: labels.auth.deposit
|
|
2603
|
+
})
|
|
2604
|
+
)
|
|
2605
|
+
}
|
|
2606
|
+
) : null,
|
|
2607
|
+
onWithdraw ? /* @__PURE__ */ jsx10(
|
|
2608
|
+
Button,
|
|
2609
|
+
{
|
|
2610
|
+
variant: "secondary",
|
|
2611
|
+
size: "medium",
|
|
2612
|
+
onClick: onWithdraw,
|
|
2613
|
+
className: "min-w-0 flex-1 min-h-10",
|
|
2614
|
+
children: labels.auth.withdraw
|
|
2615
|
+
}
|
|
2616
|
+
) : null,
|
|
2617
|
+
onEditProfile ? /* @__PURE__ */ jsxs10(
|
|
2618
|
+
"button",
|
|
2619
|
+
{
|
|
2620
|
+
type: "button",
|
|
2621
|
+
onClick: onEditProfile,
|
|
2622
|
+
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",
|
|
2623
|
+
children: [
|
|
2624
|
+
/* @__PURE__ */ jsx10(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
|
|
2625
|
+
/* @__PURE__ */ jsx10("span", { className: "text-agg-sm font-agg-bold leading-5", children: "Edit" })
|
|
2626
|
+
]
|
|
2627
|
+
}
|
|
2628
|
+
) : null
|
|
2629
|
+
] })
|
|
2630
|
+
]
|
|
2631
|
+
}
|
|
2632
|
+
);
|
|
2633
|
+
};
|
|
2634
|
+
UserInfoCard.displayName = "UserInfoCard";
|
|
2635
|
+
|
|
2636
|
+
// src/pages/user-profile/index.tsx
|
|
2637
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2638
|
+
var currencyFormatter = new Intl.NumberFormat("en-US", {
|
|
2639
|
+
style: "currency",
|
|
2640
|
+
currency: "USD",
|
|
2641
|
+
minimumFractionDigits: 2,
|
|
2642
|
+
maximumFractionDigits: 2
|
|
2643
|
+
});
|
|
2644
|
+
var formatUsd = (value) => currencyFormatter.format(Number.isFinite(value) ? value : 0);
|
|
2645
|
+
var formatSignedPercentLabel = (ratio) => {
|
|
2646
|
+
const pct = Number.isFinite(ratio) ? ratio * 100 : 0;
|
|
2647
|
+
const sign = pct > 0 ? "+" : "";
|
|
2648
|
+
return `${sign}${pct.toFixed(2)}%`;
|
|
2649
|
+
};
|
|
2650
|
+
var MICRO_UNITS_SCALE = 1e6;
|
|
2651
|
+
var twoDecimalNumberFormatter = new Intl.NumberFormat("en-US", {
|
|
2652
|
+
minimumFractionDigits: 2,
|
|
2653
|
+
maximumFractionDigits: 2
|
|
2654
|
+
});
|
|
2655
|
+
var twoDecimalUsdFormatter = new Intl.NumberFormat("en-US", {
|
|
2656
|
+
style: "currency",
|
|
2657
|
+
currency: "USD",
|
|
2658
|
+
minimumFractionDigits: 2,
|
|
2659
|
+
maximumFractionDigits: 2
|
|
2660
|
+
});
|
|
2661
|
+
var DEFAULT_TOKEN_DECIMALS = 6;
|
|
2662
|
+
var TOKEN_DECIMALS_BY_SYMBOL = {
|
|
2663
|
+
BNB: 18,
|
|
2664
|
+
ETH: 18,
|
|
2665
|
+
MATIC: 18,
|
|
2666
|
+
POL: 18,
|
|
2667
|
+
WETH: 18,
|
|
2668
|
+
USDC: 6,
|
|
2669
|
+
USDT: 6
|
|
2670
|
+
};
|
|
2671
|
+
var TOKEN_DECIMALS_BY_CHAIN_AND_SYMBOL = {
|
|
2672
|
+
"56": {
|
|
2673
|
+
USDC: 18,
|
|
2674
|
+
USDT: 18
|
|
2675
|
+
}
|
|
2676
|
+
};
|
|
2677
|
+
var shortenAddress = (address) => {
|
|
2678
|
+
if (!address) return void 0;
|
|
2679
|
+
if (address.length <= 12) return address;
|
|
2680
|
+
return `${address.slice(0, 6)}...${address.slice(-5)}`;
|
|
2681
|
+
};
|
|
2682
|
+
var parseRawMicroValue = (value) => {
|
|
2683
|
+
if (!value) return null;
|
|
2684
|
+
if (value.startsWith("0x") || value.startsWith("0X")) {
|
|
2685
|
+
try {
|
|
2686
|
+
return Number(BigInt(value)) / MICRO_UNITS_SCALE;
|
|
2687
|
+
} catch (e) {
|
|
2688
|
+
return null;
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
const parsed = Number(value);
|
|
2692
|
+
if (!Number.isFinite(parsed)) return null;
|
|
2693
|
+
return value.includes(".") ? parsed : parsed / MICRO_UNITS_SCALE;
|
|
2694
|
+
};
|
|
2695
|
+
var formatScaledNumberTwoDecimals = (value) => {
|
|
2696
|
+
const parsed = parseRawMicroValue(value);
|
|
2697
|
+
if (parsed == null) return "0.00";
|
|
2698
|
+
return twoDecimalNumberFormatter.format(parsed);
|
|
2699
|
+
};
|
|
2700
|
+
var getTokenDecimals = (tokenSymbol, chainId) => {
|
|
2701
|
+
var _a;
|
|
2702
|
+
const normalizedSymbol = tokenSymbol.trim().toUpperCase();
|
|
2703
|
+
const normalizedChainId = chainId == null ? void 0 : chainId.trim();
|
|
2704
|
+
if (normalizedChainId) {
|
|
2705
|
+
const chainDecimals = TOKEN_DECIMALS_BY_CHAIN_AND_SYMBOL[normalizedChainId];
|
|
2706
|
+
const chainTokenDecimals = chainDecimals == null ? void 0 : chainDecimals[normalizedSymbol];
|
|
2707
|
+
if (chainTokenDecimals != null) return chainTokenDecimals;
|
|
2708
|
+
}
|
|
2709
|
+
return (_a = TOKEN_DECIMALS_BY_SYMBOL[normalizedSymbol]) != null ? _a : DEFAULT_TOKEN_DECIMALS;
|
|
2710
|
+
};
|
|
2711
|
+
var parseRawTokenValue = (value, decimals) => {
|
|
2712
|
+
if (!value) return null;
|
|
2713
|
+
if (value.includes(".")) {
|
|
2714
|
+
const parsed = Number(value);
|
|
2715
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
2716
|
+
}
|
|
2717
|
+
try {
|
|
2718
|
+
const raw = BigInt(value);
|
|
2719
|
+
let divisor = BigInt(1);
|
|
2720
|
+
for (let i = 0; i < decimals; i++) divisor *= BigInt(10);
|
|
2721
|
+
const whole = raw / divisor;
|
|
2722
|
+
const remainder = raw % divisor;
|
|
2723
|
+
return Number(whole) + Number(remainder) / Number(divisor);
|
|
2724
|
+
} catch (e) {
|
|
2725
|
+
const parsed = Number(value);
|
|
2726
|
+
if (!Number.isFinite(parsed)) return null;
|
|
2727
|
+
return parsed / __pow(10, decimals);
|
|
2728
|
+
}
|
|
2729
|
+
};
|
|
2730
|
+
var formatTokenAmountTwoDecimals = (value, tokenSymbol, chainId) => {
|
|
2731
|
+
const parsed = parseRawTokenValue(value, getTokenDecimals(tokenSymbol, chainId));
|
|
2732
|
+
if (parsed == null) return "0.00";
|
|
2733
|
+
return twoDecimalNumberFormatter.format(parsed);
|
|
2734
|
+
};
|
|
2735
|
+
var getFilledUsdValue = (filledAmountRaw) => {
|
|
2736
|
+
var _a;
|
|
2737
|
+
return (_a = parseRawMicroValue(filledAmountRaw)) != null ? _a : 0;
|
|
2738
|
+
};
|
|
2739
|
+
var formatFilledUsdTwoDecimals = (filledAmountRaw) => {
|
|
2740
|
+
return twoDecimalUsdFormatter.format(getFilledUsdValue(filledAmountRaw));
|
|
2741
|
+
};
|
|
2742
|
+
var formatTradeQuantityTwoDecimals = (executionPrice, filledAmountRaw) => {
|
|
2743
|
+
const priceNum = Number(executionPrice);
|
|
2744
|
+
const filledUsd = getFilledUsdValue(filledAmountRaw);
|
|
2745
|
+
const quantity = priceNum > 0 ? filledUsd / priceNum : 0;
|
|
2746
|
+
return twoDecimalNumberFormatter.format(quantity);
|
|
2747
|
+
};
|
|
2748
|
+
var fallbackThumbnailSrc = 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60"><rect width="100%" height="100%" fill="%23f4f4f7"/></svg>';
|
|
2749
|
+
var toAbsoluteTimeLabel = (value) => {
|
|
2750
|
+
const d = value instanceof Date ? value : new Date(value);
|
|
2751
|
+
if (Number.isNaN(d.getTime())) return "";
|
|
2752
|
+
const months = [
|
|
2753
|
+
"Jan",
|
|
2754
|
+
"Feb",
|
|
2755
|
+
"Mar",
|
|
2756
|
+
"Apr",
|
|
2757
|
+
"May",
|
|
2758
|
+
"Jun",
|
|
2759
|
+
"Jul",
|
|
2760
|
+
"Aug",
|
|
2761
|
+
"Sep",
|
|
2762
|
+
"Oct",
|
|
2763
|
+
"Nov",
|
|
2764
|
+
"Dec"
|
|
2765
|
+
];
|
|
2766
|
+
return `${months[d.getUTCMonth()]} ${d.getUTCDate()}, ${d.getUTCFullYear()}`;
|
|
2767
|
+
};
|
|
2768
|
+
var toRelativeTimeLabel = (value) => {
|
|
2769
|
+
const timestamp = value instanceof Date ? value.getTime() : Date.parse(value);
|
|
2770
|
+
if (Number.isNaN(timestamp)) return "";
|
|
2771
|
+
const diffMs = Date.now() - timestamp;
|
|
2772
|
+
const minute = 60 * 1e3;
|
|
2773
|
+
const hour = 60 * minute;
|
|
2774
|
+
const day = 24 * hour;
|
|
2775
|
+
const week = 7 * day;
|
|
2776
|
+
if (diffMs < hour) {
|
|
2777
|
+
const minutes = Math.max(1, Math.floor(diffMs / minute));
|
|
2778
|
+
return `${minutes}m ago`;
|
|
2779
|
+
}
|
|
2780
|
+
if (diffMs < day) {
|
|
2781
|
+
const hours = Math.max(1, Math.floor(diffMs / hour));
|
|
2782
|
+
return `${hours}h ago`;
|
|
2783
|
+
}
|
|
2784
|
+
if (diffMs < week) {
|
|
2785
|
+
const days = Math.max(1, Math.floor(diffMs / day));
|
|
2786
|
+
return `${days}d ago`;
|
|
2787
|
+
}
|
|
2788
|
+
const weeks = Math.max(1, Math.floor(diffMs / week));
|
|
2789
|
+
return `${weeks}w ago`;
|
|
2790
|
+
};
|
|
2791
|
+
var toAmountLabel = (executionPrice, filledAmountRaw) => {
|
|
2792
|
+
if (!executionPrice || !filledAmountRaw) return "-";
|
|
2793
|
+
return formatFilledUsdTwoDecimals(filledAmountRaw);
|
|
2794
|
+
};
|
|
2795
|
+
var toSignedAmountLabel = (sign, executionPrice, filledAmountRaw) => {
|
|
2796
|
+
const amountLabel = toAmountLabel(executionPrice, filledAmountRaw);
|
|
2797
|
+
return amountLabel === "-" ? amountLabel : `${sign}${amountLabel}`;
|
|
2798
|
+
};
|
|
2799
|
+
var SVM_CHAIN_IDS = /* @__PURE__ */ new Set(["792703809"]);
|
|
2800
|
+
var OPEN_ORDER_STATUSES = /* @__PURE__ */ new Set([
|
|
2801
|
+
"pending",
|
|
2802
|
+
"signing",
|
|
2803
|
+
"pending_bridge",
|
|
2804
|
+
"submitting",
|
|
2805
|
+
"submitted"
|
|
2806
|
+
]);
|
|
2807
|
+
var OPEN_ORDERS_REFETCH_INTERVAL_MS = 1e4;
|
|
2808
|
+
var isOpenOrderStatus = (status) => OPEN_ORDER_STATUSES.has(status.toLowerCase());
|
|
2809
|
+
var getActivityErrorMessage = (item) => {
|
|
2810
|
+
if (!("errorMessage" in item)) return null;
|
|
2811
|
+
return typeof item.errorMessage === "string" ? item.errorMessage : null;
|
|
2812
|
+
};
|
|
2813
|
+
var hasActivityError = (item) => {
|
|
2814
|
+
const errorMessage = getActivityErrorMessage(item);
|
|
2815
|
+
return item.status.toLowerCase() === "failed" || !!(errorMessage == null ? void 0 : errorMessage.trim());
|
|
2816
|
+
};
|
|
2817
|
+
var isVisibleActivityItem = (item) => {
|
|
2818
|
+
var _a;
|
|
2819
|
+
if (item.type === "user_op" || item.type === "bridge") return false;
|
|
2820
|
+
if (item.type === "trade" && item.status.toLowerCase() === "failed" && ((_a = parseRawMicroValue(item.filledAmountRaw)) != null ? _a : 0) <= 0)
|
|
2821
|
+
return false;
|
|
2822
|
+
return true;
|
|
2823
|
+
};
|
|
2824
|
+
var isVisibleUserProfileActivity = (activity) => activity.kind !== "bridge";
|
|
2825
|
+
var shouldFetchFullUserProfile = (userProfile) => {
|
|
2826
|
+
var _a, _b, _c, _d;
|
|
2827
|
+
if (!userProfile) return true;
|
|
2828
|
+
return !userProfile.username && !userProfile.avatarUrl && ((_b = (_a = userProfile.accounts) == null ? void 0 : _a.length) != null ? _b : 0) === 0 && ((_d = (_c = userProfile.wallets) == null ? void 0 : _c.length) != null ? _d : 0) === 0;
|
|
2829
|
+
};
|
|
2830
|
+
var normalizeAddress = (address) => {
|
|
2831
|
+
const trimmed = address == null ? void 0 : address.trim();
|
|
2832
|
+
return trimmed ? trimmed.toLowerCase() : void 0;
|
|
2833
|
+
};
|
|
2834
|
+
var toNumericChainId = (chainId) => {
|
|
2835
|
+
const parsed = Number(chainId);
|
|
2836
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
2837
|
+
};
|
|
2838
|
+
var getConnectedWalletAccountAddresses = (userProfile) => {
|
|
2839
|
+
var _a;
|
|
2840
|
+
const accounts = (_a = userProfile == null ? void 0 : userProfile.accounts) != null ? _a : [];
|
|
2841
|
+
const walletAccounts = accounts.filter((account) => {
|
|
2842
|
+
var _a2;
|
|
2843
|
+
const provider = (_a2 = account.provider) == null ? void 0 : _a2.toLowerCase();
|
|
2844
|
+
return provider === "wallet" || provider === "solana_wallet";
|
|
2845
|
+
});
|
|
2846
|
+
return new Set(
|
|
2847
|
+
walletAccounts.map((account) => normalizeAddress(account.providerAccountId)).filter((address) => !!address)
|
|
2848
|
+
);
|
|
2849
|
+
};
|
|
2850
|
+
var resolveDepositActivitySource = ({
|
|
2851
|
+
fromAddress,
|
|
2852
|
+
chainId,
|
|
2853
|
+
connectedWalletAddresses,
|
|
2854
|
+
depositAddress
|
|
2855
|
+
}) => {
|
|
2856
|
+
const normalizedFromAddress = normalizeAddress(fromAddress);
|
|
2857
|
+
if (normalizedFromAddress && connectedWalletAddresses.has(normalizedFromAddress)) {
|
|
2858
|
+
return "wallet";
|
|
2859
|
+
}
|
|
2860
|
+
if (normalizedFromAddress && normalizedFromAddress === normalizeAddress(depositAddress)) {
|
|
2861
|
+
return "crypto";
|
|
2862
|
+
}
|
|
2863
|
+
if (SVM_CHAIN_IDS.has(chainId.trim())) {
|
|
2864
|
+
return "wallet";
|
|
2865
|
+
}
|
|
2866
|
+
return "crypto";
|
|
2867
|
+
};
|
|
2868
|
+
var toTradeThumbnailSrc = (item, orders) => {
|
|
2869
|
+
var _a, _b, _c;
|
|
2870
|
+
if ((_a = item.venueMarket) == null ? void 0 : _a.image) return item.venueMarket.image;
|
|
2871
|
+
const matchingOrder = orders.find((order) => order.id === item.id);
|
|
2872
|
+
return (_c = (_b = matchingOrder == null ? void 0 : matchingOrder.venueMarket) == null ? void 0 : _b.image) != null ? _c : fallbackThumbnailSrc;
|
|
2873
|
+
};
|
|
2874
|
+
var toTokenAmountLabel = ({
|
|
2875
|
+
amountRaw,
|
|
2876
|
+
tokenSymbol,
|
|
2877
|
+
chainId,
|
|
2878
|
+
sign
|
|
2879
|
+
}) => {
|
|
2880
|
+
const prefix = sign != null ? sign : "";
|
|
2881
|
+
return `${prefix}${formatTokenAmountTwoDecimals(amountRaw, tokenSymbol, chainId)} ${tokenSymbol}`;
|
|
2882
|
+
};
|
|
2883
|
+
var POSITION_ROW_VENUE_ORDER = [
|
|
2884
|
+
Venue.polymarket,
|
|
2885
|
+
Venue.kalshi,
|
|
2886
|
+
Venue.opinion,
|
|
2887
|
+
Venue.limitless
|
|
2888
|
+
];
|
|
2889
|
+
function venueBreakdownSortKey(venue) {
|
|
2890
|
+
const idx = POSITION_ROW_VENUE_ORDER.indexOf(venue);
|
|
2891
|
+
return idx === -1 ? POSITION_ROW_VENUE_ORDER.length : idx;
|
|
2892
|
+
}
|
|
2893
|
+
function toVenueLogoName(venue) {
|
|
2894
|
+
return venue;
|
|
2895
|
+
}
|
|
2896
|
+
function buildVenueShareBreakdown(outcome) {
|
|
2897
|
+
const breakdown = outcome.venueBreakdown;
|
|
2898
|
+
if (breakdown.length === 0) {
|
|
2899
|
+
return [];
|
|
2900
|
+
}
|
|
2901
|
+
const sorted = [...breakdown].sort(
|
|
2902
|
+
(a, b) => venueBreakdownSortKey(a.venue) - venueBreakdownSortKey(b.venue)
|
|
2903
|
+
);
|
|
2904
|
+
return sorted.map((row) => ({
|
|
2905
|
+
venue: toVenueLogoName(row.venue),
|
|
2906
|
+
sharesLabel: `${twoDecimalNumberFormatter.format(row.size)} shares`
|
|
2907
|
+
}));
|
|
2908
|
+
}
|
|
2909
|
+
var UserProfilePage = ({
|
|
2910
|
+
user,
|
|
2911
|
+
balanceChainsOverride,
|
|
2912
|
+
venueBalances: _venueBalances,
|
|
2913
|
+
balance,
|
|
2914
|
+
activePositions,
|
|
2915
|
+
closedPositions,
|
|
2916
|
+
activities,
|
|
2917
|
+
onEditProfile,
|
|
2918
|
+
onDeposit,
|
|
2919
|
+
onWithdraw,
|
|
2920
|
+
openOrders,
|
|
2921
|
+
initialPositionFilter = "active",
|
|
2922
|
+
tab,
|
|
2923
|
+
onTabChange,
|
|
2924
|
+
onPositionClick,
|
|
2925
|
+
getPositionHref,
|
|
2926
|
+
onClaim,
|
|
2927
|
+
claimingPositionKeys,
|
|
2928
|
+
onActivityClick,
|
|
2929
|
+
getActivityHref,
|
|
2930
|
+
onOpenOrderClick,
|
|
2931
|
+
onCancelOrder,
|
|
2932
|
+
cancellingOrderIds,
|
|
2933
|
+
isLoadingPositions,
|
|
2934
|
+
isLoadingActivities,
|
|
2935
|
+
isLoadingOpenOrders,
|
|
2936
|
+
positionsError,
|
|
2937
|
+
activitiesError,
|
|
2938
|
+
openOrdersError,
|
|
2939
|
+
hasMoreActivePositions,
|
|
2940
|
+
isLoadingMoreActivePositions,
|
|
2941
|
+
onLoadMoreActivePositions,
|
|
2942
|
+
hasMoreClosedPositions,
|
|
2943
|
+
isLoadingMoreClosedPositions,
|
|
2944
|
+
onLoadMoreClosedPositions,
|
|
2945
|
+
onPositionFilterChange: onPositionFilterChangeProp,
|
|
2946
|
+
hasMoreActivities,
|
|
2947
|
+
isLoadingMoreActivities,
|
|
2948
|
+
onLoadMoreActivities,
|
|
2949
|
+
hasMoreOpenOrders,
|
|
2950
|
+
isLoadingMoreOpenOrders,
|
|
2951
|
+
onLoadMoreOpenOrders,
|
|
2952
|
+
classNames,
|
|
2953
|
+
onError
|
|
2954
|
+
}) => {
|
|
2955
|
+
const [isHydrated, setIsHydrated] = useState6(false);
|
|
2956
|
+
useEffect4(() => {
|
|
2957
|
+
setIsHydrated(true);
|
|
2958
|
+
}, []);
|
|
2959
|
+
const { user: currentUser, isAuthenticated } = useAggAuthState();
|
|
2960
|
+
const { isDepositBlocked } = useGeoBlock();
|
|
2961
|
+
const balanceState = useAggBalance();
|
|
2962
|
+
const client = useAggClient();
|
|
2963
|
+
const labels = useLabels6();
|
|
2964
|
+
const queryClient = useQueryClient();
|
|
2965
|
+
const [internalCancellingIds, setInternalCancellingIds] = useState6({});
|
|
2966
|
+
const [profileUser, setProfileUser] = useState6(void 0);
|
|
2967
|
+
const shouldUseHookData = !user;
|
|
2968
|
+
const connectedVenues = useMemo3(() => {
|
|
2969
|
+
var _a;
|
|
2970
|
+
if (!shouldUseHookData) return [];
|
|
2971
|
+
const fromBalance = (_a = balanceState.connectedVenues) != null ? _a : [];
|
|
2972
|
+
return [...new Set(fromBalance)].sort((a, b) => a.localeCompare(b));
|
|
2973
|
+
}, [balanceState, shouldUseHookData]);
|
|
2974
|
+
const [positionFilter, setPositionFilter] = useState6(initialPositionFilter);
|
|
2975
|
+
const activePositionsQuery = useExecutionPositions({
|
|
2976
|
+
enabled: shouldUseHookData && isAuthenticated,
|
|
2977
|
+
status: "active",
|
|
2978
|
+
limit: 25
|
|
2979
|
+
});
|
|
2980
|
+
const [hasVisitedClosedTab, setHasVisitedClosedTab] = useState6(
|
|
2981
|
+
initialPositionFilter === "closed"
|
|
2982
|
+
);
|
|
2983
|
+
const closedPositionsQuery = useExecutionPositions({
|
|
2984
|
+
enabled: shouldUseHookData && isAuthenticated && hasVisitedClosedTab,
|
|
2985
|
+
status: "closed",
|
|
2986
|
+
limit: 25
|
|
2987
|
+
});
|
|
2988
|
+
const handlePositionFilterChange = useCallback3(
|
|
2989
|
+
(filter) => {
|
|
2990
|
+
setPositionFilter(filter);
|
|
2991
|
+
if (filter === "closed") setHasVisitedClosedTab(true);
|
|
2992
|
+
onPositionFilterChangeProp == null ? void 0 : onPositionFilterChangeProp(filter);
|
|
2993
|
+
},
|
|
2994
|
+
[onPositionFilterChangeProp]
|
|
2995
|
+
);
|
|
2996
|
+
useEffect4(() => {
|
|
2997
|
+
setPositionFilter(initialPositionFilter);
|
|
2998
|
+
if (initialPositionFilter === "closed") {
|
|
2999
|
+
setHasVisitedClosedTab(true);
|
|
3000
|
+
}
|
|
3001
|
+
}, [initialPositionFilter]);
|
|
3002
|
+
const ordersQuery = useExecutionOrders({
|
|
3003
|
+
enabled: shouldUseHookData && isAuthenticated,
|
|
3004
|
+
limit: 25
|
|
3005
|
+
});
|
|
3006
|
+
const { refetch: refetchOrders } = ordersQuery;
|
|
3007
|
+
const activityQuery = useUserActivity({
|
|
3008
|
+
enabled: shouldUseHookData && isAuthenticated,
|
|
3009
|
+
limit: 25
|
|
3010
|
+
});
|
|
3011
|
+
const depositAddressesQuery = useDepositAddresses({
|
|
3012
|
+
enabled: shouldUseHookData && isAuthenticated,
|
|
3013
|
+
poll: false
|
|
3014
|
+
});
|
|
3015
|
+
const handleCancelOrder = useCallback3(
|
|
3016
|
+
(order) => __async(null, null, function* () {
|
|
3017
|
+
if (onCancelOrder) {
|
|
3018
|
+
onCancelOrder(order);
|
|
3019
|
+
return;
|
|
3020
|
+
}
|
|
3021
|
+
setInternalCancellingIds((prev) => __spreadProps(__spreadValues({}, prev), { [order.id]: true }));
|
|
3022
|
+
try {
|
|
3023
|
+
yield client.cancelManagedOrder(order.id);
|
|
3024
|
+
yield queryClient.invalidateQueries({ queryKey: ["execution-orders"] });
|
|
3025
|
+
} finally {
|
|
3026
|
+
setInternalCancellingIds((prev) => {
|
|
3027
|
+
var _a;
|
|
3028
|
+
const _b = prev, { [_a = order.id]: _removed } = _b, rest = __objRest(_b, [__restKey(_a)]);
|
|
3029
|
+
return rest;
|
|
3030
|
+
});
|
|
3031
|
+
}
|
|
3032
|
+
}),
|
|
3033
|
+
[client, onCancelOrder, queryClient]
|
|
3034
|
+
);
|
|
3035
|
+
useEffect4(() => {
|
|
3036
|
+
if (!shouldUseHookData || !isAuthenticated || typeof refetchOrders !== "function") return;
|
|
3037
|
+
const intervalId = window.setInterval(() => {
|
|
3038
|
+
void refetchOrders();
|
|
3039
|
+
}, OPEN_ORDERS_REFETCH_INTERVAL_MS);
|
|
3040
|
+
return () => window.clearInterval(intervalId);
|
|
3041
|
+
}, [isAuthenticated, refetchOrders, shouldUseHookData]);
|
|
3042
|
+
useEffect4(() => {
|
|
3043
|
+
if (!shouldUseHookData || !isAuthenticated) {
|
|
3044
|
+
setProfileUser(void 0);
|
|
3045
|
+
return;
|
|
3046
|
+
}
|
|
3047
|
+
if (!shouldFetchFullUserProfile(currentUser)) {
|
|
3048
|
+
setProfileUser(void 0);
|
|
3049
|
+
return;
|
|
3050
|
+
}
|
|
3051
|
+
let isActive = true;
|
|
3052
|
+
void client.getCurrentUser().then((fullUser) => {
|
|
3053
|
+
if (isActive) setProfileUser(fullUser);
|
|
3054
|
+
}).catch(() => {
|
|
3055
|
+
if (isActive) setProfileUser(void 0);
|
|
3056
|
+
});
|
|
3057
|
+
return () => {
|
|
3058
|
+
isActive = false;
|
|
3059
|
+
};
|
|
3060
|
+
}, [client, currentUser, isAuthenticated, shouldUseHookData]);
|
|
3061
|
+
const resolvedUser = useMemo3(() => {
|
|
3062
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3063
|
+
if (user) return user;
|
|
3064
|
+
const fullUser = profileUser != null ? profileUser : currentUser;
|
|
3065
|
+
const fallbackUsername = (fullUser == null ? void 0 : fullUser.id) ? `user_${fullUser.id.slice(0, 6)}` : "User";
|
|
3066
|
+
const twitterAccount = (_a = fullUser == null ? void 0 : fullUser.accounts) == null ? void 0 : _a.find(
|
|
3067
|
+
(account) => String(account.provider).toLowerCase() === "twitter"
|
|
3068
|
+
);
|
|
3069
|
+
const normalizedTwitterHandle = (_b = twitterAccount == null ? void 0 : twitterAccount.providerAccountId) == null ? void 0 : _b.replace(/^@/, "");
|
|
3070
|
+
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 : [];
|
|
3071
|
+
const connectedWallets = walletAccounts.map((a) => {
|
|
3072
|
+
var _a2;
|
|
3073
|
+
return {
|
|
3074
|
+
chain: a.provider === "solana_wallet" ? "solana" : "evm",
|
|
3075
|
+
displayAddress: (_a2 = shortenAddress(a.providerAccountId)) != null ? _a2 : a.providerAccountId
|
|
3076
|
+
};
|
|
3077
|
+
});
|
|
3078
|
+
return {
|
|
3079
|
+
username: (_e = fullUser == null ? void 0 : fullUser.username) != null ? _e : fallbackUsername,
|
|
3080
|
+
avatarUrl: (_f = fullUser == null ? void 0 : fullUser.avatarUrl) != null ? _f : null,
|
|
3081
|
+
socialLinks: normalizedTwitterHandle ? [
|
|
3082
|
+
{
|
|
3083
|
+
platform: "twitter",
|
|
3084
|
+
handle: `https://x.com/${normalizedTwitterHandle}`
|
|
3085
|
+
}
|
|
3086
|
+
] : [],
|
|
3087
|
+
connectedExchanges: connectedVenues.map((venue) => ({ venue })),
|
|
3088
|
+
connectedWallets,
|
|
3089
|
+
displayAddress: shortenAddress(getWalletAddressFromUserProfile(fullUser)),
|
|
3090
|
+
socialHandle: normalizedTwitterHandle != null ? normalizedTwitterHandle : void 0
|
|
3091
|
+
};
|
|
3092
|
+
}, [connectedVenues, currentUser, profileUser, user]);
|
|
3093
|
+
const _resolvedVenueBalances = useMemo3(() => {
|
|
3094
|
+
if (_venueBalances) return _venueBalances;
|
|
3095
|
+
return balanceState.balanceBreakdown.map((item) => ({
|
|
3096
|
+
chain: item.label,
|
|
3097
|
+
accountCount: item.accountCount,
|
|
3098
|
+
balanceLabel: formatUsd(item.balance)
|
|
3099
|
+
}));
|
|
3100
|
+
}, [_venueBalances, balanceState.balanceBreakdown]);
|
|
3101
|
+
const positionsValueLabel = useMemo3(() => {
|
|
3102
|
+
var _a;
|
|
3103
|
+
if (balance == null ? void 0 : balance.totalLabel) return balance.totalLabel;
|
|
3104
|
+
const managed = balanceState.managedBalances;
|
|
3105
|
+
const positions = (_a = managed == null ? void 0 : managed.positions) != null ? _a : [];
|
|
3106
|
+
const positionsValueTotal = positions.reduce((sum, p) => sum + (Number(p.balance) || 0), 0);
|
|
3107
|
+
return formatUsd(positionsValueTotal);
|
|
3108
|
+
}, [balance, balanceState]);
|
|
3109
|
+
const availableBalanceLabel = useMemo3(() => {
|
|
3110
|
+
var _a;
|
|
3111
|
+
return formatUsd((_a = balanceState.totalBalance) != null ? _a : 0);
|
|
3112
|
+
}, [balanceState.totalBalance]);
|
|
3113
|
+
const resolvedActivities = useMemo3(() => {
|
|
3114
|
+
if (activities) return activities.filter(isVisibleUserProfileActivity);
|
|
3115
|
+
const formatTime = isHydrated ? toRelativeTimeLabel : toAbsoluteTimeLabel;
|
|
3116
|
+
const fullUser = profileUser != null ? profileUser : currentUser;
|
|
3117
|
+
const connectedWalletAddresses = getConnectedWalletAccountAddresses(fullUser);
|
|
3118
|
+
return activityQuery.activities.filter(isVisibleActivityItem).map((item) => {
|
|
3119
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
3120
|
+
const timeLabel = formatTime(item.createdAt);
|
|
3121
|
+
if (item.type === "trade") {
|
|
3122
|
+
const tradeItem = item;
|
|
3123
|
+
const sideLower = item.side.toLowerCase();
|
|
3124
|
+
const type = sideLower === "sell" ? "Sell" : "Buy";
|
|
3125
|
+
const isFailed = item.status.toLowerCase() === "failed";
|
|
3126
|
+
const hasError = hasActivityError(item);
|
|
3127
|
+
const eventId = (_b = (_a = tradeItem.venueMarket) == null ? void 0 : _a.venueEventId) != null ? _b : void 0;
|
|
3128
|
+
const marketId = (_d = (_c = tradeItem.venueMarket) == null ? void 0 : _c.id) != null ? _d : void 0;
|
|
3129
|
+
const marketQuestion = (_g = (_f = (_e = tradeItem.venueMarket) == null ? void 0 : _e.question) != null ? _f : tradeItem.marketQuestion) != null ? _g : "Market";
|
|
3130
|
+
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 : "";
|
|
3131
|
+
return {
|
|
3132
|
+
kind: "trade",
|
|
3133
|
+
id: item.id,
|
|
3134
|
+
eventId,
|
|
3135
|
+
marketId,
|
|
3136
|
+
isFailed,
|
|
3137
|
+
hasError,
|
|
3138
|
+
type,
|
|
3139
|
+
thumbnailSrc: toTradeThumbnailSrc(tradeItem, ordersQuery.orders),
|
|
3140
|
+
title: marketQuestion,
|
|
3141
|
+
venue: item.venue,
|
|
3142
|
+
outcomeLabel,
|
|
3143
|
+
sharesLabel: isFailed ? "-" : `${formatTradeQuantityTwoDecimals(item.executionPrice, item.filledAmountRaw)} shares`,
|
|
3144
|
+
amountLabel: isFailed ? "-" : toSignedAmountLabel(
|
|
3145
|
+
sideLower === "sell" ? "+" : "-",
|
|
3146
|
+
item.executionPrice,
|
|
3147
|
+
item.filledAmountRaw
|
|
3148
|
+
),
|
|
3149
|
+
timeLabel
|
|
3150
|
+
};
|
|
3151
|
+
}
|
|
3152
|
+
if (item.type === "withdrawal") {
|
|
3153
|
+
const isFailed = item.status.toLowerCase() === "failed";
|
|
3154
|
+
const hasError = hasActivityError(item);
|
|
3155
|
+
return {
|
|
3156
|
+
kind: "withdrawal",
|
|
3157
|
+
id: item.id,
|
|
3158
|
+
isFailed,
|
|
3159
|
+
hasError,
|
|
3160
|
+
type: labels.userProfile.activity.withdrawalType,
|
|
3161
|
+
title: labels.userProfile.activity.withdrawalTitle(item.tokenSymbol),
|
|
3162
|
+
subtitleLabel: `to ${(_m = shortenAddress(item.destinationAddress)) != null ? _m : item.destinationAddress} \xB7 ${formatChainIdLabel(item.destinationChainId)}`,
|
|
3163
|
+
amountLabel: isFailed ? "-" : toTokenAmountLabel({
|
|
3164
|
+
amountRaw: item.amountRaw,
|
|
3165
|
+
chainId: item.destinationChainId,
|
|
3166
|
+
tokenSymbol: item.tokenSymbol,
|
|
3167
|
+
sign: "-"
|
|
3168
|
+
}),
|
|
3169
|
+
timeLabel
|
|
3170
|
+
};
|
|
3171
|
+
}
|
|
3172
|
+
if (item.type === "deposit") {
|
|
3173
|
+
const isFailed = item.status.toLowerCase() === "failed";
|
|
3174
|
+
const hasError = hasActivityError(item);
|
|
3175
|
+
const depositSource = resolveDepositActivitySource({
|
|
3176
|
+
fromAddress: item.fromAddress,
|
|
3177
|
+
chainId: item.chainId,
|
|
3178
|
+
connectedWalletAddresses,
|
|
3179
|
+
depositAddress: depositAddressesQuery.getAddress(toNumericChainId(item.chainId))
|
|
3180
|
+
});
|
|
3181
|
+
const depositTitleBySource = {
|
|
3182
|
+
wallet: labels.userProfile.activity.depositTitles.connectedWallet,
|
|
3183
|
+
crypto: labels.userProfile.activity.depositTitles.externalWallet,
|
|
3184
|
+
card: labels.userProfile.activity.depositTitles.card
|
|
3185
|
+
};
|
|
3186
|
+
return {
|
|
3187
|
+
kind: "deposit",
|
|
3188
|
+
id: item.id,
|
|
3189
|
+
isFailed,
|
|
3190
|
+
hasError,
|
|
3191
|
+
type: labels.userProfile.activity.depositType,
|
|
3192
|
+
title: depositTitleBySource[depositSource],
|
|
3193
|
+
subtitleLabel: `from ${(_n = shortenAddress(item.fromAddress)) != null ? _n : item.fromAddress} \xB7 ${formatChainIdLabel(item.chainId)}`,
|
|
3194
|
+
amountLabel: isFailed ? "-" : toTokenAmountLabel({
|
|
3195
|
+
amountRaw: item.amountRaw,
|
|
3196
|
+
chainId: item.chainId,
|
|
3197
|
+
tokenSymbol: item.tokenSymbol,
|
|
3198
|
+
sign: "+"
|
|
3199
|
+
}),
|
|
3200
|
+
timeLabel,
|
|
3201
|
+
depositSource,
|
|
3202
|
+
chainId: item.chainId
|
|
3203
|
+
};
|
|
3204
|
+
}
|
|
3205
|
+
const _exhaustive = item;
|
|
3206
|
+
return _exhaustive;
|
|
3207
|
+
});
|
|
3208
|
+
}, [
|
|
3209
|
+
activities,
|
|
3210
|
+
activityQuery.activities,
|
|
3211
|
+
currentUser,
|
|
3212
|
+
depositAddressesQuery,
|
|
3213
|
+
isHydrated,
|
|
3214
|
+
labels,
|
|
3215
|
+
ordersQuery.orders,
|
|
3216
|
+
profileUser
|
|
3217
|
+
]);
|
|
3218
|
+
const resolvedOpenOrders = useMemo3(() => {
|
|
3219
|
+
if (openOrders) return openOrders;
|
|
3220
|
+
return ordersQuery.orders.filter((order) => isOpenOrderStatus(order.status)).map((order) => {
|
|
3221
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
3222
|
+
return {
|
|
3223
|
+
id: order.id,
|
|
3224
|
+
thumbnailSrc: (_b = (_a = order.venueMarket) == null ? void 0 : _a.image) != null ? _b : fallbackThumbnailSrc,
|
|
3225
|
+
title: ((_c = order.venueMarket) == null ? void 0 : _c.question) || "Market",
|
|
3226
|
+
outcomeLabel: ((_d = order.venueMarketOutcome) == null ? void 0 : _d.title) || ((_e = order.venueMarketOutcome) == null ? void 0 : _e.label) || "Outcome",
|
|
3227
|
+
venue: order.venue,
|
|
3228
|
+
filledLabel: `${formatScaledNumberTwoDecimals((_f = order.filledAmountRaw) != null ? _f : "0")}/${formatScaledNumberTwoDecimals(order.amountRaw)}`,
|
|
3229
|
+
valueLabel: formatFilledUsdTwoDecimals(order.filledAmountRaw),
|
|
3230
|
+
status: order.status,
|
|
3231
|
+
dagRunId: (_g = order.dagRunId) != null ? _g : null
|
|
3232
|
+
};
|
|
3233
|
+
});
|
|
3234
|
+
}, [openOrders, ordersQuery.orders]);
|
|
3235
|
+
const adaptPositionGroups = useCallback3(
|
|
3236
|
+
(groups) => {
|
|
3237
|
+
return groups.flatMap((group) => {
|
|
3238
|
+
var _a, _b;
|
|
3239
|
+
const closedTotals = group.status === "closed" ? computeClosedPositionTotals(group) : void 0;
|
|
3240
|
+
const venueEventId = (_a = group.venueMarket.venueEventId) != null ? _a : void 0;
|
|
3241
|
+
const eventId = (_b = group.eventId) != null ? _b : venueEventId;
|
|
3242
|
+
const marketId = group.targetMarketId;
|
|
3243
|
+
return group.venueMarket.venueMarketOutcomes.map((outcome) => {
|
|
3244
|
+
var _a2, _b2, _c, _d;
|
|
3245
|
+
const currentPriceCents = Math.round(outcome.currentPrice * 100);
|
|
3246
|
+
const averagePriceCents = Math.round(outcome.avgEntryPrice * 100);
|
|
3247
|
+
const pnlPrefix = outcome.unrealizedPnl >= 0 ? "+" : "";
|
|
3248
|
+
const pnlPercent = outcome.unrealizedPnlPercent.toFixed(2);
|
|
3249
|
+
return {
|
|
3250
|
+
id: `${group.targetMarketId}-${outcome.label}-${(_a2 = outcome.title) != null ? _a2 : ""}`,
|
|
3251
|
+
eventId,
|
|
3252
|
+
marketId,
|
|
3253
|
+
thumbnailSrc: (_b2 = group.venueMarket.image) != null ? _b2 : fallbackThumbnailSrc,
|
|
3254
|
+
title: group.venueMarket.question,
|
|
3255
|
+
outcomeLabel: ((_c = outcome.title) == null ? void 0 : _c.trim()) || outcome.label,
|
|
3256
|
+
venueShareBreakdown: buildVenueShareBreakdown(outcome),
|
|
3257
|
+
averageLabel: `${averagePriceCents}\xA2`,
|
|
3258
|
+
currentLabel: `${currentPriceCents}\xA2`,
|
|
3259
|
+
valueLabel: formatUsd(outcome.totalValue),
|
|
3260
|
+
pnlLabel: `${pnlPrefix}${formatUsd(outcome.unrealizedPnl)} (${pnlPrefix}${pnlPercent}%)`,
|
|
3261
|
+
isPnlPositive: outcome.unrealizedPnl >= 0,
|
|
3262
|
+
status: group.status,
|
|
3263
|
+
marketStatus: group.venueMarket.status,
|
|
3264
|
+
winner: (_d = outcome.winner) != null ? _d : null,
|
|
3265
|
+
resolutionDate: group.resolutionDate,
|
|
3266
|
+
closedTotalTradedLabel: closedTotals ? formatUsd(closedTotals.totalTraded) : void 0,
|
|
3267
|
+
closedAmountWonLabel: closedTotals ? formatUsd(closedTotals.amountWon) : void 0,
|
|
3268
|
+
closedReturnLabel: closedTotals ? formatSignedPercentLabel(closedTotals.returnPct) : void 0,
|
|
3269
|
+
closedClaimStatus: closedTotals ? group.redeemStatus : void 0,
|
|
3270
|
+
winningOutcomeIds: closedTotals == null ? void 0 : closedTotals.winningOutcomeIds
|
|
3271
|
+
};
|
|
3272
|
+
});
|
|
3273
|
+
});
|
|
3274
|
+
},
|
|
3275
|
+
[]
|
|
3276
|
+
);
|
|
3277
|
+
const resolvedActivePositions = useMemo3(() => {
|
|
3278
|
+
if (activePositions) return activePositions;
|
|
3279
|
+
return adaptPositionGroups(activePositionsQuery.positions);
|
|
3280
|
+
}, [activePositions, activePositionsQuery.positions, adaptPositionGroups]);
|
|
3281
|
+
const resolvedClosedPositions = useMemo3(() => {
|
|
3282
|
+
if (closedPositions) return closedPositions;
|
|
3283
|
+
return adaptPositionGroups(closedPositionsQuery.positions);
|
|
3284
|
+
}, [closedPositions, closedPositionsQuery.positions, adaptPositionGroups]);
|
|
3285
|
+
return /* @__PURE__ */ jsx11(AggErrorBoundary, { onError, children: /* @__PURE__ */ jsx11(
|
|
3286
|
+
"section",
|
|
3287
|
+
{
|
|
3288
|
+
className: cn(
|
|
3289
|
+
"agg-user-profile-page",
|
|
3290
|
+
"w-full mx-auto px-6 lg:px-10 pb-10 max-w-[1360px]",
|
|
3291
|
+
classNames == null ? void 0 : classNames.root
|
|
3292
|
+
),
|
|
3293
|
+
children: /* @__PURE__ */ jsxs11(
|
|
3294
|
+
"div",
|
|
3295
|
+
{
|
|
3296
|
+
className: cn(
|
|
3297
|
+
"agg-page-content",
|
|
3298
|
+
"pt-4 sm:pt-6 md:pt-8 pb-10",
|
|
3299
|
+
"flex w-full flex-col gap-6",
|
|
3300
|
+
classNames == null ? void 0 : classNames.topRow
|
|
3301
|
+
),
|
|
3302
|
+
children: [
|
|
3303
|
+
/* @__PURE__ */ jsxs11("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: [
|
|
3304
|
+
/* @__PURE__ */ jsx11(
|
|
3305
|
+
"div",
|
|
3306
|
+
{
|
|
3307
|
+
className: cn(
|
|
3308
|
+
"agg-profile-main",
|
|
3309
|
+
"flex min-w-0 flex-1 flex-col gap-4 sm:gap-6 h-full",
|
|
3310
|
+
classNames == null ? void 0 : classNames.leftColumn
|
|
3311
|
+
),
|
|
3312
|
+
children: /* @__PURE__ */ jsx11(
|
|
3313
|
+
UserInfoCard,
|
|
3314
|
+
{
|
|
3315
|
+
user: resolvedUser,
|
|
3316
|
+
onEditProfile,
|
|
3317
|
+
onDeposit,
|
|
3318
|
+
onWithdraw,
|
|
3319
|
+
isDepositBlocked,
|
|
3320
|
+
className: cn("h-full", classNames == null ? void 0 : classNames.userInfoCard)
|
|
3321
|
+
}
|
|
3322
|
+
)
|
|
3323
|
+
}
|
|
3324
|
+
),
|
|
3325
|
+
/* @__PURE__ */ jsxs11(
|
|
3326
|
+
"div",
|
|
3327
|
+
{
|
|
3328
|
+
className: cn("agg-profile-side-panels flex flex-col gap-4", classNames == null ? void 0 : classNames.rightColumn),
|
|
3329
|
+
children: [
|
|
3330
|
+
/* @__PURE__ */ jsx11(PositionsValueCard, { valueLabel: positionsValueLabel }),
|
|
3331
|
+
/* @__PURE__ */ jsx11(
|
|
3332
|
+
AvailableBalanceCard,
|
|
3333
|
+
{
|
|
3334
|
+
valueLabel: availableBalanceLabel,
|
|
3335
|
+
chains: (balanceChainsOverride != null ? balanceChainsOverride : balanceState.balanceBreakdown).map((b) => ({
|
|
3336
|
+
key: b.key,
|
|
3337
|
+
label: b.label,
|
|
3338
|
+
balance: b.balance,
|
|
3339
|
+
accountCount: b.accountCount,
|
|
3340
|
+
venues: b.venues
|
|
3341
|
+
}))
|
|
3342
|
+
}
|
|
3343
|
+
)
|
|
3344
|
+
]
|
|
3345
|
+
}
|
|
3346
|
+
)
|
|
3347
|
+
] }),
|
|
3348
|
+
/* @__PURE__ */ jsx11(
|
|
3349
|
+
PositionsActivity,
|
|
3350
|
+
{
|
|
3351
|
+
tab,
|
|
3352
|
+
onTabChange,
|
|
3353
|
+
activePositions: resolvedActivePositions,
|
|
3354
|
+
closedPositions: resolvedClosedPositions,
|
|
3355
|
+
activities: resolvedActivities,
|
|
3356
|
+
openOrders: resolvedOpenOrders,
|
|
3357
|
+
onPositionClick,
|
|
3358
|
+
getPositionHref,
|
|
3359
|
+
onClaim,
|
|
3360
|
+
claimingPositionKeys,
|
|
3361
|
+
onActivityClick,
|
|
3362
|
+
getActivityHref,
|
|
3363
|
+
onOpenOrderClick,
|
|
3364
|
+
onCancelOrder: handleCancelOrder,
|
|
3365
|
+
cancellingOrderIds: cancellingOrderIds != null ? cancellingOrderIds : internalCancellingIds,
|
|
3366
|
+
isLoadingPositions: isLoadingPositions != null ? isLoadingPositions : !!shouldUseHookData && (positionFilter === "active" ? activePositionsQuery.isLoading : closedPositionsQuery.isLoading),
|
|
3367
|
+
isLoadingActivities: isLoadingActivities != null ? isLoadingActivities : !!shouldUseHookData && activityQuery.isLoading,
|
|
3368
|
+
isLoadingOpenOrders: isLoadingOpenOrders != null ? isLoadingOpenOrders : !!shouldUseHookData && ordersQuery.isLoading,
|
|
3369
|
+
positionsError: positionsError != null ? positionsError : !!shouldUseHookData && (positionFilter === "active" ? !!activePositionsQuery.error : !!closedPositionsQuery.error),
|
|
3370
|
+
activitiesError: activitiesError != null ? activitiesError : !!shouldUseHookData && !!activityQuery.error,
|
|
3371
|
+
openOrdersError: openOrdersError != null ? openOrdersError : !!shouldUseHookData && !!ordersQuery.error,
|
|
3372
|
+
hasMoreActivePositions: hasMoreActivePositions != null ? hasMoreActivePositions : !!shouldUseHookData && !!activePositionsQuery.hasNextPage,
|
|
3373
|
+
isLoadingMoreActivePositions: isLoadingMoreActivePositions != null ? isLoadingMoreActivePositions : !!shouldUseHookData && !!activePositionsQuery.isFetchingNextPage,
|
|
3374
|
+
onLoadMoreActivePositions: onLoadMoreActivePositions != null ? onLoadMoreActivePositions : shouldUseHookData && activePositionsQuery.hasNextPage ? () => {
|
|
3375
|
+
void activePositionsQuery.fetchNextPage();
|
|
3376
|
+
} : void 0,
|
|
3377
|
+
hasMoreClosedPositions: hasMoreClosedPositions != null ? hasMoreClosedPositions : !!shouldUseHookData && !!closedPositionsQuery.hasNextPage,
|
|
3378
|
+
isLoadingMoreClosedPositions: isLoadingMoreClosedPositions != null ? isLoadingMoreClosedPositions : !!shouldUseHookData && !!closedPositionsQuery.isFetchingNextPage,
|
|
3379
|
+
onLoadMoreClosedPositions: onLoadMoreClosedPositions != null ? onLoadMoreClosedPositions : shouldUseHookData && closedPositionsQuery.hasNextPage ? () => {
|
|
3380
|
+
void closedPositionsQuery.fetchNextPage();
|
|
3381
|
+
} : void 0,
|
|
3382
|
+
onPositionFilterChange: handlePositionFilterChange,
|
|
3383
|
+
initialPositionFilter,
|
|
3384
|
+
hasMoreActivities: hasMoreActivities != null ? hasMoreActivities : !!shouldUseHookData && !!activityQuery.hasNextPage,
|
|
3385
|
+
isLoadingMoreActivities: isLoadingMoreActivities != null ? isLoadingMoreActivities : !!shouldUseHookData && !!activityQuery.isFetchingNextPage,
|
|
3386
|
+
onLoadMoreActivities: onLoadMoreActivities != null ? onLoadMoreActivities : shouldUseHookData && activityQuery.hasNextPage ? () => {
|
|
3387
|
+
void activityQuery.fetchNextPage();
|
|
3388
|
+
} : void 0,
|
|
3389
|
+
hasMoreOpenOrders: hasMoreOpenOrders != null ? hasMoreOpenOrders : !!shouldUseHookData && !!ordersQuery.hasNextPage,
|
|
3390
|
+
isLoadingMoreOpenOrders: isLoadingMoreOpenOrders != null ? isLoadingMoreOpenOrders : !!shouldUseHookData && !!ordersQuery.isFetchingNextPage,
|
|
3391
|
+
onLoadMoreOpenOrders: onLoadMoreOpenOrders != null ? onLoadMoreOpenOrders : shouldUseHookData && ordersQuery.hasNextPage ? () => {
|
|
3392
|
+
void ordersQuery.fetchNextPage();
|
|
3393
|
+
} : void 0,
|
|
3394
|
+
className: classNames == null ? void 0 : classNames.positionsActivity
|
|
3395
|
+
}
|
|
3396
|
+
)
|
|
3397
|
+
]
|
|
3398
|
+
}
|
|
3399
|
+
)
|
|
3400
|
+
}
|
|
3401
|
+
) });
|
|
3402
|
+
};
|
|
3403
|
+
UserProfilePage.displayName = "UserProfilePage";
|
|
3404
|
+
|
|
3405
|
+
export {
|
|
3406
|
+
DefaultAvatar,
|
|
3407
|
+
ConditionalWrapper,
|
|
3408
|
+
EventMarketPage,
|
|
3409
|
+
useHomePageModals,
|
|
3410
|
+
HomePage,
|
|
3411
|
+
USER_PROFILE_TAB_POSITIONS,
|
|
3412
|
+
USER_PROFILE_TAB_OPEN_ORDERS,
|
|
3413
|
+
USER_PROFILE_TAB_ACTIVITY,
|
|
3414
|
+
UserProfilePage
|
|
3415
|
+
};
|