@loafmarkets/ui 0.1.148 → 0.1.149
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.js +29 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8297,34 +8297,35 @@ function truncateAddress(addr) {
|
|
|
8297
8297
|
if (addr.length <= 12) return addr;
|
|
8298
8298
|
return `${addr.slice(0, 6)}...${addr.slice(-4)}`;
|
|
8299
8299
|
}
|
|
8300
|
-
function
|
|
8301
|
-
if (
|
|
8302
|
-
const
|
|
8300
|
+
function generateDividendHistory(valuation, totalTokens, tokenPrice) {
|
|
8301
|
+
if (valuation <= 0 || !totalTokens || !tokenPrice) return { records: [], priceHistory: [] };
|
|
8302
|
+
const annualDiv = valuation * 0.02;
|
|
8303
|
+
const monthlyDivPerShare = annualDiv / 12 / totalTokens;
|
|
8303
8304
|
const records = [];
|
|
8305
|
+
const priceHistory = [];
|
|
8304
8306
|
const now = /* @__PURE__ */ new Date();
|
|
8307
|
+
let price = tokenPrice * 0.84;
|
|
8308
|
+
for (let i = 365; i >= 0; i--) {
|
|
8309
|
+
const t = Date.now() - i * 864e5;
|
|
8310
|
+
const progress = (365 - i) / 365;
|
|
8311
|
+
const target = tokenPrice * (0.84 + progress * 0.16);
|
|
8312
|
+
price += (target - price) * 0.03 + (Math.random() - 0.5) * 0.8;
|
|
8313
|
+
price = Math.max(tokenPrice * 0.75, price);
|
|
8314
|
+
priceHistory.push({ time: t, price: Math.round(price * 100) / 100 });
|
|
8315
|
+
}
|
|
8305
8316
|
for (let i = 11; i >= 0; i--) {
|
|
8306
|
-
const
|
|
8307
|
-
const
|
|
8317
|
+
const exDate = new Date(now.getFullYear(), now.getMonth() - i, 1);
|
|
8318
|
+
const exTime = exDate.getTime();
|
|
8319
|
+
const closest = priceHistory.reduce((best, p) => Math.abs(p.time - exTime) < Math.abs(best.time - exTime) ? p : best);
|
|
8320
|
+
const priceAtEx = closest.price;
|
|
8308
8321
|
records.push({
|
|
8309
|
-
exDate:
|
|
8310
|
-
payDate: new Date(
|
|
8311
|
-
perShare:
|
|
8312
|
-
yieldPct:
|
|
8322
|
+
exDate: exDate.toLocaleDateString("en-AU", { day: "2-digit", month: "short", year: "numeric" }),
|
|
8323
|
+
payDate: new Date(exDate.getFullYear(), exDate.getMonth(), 15).toLocaleDateString("en-AU", { day: "2-digit", month: "short", year: "numeric" }),
|
|
8324
|
+
perShare: monthlyDivPerShare,
|
|
8325
|
+
yieldPct: monthlyDivPerShare * 12 / priceAtEx * 100
|
|
8313
8326
|
});
|
|
8314
8327
|
}
|
|
8315
|
-
return records;
|
|
8316
|
-
}
|
|
8317
|
-
function generateMockPriceHistory() {
|
|
8318
|
-
const points = [];
|
|
8319
|
-
const now = Date.now();
|
|
8320
|
-
let price = 210;
|
|
8321
|
-
for (let i = 365; i >= 0; i--) {
|
|
8322
|
-
const t = now - i * 864e5;
|
|
8323
|
-
price += (Math.random() - 0.47) * 1.2;
|
|
8324
|
-
price = Math.max(180, price);
|
|
8325
|
-
points.push({ time: t, price: Math.round(price * 100) / 100 });
|
|
8326
|
-
}
|
|
8327
|
-
return points;
|
|
8328
|
+
return { records, priceHistory };
|
|
8328
8329
|
}
|
|
8329
8330
|
function PropertyOverview({
|
|
8330
8331
|
propertyName,
|
|
@@ -8423,13 +8424,14 @@ function PropertyOverview({
|
|
|
8423
8424
|
{ label: "Open Orders", value: isLoading && openOrdersValue == null ? loadingSkeleton : openOrdersValue != null && openOrdersValue > 0 ? `$${openOrdersValue.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}` : "\u2014" },
|
|
8424
8425
|
{ label: "Holders", value: isLoading && holderCount == null ? loadingSkeleton : holderCount != null ? holderCount.toLocaleString() : "\u2014" }
|
|
8425
8426
|
];
|
|
8426
|
-
const
|
|
8427
|
+
const annualDividend = resolvedValuation ? resolvedValuation * 0.02 : null;
|
|
8428
|
+
const monthlyDivPerShare = annualDividend && resolvedTokensIssued ? annualDividend / 12 / resolvedTokensIssued : null;
|
|
8427
8429
|
const propertyStats = [
|
|
8428
8430
|
{ label: "Last Valuation", value: isLoading && resolvedValuation == null ? loadingSkeleton : resolvedValuation ? resolvedValuation >= 1e6 ? `$${(resolvedValuation / 1e6).toFixed(2)}M` : `$${resolvedValuation.toLocaleString()}` : "\u2014" },
|
|
8429
8431
|
{ label: "Number of Offers", value: "\u2014" },
|
|
8430
8432
|
{ label: "Growth (Past 5 Years)", value: "\u2014" },
|
|
8431
8433
|
{ label: "Security Interest in Asset", value: "Yes, secured to Land Registry" },
|
|
8432
|
-
{ label: "
|
|
8434
|
+
{ label: "Dividend Per Share", value: isLoading && monthlyDivPerShare == null ? loadingSkeleton : monthlyDivPerShare != null ? `$${monthlyDivPerShare.toFixed(4)}/mo` : "\u2014" }
|
|
8433
8435
|
];
|
|
8434
8436
|
return /* @__PURE__ */ jsxRuntime.jsxs(Wrapper, { children: [
|
|
8435
8437
|
/* @__PURE__ */ jsxRuntime.jsxs(Section, { children: [
|
|
@@ -8500,7 +8502,7 @@ function PropertyOverview({
|
|
|
8500
8502
|
showDividendHistory && /* @__PURE__ */ jsxRuntime.jsx(
|
|
8501
8503
|
DividendHistoryPopup,
|
|
8502
8504
|
{
|
|
8503
|
-
|
|
8505
|
+
valuation: resolvedValuation,
|
|
8504
8506
|
totalTokens: resolvedTokensIssued,
|
|
8505
8507
|
tokenPrice: tokenPriceValue,
|
|
8506
8508
|
ticker,
|
|
@@ -8595,14 +8597,13 @@ function PropertyOverview({
|
|
|
8595
8597
|
] });
|
|
8596
8598
|
}
|
|
8597
8599
|
function DividendHistoryPopup({
|
|
8598
|
-
|
|
8600
|
+
valuation,
|
|
8599
8601
|
totalTokens,
|
|
8600
8602
|
tokenPrice,
|
|
8601
8603
|
ticker,
|
|
8602
8604
|
onClose
|
|
8603
8605
|
}) {
|
|
8604
|
-
const records =
|
|
8605
|
-
const priceHistory = generateMockPriceHistory();
|
|
8606
|
+
const { records, priceHistory } = generateDividendHistory(valuation ?? 0, totalTokens ?? 0, tokenPrice ?? 0);
|
|
8606
8607
|
React5.useEffect(() => {
|
|
8607
8608
|
const handleEsc = (e) => {
|
|
8608
8609
|
if (e.key === "Escape") onClose();
|