@agg-market/ui 13.0.0 → 14.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pages.js CHANGED
@@ -8192,6 +8192,9 @@ var getTradingVenueLabel = (venue, label) => {
8192
8192
  if (label) return label;
8193
8193
  return defaultLabels.venues[venue];
8194
8194
  };
8195
+ var getTradingSharesLabel = (value) => {
8196
+ return defaultLabels.trading.shares(value);
8197
+ };
8195
8198
 
8196
8199
  // src/trading/place-order/index.tsx
8197
8200
  var import_jsx_runtime93 = require("react/jsx-runtime");
@@ -9576,11 +9579,11 @@ var AvailableBalanceCard = ({
9576
9579
  {
9577
9580
  "aria-label": "Balances by chain",
9578
9581
  size: "small",
9579
- side: "top",
9582
+ side: "bottom",
9580
9583
  classNames: { content: "border-0" },
9581
9584
  content: /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: "flex min-w-[280px] max-w-[360px] flex-col gap-2 p-3 sm:p-4", children: [
9582
9585
  /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: "font-agg-sans text-agg-sm leading-5 font-agg-bold text-agg-foreground", children: "Balance by network" }),
9583
- /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { role: "list", className: "divide-y divide-agg-separator/60", children: chains.map((row) => {
9586
+ /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { role: "list", children: chains.map((row) => {
9584
9587
  const icon = chainIconName(row.label);
9585
9588
  return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(
9586
9589
  "div",
@@ -9674,28 +9677,29 @@ var ActivityRow = ({ activity, onClick }) => {
9674
9677
  ),
9675
9678
  onClick: handleClick,
9676
9679
  children: [
9677
- /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("p", { className: "hidden w-[60px] shrink-0 font-agg-sans text-agg-base leading-agg-6 font-agg-normal text-agg-foreground sm:block", children: activity.type }),
9678
- /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex min-w-0 w-full flex-1 items-center gap-3 sm:gap-4", children: [
9680
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "hidden w-[60px] shrink-0 items-center gap-1 sm:flex", children: [
9679
9681
  /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(VenueLogo, { venue: activity.venue, size: "small", className: "shrink-0" }),
9680
- /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
9681
- /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
9682
- RemoteImage,
9683
- {
9684
- src: activity.thumbnailSrc,
9685
- alt: "",
9686
- className: "h-[52px] w-[52px] shrink-0 rounded-agg-sm object-cover sm:h-[60px] sm:w-[60px]"
9687
- }
9688
- ),
9689
- /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
9690
- /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("p", { className: "min-w-full overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: activity.title }),
9691
- /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex flex-wrap items-center gap-2 sm:gap-3", children: [
9692
- /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: "inline-flex items-center justify-center gap-1.5 rounded-full bg-agg-secondary-hover px-3 py-1.5 sm:px-4", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: activity.outcomeLabel }) }),
9693
- /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-black whitespace-nowrap", children: activity.sharesLabel })
9694
- ] })
9682
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-normal text-agg-foreground", children: activity.type })
9683
+ ] }),
9684
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: "flex min-w-0 w-full flex-1 items-center gap-3 sm:gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
9685
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
9686
+ RemoteImage,
9687
+ {
9688
+ src: activity.thumbnailSrc,
9689
+ alt: "",
9690
+ className: "h-[52px] w-[52px] shrink-0 rounded-agg-sm object-cover sm:h-[60px] sm:w-[60px]"
9691
+ }
9692
+ ),
9693
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
9694
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("p", { className: "min-w-full overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: activity.title }),
9695
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex flex-wrap items-center gap-2 sm:gap-3", children: [
9696
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: "inline-flex items-center justify-center gap-1.5 rounded-full bg-agg-secondary-hover px-3 py-1.5 sm:px-4", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: activity.outcomeLabel }) }),
9697
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-black whitespace-nowrap", children: activity.sharesLabel })
9695
9698
  ] })
9696
9699
  ] })
9697
- ] }),
9698
- /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex w-full flex-row items-center justify-between gap-1 text-agg-base leading-agg-6 whitespace-nowrap sm:w-[120px] sm:shrink-0 sm:flex-col sm:items-end sm:justify-center", children: [
9700
+ ] }) }),
9701
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: "hidden w-[175px] shrink-0 sm:block", "aria-hidden": true }),
9702
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex w-full flex-row items-center justify-between gap-1 text-agg-base leading-agg-6 whitespace-nowrap sm:w-[184px] sm:shrink-0 sm:flex-col sm:items-end sm:justify-center", children: [
9699
9703
  /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("p", { className: "font-agg-sans font-agg-bold text-black", children: activity.amountLabel }),
9700
9704
  /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("p", { className: "font-agg-sans font-agg-normal text-agg-muted-foreground", children: activity.timeLabel })
9701
9705
  ] })
@@ -9744,22 +9748,29 @@ var PositionRow = ({ position, onClick }) => {
9744
9748
  onClick: handleClick,
9745
9749
  children: [
9746
9750
  /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: "flex min-w-0 w-full flex-1 items-center gap-3 sm:gap-4", children: [
9747
- /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(VenueLogo, { venue: position.venue, size: "small", className: "shrink-0" }),
9748
- /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
9749
- /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
9750
- RemoteImage,
9751
- {
9752
- src: position.thumbnailSrc,
9753
- alt: "",
9754
- className: "h-[52px] w-[52px] shrink-0 rounded-agg-sm object-cover sm:h-[60px] sm:w-[60px]"
9755
- }
9756
- ),
9757
- /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
9758
- /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("p", { className: "min-w-full overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: position.title }),
9759
- /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: "flex flex-wrap items-center gap-2 sm:gap-3", children: [
9760
- /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("span", { className: "inline-flex items-center justify-center gap-1.5 rounded-full bg-agg-secondary-hover px-3 py-1.5 sm:px-4", children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: position.outcomeLabel }) }),
9761
- /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-black whitespace-nowrap", children: position.sharesLabel })
9762
- ] })
9751
+ /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
9752
+ RemoteImage,
9753
+ {
9754
+ src: position.thumbnailSrc,
9755
+ alt: "",
9756
+ className: "h-[52px] w-[52px] shrink-0 rounded-agg-sm object-cover sm:h-[60px] sm:w-[60px]"
9757
+ }
9758
+ ),
9759
+ /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
9760
+ /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("p", { className: "min-w-full overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: position.title }),
9761
+ /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
9762
+ /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("span", { className: "inline-flex items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-1.5 sm:px-[16px] sm:py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: position.outcomeLabel }) }),
9763
+ /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: "flex min-w-0 flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2", children: position.venueShareBreakdown.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(
9764
+ "div",
9765
+ {
9766
+ className: "flex items-center gap-1",
9767
+ children: [
9768
+ /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(VenueLogo, { venue: row.venue, size: "small", className: "size-4 shrink-0" }),
9769
+ /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-black whitespace-nowrap", children: row.sharesLabel })
9770
+ ]
9771
+ },
9772
+ `${row.venue}-${row.sharesLabel}-${String(index)}`
9773
+ )) })
9763
9774
  ] })
9764
9775
  ] })
9765
9776
  ] }),
@@ -9779,7 +9790,14 @@ var PositionRow = ({ position, onClick }) => {
9779
9790
  }
9780
9791
  )
9781
9792
  ] }),
9782
- /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(Icon, { name: "chevron-right", size: "small", className: "shrink-0 text-agg-muted-foreground" })
9793
+ /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
9794
+ Icon,
9795
+ {
9796
+ name: "chevron-right",
9797
+ size: "small",
9798
+ className: "size-5 shrink-0 text-agg-muted-foreground"
9799
+ }
9800
+ )
9783
9801
  ] })
9784
9802
  ]
9785
9803
  }
@@ -9793,6 +9811,7 @@ var tabItems = [
9793
9811
  { value: USER_PROFILE_TAB_POSITIONS, label: "Positions" },
9794
9812
  { value: USER_PROFILE_TAB_ACTIVITY, label: "Activity" }
9795
9813
  ];
9814
+ var TabRowsSkeleton = ({ ariaLabel }) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { role: "status", "aria-label": ariaLabel, className: "flex flex-col gap-3 sm:gap-4", children: Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "h-14 rounded-agg-sm bg-agg-secondary-hover/80 sm:h-16" }, index)) });
9796
9815
  var PositionsActivity = ({
9797
9816
  activePositions = [],
9798
9817
  closedPositions = [],
@@ -9814,21 +9833,91 @@ var PositionsActivity = ({
9814
9833
  const [activeTab, setActiveTab] = (0, import_react17.useState)(USER_PROFILE_TAB_POSITIONS);
9815
9834
  const [positionFilter, setPositionFilter] = (0, import_react17.useState)("active");
9816
9835
  const [searchValue, setSearchValue] = (0, import_react17.useState)("");
9836
+ const [isSearchFocused, setIsSearchFocused] = (0, import_react17.useState)(false);
9837
+ const positionsLoadMoreRef = (0, import_react17.useRef)(null);
9838
+ const activitiesLoadMoreRef = (0, import_react17.useRef)(null);
9817
9839
  const isPositionsTab = activeTab === USER_PROFILE_TAB_POSITIONS;
9818
9840
  const filteredPositions = (0, import_react17.useMemo)(() => {
9819
- const positions = positionFilter === "active" ? activePositions : closedPositions;
9820
- if (!searchValue.trim()) return positions;
9821
- const query = searchValue.toLowerCase();
9822
- return positions.filter((p) => p.title.toLowerCase().includes(query));
9841
+ const base = positionFilter === "active" ? activePositions : closedPositions;
9842
+ if (!searchValue.trim()) return base;
9843
+ const q = searchValue.toLowerCase();
9844
+ return base.filter((p) => p.title.toLowerCase().includes(q));
9823
9845
  }, [activePositions, closedPositions, positionFilter, searchValue]);
9824
9846
  const filteredActivities = (0, import_react17.useMemo)(() => {
9825
9847
  if (!searchValue.trim()) return activities;
9826
- const query = searchValue.toLowerCase();
9827
- return activities.filter((a) => a.title.toLowerCase().includes(query));
9848
+ const q = searchValue.toLowerCase();
9849
+ return activities.filter((a) => a.title.toLowerCase().includes(q));
9828
9850
  }, [activities, searchValue]);
9851
+ const searchResults = (0, import_react17.useMemo)(() => {
9852
+ if (!searchValue.trim()) return [];
9853
+ if (isPositionsTab) {
9854
+ return filteredPositions.slice(0, 5).map((p) => ({
9855
+ id: p.id,
9856
+ title: p.title,
9857
+ thumbnailSrc: p.thumbnailSrc,
9858
+ metaPrimary: p.outcomeLabel,
9859
+ metaSecondary: p.valueLabel,
9860
+ kind: "position",
9861
+ raw: p
9862
+ }));
9863
+ }
9864
+ return filteredActivities.slice(0, 5).map((a) => ({
9865
+ id: a.id,
9866
+ title: a.title,
9867
+ thumbnailSrc: a.thumbnailSrc,
9868
+ metaPrimary: a.outcomeLabel,
9869
+ metaSecondary: a.amountLabel,
9870
+ kind: "activity",
9871
+ raw: a
9872
+ }));
9873
+ }, [filteredActivities, filteredPositions, isPositionsTab, searchValue]);
9829
9874
  const handleSearchChange = (event) => {
9830
9875
  setSearchValue(event.target.value);
9831
9876
  };
9877
+ (0, import_react17.useEffect)(() => {
9878
+ if (!isPositionsTab || !hasMorePositions) return;
9879
+ const target = positionsLoadMoreRef.current;
9880
+ if (!target || !onLoadMorePositions) return;
9881
+ const observer = new IntersectionObserver(
9882
+ (entries) => {
9883
+ const entry = entries[0];
9884
+ if (!(entry == null ? void 0 : entry.isIntersecting)) return;
9885
+ if (isLoadingPositions || isLoadingMorePositions || !hasMorePositions) return;
9886
+ onLoadMorePositions();
9887
+ },
9888
+ { rootMargin: "240px 0px" }
9889
+ );
9890
+ observer.observe(target);
9891
+ return () => observer.disconnect();
9892
+ }, [
9893
+ hasMorePositions,
9894
+ isLoadingMorePositions,
9895
+ isLoadingPositions,
9896
+ isPositionsTab,
9897
+ onLoadMorePositions
9898
+ ]);
9899
+ (0, import_react17.useEffect)(() => {
9900
+ if (isPositionsTab || !hasMoreActivities) return;
9901
+ const target = activitiesLoadMoreRef.current;
9902
+ if (!target || !onLoadMoreActivities) return;
9903
+ const observer = new IntersectionObserver(
9904
+ (entries) => {
9905
+ const entry = entries[0];
9906
+ if (!(entry == null ? void 0 : entry.isIntersecting)) return;
9907
+ if (isLoadingActivities || isLoadingMoreActivities || !hasMoreActivities) return;
9908
+ onLoadMoreActivities();
9909
+ },
9910
+ { rootMargin: "240px 0px" }
9911
+ );
9912
+ observer.observe(target);
9913
+ return () => observer.disconnect();
9914
+ }, [
9915
+ hasMoreActivities,
9916
+ isLoadingActivities,
9917
+ isLoadingMoreActivities,
9918
+ isPositionsTab,
9919
+ onLoadMoreActivities
9920
+ ]);
9832
9921
  return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(
9833
9922
  "div",
9834
9923
  {
@@ -9870,23 +9959,95 @@ var PositionsActivity = ({
9870
9959
  )
9871
9960
  ] }, filter.value);
9872
9961
  }) }) : null,
9873
- /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("label", { className: "flex w-full min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("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: [
9874
- /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(Icon, { name: "search", size: "small", className: "shrink-0 text-agg-muted-foreground" }),
9875
- /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
9876
- "input",
9877
- {
9878
- value: searchValue,
9879
- onChange: handleSearchChange,
9880
- placeholder: "Search...",
9881
- className: cn(
9882
- "h-6 w-full min-w-0 border-0 bg-transparent p-0",
9883
- "font-agg-sans text-agg-base leading-agg-6 font-agg-normal text-agg-foreground",
9884
- "placeholder:text-agg-muted-foreground",
9885
- "outline-none focus:outline-none"
9886
- )
9887
- }
9888
- )
9889
- ] }) })
9962
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(
9963
+ "div",
9964
+ {
9965
+ className: "relative flex w-full min-w-0 flex-1",
9966
+ onFocusCapture: () => setIsSearchFocused(true),
9967
+ onBlurCapture: (event) => {
9968
+ const next = event.relatedTarget;
9969
+ if (next && event.currentTarget.contains(next)) return;
9970
+ setIsSearchFocused(false);
9971
+ },
9972
+ children: [
9973
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("label", { className: "flex w-full min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("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: [
9974
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(Icon, { name: "search", size: "small", className: "shrink-0 text-agg-muted-foreground" }),
9975
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
9976
+ "input",
9977
+ {
9978
+ value: searchValue,
9979
+ onChange: handleSearchChange,
9980
+ placeholder: "Search...",
9981
+ className: cn(
9982
+ "h-6 w-full min-w-0 border-0 bg-transparent p-0",
9983
+ "font-agg-sans text-agg-base leading-agg-6 font-agg-normal text-agg-foreground",
9984
+ "placeholder:text-agg-muted-foreground",
9985
+ "outline-none focus:outline-none"
9986
+ )
9987
+ }
9988
+ )
9989
+ ] }) }),
9990
+ isSearchFocused && searchValue.trim() ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "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__ */ (0, import_jsx_runtime102.jsx)(
9991
+ "ul",
9992
+ {
9993
+ className: "m-0 flex list-none flex-col p-0",
9994
+ role: "listbox",
9995
+ "aria-label": "Search results",
9996
+ children: searchResults.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
9997
+ "li",
9998
+ {
9999
+ role: "presentation",
10000
+ className: cn(index > 0 && "border-t border-agg-separator"),
10001
+ children: /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(
10002
+ "button",
10003
+ {
10004
+ type: "button",
10005
+ className: "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",
10006
+ onClick: () => {
10007
+ if (item.kind === "position") {
10008
+ onPositionClick == null ? void 0 : onPositionClick(item.raw);
10009
+ } else {
10010
+ onActivityClick == null ? void 0 : onActivityClick(item.raw);
10011
+ }
10012
+ },
10013
+ children: [
10014
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
10015
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
10016
+ "img",
10017
+ {
10018
+ src: item.thumbnailSrc,
10019
+ alt: "",
10020
+ className: "size-12 shrink-0 rounded-[8px] object-cover"
10021
+ }
10022
+ ),
10023
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
10024
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("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 }),
10025
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex min-w-0 items-center gap-2 text-agg-muted-foreground", children: [
10026
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("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 }),
10027
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("span", { className: "text-agg-muted-foreground", "aria-hidden": true, children: "\xB7" }),
10028
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("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 })
10029
+ ] })
10030
+ ] })
10031
+ ] }),
10032
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
10033
+ Icon,
10034
+ {
10035
+ name: "chevron-right",
10036
+ size: "medium",
10037
+ className: "h-5 w-5 shrink-0 text-agg-muted-foreground"
10038
+ }
10039
+ )
10040
+ ]
10041
+ }
10042
+ )
10043
+ },
10044
+ item.id
10045
+ ))
10046
+ }
10047
+ ) : /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "px-5 py-6 font-agg-sans text-agg-sm leading-agg-5 text-agg-muted-foreground", children: "No results" }) }) : null
10048
+ ]
10049
+ }
10050
+ )
9890
10051
  ] }),
9891
10052
  isPositionsTab && filteredPositions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "hidden items-center gap-6 px-0 sm:flex", children: [
9892
10053
  /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("p", { className: "min-w-0 flex-1 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: "Market" }),
@@ -9897,15 +10058,9 @@ var PositionsActivity = ({
9897
10058
  !isPositionsTab && filteredActivities.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "hidden items-center gap-6 px-0 sm:flex", children: [
9898
10059
  /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("p", { className: "w-[60px] shrink-0 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: "Type" }),
9899
10060
  /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("p", { className: "min-w-0 flex-1 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: "Market" }),
9900
- /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("p", { className: "w-[120px] shrink-0 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground text-right", children: "Amount" })
10061
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("p", { className: "w-[184px] shrink-0 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground text-right", children: "Amount" })
9901
10062
  ] }) : null,
9902
- isPositionsTab ? isLoadingPositions && filteredPositions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
9903
- Skeleton,
9904
- {
9905
- view: skeletonViews.userProfilePositionsActivity,
9906
- ariaLabel: "Loading positions"
9907
- }
9908
- ) : positionsError && filteredPositions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
10063
+ isPositionsTab ? isLoadingPositions && filteredPositions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(TabRowsSkeleton, { ariaLabel: "Loading positions" }) : positionsError && filteredPositions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
9909
10064
  EmptyState,
9910
10065
  {
9911
10066
  title: "Unable to load positions",
@@ -9917,38 +10072,15 @@ var PositionsActivity = ({
9917
10072
  title: "No positions yet",
9918
10073
  description: "Your open trades will appear here once you place an order."
9919
10074
  }
9920
- ) : isLoadingActivities && filteredActivities.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
9921
- Skeleton,
9922
- {
9923
- view: skeletonViews.userProfilePositionsActivity,
9924
- ariaLabel: "Loading activity"
9925
- }
9926
- ) : activitiesError && filteredActivities.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(EmptyState, { title: "Unable to load activity", description: "Please try again in a moment." }) : filteredActivities.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "flex flex-col gap-3 sm:gap-4", children: filteredActivities.map((activity) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(ActivityRow, { activity, onClick: onActivityClick }, activity.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
10075
+ ) : isLoadingActivities && filteredActivities.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(TabRowsSkeleton, { ariaLabel: "Loading activity" }) : activitiesError && filteredActivities.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(EmptyState, { title: "Unable to load activity", description: "Please try again in a moment." }) : filteredActivities.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "flex flex-col gap-3 sm:gap-4", children: filteredActivities.map((activity) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(ActivityRow, { activity, onClick: onActivityClick }, activity.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
9927
10076
  EmptyState,
9928
10077
  {
9929
10078
  title: "No activity yet",
9930
10079
  description: "Your trading activity will appear here."
9931
10080
  }
9932
10081
  ),
9933
- isPositionsTab ? hasMorePositions ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "flex w-full justify-center pt-1", children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
9934
- Button,
9935
- {
9936
- variant: "secondary",
9937
- size: "medium",
9938
- isLoading: isLoadingMorePositions,
9939
- onClick: onLoadMorePositions,
9940
- children: "Load more"
9941
- }
9942
- ) }) : null : hasMoreActivities ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "flex w-full justify-center pt-1", children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
9943
- Button,
9944
- {
9945
- variant: "secondary",
9946
- size: "medium",
9947
- isLoading: isLoadingMoreActivities,
9948
- onClick: onLoadMoreActivities,
9949
- children: "Load more"
9950
- }
9951
- ) }) : null
10082
+ isPositionsTab && hasMorePositions ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { ref: positionsLoadMoreRef, className: "h-px w-full", "aria-hidden": true }) : null,
10083
+ !isPositionsTab && hasMoreActivities ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { ref: activitiesLoadMoreRef, className: "h-px w-full", "aria-hidden": true }) : null
9952
10084
  ] })
9953
10085
  ]
9954
10086
  }
@@ -9956,54 +10088,9 @@ var PositionsActivity = ({
9956
10088
  };
9957
10089
  PositionsActivity.displayName = "PositionsActivity";
9958
10090
 
9959
- // src/pages/user-profile/components/default-avatar.tsx
9960
- var import_jsx_runtime103 = require("react/jsx-runtime");
9961
- var DefaultAvatar = ({ className }) => {
9962
- return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
9963
- "svg",
9964
- {
9965
- xmlns: "http://www.w3.org/2000/svg",
9966
- width: "120",
9967
- height: "120",
9968
- viewBox: "0 0 120 120",
9969
- fill: "none",
9970
- className: cn("shrink-0", className),
9971
- "aria-hidden": true,
9972
- children: [
9973
- /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("g", { clipPath: "url(#clip0_default_avatar)", children: [
9974
- /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
9975
- "path",
9976
- {
9977
- 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",
9978
- fill: "white"
9979
- }
9980
- ),
9981
- /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
9982
- "path",
9983
- {
9984
- 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",
9985
- fill: "black",
9986
- fillOpacity: "0.1"
9987
- }
9988
- ),
9989
- /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
9990
- "path",
9991
- {
9992
- 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",
9993
- fill: "black",
9994
- fillOpacity: "0.1"
9995
- }
9996
- )
9997
- ] }),
9998
- /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("clipPath", { id: "clip0_default_avatar", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("rect", { width: "120", height: "120", fill: "white" }) }) })
9999
- ]
10000
- }
10001
- );
10002
- };
10003
- DefaultAvatar.displayName = "DefaultAvatar";
10004
-
10005
10091
  // src/pages/user-profile/components/user-info-card.tsx
10006
- var import_jsx_runtime104 = require("react/jsx-runtime");
10092
+ var import_jsx_runtime103 = require("react/jsx-runtime");
10093
+ var fallbackAvatarSrc = "https://picsum.photos/seed/user-profile-avatar/120/120";
10007
10094
  var UserInfoCard = ({
10008
10095
  user,
10009
10096
  onEditProfile,
@@ -10011,11 +10098,11 @@ var UserInfoCard = ({
10011
10098
  onWithdraw,
10012
10099
  className
10013
10100
  }) => {
10014
- var _a, _b, _c;
10101
+ var _a, _b, _c, _d;
10015
10102
  const evmExchanges = ((_a = user.connectedExchanges) != null ? _a : []).filter((ex) => ex.venue !== "kalshi");
10016
10103
  const totalExchangeCount = (_c = (_b = user.connectedExchanges) == null ? void 0 : _b.length) != null ? _c : 0;
10017
10104
  const hasEvmExchanges = evmExchanges.length > 0;
10018
- return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(
10105
+ return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
10019
10106
  "div",
10020
10107
  {
10021
10108
  className: cn(
@@ -10023,26 +10110,26 @@ var UserInfoCard = ({
10023
10110
  className
10024
10111
  ),
10025
10112
  children: [
10026
- /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: "flex w-full flex-col items-start gap-4 sm:flex-row sm:gap-5", children: [
10027
- /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { className: "shrink-0", children: user.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
10113
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "flex w-full flex-col items-start gap-4 sm:flex-row sm:gap-5", children: [
10114
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
10028
10115
  RemoteImage,
10029
10116
  {
10030
- src: user.avatarUrl,
10117
+ src: (_d = user.avatarUrl) != null ? _d : fallbackAvatarSrc,
10031
10118
  alt: user.username,
10032
10119
  className: "h-20 w-20 rounded-full object-cover sm:h-[120px] sm:w-[120px]"
10033
10120
  }
10034
- ) : /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(DefaultAvatar, { className: "h-20 w-20 sm:h-[120px] sm:w-[120px]" }) }),
10035
- /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: "flex min-w-0 w-full flex-1 flex-col gap-3 sm:gap-4", children: [
10036
- /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-3 sm:gap-4", children: [
10037
- /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
10038
- /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("h2", { className: "truncate text-[22px] leading-7 font-agg-bold text-agg-foreground sm:agg-type-heading", children: user.username }),
10039
- user.socialLinks && user.socialLinks.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { className: "flex items-center gap-2", children: user.socialLinks.map((social) => {
10121
+ ) }),
10122
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "flex min-w-0 w-full flex-1 flex-col gap-3 sm:gap-4", children: [
10123
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-3 sm:gap-4", children: [
10124
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
10125
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("h2", { className: "truncate text-[22px] leading-7 font-agg-bold text-agg-foreground sm:agg-type-heading", children: user.username }),
10126
+ user.socialLinks && user.socialLinks.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: "flex items-center gap-2", children: user.socialLinks.map((social) => {
10040
10127
  const iconName = social.platform === "twitter" ? "twitter" : social.platform === "discord" ? "discord" : "telegram";
10041
- const iconNode = /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("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__ */ (0, import_jsx_runtime104.jsx)(Icon, { name: iconName, size: "small", className: "text-agg-foreground" }) });
10128
+ const iconNode = /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("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__ */ (0, import_jsx_runtime103.jsx)(Icon, { name: iconName, size: "small", className: "text-agg-foreground" }) });
10042
10129
  if (!social.handle) {
10043
- return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("span", { children: iconNode }, `${social.platform}-icon`);
10130
+ return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { children: iconNode }, `${social.platform}-icon`);
10044
10131
  }
10045
- return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
10132
+ return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
10046
10133
  "a",
10047
10134
  {
10048
10135
  href: social.handle,
@@ -10055,22 +10142,22 @@ var UserInfoCard = ({
10055
10142
  );
10056
10143
  }) }) : null
10057
10144
  ] }),
10058
- onEditProfile ? /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(
10145
+ onEditProfile ? /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
10059
10146
  "button",
10060
10147
  {
10061
10148
  type: "button",
10062
10149
  onClick: onEditProfile,
10063
10150
  className: "hidden shrink-0 cursor-pointer items-center gap-2 bg-transparent text-agg-primary hover:opacity-80 sm:flex",
10064
10151
  children: [
10065
- /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
10066
- /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("span", { className: "text-agg-base font-agg-bold leading-6", children: "Edit" })
10152
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
10153
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { className: "text-agg-base font-agg-bold leading-6", children: "Edit" })
10067
10154
  ]
10068
10155
  }
10069
10156
  ) : null
10070
10157
  ] }),
10071
- totalExchangeCount > 0 || user.socialHandle ? /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: "flex w-full flex-col gap-2.5 sm:gap-3", children: [
10072
- hasEvmExchanges ? /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: "flex flex-wrap items-center gap-2 sm:gap-3", children: [
10073
- /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { className: "flex items-center", children: evmExchanges.map((exchange, idx) => /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
10158
+ totalExchangeCount > 0 || user.socialHandle ? /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "flex w-full flex-col gap-2.5 sm:gap-3", children: [
10159
+ hasEvmExchanges ? /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "flex flex-wrap items-center gap-2 sm:gap-3", children: [
10160
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: "flex items-center", children: evmExchanges.map((exchange, idx) => /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
10074
10161
  "div",
10075
10162
  {
10076
10163
  className: cn(
@@ -10078,7 +10165,7 @@ var UserInfoCard = ({
10078
10165
  idx > 0 && "-ml-2"
10079
10166
  ),
10080
10167
  style: { zIndex: evmExchanges.length - idx },
10081
- children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
10168
+ children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
10082
10169
  RemoteImage,
10083
10170
  {
10084
10171
  src: venueLogoUrlRegistry[exchange.venue],
@@ -10089,18 +10176,18 @@ var UserInfoCard = ({
10089
10176
  },
10090
10177
  `${exchange.venue}-${idx}`
10091
10178
  )) }),
10092
- user.displayAddress ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("span", { className: "text-agg-sm font-agg-normal leading-5 text-agg-foreground sm:text-agg-base sm:leading-6", children: user.displayAddress }) : null,
10093
- /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: "flex items-center gap-1", children: [
10094
- /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("span", { className: "text-agg-sm font-agg-normal leading-5 text-agg-muted-foreground", children: [
10179
+ user.displayAddress ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { className: "text-agg-sm font-agg-normal leading-5 text-agg-foreground sm:text-agg-base sm:leading-6", children: user.displayAddress }) : null,
10180
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "flex items-center gap-1", children: [
10181
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("span", { className: "text-agg-sm font-agg-normal leading-5 text-agg-muted-foreground", children: [
10095
10182
  totalExchangeCount,
10096
10183
  " exchange",
10097
10184
  totalExchangeCount !== 1 ? "s" : ""
10098
10185
  ] }),
10099
- /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(Icon, { name: "info", size: "small", className: "text-agg-muted-foreground" })
10186
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Icon, { name: "info", size: "small", className: "text-agg-muted-foreground" })
10100
10187
  ] })
10101
10188
  ] }) : null,
10102
- user.socialHandle ? /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: "flex items-center gap-2 sm:gap-3", children: [
10103
- user.socialHandleVenue ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center overflow-hidden rounded-[4px]", children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
10189
+ user.socialHandle ? /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "flex items-center gap-2 sm:gap-3", children: [
10190
+ user.socialHandleVenue ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center overflow-hidden rounded-[4px]", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
10104
10191
  RemoteImage,
10105
10192
  {
10106
10193
  src: venueLogoUrlRegistry[user.socialHandleVenue],
@@ -10108,14 +10195,14 @@ var UserInfoCard = ({
10108
10195
  className: "h-5 w-5"
10109
10196
  }
10110
10197
  ) }) : null,
10111
- /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("span", { className: "text-agg-sm font-agg-normal leading-5 text-agg-foreground sm:text-agg-base sm:leading-6", children: user.socialHandle })
10198
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { className: "text-agg-sm font-agg-normal leading-5 text-agg-foreground sm:text-agg-base sm:leading-6", children: user.socialHandle })
10112
10199
  ] }) : null
10113
10200
  ] }) : null
10114
10201
  ] })
10115
10202
  ] }),
10116
- (onDeposit || onWithdraw) && /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: "flex w-full items-center gap-5", children: [
10117
- /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
10118
- onDeposit ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
10203
+ (onDeposit || onWithdraw) && /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "flex w-full items-center gap-5", children: [
10204
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
10205
+ onDeposit ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
10119
10206
  "button",
10120
10207
  {
10121
10208
  type: "button",
@@ -10124,7 +10211,7 @@ var UserInfoCard = ({
10124
10211
  children: "Deposit"
10125
10212
  }
10126
10213
  ) : null,
10127
- onWithdraw ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
10214
+ onWithdraw ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
10128
10215
  "button",
10129
10216
  {
10130
10217
  type: "button",
@@ -10134,15 +10221,15 @@ var UserInfoCard = ({
10134
10221
  }
10135
10222
  ) : null
10136
10223
  ] }),
10137
- onEditProfile ? /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(
10224
+ onEditProfile ? /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
10138
10225
  "button",
10139
10226
  {
10140
10227
  type: "button",
10141
10228
  onClick: onEditProfile,
10142
10229
  className: "flex shrink-0 cursor-pointer items-center gap-1.5 bg-transparent text-agg-primary hover:opacity-80 sm:hidden",
10143
10230
  children: [
10144
- /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(Icon, { name: "pencil", size: "small", className: "h-3.5 w-3.5 text-agg-primary" }),
10145
- /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("span", { className: "text-agg-sm font-agg-bold leading-5", children: "Edit" })
10231
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Icon, { name: "pencil", size: "small", className: "h-3.5 w-3.5 text-agg-primary" }),
10232
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { className: "text-agg-sm font-agg-bold leading-5", children: "Edit" })
10146
10233
  ]
10147
10234
  }
10148
10235
  ) : null
@@ -10154,7 +10241,7 @@ var UserInfoCard = ({
10154
10241
  UserInfoCard.displayName = "UserInfoCard";
10155
10242
 
10156
10243
  // src/pages/user-profile/index.tsx
10157
- var import_jsx_runtime105 = require("react/jsx-runtime");
10244
+ var import_jsx_runtime104 = require("react/jsx-runtime");
10158
10245
  var currencyFormatter = new Intl.NumberFormat("en-US", {
10159
10246
  style: "currency",
10160
10247
  currency: "USD",
@@ -10201,8 +10288,35 @@ var toAmountLabel = (amountRaw, executionPrice, filledAmountRaw) => {
10201
10288
  if (Number.isFinite(parsedAmount)) return formatUsd(parsedAmount);
10202
10289
  return "$0.00";
10203
10290
  };
10291
+ var POSITION_ROW_VENUE_ORDER = ["polymarket", "kalshi", "opinion", "limitless"];
10292
+ function venueBreakdownSortKey(venue) {
10293
+ const idx = POSITION_ROW_VENUE_ORDER.indexOf(venue);
10294
+ return idx === -1 ? POSITION_ROW_VENUE_ORDER.length : idx;
10295
+ }
10296
+ function toVenueLogoName(venue) {
10297
+ return venue;
10298
+ }
10299
+ function buildVenueShareBreakdown(outcome) {
10300
+ const breakdown = outcome.venueBreakdown;
10301
+ if (breakdown.length === 0) {
10302
+ return [
10303
+ {
10304
+ venue: "polymarket",
10305
+ sharesLabel: getTradingSharesLabel(outcome.totalSize)
10306
+ }
10307
+ ];
10308
+ }
10309
+ const sorted = [...breakdown].sort(
10310
+ (a, b) => venueBreakdownSortKey(a.venue) - venueBreakdownSortKey(b.venue)
10311
+ );
10312
+ return sorted.map((row) => ({
10313
+ venue: toVenueLogoName(row.venue),
10314
+ sharesLabel: getTradingSharesLabel(row.size)
10315
+ }));
10316
+ }
10204
10317
  var UserProfilePage = ({
10205
10318
  user,
10319
+ balanceChainsOverride,
10206
10320
  venueBalances: _venueBalances,
10207
10321
  balance,
10208
10322
  activePositions,
@@ -10305,20 +10419,17 @@ var UserProfilePage = ({
10305
10419
  if (activePositions) return activePositions;
10306
10420
  return positionsQuery.positions.flatMap(
10307
10421
  (group) => group.venueMarket.venueMarketOutcomes.map((outcome) => {
10308
- var _a, _b, _c;
10309
- const outcomeVenue = (_a = outcome.venueBreakdown[0]) == null ? void 0 : _a.venue;
10310
- const venue = connectedVenues.includes(outcomeVenue != null ? outcomeVenue : "polymarket") ? outcomeVenue != null ? outcomeVenue : "polymarket" : "polymarket";
10422
+ var _a, _b;
10311
10423
  const currentPriceCents = Math.round(outcome.currentPrice * 100);
10312
10424
  const averagePriceCents = Math.round(outcome.avgEntryPrice * 100);
10313
10425
  const pnlPrefix = outcome.unrealizedPnl >= 0 ? "+" : "";
10314
10426
  const pnlPercent = (outcome.unrealizedPnlPercent * 100).toFixed(2);
10315
10427
  return {
10316
- id: `${group.targetMarketId}-${outcome.label}-${(_b = outcome.title) != null ? _b : ""}`,
10317
- thumbnailSrc: (_c = group.venueMarket.image) != null ? _c : fallbackThumbnailSrc,
10428
+ id: `${group.targetMarketId}-${outcome.label}-${(_a = outcome.title) != null ? _a : ""}`,
10429
+ thumbnailSrc: (_b = group.venueMarket.image) != null ? _b : fallbackThumbnailSrc,
10318
10430
  title: group.venueMarket.question,
10319
- venue,
10320
- outcomeLabel: `${outcome.label} ${currentPriceCents}\xA2`,
10321
- sharesLabel: `${outcome.totalSize.toFixed(2)} shares`,
10431
+ outcomeLabel: outcome.label,
10432
+ venueShareBreakdown: buildVenueShareBreakdown(outcome),
10322
10433
  averageLabel: `${averagePriceCents}\xA2`,
10323
10434
  currentLabel: `${currentPriceCents}\xA2`,
10324
10435
  valueLabel: formatUsd(outcome.totalValue),
@@ -10327,66 +10438,56 @@ var UserProfilePage = ({
10327
10438
  };
10328
10439
  })
10329
10440
  );
10330
- }, [activePositions, connectedVenues, positionsQuery.positions]);
10441
+ }, [activePositions, positionsQuery.positions]);
10331
10442
  const resolvedClosedPositions = (0, import_react18.useMemo)(() => {
10332
10443
  return closedPositions != null ? closedPositions : [];
10333
10444
  }, [closedPositions]);
10334
- return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("div", { className: "box-border w-full overflow-x-hidden p-5 sm:p-10", children: /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(
10335
- "section",
10445
+ return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("section", { className: cn("w-full pb-24 lg:pb-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(
10446
+ "div",
10336
10447
  {
10337
10448
  className: cn(
10338
- // Outer container spacing per updated Figma
10339
- "flex w-full flex-col gap-6 sm:gap-8 overflow-clip rounded-agg-xl border border-agg-separator bg-agg-secondary p-5 sm:p-8",
10340
- classNames == null ? void 0 : classNames.root
10449
+ "mx-auto flex w-full max-w-[1200px] flex-col gap-6 px-3 py-3 md:px-6 md:py-6",
10450
+ classNames == null ? void 0 : classNames.topRow
10341
10451
  ),
10342
10452
  children: [
10343
- /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(
10344
- "div",
10345
- {
10346
- className: cn(
10347
- "grid grid-cols-1 gap-6 sm:grid-cols-[1fr_minmax(300px,420px)] sm:items-stretch sm:gap-8",
10348
- classNames == null ? void 0 : classNames.topRow
10349
- ),
10350
- children: [
10351
- /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
10352
- "div",
10453
+ /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: "grid grid-cols-1 gap-6 sm:grid-cols-[1fr_minmax(300px,420px)] sm:items-stretch sm:gap-8", children: [
10454
+ /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
10455
+ "div",
10456
+ {
10457
+ className: cn(
10458
+ "flex min-w-0 flex-1 flex-col gap-4 sm:gap-6 h-full",
10459
+ classNames == null ? void 0 : classNames.leftColumn
10460
+ ),
10461
+ children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
10462
+ UserInfoCard,
10353
10463
  {
10354
- className: cn(
10355
- "flex min-w-0 flex-1 flex-col gap-4 sm:gap-6 h-full",
10356
- classNames == null ? void 0 : classNames.leftColumn
10357
- ),
10358
- children: /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
10359
- UserInfoCard,
10360
- {
10361
- user: resolvedUser,
10362
- onEditProfile,
10363
- onDeposit,
10364
- onWithdraw,
10365
- className: cn("h-full", classNames == null ? void 0 : classNames.userInfoCard)
10366
- }
10367
- )
10464
+ user: resolvedUser,
10465
+ onEditProfile,
10466
+ onDeposit,
10467
+ onWithdraw,
10468
+ className: cn("h-full", classNames == null ? void 0 : classNames.userInfoCard)
10368
10469
  }
10369
- ),
10370
- /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)("div", { className: cn("grid grid-cols-1 grid-rows-2 gap-4 h-full", classNames == null ? void 0 : classNames.rightColumn), children: [
10371
- /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(PositionsValueCard, { valueLabel: positionsValueLabel, className: "h-full" }),
10372
- /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
10373
- AvailableBalanceCard,
10374
- {
10375
- valueLabel: availableBalanceLabel,
10376
- chains: balanceState.balanceBreakdown.map((b) => ({
10377
- key: b.key,
10378
- label: b.label,
10379
- balance: b.balance,
10380
- accountCount: b.accountCount
10381
- })),
10382
- className: "h-full"
10383
- }
10384
- )
10385
- ] })
10386
- ]
10387
- }
10388
- ),
10389
- /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
10470
+ )
10471
+ }
10472
+ ),
10473
+ /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: cn("grid grid-cols-1 grid-rows-2 gap-4 h-full", classNames == null ? void 0 : classNames.rightColumn), children: [
10474
+ /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(PositionsValueCard, { valueLabel: positionsValueLabel, className: "h-full" }),
10475
+ /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
10476
+ AvailableBalanceCard,
10477
+ {
10478
+ valueLabel: availableBalanceLabel,
10479
+ chains: (balanceChainsOverride != null ? balanceChainsOverride : balanceState.balanceBreakdown).map((b) => ({
10480
+ key: b.key,
10481
+ label: b.label,
10482
+ balance: b.balance,
10483
+ accountCount: b.accountCount
10484
+ })),
10485
+ className: "h-full"
10486
+ }
10487
+ )
10488
+ ] })
10489
+ ] }),
10490
+ /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
10390
10491
  PositionsActivity,
10391
10492
  {
10392
10493
  activePositions: resolvedActivePositions,