@loafmarkets/ui 0.1.164 → 0.1.166

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
@@ -7946,6 +7946,7 @@ function GalleryMapSection({
7946
7946
  const [showVideo, setShowVideo] = useState(false);
7947
7947
  const [autoPlaying, setAutoPlaying] = useState(autoPlay);
7948
7948
  const [showFullMap, setShowFullMap] = useState(false);
7949
+ const [showFullVideo, setShowFullVideo] = useState(false);
7949
7950
  const resolvedMapUrl = mapUrl ?? (tokenName ? `/map/${tokenName}?embed=true&zoom=14&hideOthers=true` : "about:blank");
7950
7951
  useEffect(() => {
7951
7952
  if (!autoPlaying || images.length <= 1) return;
@@ -8004,7 +8005,7 @@ function GalleryMapSection({
8004
8005
  setCarouselIndex(actualIndex);
8005
8006
  }, children: /* @__PURE__ */ jsx("img", { src: img.src, alt: img.title }) }, actualIndex);
8006
8007
  }) }),
8007
- (floorplanIndex !== -1 || videoUrl) && /* @__PURE__ */ jsx(ThumbDivider, {}),
8008
+ /* @__PURE__ */ jsx(ThumbDivider, {}),
8008
8009
  /* @__PURE__ */ jsxs(FixedButtons, { children: [
8009
8010
  floorplanIndex !== -1 && /* @__PURE__ */ jsxs(FixedBtn, { $active: isFloorplan, onClick: () => {
8010
8011
  stopAutoPlay();
@@ -8018,9 +8019,13 @@ function GalleryMapSection({
8018
8019
  ] }),
8019
8020
  "Floor Plan"
8020
8021
  ] }),
8021
- videoUrl && /* @__PURE__ */ jsxs(FixedBtn, { $active: showVideo, onClick: () => setShowVideo((p) => !p), children: [
8022
+ videoUrl && /* @__PURE__ */ jsxs(FixedBtn, { $active: false, onClick: () => setShowFullVideo(true), children: [
8022
8023
  /* @__PURE__ */ jsx(BiVideo, { size: 16 }),
8023
8024
  " Video"
8025
+ ] }),
8026
+ /* @__PURE__ */ jsxs(FixedBtn, { $active: false, onClick: () => setShowFullMap(true), children: [
8027
+ /* @__PURE__ */ jsx(BiMap, { size: 16 }),
8028
+ " Map View"
8024
8029
  ] })
8025
8030
  ] })
8026
8031
  ] }),
@@ -8089,7 +8094,8 @@ function GalleryMapSection({
8089
8094
  /* @__PURE__ */ jsx(SuburbDesc, { children: "Premium harbourside suburb on Sydney's Lower North Shore. Known for heritage homes, village atmosphere, and proximity to Taronga Zoo and Balmoral Beach." })
8090
8095
  ] })
8091
8096
  ] }),
8092
- showFullMap && /* @__PURE__ */ jsx(FullMapPopup, { onClose: () => setShowFullMap(false) })
8097
+ showFullMap && /* @__PURE__ */ jsx(FullMapPopup, { onClose: () => setShowFullMap(false) }),
8098
+ showFullVideo && videoUrl && /* @__PURE__ */ jsx(FullVideoPopup, { videoUrl, onClose: () => setShowFullVideo(false) })
8093
8099
  ] });
8094
8100
  }
8095
8101
  function FullMapPopup({ onClose }) {
@@ -8145,6 +8151,25 @@ function FullMapPopup({ onClose }) {
8145
8151
  ) })
8146
8152
  ] }) });
8147
8153
  }
8154
+ function FullVideoPopup({ videoUrl, onClose }) {
8155
+ useEffect(() => {
8156
+ const handleEsc = (e) => {
8157
+ if (e.key === "Escape") onClose();
8158
+ };
8159
+ window.addEventListener("keydown", handleEsc);
8160
+ return () => window.removeEventListener("keydown", handleEsc);
8161
+ }, [onClose]);
8162
+ return /* @__PURE__ */ jsx(FullMapOverlay, { onClick: onClose, children: /* @__PURE__ */ jsxs(FullMapPanel, { onClick: (e) => e.stopPropagation(), style: { maxWidth: 1e3 }, children: [
8163
+ /* @__PURE__ */ jsxs(FullMapHeader, { children: [
8164
+ /* @__PURE__ */ jsxs(FullMapTitle, { children: [
8165
+ /* @__PURE__ */ jsx(BiVideo, {}),
8166
+ " Property Video"
8167
+ ] }),
8168
+ /* @__PURE__ */ jsx(FullMapClose, { onClick: onClose, "aria-label": "Close video", children: "\u2715" })
8169
+ ] }),
8170
+ /* @__PURE__ */ jsx(FullVideoFrame, { children: /* @__PURE__ */ jsx("video", { autoPlay: true, loop: true, playsInline: true, controls: true, style: { width: "100%", height: "100%", objectFit: "contain", background: "#000", borderRadius: 8 }, children: /* @__PURE__ */ jsx("source", { src: videoUrl, type: "video/mp4" }) }) })
8171
+ ] }) });
8172
+ }
8148
8173
  var Row = styled9.div`
8149
8174
  display: grid;
8150
8175
  grid-template-columns: 2fr 1fr;
@@ -8367,6 +8392,14 @@ var FullMapFrame = styled9.div`
8367
8392
  flex: 1;
8368
8393
  min-height: 0;
8369
8394
  `;
8395
+ var FullVideoFrame = styled9.div`
8396
+ flex: 1;
8397
+ min-height: 0;
8398
+ display: flex;
8399
+ align-items: center;
8400
+ justify-content: center;
8401
+ padding: 0 1rem 1rem;
8402
+ `;
8370
8403
  var BedIcon = /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
8371
8404
  /* @__PURE__ */ jsx("path", { d: "M2 4v16" }),
8372
8405
  /* @__PURE__ */ jsx("path", { d: "M2 8h18a2 2 0 0 1 2 2v10" }),
@@ -8428,32 +8461,36 @@ function truncateAddress(addr) {
8428
8461
  if (addr.length <= 12) return addr;
8429
8462
  return `${addr.slice(0, 6)}...${addr.slice(-4)}`;
8430
8463
  }
8431
- function generateDividendHistory(valuation, totalTokens, tokenPrice) {
8464
+ function generateDividendHistory(valuation, totalTokens, tokenPrice, realPriceHistory) {
8432
8465
  if (valuation <= 0 || !totalTokens || !tokenPrice) return { records: [], priceHistory: [] };
8433
8466
  const annualDiv = valuation * 0.02;
8434
8467
  const monthlyDivPerShare = annualDiv / 12 / totalTokens;
8435
8468
  const records = [];
8436
- const priceHistory = [];
8469
+ const priceHistory = realPriceHistory?.length ? realPriceHistory.map((c) => ({ time: typeof c.time === "number" && c.time < 1e12 ? c.time * 1e3 : c.time, price: c.close })) : (() => {
8470
+ const pts = [];
8471
+ let price = tokenPrice * 0.84;
8472
+ for (let i = 365; i >= 0; i--) {
8473
+ const t = Date.now() - i * 864e5;
8474
+ const progress = (365 - i) / 365;
8475
+ const target = tokenPrice * (0.84 + progress * 0.16);
8476
+ price += (target - price) * 0.03 + (Math.random() - 0.5) * 0.8;
8477
+ price = Math.max(tokenPrice * 0.75, price);
8478
+ pts.push({ time: t, price: Math.round(price * 100) / 100 });
8479
+ }
8480
+ return pts;
8481
+ })();
8437
8482
  const now = /* @__PURE__ */ new Date();
8438
- let price = tokenPrice * 0.84;
8439
- for (let i = 365; i >= 0; i--) {
8440
- const t = Date.now() - i * 864e5;
8441
- const progress = (365 - i) / 365;
8442
- const target = tokenPrice * (0.84 + progress * 0.16);
8443
- price += (target - price) * 0.03 + (Math.random() - 0.5) * 0.8;
8444
- price = Math.max(tokenPrice * 0.75, price);
8445
- priceHistory.push({ time: t, price: Math.round(price * 100) / 100 });
8446
- }
8447
8483
  for (let i = 11; i >= 0; i--) {
8448
8484
  const exDate = new Date(now.getFullYear(), now.getMonth() - i, 1);
8449
8485
  const exTime = exDate.getTime();
8450
8486
  const closest = priceHistory.reduce((best, p) => Math.abs(p.time - exTime) < Math.abs(best.time - exTime) ? p : best);
8451
8487
  const priceAtEx = closest.price;
8488
+ const annualisedYield = priceAtEx > 0 ? monthlyDivPerShare * 12 / priceAtEx * 100 : 2;
8452
8489
  records.push({
8453
8490
  exDate: exDate.toLocaleDateString("en-AU", { day: "2-digit", month: "short", year: "numeric" }),
8454
8491
  payDate: new Date(exDate.getFullYear(), exDate.getMonth(), 15).toLocaleDateString("en-AU", { day: "2-digit", month: "short", year: "numeric" }),
8455
8492
  perShare: monthlyDivPerShare,
8456
- yieldPct: monthlyDivPerShare * 12 / priceAtEx * 100
8493
+ yieldPct: annualisedYield
8457
8494
  });
8458
8495
  }
8459
8496
  return { records, priceHistory };
@@ -8487,7 +8524,8 @@ function PropertyOverview({
8487
8524
  percentageTokenized,
8488
8525
  volume24h,
8489
8526
  openOrdersValue,
8490
- holderCount
8527
+ holderCount,
8528
+ priceHistory: priceHistoryProp
8491
8529
  }) {
8492
8530
  const [isDescExpanded, setDescExpanded] = useState(false);
8493
8531
  const [showDividendHistory, setShowDividendHistory] = useState(false);
@@ -8647,6 +8685,7 @@ function PropertyOverview({
8647
8685
  totalTokens: resolvedTokensIssued,
8648
8686
  tokenPrice: tokenPriceValue,
8649
8687
  ticker,
8688
+ priceHistory: priceHistoryProp,
8650
8689
  onClose: () => setShowDividendHistory(false)
8651
8690
  }
8652
8691
  ),
@@ -8779,9 +8818,10 @@ function DividendHistoryPopup({
8779
8818
  totalTokens,
8780
8819
  tokenPrice,
8781
8820
  ticker,
8821
+ priceHistory: realPriceHistory,
8782
8822
  onClose
8783
8823
  }) {
8784
- const { records, priceHistory } = generateDividendHistory(valuation ?? 0, totalTokens ?? 0, tokenPrice ?? 0);
8824
+ const { records, priceHistory } = generateDividendHistory(valuation ?? 0, totalTokens ?? 0, tokenPrice ?? 0, realPriceHistory);
8785
8825
  useEffect(() => {
8786
8826
  const handleEsc = (e) => {
8787
8827
  if (e.key === "Escape") onClose();