@loafmarkets/ui 0.1.364 → 0.1.366

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -6439,6 +6439,7 @@ var LoginPopup = ({
6439
6439
  onClose,
6440
6440
  onOpenEarlyAccess,
6441
6441
  onWalletLogin,
6442
+ onWalletSignup,
6442
6443
  onPasskeyLogin,
6443
6444
  isAuthenticated,
6444
6445
  currentUser,
@@ -6524,7 +6525,7 @@ var LoginPopup = ({
6524
6525
  if (suppressAutoCloseRef.current) {
6525
6526
  return;
6526
6527
  }
6527
- if (view === "kyc" || view === "kyc-success" || view === "kyc-failed" || view === "funding" || view === "receive" || view === "referral") {
6528
+ if (view === "kyc" || view === "kyc-success" || view === "kyc-failed" || view === "funding" || view === "receive" || view === "referral" || view === "wallet-handle") {
6528
6529
  return;
6529
6530
  }
6530
6531
  if (isAuthenticated || currentUser) {
@@ -6540,12 +6541,21 @@ var LoginPopup = ({
6540
6541
  }, [onClose]);
6541
6542
  const handleWalletLogin = async () => {
6542
6543
  if (onWalletLogin) {
6544
+ suppressAutoCloseRef.current = true;
6543
6545
  try {
6544
- await onWalletLogin();
6546
+ const result = await onWalletLogin();
6547
+ if (result && result.needsHandle && onWalletSignup) {
6548
+ setHandle("");
6549
+ setError("");
6550
+ setView("wallet-handle");
6551
+ return;
6552
+ }
6553
+ suppressAutoCloseRef.current = false;
6545
6554
  onClose();
6546
6555
  return;
6547
6556
  } catch (err) {
6548
6557
  console.error("[LoginTrace][Popup] Wallet login failed", err);
6558
+ suppressAutoCloseRef.current = false;
6549
6559
  }
6550
6560
  }
6551
6561
  onClose();
@@ -6553,6 +6563,31 @@ var LoginPopup = ({
6553
6563
  onOpenEarlyAccess();
6554
6564
  }
6555
6565
  };
6566
+ const handleWalletSignupSubmit = async (event) => {
6567
+ event?.preventDefault();
6568
+ if (!handle.trim()) {
6569
+ setError("Please claim a handle to continue");
6570
+ return;
6571
+ }
6572
+ if (!onWalletSignup) {
6573
+ onClose();
6574
+ return;
6575
+ }
6576
+ setLoading(true);
6577
+ setError("");
6578
+ try {
6579
+ await onWalletSignup(handle.trim());
6580
+ if (onSubmitReferralCode) {
6581
+ setView("referral");
6582
+ } else {
6583
+ onClose();
6584
+ }
6585
+ } catch (err) {
6586
+ setError(err instanceof Error ? err.message : "Couldn't complete sign up. Please try again.");
6587
+ } finally {
6588
+ setLoading(false);
6589
+ }
6590
+ };
6556
6591
  const handlePasskeyLogin = async () => {
6557
6592
  if (!onPasskeyLogin) return;
6558
6593
  setError("");
@@ -6879,6 +6914,31 @@ var LoginPopup = ({
6879
6914
  isSignUp && /* @__PURE__ */ jsx(MiniLiveFeed, {})
6880
6915
  ] }) });
6881
6916
  }
6917
+ if (view === "wallet-handle") {
6918
+ return /* @__PURE__ */ jsx(Overlay2, { onClick: loading ? void 0 : onClose, children: /* @__PURE__ */ jsxs(PopupContainer, { onClick: (event) => event.stopPropagation(), children: [
6919
+ !loading && /* @__PURE__ */ jsx(CloseButton, { onClick: onClose, "aria-label": "Close login popup", children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }) }) }),
6920
+ /* @__PURE__ */ jsxs(Title, { children: [
6921
+ /* @__PURE__ */ jsx(LogoContainer3, { children: /* @__PURE__ */ jsx(LogoImage, { src: logoSrc, alt: logoAlt }) }),
6922
+ "Claim your handle"
6923
+ ] }),
6924
+ /* @__PURE__ */ jsx("form", { onSubmit: handleWalletSignupSubmit, children: /* @__PURE__ */ jsxs(EmailFormContainer, { children: [
6925
+ /* @__PURE__ */ jsx(
6926
+ EmailInput,
6927
+ {
6928
+ type: "text",
6929
+ placeholder: "Claim your handle (e.g. Landlord)",
6930
+ value: handle,
6931
+ onChange: (event) => setHandle(event.target.value),
6932
+ autoFocus: true
6933
+ }
6934
+ ),
6935
+ /* @__PURE__ */ jsx(SubmitButton, { type: "submit", disabled: loading || !handle.trim(), children: loading ? "Setting up your account\u2026" : "Continue" }),
6936
+ error && /* @__PURE__ */ jsx(StatusMessage, { $error: true, children: error })
6937
+ ] }) }),
6938
+ /* @__PURE__ */ jsx(InfoText, { children: "Pick a public handle for your Loaf profile." }),
6939
+ /* @__PURE__ */ jsx(MiniLiveFeed, {})
6940
+ ] }) });
6941
+ }
6882
6942
  if (view === "otp") {
6883
6943
  return /* @__PURE__ */ jsx(Overlay2, { onClick: loading ? void 0 : onClose, children: /* @__PURE__ */ jsxs(PopupContainer, { onClick: (event) => event.stopPropagation(), children: [
6884
6944
  !loading && /* @__PURE__ */ jsx(CloseButton, { onClick: onClose, "aria-label": "Close login popup", children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }) }) }),
@@ -7097,7 +7157,7 @@ var LoginPopup = ({
7097
7157
  }
7098
7158
  };
7099
7159
  const handleJoinWaitlistSkip = async () => {
7100
- if (!onJoinWaitlist) {
7160
+ if (!onJoinWaitlist || !email) {
7101
7161
  onClose();
7102
7162
  return;
7103
7163
  }
@@ -7171,7 +7231,7 @@ var LoginPopup = ({
7171
7231
  onClick: () => void handleJoinWaitlistSkip(),
7172
7232
  disabled: waitlistLoading,
7173
7233
  style: { marginTop: "0.75rem" },
7174
- children: waitlistLoading ? "Joining\u2026" : "Skip for now & join Waitlist"
7234
+ children: waitlistLoading ? "Joining\u2026" : email ? "Skip for now & join Waitlist" : "Skip for now"
7175
7235
  }
7176
7236
  )
7177
7237
  ] })
@@ -13557,9 +13617,9 @@ function PortfolioActivityPanel({
13557
13617
  case "asset":
13558
13618
  return dir * a.tokenName.localeCompare(b.tokenName);
13559
13619
  case "units":
13560
- return dir * (a.quantity - b.quantity);
13620
+ return dir * (a.totalQuantity - b.totalQuantity);
13561
13621
  case "value":
13562
- return dir * (a.quantity * a.marketPrice - b.quantity * b.marketPrice);
13622
+ return dir * (a.totalQuantity * a.marketPrice - b.totalQuantity * b.marketPrice);
13563
13623
  case "avgPrice":
13564
13624
  return dir * (a.averageEntryPrice - b.averageEntryPrice);
13565
13625
  case "currentPrice":
@@ -13728,8 +13788,8 @@ function PortfolioActivityPanel({
13728
13788
  ] })
13729
13789
  ] }),
13730
13790
  sortedPositions.map((pos) => {
13731
- const currentValue = pos.quantity * pos.marketPrice;
13732
- const costBasis = pos.quantity * pos.averageEntryPrice;
13791
+ const currentValue = pos.totalQuantity * pos.marketPrice;
13792
+ const costBasis = pos.totalQuantity * pos.averageEntryPrice;
13733
13793
  const pnl = pos.propertyPnl ?? currentValue - costBasis;
13734
13794
  const pnlPercent = pos.propertyPnlPercent ?? pos.percentChange ?? 0;
13735
13795
  const isPositive = pnl >= 0;
@@ -13746,7 +13806,7 @@ function PortfolioActivityPanel({
13746
13806
  ] }),
13747
13807
  /* @__PURE__ */ jsxs(CUnitsCell, { children: [
13748
13808
  /* @__PURE__ */ jsx(CCellLabel, { children: "Units" }),
13749
- formatNumber2(pos.quantity, pos.quantity >= 100 ? 0 : 2),
13809
+ formatNumber2(pos.totalQuantity, pos.totalQuantity >= 100 ? 0 : 2),
13750
13810
  " ",
13751
13811
  ticker
13752
13812
  ] }),
@@ -13819,15 +13879,15 @@ function PortfolioActivityPanel({
13819
13879
  onClosePosition && /* @__PURE__ */ jsx(PositionsHeaderCell, { children: /* @__PURE__ */ jsx(CloseAllHeaderBtn, { onClick: () => setCloseAllOpen(true), children: "Sell All" }) })
13820
13880
  ] }),
13821
13881
  sortedPositions.map((pos) => {
13822
- const currentValue = pos.quantity * pos.marketPrice;
13823
- const costBasis = pos.quantity * pos.averageEntryPrice;
13882
+ const currentValue = pos.totalQuantity * pos.marketPrice;
13883
+ const costBasis = pos.totalQuantity * pos.averageEntryPrice;
13824
13884
  const pnl = pos.propertyPnl ?? currentValue - costBasis;
13825
13885
  const pnlPercent = pos.propertyPnlPercent ?? pos.percentChange ?? 0;
13826
13886
  const isPositive = pnl >= 0;
13827
13887
  return /* @__PURE__ */ jsxs(PositionsRow, { $hasClose: !!onClosePosition, children: [
13828
13888
  /* @__PURE__ */ jsx(PositionsCell, { children: /* @__PURE__ */ jsx(HoldingsPropertyLink, { onClick: () => onPositionClick?.(pos.tokenName, pos.isIpoAllocation), children: pos.tokenName }) }),
13829
13889
  /* @__PURE__ */ jsx(PositionsCell, { children: /* @__PURE__ */ jsxs("span", { style: { color: "#fff", fontSize: "0.8rem" }, children: [
13830
- formatNumber2(pos.quantity),
13890
+ formatNumber2(pos.totalQuantity),
13831
13891
  " ",
13832
13892
  /* @__PURE__ */ jsx("span", { style: { color: "rgba(255,255,255,0.4)", fontSize: "0.7rem" }, children: pos.tokenName.toUpperCase() })
13833
13893
  ] }) }),