@loafmarkets/ui 0.0.1
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.d.mts +271 -0
- package/dist/index.d.ts +271 -0
- package/dist/index.js +1700 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1660 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +52 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1700 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React5 = require('react');
|
|
4
|
+
var reactSlot = require('@radix-ui/react-slot');
|
|
5
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
6
|
+
var clsx = require('clsx');
|
|
7
|
+
var tailwindMerge = require('tailwind-merge');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
var lucideReact = require('lucide-react');
|
|
10
|
+
var lightweightCharts = require('lightweight-charts');
|
|
11
|
+
|
|
12
|
+
function _interopNamespace(e) {
|
|
13
|
+
if (e && e.__esModule) return e;
|
|
14
|
+
var n = Object.create(null);
|
|
15
|
+
if (e) {
|
|
16
|
+
Object.keys(e).forEach(function (k) {
|
|
17
|
+
if (k !== 'default') {
|
|
18
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
19
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return e[k]; }
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
n.default = e;
|
|
27
|
+
return Object.freeze(n);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var React5__namespace = /*#__PURE__*/_interopNamespace(React5);
|
|
31
|
+
|
|
32
|
+
// src/components/button.tsx
|
|
33
|
+
function cn(...inputs) {
|
|
34
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
35
|
+
}
|
|
36
|
+
var buttonVariants = classVarianceAuthority.cva(
|
|
37
|
+
"inline-flex items-center justify-center font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
38
|
+
{
|
|
39
|
+
variants: {
|
|
40
|
+
variant: {
|
|
41
|
+
primary: "bg-teal-500 text-slate-950 hover:bg-teal-400 focus-visible:ring-teal-200",
|
|
42
|
+
accent: "bg-[var(--color-accent,#e6c87e)] text-black hover:bg-[var(--color-accent-hover,#f8d12f)] focus-visible:ring-[var(--color-accent,#e6c87e)]",
|
|
43
|
+
accentOutline: "border border-[var(--color-accent,#e6c87e)] bg-transparent text-[var(--color-accent,#e6c87e)] hover:bg-[rgba(230,200,126,0.10)] focus-visible:ring-[var(--color-accent,#e6c87e)]",
|
|
44
|
+
media: "border border-white/10 bg-transparent text-white/90 hover:bg-white/5 hover:border-[var(--color-accent,#e6c87e)] hover:text-[var(--color-accent,#e6c87e)] focus-visible:ring-[var(--color-accent,#e6c87e)]",
|
|
45
|
+
outline: "border border-slate-800/20 bg-white text-slate-900 hover:border-slate-800/40 focus-visible:ring-slate-200",
|
|
46
|
+
ghost: "bg-transparent text-slate-900 hover:bg-slate-900/5 focus-visible:ring-slate-200",
|
|
47
|
+
danger: "bg-rose-500 text-white hover:bg-rose-400 focus-visible:ring-rose-200"
|
|
48
|
+
},
|
|
49
|
+
size: {
|
|
50
|
+
sm: "h-9 px-4 text-sm",
|
|
51
|
+
md: "h-11 px-6 text-base",
|
|
52
|
+
lg: "h-12 px-7 text-lg",
|
|
53
|
+
icon: "h-10 w-10"
|
|
54
|
+
},
|
|
55
|
+
radius: {
|
|
56
|
+
pill: "rounded-full",
|
|
57
|
+
md: "rounded"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
defaultVariants: {
|
|
61
|
+
variant: "primary",
|
|
62
|
+
size: "md",
|
|
63
|
+
radius: "pill"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
var Button = React5__namespace.forwardRef(
|
|
68
|
+
({ className, variant, size, radius, asChild = false, ...props }, ref) => {
|
|
69
|
+
const Comp = asChild ? reactSlot.Slot : "button";
|
|
70
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
71
|
+
Comp,
|
|
72
|
+
{
|
|
73
|
+
ref,
|
|
74
|
+
className: cn(buttonVariants({ variant, size, radius }), className),
|
|
75
|
+
...props
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
Button.displayName = "Button";
|
|
81
|
+
var badgeVariants = classVarianceAuthority.cva(
|
|
82
|
+
"inline-flex items-center rounded-full border px-3 py-1 text-xs font-semibold uppercase tracking-wide transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
|
|
83
|
+
{
|
|
84
|
+
variants: {
|
|
85
|
+
variant: {
|
|
86
|
+
default: "border-transparent bg-slate-900 text-white focus-visible:ring-slate-300",
|
|
87
|
+
muted: "border-transparent bg-slate-100 text-slate-600 focus-visible:ring-slate-200",
|
|
88
|
+
outline: "border-slate-200 bg-white text-slate-600 focus-visible:ring-slate-200",
|
|
89
|
+
success: "border-transparent bg-teal-500/15 text-teal-600 focus-visible:ring-teal-200",
|
|
90
|
+
active: "border-transparent bg-[rgba(14,203,129,0.25)] text-[#0ecb81] focus-visible:ring-[rgba(14,203,129,0.35)]",
|
|
91
|
+
pending: "border-transparent bg-white/10 text-white/60 focus-visible:ring-white/20",
|
|
92
|
+
rejected: "border-transparent bg-[rgba(246,70,93,0.20)] text-[#f6465d] focus-visible:ring-[rgba(246,70,93,0.30)]"
|
|
93
|
+
},
|
|
94
|
+
size: {
|
|
95
|
+
sm: "px-2.5 py-0.5 text-[11px]",
|
|
96
|
+
md: "px-3 py-1 text-xs"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
defaultVariants: {
|
|
100
|
+
variant: "default",
|
|
101
|
+
size: "md"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
var Badge = React5__namespace.forwardRef(
|
|
106
|
+
({ className, variant, size, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("span", { ref, className: cn(badgeVariants({ variant, size }), className), ...props })
|
|
107
|
+
);
|
|
108
|
+
Badge.displayName = "Badge";
|
|
109
|
+
var Card = React5__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
110
|
+
"div",
|
|
111
|
+
{
|
|
112
|
+
ref,
|
|
113
|
+
className: cn(
|
|
114
|
+
"rounded-3xl border border-slate-200 bg-white shadow-sm transition hover:shadow-md",
|
|
115
|
+
className
|
|
116
|
+
),
|
|
117
|
+
...props
|
|
118
|
+
}
|
|
119
|
+
));
|
|
120
|
+
Card.displayName = "Card";
|
|
121
|
+
var CardHeader = React5__namespace.forwardRef(
|
|
122
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex flex-col space-y-1.5 p-6", className), ...props })
|
|
123
|
+
);
|
|
124
|
+
CardHeader.displayName = "CardHeader";
|
|
125
|
+
var CardTitle = React5__namespace.forwardRef(
|
|
126
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
127
|
+
"h3",
|
|
128
|
+
{
|
|
129
|
+
ref,
|
|
130
|
+
className: cn("text-xl font-semibold tracking-tight text-slate-900", className),
|
|
131
|
+
...props
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
);
|
|
135
|
+
CardTitle.displayName = "CardTitle";
|
|
136
|
+
var CardDescription = React5__namespace.forwardRef(
|
|
137
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("p", { ref, className: cn("text-sm text-slate-500", className), ...props })
|
|
138
|
+
);
|
|
139
|
+
CardDescription.displayName = "CardDescription";
|
|
140
|
+
var CardContent = React5__namespace.forwardRef(
|
|
141
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("px-6 pb-6 pt-2 text-sm text-slate-600", className), ...props })
|
|
142
|
+
);
|
|
143
|
+
CardContent.displayName = "CardContent";
|
|
144
|
+
var CardFooter = React5__namespace.forwardRef(
|
|
145
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex items-center border-t border-slate-100 px-6 py-4", className), ...props })
|
|
146
|
+
);
|
|
147
|
+
CardFooter.displayName = "CardFooter";
|
|
148
|
+
var defaultFormatCurrency = (value) => new Intl.NumberFormat("en-US", {
|
|
149
|
+
style: "currency",
|
|
150
|
+
currency: "USD",
|
|
151
|
+
minimumFractionDigits: 2,
|
|
152
|
+
maximumFractionDigits: 2
|
|
153
|
+
}).format(value);
|
|
154
|
+
var defaultFormatPercent = (value) => {
|
|
155
|
+
const sign = value >= 0 ? "+" : "-";
|
|
156
|
+
return `${sign}${Math.abs(value).toFixed(2)}%`;
|
|
157
|
+
};
|
|
158
|
+
var defaultFormatSignedCurrency = (value) => {
|
|
159
|
+
const sign = value >= 0 ? "+" : "-";
|
|
160
|
+
return `${sign}${defaultFormatCurrency(Math.abs(value))}`;
|
|
161
|
+
};
|
|
162
|
+
var PortfolioSummary = React5__namespace.forwardRef(
|
|
163
|
+
({
|
|
164
|
+
availableCash,
|
|
165
|
+
portfolioValue,
|
|
166
|
+
totalReturnPercent,
|
|
167
|
+
unrealizedPnl,
|
|
168
|
+
onResetAccount,
|
|
169
|
+
positionsHeading = "Current Positions",
|
|
170
|
+
emptyPositionsText = "No positions yet. Start trading to build your portfolio!",
|
|
171
|
+
formatCurrency = defaultFormatCurrency,
|
|
172
|
+
formatPercent = defaultFormatPercent,
|
|
173
|
+
formatSignedCurrency = defaultFormatSignedCurrency,
|
|
174
|
+
className,
|
|
175
|
+
children,
|
|
176
|
+
...props
|
|
177
|
+
}, ref) => {
|
|
178
|
+
const totalReturnClassName = totalReturnPercent >= 0 ? "text-[#0ecb81]" : "text-[#f6465d]";
|
|
179
|
+
const pnlClassName = unrealizedPnl >= 0 ? "text-[#0ecb81]" : "text-[#f6465d]";
|
|
180
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
181
|
+
Card,
|
|
182
|
+
{
|
|
183
|
+
ref,
|
|
184
|
+
className: cn(
|
|
185
|
+
"w-full max-w-[560px] rounded-[12px] border border-white/10 bg-black/30 p-6 text-white backdrop-blur-md",
|
|
186
|
+
className
|
|
187
|
+
),
|
|
188
|
+
...props,
|
|
189
|
+
children: [
|
|
190
|
+
/* @__PURE__ */ jsxRuntime.jsxs(CardHeader, { className: "p-0 pb-4", children: [
|
|
191
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4", children: [
|
|
192
|
+
/* @__PURE__ */ jsxRuntime.jsx(CardTitle, { className: "m-0 text-[1.1rem] font-semibold text-white", children: "Portfolio Summary" }),
|
|
193
|
+
onResetAccount ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
194
|
+
"button",
|
|
195
|
+
{
|
|
196
|
+
type: "button",
|
|
197
|
+
onClick: onResetAccount,
|
|
198
|
+
className: "cursor-pointer rounded-[6px] border border-white/20 bg-white/10 px-[0.7rem] py-[0.35rem] text-xs text-[#888] transition-all duration-150 hover:border-white/30 hover:bg-white/[0.15] hover:text-white",
|
|
199
|
+
children: "Reset Account"
|
|
200
|
+
}
|
|
201
|
+
) : null
|
|
202
|
+
] }),
|
|
203
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 h-px w-full bg-white/10" })
|
|
204
|
+
] }),
|
|
205
|
+
/* @__PURE__ */ jsxRuntime.jsxs(CardContent, { className: "p-0 pt-4", children: [
|
|
206
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
207
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
208
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs uppercase tracking-[0.5px] text-white/50", children: "Available Cash" }),
|
|
209
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-[1.25rem] font-semibold text-white", children: formatCurrency(availableCash) })
|
|
210
|
+
] }),
|
|
211
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
212
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs uppercase tracking-[0.5px] text-white/50", children: "Portfolio Value" }),
|
|
213
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-[1.25rem] font-semibold text-white", children: formatCurrency(portfolioValue) })
|
|
214
|
+
] }),
|
|
215
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
216
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs uppercase tracking-[0.5px] text-white/50", children: "Total Return" }),
|
|
217
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("mt-1 text-[1.25rem] font-semibold", totalReturnClassName), children: formatPercent(totalReturnPercent) })
|
|
218
|
+
] }),
|
|
219
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
220
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs uppercase tracking-[0.5px] text-white/50", children: "Unrealized P&L" }),
|
|
221
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("mt-1 text-[1.25rem] font-semibold", pnlClassName), children: formatSignedCurrency(unrealizedPnl) })
|
|
222
|
+
] })
|
|
223
|
+
] }),
|
|
224
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-6", children: [
|
|
225
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "m-0 text-[0.9rem] font-medium text-white/70", children: positionsHeading }),
|
|
226
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3", children: children ? children : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "py-4 text-center text-[0.85rem] text-white/40", children: emptyPositionsText }) })
|
|
227
|
+
] })
|
|
228
|
+
] })
|
|
229
|
+
]
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
PortfolioSummary.displayName = "PortfolioSummary";
|
|
235
|
+
var clamp = (v, min, max) => Math.min(max, Math.max(min, v));
|
|
236
|
+
var fmt0 = (v) => Math.abs(v).toLocaleString(void 0, { maximumFractionDigits: 0 });
|
|
237
|
+
function HousePositionSlider({
|
|
238
|
+
tokenId,
|
|
239
|
+
tokenSymbol,
|
|
240
|
+
totalTokens,
|
|
241
|
+
currentPrice,
|
|
242
|
+
availableCash,
|
|
243
|
+
tokensHeld,
|
|
244
|
+
pendingOrders = [],
|
|
245
|
+
defaultOrderType = "market",
|
|
246
|
+
onConfirmOrder,
|
|
247
|
+
className,
|
|
248
|
+
...props
|
|
249
|
+
}) {
|
|
250
|
+
const [orderMode, setOrderMode] = React5__namespace.useState("none");
|
|
251
|
+
const [buyTrackingMode, setBuyTrackingMode] = React5__namespace.useState("dollars");
|
|
252
|
+
const [deltaDollars, setDeltaDollars] = React5__namespace.useState(0);
|
|
253
|
+
const [deltaTokensBuy, setDeltaTokensBuy] = React5__namespace.useState(0);
|
|
254
|
+
const [deltaTokensSell, setDeltaTokensSell] = React5__namespace.useState(0);
|
|
255
|
+
const [isDragging, setIsDragging] = React5__namespace.useState(false);
|
|
256
|
+
const [orderType, setOrderType] = React5__namespace.useState(defaultOrderType);
|
|
257
|
+
const [limitPrice, setLimitPrice] = React5__namespace.useState(currentPrice);
|
|
258
|
+
const [limitPriceInput, setLimitPriceInput] = React5__namespace.useState(currentPrice.toFixed(2));
|
|
259
|
+
const [ownershipInput, setOwnershipInput] = React5__namespace.useState("");
|
|
260
|
+
const [tokenAmountInput, setTokenAmountInput] = React5__namespace.useState("");
|
|
261
|
+
const houseRef = React5__namespace.useRef(null);
|
|
262
|
+
React5__namespace.useEffect(() => {
|
|
263
|
+
setLimitPrice(currentPrice);
|
|
264
|
+
setLimitPriceInput(currentPrice.toFixed(2));
|
|
265
|
+
}, [currentPrice]);
|
|
266
|
+
const effectivePrice = orderType === "limit" ? limitPrice : currentPrice;
|
|
267
|
+
const holdingsValue = tokensHeld * effectivePrice;
|
|
268
|
+
const totalCapacity = holdingsValue + availableCash;
|
|
269
|
+
const pendingBuyValue = pendingOrders.filter((o) => o.type === "buy").reduce((s, o) => s + o.value, 0);
|
|
270
|
+
const pendingSellTokens = pendingOrders.filter((o) => o.type === "sell").reduce((s, o) => s + Math.abs(o.tokens), 0);
|
|
271
|
+
const effectiveAvailableCash = Math.max(0, availableCash - pendingBuyValue);
|
|
272
|
+
const effectiveTokensHeld = Math.max(0, tokensHeld - pendingSellTokens);
|
|
273
|
+
const baselinePct = totalCapacity <= 0 ? 0 : holdingsValue / totalCapacity * 100;
|
|
274
|
+
let deltaTokens = 0;
|
|
275
|
+
let deltaValue = 0;
|
|
276
|
+
let targetTokens = tokensHeld;
|
|
277
|
+
let targetValue = holdingsValue;
|
|
278
|
+
if (orderMode === "buy") {
|
|
279
|
+
if (buyTrackingMode === "tokens") {
|
|
280
|
+
deltaTokens = deltaTokensBuy;
|
|
281
|
+
deltaValue = deltaTokensBuy * effectivePrice;
|
|
282
|
+
} else {
|
|
283
|
+
deltaValue = deltaDollars;
|
|
284
|
+
deltaTokens = deltaDollars / (effectivePrice || 1);
|
|
285
|
+
}
|
|
286
|
+
} else if (orderMode === "sell") {
|
|
287
|
+
deltaTokens = deltaTokensSell;
|
|
288
|
+
deltaValue = deltaTokensSell * effectivePrice;
|
|
289
|
+
}
|
|
290
|
+
targetTokens = tokensHeld + deltaTokens;
|
|
291
|
+
targetValue = targetTokens * effectivePrice;
|
|
292
|
+
const targetPct = totalCapacity <= 0 ? 0 : targetValue / totalCapacity * 100;
|
|
293
|
+
const isIncrease = orderMode === "buy";
|
|
294
|
+
const hasChange = orderMode !== "none" && (Math.abs(deltaTokens) > 1e-3 || Math.abs(deltaValue) > 0.01);
|
|
295
|
+
const currentOwnership = totalTokens <= 0 ? 0 : tokensHeld / totalTokens * 100;
|
|
296
|
+
const targetOwnership = totalTokens <= 0 ? 0 : targetTokens / totalTokens * 100;
|
|
297
|
+
const estFeeTokens = Math.abs(deltaValue) * 5e-3 / (effectivePrice || 1);
|
|
298
|
+
const updateOrderFromTargetValue = React5__namespace.useCallback(
|
|
299
|
+
(newTargetValue) => {
|
|
300
|
+
const newDeltaValue = newTargetValue - holdingsValue;
|
|
301
|
+
if (newDeltaValue > 0) {
|
|
302
|
+
setOrderMode("buy");
|
|
303
|
+
setBuyTrackingMode("dollars");
|
|
304
|
+
setDeltaDollars(Math.min(newDeltaValue, effectiveAvailableCash));
|
|
305
|
+
setDeltaTokensBuy(0);
|
|
306
|
+
setDeltaTokensSell(0);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
if (newDeltaValue < 0) {
|
|
310
|
+
const newDeltaTokens = newTargetValue / (effectivePrice || 1) - tokensHeld;
|
|
311
|
+
setOrderMode("sell");
|
|
312
|
+
setBuyTrackingMode("dollars");
|
|
313
|
+
setDeltaTokensSell(Math.max(newDeltaTokens, -effectiveTokensHeld));
|
|
314
|
+
setDeltaDollars(0);
|
|
315
|
+
setDeltaTokensBuy(0);
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
setOrderMode("none");
|
|
319
|
+
setBuyTrackingMode("dollars");
|
|
320
|
+
setDeltaDollars(0);
|
|
321
|
+
setDeltaTokensBuy(0);
|
|
322
|
+
setDeltaTokensSell(0);
|
|
323
|
+
},
|
|
324
|
+
[effectiveAvailableCash, effectivePrice, effectiveTokensHeld, holdingsValue, tokensHeld]
|
|
325
|
+
);
|
|
326
|
+
const updateOrderFromOwnership = React5__namespace.useCallback(
|
|
327
|
+
(newOwnershipPercent) => {
|
|
328
|
+
const nextOwnership = clamp(newOwnershipPercent, 0, 100);
|
|
329
|
+
const newTargetTokens = nextOwnership / 100 * totalTokens;
|
|
330
|
+
updateOrderFromTargetValue(newTargetTokens * effectivePrice);
|
|
331
|
+
},
|
|
332
|
+
[effectivePrice, totalTokens, updateOrderFromTargetValue]
|
|
333
|
+
);
|
|
334
|
+
const updateOrderFromTokenAmount = React5__namespace.useCallback(
|
|
335
|
+
(tokenAmountSigned) => {
|
|
336
|
+
if (tokenAmountSigned > 0) {
|
|
337
|
+
const maxTokens = effectiveAvailableCash / (effectivePrice || 1);
|
|
338
|
+
setOrderMode("buy");
|
|
339
|
+
setBuyTrackingMode("tokens");
|
|
340
|
+
setDeltaTokensBuy(Math.min(tokenAmountSigned, maxTokens));
|
|
341
|
+
setDeltaDollars(0);
|
|
342
|
+
setDeltaTokensSell(0);
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
if (tokenAmountSigned < 0) {
|
|
346
|
+
setOrderMode("sell");
|
|
347
|
+
setBuyTrackingMode("dollars");
|
|
348
|
+
setDeltaTokensSell(Math.max(tokenAmountSigned, -effectiveTokensHeld));
|
|
349
|
+
setDeltaDollars(0);
|
|
350
|
+
setDeltaTokensBuy(0);
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
setOrderMode("none");
|
|
354
|
+
setBuyTrackingMode("dollars");
|
|
355
|
+
setDeltaDollars(0);
|
|
356
|
+
setDeltaTokensBuy(0);
|
|
357
|
+
setDeltaTokensSell(0);
|
|
358
|
+
},
|
|
359
|
+
[effectiveAvailableCash, effectivePrice, effectiveTokensHeld]
|
|
360
|
+
);
|
|
361
|
+
const handleDragAtClientY = React5__namespace.useCallback(
|
|
362
|
+
(clientY) => {
|
|
363
|
+
if (!houseRef.current) return;
|
|
364
|
+
const rect = houseRef.current.getBoundingClientRect();
|
|
365
|
+
const y = clientY - rect.top;
|
|
366
|
+
const pct = clamp(100 - y / rect.height * 100, 0, 100);
|
|
367
|
+
updateOrderFromTargetValue(pct / 100 * totalCapacity);
|
|
368
|
+
},
|
|
369
|
+
[totalCapacity, updateOrderFromTargetValue]
|
|
370
|
+
);
|
|
371
|
+
const onMouseDown = (e) => {
|
|
372
|
+
e.preventDefault();
|
|
373
|
+
setIsDragging(true);
|
|
374
|
+
const onMove = (ev) => handleDragAtClientY(ev.clientY);
|
|
375
|
+
const onUp = () => {
|
|
376
|
+
setIsDragging(false);
|
|
377
|
+
document.removeEventListener("mousemove", onMove);
|
|
378
|
+
document.removeEventListener("mouseup", onUp);
|
|
379
|
+
};
|
|
380
|
+
document.addEventListener("mousemove", onMove);
|
|
381
|
+
document.addEventListener("mouseup", onUp);
|
|
382
|
+
};
|
|
383
|
+
const onTouchStart = () => {
|
|
384
|
+
setIsDragging(true);
|
|
385
|
+
const onMove = (ev) => {
|
|
386
|
+
const touch = ev.touches[0];
|
|
387
|
+
if (!touch) return;
|
|
388
|
+
handleDragAtClientY(touch.clientY);
|
|
389
|
+
};
|
|
390
|
+
const onEnd = () => {
|
|
391
|
+
setIsDragging(false);
|
|
392
|
+
document.removeEventListener("touchmove", onMove);
|
|
393
|
+
document.removeEventListener("touchend", onEnd);
|
|
394
|
+
};
|
|
395
|
+
document.addEventListener("touchmove", onMove);
|
|
396
|
+
document.addEventListener("touchend", onEnd);
|
|
397
|
+
};
|
|
398
|
+
const handleCancel = () => {
|
|
399
|
+
setOrderMode("none");
|
|
400
|
+
setBuyTrackingMode("dollars");
|
|
401
|
+
setDeltaDollars(0);
|
|
402
|
+
setDeltaTokensBuy(0);
|
|
403
|
+
setDeltaTokensSell(0);
|
|
404
|
+
};
|
|
405
|
+
const handleConfirm = () => {
|
|
406
|
+
if (!hasChange) return;
|
|
407
|
+
const priceToUse = orderType === "market" ? currentPrice : limitPrice;
|
|
408
|
+
onConfirmOrder?.({
|
|
409
|
+
side: isIncrease ? "buy" : "sell",
|
|
410
|
+
orderType,
|
|
411
|
+
tokenId,
|
|
412
|
+
tokenSymbol,
|
|
413
|
+
price: priceToUse,
|
|
414
|
+
deltaTokens,
|
|
415
|
+
deltaValue,
|
|
416
|
+
targetOwnership,
|
|
417
|
+
targetTokens,
|
|
418
|
+
targetValue
|
|
419
|
+
});
|
|
420
|
+
handleCancel();
|
|
421
|
+
};
|
|
422
|
+
const rectTop = 10;
|
|
423
|
+
const rectBottom = 150;
|
|
424
|
+
const totalFillableHeight = rectBottom - rectTop;
|
|
425
|
+
const baselineFillHeight = baselinePct / 100 * totalFillableHeight;
|
|
426
|
+
const targetFillHeight = targetPct / 100 * totalFillableHeight;
|
|
427
|
+
const baselineFillY = rectBottom - baselineFillHeight;
|
|
428
|
+
const targetFillY = rectBottom - targetFillHeight;
|
|
429
|
+
const showIncrease = targetPct > baselinePct;
|
|
430
|
+
const showDecrease = targetPct < baselinePct;
|
|
431
|
+
const valueLabel = orderType === "limit" ? `${tokenSymbol} Owned at Limit` : `${tokenSymbol} Owned`;
|
|
432
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative flex w-full flex-col items-center gap-6 rounded-[12px] bg-black/20 px-8 pb-6 pt-12", className), ...props, children: [
|
|
433
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute left-4 top-4 text-[1.1rem] font-semibold tracking-[0.5px] text-white", children: "Place Order" }),
|
|
434
|
+
hasChange ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
435
|
+
"button",
|
|
436
|
+
{
|
|
437
|
+
type: "button",
|
|
438
|
+
onClick: handleCancel,
|
|
439
|
+
className: "absolute right-3 top-3 rounded-[6px] border border-white/20 bg-white/10 px-2.5 py-1.5 text-[0.7rem] text-[#888] transition-all duration-150 hover:border-white/30 hover:bg-white/[0.15] hover:text-white",
|
|
440
|
+
children: "\u2715 Cancel"
|
|
441
|
+
}
|
|
442
|
+
) : null,
|
|
443
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
|
|
444
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-2 text-xs uppercase tracking-[1px] text-[#888]", children: valueLabel }),
|
|
445
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "inline-flex items-baseline gap-2 text-[2rem] font-bold text-white", children: isDragging ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
446
|
+
"span",
|
|
447
|
+
{
|
|
448
|
+
className: cn("text-[2rem] font-semibold", deltaValue >= 0 ? "text-[#0ecb81]" : "text-[#f6465d]"),
|
|
449
|
+
children: [
|
|
450
|
+
deltaValue > 0 ? "+" : deltaValue < 0 ? "-" : "",
|
|
451
|
+
"$",
|
|
452
|
+
fmt0(deltaValue)
|
|
453
|
+
]
|
|
454
|
+
}
|
|
455
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
456
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
457
|
+
"$",
|
|
458
|
+
fmt0(targetValue)
|
|
459
|
+
] }),
|
|
460
|
+
hasChange ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
461
|
+
"span",
|
|
462
|
+
{
|
|
463
|
+
className: cn(
|
|
464
|
+
"relative top-[-0.5rem] text-[0.85rem] font-semibold",
|
|
465
|
+
deltaValue >= 0 ? "text-[#0ecb81]" : "text-[#f6465d]"
|
|
466
|
+
),
|
|
467
|
+
children: [
|
|
468
|
+
deltaValue > 0 ? "+" : deltaValue < 0 ? "-" : "",
|
|
469
|
+
fmt0(deltaValue)
|
|
470
|
+
]
|
|
471
|
+
}
|
|
472
|
+
) : null
|
|
473
|
+
] }) })
|
|
474
|
+
] }),
|
|
475
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: houseRef, className: "h-[200px] w-[160px] select-none touch-none", style: { cursor: "ns-resize" }, onMouseDown, onTouchStart, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 120 160", className: "h-full w-full overflow-visible", children: [
|
|
476
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "10", y: "10", width: "100", height: "140", rx: "8", fill: "rgba(255,255,255,0.04)", stroke: "rgba(255,255,255,0.10)" }),
|
|
477
|
+
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "loaf-clip", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "10", y: "10", width: "100", height: "140", rx: "8" }) }),
|
|
478
|
+
/* @__PURE__ */ jsxRuntime.jsxs("g", { clipPath: "url(#loaf-clip)", children: [
|
|
479
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "10", y: showDecrease ? targetFillY : baselineFillY, width: "100", height: showDecrease ? targetFillHeight : baselineFillHeight, fill: "rgba(220,175,120,0.7)" }),
|
|
480
|
+
showIncrease ? /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "10", y: targetFillY, width: "100", height: targetFillHeight - baselineFillHeight, fill: "rgba(14,203,129,0.35)" }) : null,
|
|
481
|
+
showDecrease ? /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "10", y: baselineFillY, width: "100", height: baselineFillHeight - targetFillHeight, fill: "rgba(246,70,93,0.35)" }) : null,
|
|
482
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", y1: targetFillY, x2: "108", y2: targetFillY, stroke: showIncrease ? "#0ecb81" : showDecrease ? "#f6465d" : "rgba(234,217,162,1)", strokeWidth: "2", strokeLinecap: "round" })
|
|
483
|
+
] })
|
|
484
|
+
] }) }),
|
|
485
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
486
|
+
"button",
|
|
487
|
+
{
|
|
488
|
+
type: "button",
|
|
489
|
+
disabled: !hasChange,
|
|
490
|
+
onClick: handleConfirm,
|
|
491
|
+
className: cn(
|
|
492
|
+
"w-full rounded-[10px] px-4 py-4 text-base font-semibold transition",
|
|
493
|
+
!hasChange ? "cursor-not-allowed bg-white/10 text-white/30" : isIncrease ? "bg-[#0ecb81] text-white hover:-translate-y-[1px] hover:shadow-[0_4px_12px_rgba(14,203,129,0.3)]" : "bg-[#f6465d] text-white hover:-translate-y-[1px] hover:shadow-[0_4px_12px_rgba(246,70,93,0.3)]"
|
|
494
|
+
),
|
|
495
|
+
children: !hasChange ? "Adjust Position" : isIncrease ? `Buy $${fmt0(deltaValue)}` : `Sell $${fmt0(deltaValue)}`
|
|
496
|
+
}
|
|
497
|
+
),
|
|
498
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full border-t border-white/10 py-4 text-[0.85rem]", children: [
|
|
499
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between py-2", children: [
|
|
500
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-white/50", children: [
|
|
501
|
+
tokenSymbol,
|
|
502
|
+
" Ownership"
|
|
503
|
+
] }),
|
|
504
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-white", children: [
|
|
505
|
+
currentOwnership.toFixed(2),
|
|
506
|
+
"%",
|
|
507
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "mx-1.5 text-white/50", children: "\u2192" }),
|
|
508
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
509
|
+
"input",
|
|
510
|
+
{
|
|
511
|
+
type: "text",
|
|
512
|
+
value: ownershipInput || targetOwnership.toFixed(2),
|
|
513
|
+
onChange: (e) => {
|
|
514
|
+
const val = e.target.value;
|
|
515
|
+
if (val === "" || /^[0-9]*\.?[0-9]*$/.test(val)) setOwnershipInput(val);
|
|
516
|
+
},
|
|
517
|
+
onFocus: () => setOwnershipInput(targetOwnership.toFixed(2)),
|
|
518
|
+
onBlur: () => {
|
|
519
|
+
const num = Number.parseFloat(ownershipInput);
|
|
520
|
+
if (Number.isFinite(num)) updateOrderFromOwnership(num);
|
|
521
|
+
setOwnershipInput("");
|
|
522
|
+
},
|
|
523
|
+
onKeyDown: (e) => {
|
|
524
|
+
if (e.key === "Enter") e.target.blur();
|
|
525
|
+
},
|
|
526
|
+
className: cn(
|
|
527
|
+
"w-[70px] rounded-[4px] border bg-white/10 px-2 py-1 text-right font-semibold outline-none",
|
|
528
|
+
targetOwnership >= currentOwnership ? "border-[rgba(14,203,129,0.3)] text-[#0ecb81] focus:border-[#0ecb81]" : "border-[rgba(246,70,93,0.3)] text-[#f6465d] focus:border-[#f6465d]"
|
|
529
|
+
)
|
|
530
|
+
}
|
|
531
|
+
)
|
|
532
|
+
] })
|
|
533
|
+
] }),
|
|
534
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between py-2", children: [
|
|
535
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white/50", children: isIncrease ? "Buying" : "Selling" }),
|
|
536
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1", children: [
|
|
537
|
+
orderMode === "buy" && buyTrackingMode === "dollars" ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-1 text-[#0ecb81]", children: "~" }) : null,
|
|
538
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
539
|
+
"input",
|
|
540
|
+
{
|
|
541
|
+
type: "text",
|
|
542
|
+
value: tokenAmountInput || Math.abs(deltaTokens).toFixed(2),
|
|
543
|
+
onChange: (e) => {
|
|
544
|
+
const val = e.target.value;
|
|
545
|
+
if (val === "" || /^[0-9]*\.?[0-9]*$/.test(val)) setTokenAmountInput(val);
|
|
546
|
+
},
|
|
547
|
+
onFocus: () => setTokenAmountInput(Math.abs(deltaTokens).toFixed(2)),
|
|
548
|
+
onBlur: () => {
|
|
549
|
+
const num = Number.parseFloat(tokenAmountInput);
|
|
550
|
+
if (Number.isFinite(num) && num >= 0) {
|
|
551
|
+
const signed = isIncrease || orderMode === "none" ? num : -num;
|
|
552
|
+
updateOrderFromTokenAmount(signed);
|
|
553
|
+
}
|
|
554
|
+
setTokenAmountInput("");
|
|
555
|
+
},
|
|
556
|
+
onKeyDown: (e) => {
|
|
557
|
+
if (e.key === "Enter") e.target.blur();
|
|
558
|
+
},
|
|
559
|
+
className: cn(
|
|
560
|
+
"w-[90px] rounded-[4px] border bg-white/10 px-2 py-1 text-right font-semibold outline-none",
|
|
561
|
+
isIncrease ? "border-[rgba(14,203,129,0.3)] text-[#0ecb81] focus:border-[#0ecb81]" : "border-[rgba(246,70,93,0.3)] text-[#f6465d] focus:border-[#f6465d]"
|
|
562
|
+
)
|
|
563
|
+
}
|
|
564
|
+
),
|
|
565
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("font-semibold", isIncrease ? "text-[#0ecb81]" : "text-[#f6465d]"), children: "tokens" })
|
|
566
|
+
] })
|
|
567
|
+
] }),
|
|
568
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between py-2", children: [
|
|
569
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white/50", children: "Est. Fee" }),
|
|
570
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-white", children: [
|
|
571
|
+
estFeeTokens.toFixed(6),
|
|
572
|
+
" ",
|
|
573
|
+
tokenSymbol
|
|
574
|
+
] })
|
|
575
|
+
] })
|
|
576
|
+
] }),
|
|
577
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full", children: [
|
|
578
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4 flex w-full rounded-[8px] bg-white/5 p-[3px]", children: [
|
|
579
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
580
|
+
"button",
|
|
581
|
+
{
|
|
582
|
+
type: "button",
|
|
583
|
+
onClick: () => setOrderType("market"),
|
|
584
|
+
className: cn(
|
|
585
|
+
"flex-1 rounded-[6px] px-3 py-2 text-[0.8rem] font-medium transition",
|
|
586
|
+
orderType === "market" ? "bg-[rgba(201,162,39,0.2)] text-[#C9A227]" : "text-white/50 hover:bg-white/5"
|
|
587
|
+
),
|
|
588
|
+
children: "Market"
|
|
589
|
+
}
|
|
590
|
+
),
|
|
591
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
592
|
+
"button",
|
|
593
|
+
{
|
|
594
|
+
type: "button",
|
|
595
|
+
onClick: () => setOrderType("limit"),
|
|
596
|
+
className: cn(
|
|
597
|
+
"flex-1 rounded-[6px] px-3 py-2 text-[0.8rem] font-medium transition",
|
|
598
|
+
orderType === "limit" ? "bg-[rgba(201,162,39,0.2)] text-[#C9A227]" : "text-white/50 hover:bg-white/5"
|
|
599
|
+
),
|
|
600
|
+
children: "Limit"
|
|
601
|
+
}
|
|
602
|
+
)
|
|
603
|
+
] }),
|
|
604
|
+
orderType === "limit" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative mb-4", children: [
|
|
605
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
606
|
+
"input",
|
|
607
|
+
{
|
|
608
|
+
type: "text",
|
|
609
|
+
value: limitPriceInput,
|
|
610
|
+
onChange: (e) => {
|
|
611
|
+
const input = e.target.value;
|
|
612
|
+
if (input === "" || /^[0-9]*\.?[0-9]*$/.test(input)) {
|
|
613
|
+
setLimitPriceInput(input);
|
|
614
|
+
const num = Number.parseFloat(input);
|
|
615
|
+
if (Number.isFinite(num) && num > 0) setLimitPrice(num);
|
|
616
|
+
}
|
|
617
|
+
},
|
|
618
|
+
onBlur: () => {
|
|
619
|
+
const num = Number.parseFloat(limitPriceInput);
|
|
620
|
+
if (Number.isFinite(num) && num > 0) {
|
|
621
|
+
setLimitPriceInput(num.toFixed(2));
|
|
622
|
+
setLimitPrice(num);
|
|
623
|
+
} else {
|
|
624
|
+
setLimitPriceInput(limitPrice.toFixed(2));
|
|
625
|
+
}
|
|
626
|
+
},
|
|
627
|
+
placeholder: "Price",
|
|
628
|
+
className: "w-full rounded-[8px] border border-white/10 bg-black/30 px-4 py-3 pr-14 text-[0.95rem] text-white outline-none focus:border-[#f0b90b]"
|
|
629
|
+
}
|
|
630
|
+
),
|
|
631
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute right-4 top-1/2 -translate-y-1/2 text-[0.8rem] text-white/50", children: "USD" })
|
|
632
|
+
] }) : null,
|
|
633
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-xs text-white/50", children: [
|
|
634
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
635
|
+
"Available: $",
|
|
636
|
+
availableCash.toLocaleString()
|
|
637
|
+
] }),
|
|
638
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "text-[#f0b90b] hover:underline", children: "Add Funds" })
|
|
639
|
+
] })
|
|
640
|
+
] })
|
|
641
|
+
] });
|
|
642
|
+
}
|
|
643
|
+
var formatNumber = (value, precision) => value.toFixed(precision);
|
|
644
|
+
function DepthRow({
|
|
645
|
+
side,
|
|
646
|
+
price,
|
|
647
|
+
amount,
|
|
648
|
+
depthPct,
|
|
649
|
+
precision,
|
|
650
|
+
amountPrecision
|
|
651
|
+
}) {
|
|
652
|
+
const isAsk = side === "ask";
|
|
653
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative grid grid-cols-2 items-center gap-3 px-3 py-1.5", children: [
|
|
654
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
655
|
+
"div",
|
|
656
|
+
{
|
|
657
|
+
className: cn(
|
|
658
|
+
"absolute inset-y-0 right-0",
|
|
659
|
+
isAsk ? "bg-rose-900/30" : "bg-emerald-900/30"
|
|
660
|
+
),
|
|
661
|
+
style: { width: `${clamp2(depthPct, 0, 100)}%` }
|
|
662
|
+
}
|
|
663
|
+
),
|
|
664
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
665
|
+
"div",
|
|
666
|
+
{
|
|
667
|
+
className: cn("relative z-[1] tabular-nums", isAsk ? "text-[#f6465d]" : "text-[#0ecb81]"),
|
|
668
|
+
children: [
|
|
669
|
+
"$",
|
|
670
|
+
formatNumber(price, precision)
|
|
671
|
+
]
|
|
672
|
+
}
|
|
673
|
+
),
|
|
674
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative z-[1] text-right tabular-nums text-white/90", children: formatNumber(amount, amountPrecision) })
|
|
675
|
+
] });
|
|
676
|
+
}
|
|
677
|
+
var clamp2 = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
678
|
+
var Orderbook = React5__namespace.forwardRef(
|
|
679
|
+
({
|
|
680
|
+
asks,
|
|
681
|
+
bids,
|
|
682
|
+
midPrice,
|
|
683
|
+
midChangePercent,
|
|
684
|
+
trades = [],
|
|
685
|
+
priceLabel = "Price (USD)",
|
|
686
|
+
amountLabel = "Amount",
|
|
687
|
+
precision = 2,
|
|
688
|
+
amountPrecision = 2,
|
|
689
|
+
defaultTab = "orderbook",
|
|
690
|
+
onTabChange,
|
|
691
|
+
rightHeader,
|
|
692
|
+
className,
|
|
693
|
+
...props
|
|
694
|
+
}, ref) => {
|
|
695
|
+
const [tab, setTab] = React5__namespace.useState(defaultTab);
|
|
696
|
+
const [tradeFilter, setTradeFilter] = React5__namespace.useState("all");
|
|
697
|
+
React5__namespace.useEffect(() => {
|
|
698
|
+
setTab(defaultTab);
|
|
699
|
+
}, [defaultTab]);
|
|
700
|
+
const handleTab = (next) => {
|
|
701
|
+
setTab(next);
|
|
702
|
+
onTabChange?.(next);
|
|
703
|
+
};
|
|
704
|
+
const maxAskDepth = Math.max(1, ...asks.map((l) => l.depth ?? l.amount));
|
|
705
|
+
const maxBidDepth = Math.max(1, ...bids.map((l) => l.depth ?? l.amount));
|
|
706
|
+
const midClass = midChangePercent == null ? "text-white" : midChangePercent >= 0 ? "text-[#0ecb81]" : "text-[#f6465d]";
|
|
707
|
+
const tradeFiltered = trades.filter((t) => tradeFilter === "all" || t.type === tradeFilter);
|
|
708
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
709
|
+
Card,
|
|
710
|
+
{
|
|
711
|
+
ref,
|
|
712
|
+
className: cn(
|
|
713
|
+
"w-full max-w-[520px] overflow-hidden rounded-[12px] border border-white/10 bg-black/30 text-white shadow-md",
|
|
714
|
+
className
|
|
715
|
+
),
|
|
716
|
+
...props,
|
|
717
|
+
children: [
|
|
718
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-4 pt-4", children: [
|
|
719
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
720
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
721
|
+
"button",
|
|
722
|
+
{
|
|
723
|
+
type: "button",
|
|
724
|
+
onClick: () => handleTab("orderbook"),
|
|
725
|
+
className: cn(
|
|
726
|
+
"relative pb-2 text-sm font-semibold",
|
|
727
|
+
tab === "orderbook" ? "text-white" : "text-white/60"
|
|
728
|
+
),
|
|
729
|
+
children: [
|
|
730
|
+
"Orderbook",
|
|
731
|
+
tab === "orderbook" ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute -bottom-px left-0 h-[2px] w-full bg-[#C9A227]" }) : null
|
|
732
|
+
]
|
|
733
|
+
}
|
|
734
|
+
),
|
|
735
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
736
|
+
"button",
|
|
737
|
+
{
|
|
738
|
+
type: "button",
|
|
739
|
+
onClick: () => handleTab("trades"),
|
|
740
|
+
className: cn(
|
|
741
|
+
"relative pb-2 text-sm font-medium",
|
|
742
|
+
tab === "trades" ? "text-white" : "text-white/60"
|
|
743
|
+
),
|
|
744
|
+
children: [
|
|
745
|
+
"Trades",
|
|
746
|
+
tab === "trades" ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute -bottom-px left-0 h-[2px] w-full bg-[#C9A227]" }) : null
|
|
747
|
+
]
|
|
748
|
+
}
|
|
749
|
+
)
|
|
750
|
+
] }),
|
|
751
|
+
tab === "trades" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 text-xs", children: [
|
|
752
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
753
|
+
"button",
|
|
754
|
+
{
|
|
755
|
+
type: "button",
|
|
756
|
+
onClick: () => setTradeFilter("all"),
|
|
757
|
+
className: cn(
|
|
758
|
+
"rounded-md px-2 py-1 transition",
|
|
759
|
+
tradeFilter === "all" ? "bg-white/10 text-white" : "text-white/70 hover:bg-white/10"
|
|
760
|
+
),
|
|
761
|
+
children: "All"
|
|
762
|
+
}
|
|
763
|
+
),
|
|
764
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
765
|
+
"button",
|
|
766
|
+
{
|
|
767
|
+
type: "button",
|
|
768
|
+
onClick: () => setTradeFilter("buy"),
|
|
769
|
+
className: cn(
|
|
770
|
+
"rounded-md px-2 py-1 transition",
|
|
771
|
+
tradeFilter === "buy" ? "bg-white/10 text-white" : "text-white/70 hover:bg-white/10"
|
|
772
|
+
),
|
|
773
|
+
children: "Buy"
|
|
774
|
+
}
|
|
775
|
+
),
|
|
776
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
777
|
+
"button",
|
|
778
|
+
{
|
|
779
|
+
type: "button",
|
|
780
|
+
onClick: () => setTradeFilter("sell"),
|
|
781
|
+
className: cn(
|
|
782
|
+
"rounded-md px-2 py-1 transition",
|
|
783
|
+
tradeFilter === "sell" ? "bg-white/10 text-white" : "text-white/70 hover:bg-white/10"
|
|
784
|
+
),
|
|
785
|
+
children: "Sell"
|
|
786
|
+
}
|
|
787
|
+
)
|
|
788
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-3", children: rightHeader })
|
|
789
|
+
] }),
|
|
790
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 pb-3 pt-2", children: [
|
|
791
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-3 px-3 py-2 text-xs text-white/60", children: [
|
|
792
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: priceLabel }),
|
|
793
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-right", children: amountLabel })
|
|
794
|
+
] }),
|
|
795
|
+
tab === "trades" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
796
|
+
"div",
|
|
797
|
+
{
|
|
798
|
+
className: "max-h-[380px] overflow-y-auto overflow-x-hidden",
|
|
799
|
+
style: { scrollbarGutter: "stable" },
|
|
800
|
+
children: tradeFiltered.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 py-10 text-center text-sm text-white/50", children: "No trades" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "divide-y divide-white/5", children: tradeFiltered.map((trade, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 items-center gap-3 px-3 py-1.5", children: [
|
|
801
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
802
|
+
"div",
|
|
803
|
+
{
|
|
804
|
+
className: cn(
|
|
805
|
+
"tabular-nums",
|
|
806
|
+
trade.type === "buy" ? "text-[#0ecb81]" : "text-[#f6465d]"
|
|
807
|
+
),
|
|
808
|
+
children: [
|
|
809
|
+
"$",
|
|
810
|
+
formatNumber(trade.price, precision)
|
|
811
|
+
]
|
|
812
|
+
}
|
|
813
|
+
),
|
|
814
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-right tabular-nums text-white/90", children: formatNumber(trade.amount, amountPrecision) })
|
|
815
|
+
] }, `${trade.type}-${trade.price}-${trade.amount}-${trade.time ?? i}`)) })
|
|
816
|
+
}
|
|
817
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
818
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "divide-y divide-white/5", children: asks.map((l, idx) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
819
|
+
DepthRow,
|
|
820
|
+
{
|
|
821
|
+
side: "ask",
|
|
822
|
+
price: l.price,
|
|
823
|
+
amount: l.amount,
|
|
824
|
+
depthPct: (l.depth ?? l.amount) / maxAskDepth * 100,
|
|
825
|
+
precision,
|
|
826
|
+
amountPrecision
|
|
827
|
+
},
|
|
828
|
+
`ask-${idx}-${l.price}-${l.amount}`
|
|
829
|
+
)) }),
|
|
830
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-2 grid grid-cols-2 items-center gap-3 bg-[#0b1a24] px-3 py-2", children: [
|
|
831
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("text-lg font-semibold tabular-nums", midClass), children: [
|
|
832
|
+
"$",
|
|
833
|
+
formatNumber(midPrice, precision),
|
|
834
|
+
midChangePercent == null ? null : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-2 text-sm font-semibold", children: [
|
|
835
|
+
midChangePercent >= 0 ? "+" : "",
|
|
836
|
+
midChangePercent.toFixed(2),
|
|
837
|
+
"%"
|
|
838
|
+
] })
|
|
839
|
+
] }),
|
|
840
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", {})
|
|
841
|
+
] }),
|
|
842
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "divide-y divide-white/5", children: bids.map((l, idx) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
843
|
+
DepthRow,
|
|
844
|
+
{
|
|
845
|
+
side: "bid",
|
|
846
|
+
price: l.price,
|
|
847
|
+
amount: l.amount,
|
|
848
|
+
depthPct: (l.depth ?? l.amount) / maxBidDepth * 100,
|
|
849
|
+
precision,
|
|
850
|
+
amountPrecision
|
|
851
|
+
},
|
|
852
|
+
`bid-${idx}-${l.price}-${l.amount}`
|
|
853
|
+
)) })
|
|
854
|
+
] })
|
|
855
|
+
] })
|
|
856
|
+
]
|
|
857
|
+
}
|
|
858
|
+
);
|
|
859
|
+
}
|
|
860
|
+
);
|
|
861
|
+
Orderbook.displayName = "Orderbook";
|
|
862
|
+
var PropertyTour = React5__namespace.forwardRef(
|
|
863
|
+
({
|
|
864
|
+
className,
|
|
865
|
+
title,
|
|
866
|
+
src,
|
|
867
|
+
poster,
|
|
868
|
+
autoPlay = true,
|
|
869
|
+
muted = true,
|
|
870
|
+
loop = true,
|
|
871
|
+
controls = true,
|
|
872
|
+
playsInline = true,
|
|
873
|
+
...props
|
|
874
|
+
}, ref) => {
|
|
875
|
+
const videoRef = React5__namespace.useRef(null);
|
|
876
|
+
React5__namespace.useEffect(() => {
|
|
877
|
+
const video = videoRef.current;
|
|
878
|
+
if (!video) return;
|
|
879
|
+
const handleFullscreenChange = () => {
|
|
880
|
+
const d = document;
|
|
881
|
+
const isFullscreen = !!(d.fullscreenElement || d.webkitFullscreenElement || d.mozFullScreenElement || d.msFullscreenElement);
|
|
882
|
+
if (isFullscreen) {
|
|
883
|
+
video.style.objectFit = "contain";
|
|
884
|
+
video.style.width = "100vw";
|
|
885
|
+
video.style.height = "100vh";
|
|
886
|
+
video.style.position = "fixed";
|
|
887
|
+
video.style.top = "0";
|
|
888
|
+
video.style.left = "0";
|
|
889
|
+
video.style.transform = "none";
|
|
890
|
+
video.style.zIndex = "9999";
|
|
891
|
+
} else {
|
|
892
|
+
video.style.objectFit = "cover";
|
|
893
|
+
video.style.width = "100%";
|
|
894
|
+
video.style.height = "100%";
|
|
895
|
+
video.style.position = "absolute";
|
|
896
|
+
video.style.top = "0";
|
|
897
|
+
video.style.left = "0";
|
|
898
|
+
video.style.transform = "none";
|
|
899
|
+
video.style.zIndex = "auto";
|
|
900
|
+
}
|
|
901
|
+
};
|
|
902
|
+
video.addEventListener("fullscreenchange", handleFullscreenChange);
|
|
903
|
+
video.addEventListener("webkitfullscreenchange", handleFullscreenChange);
|
|
904
|
+
video.addEventListener("mozfullscreenchange", handleFullscreenChange);
|
|
905
|
+
video.addEventListener("MSFullscreenChange", handleFullscreenChange);
|
|
906
|
+
document.addEventListener("fullscreenchange", handleFullscreenChange);
|
|
907
|
+
document.addEventListener("webkitfullscreenchange", handleFullscreenChange);
|
|
908
|
+
document.addEventListener("mozfullscreenchange", handleFullscreenChange);
|
|
909
|
+
document.addEventListener("MSFullscreenChange", handleFullscreenChange);
|
|
910
|
+
return () => {
|
|
911
|
+
video.removeEventListener("fullscreenchange", handleFullscreenChange);
|
|
912
|
+
video.removeEventListener("webkitfullscreenchange", handleFullscreenChange);
|
|
913
|
+
video.removeEventListener("mozfullscreenchange", handleFullscreenChange);
|
|
914
|
+
video.removeEventListener("MSFullscreenChange", handleFullscreenChange);
|
|
915
|
+
document.removeEventListener("fullscreenchange", handleFullscreenChange);
|
|
916
|
+
document.removeEventListener("webkitfullscreenchange", handleFullscreenChange);
|
|
917
|
+
document.removeEventListener("mozfullscreenchange", handleFullscreenChange);
|
|
918
|
+
document.removeEventListener("MSFullscreenChange", handleFullscreenChange);
|
|
919
|
+
};
|
|
920
|
+
}, []);
|
|
921
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
922
|
+
Card,
|
|
923
|
+
{
|
|
924
|
+
ref,
|
|
925
|
+
className: cn(
|
|
926
|
+
"w-full max-w-[820px] rounded-[12px] border border-white/10 bg-black/30 text-white backdrop-blur-md",
|
|
927
|
+
className
|
|
928
|
+
),
|
|
929
|
+
...props,
|
|
930
|
+
children: [
|
|
931
|
+
/* @__PURE__ */ jsxRuntime.jsx(CardHeader, { className: "px-6 pb-0 pt-6", children: /* @__PURE__ */ jsxRuntime.jsx(CardTitle, { className: "m-0 text-lg font-semibold text-white", children: title }) }),
|
|
932
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-6 pb-6 pt-5", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative aspect-video w-full overflow-hidden rounded-lg bg-black", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
933
|
+
"video",
|
|
934
|
+
{
|
|
935
|
+
ref: videoRef,
|
|
936
|
+
className: "absolute inset-0 h-full w-full object-cover object-center",
|
|
937
|
+
controls,
|
|
938
|
+
loop,
|
|
939
|
+
autoPlay,
|
|
940
|
+
muted,
|
|
941
|
+
playsInline,
|
|
942
|
+
poster,
|
|
943
|
+
children: [
|
|
944
|
+
/* @__PURE__ */ jsxRuntime.jsx("source", { src }),
|
|
945
|
+
"Your browser does not support the video tag."
|
|
946
|
+
]
|
|
947
|
+
}
|
|
948
|
+
) }) })
|
|
949
|
+
]
|
|
950
|
+
}
|
|
951
|
+
);
|
|
952
|
+
}
|
|
953
|
+
);
|
|
954
|
+
PropertyTour.displayName = "PropertyTour";
|
|
955
|
+
var TYPE_META = {
|
|
956
|
+
property: {
|
|
957
|
+
label: "Property Update",
|
|
958
|
+
accent: "#f8d12f",
|
|
959
|
+
pillBg: "rgba(248, 209, 47, 0.12)",
|
|
960
|
+
pillBorder: "rgba(248, 209, 47, 0.45)",
|
|
961
|
+
pillColor: "#f8d12f",
|
|
962
|
+
icon: lucideReact.Building2
|
|
963
|
+
},
|
|
964
|
+
market: {
|
|
965
|
+
label: "Market Insight",
|
|
966
|
+
accent: "#0ecb81",
|
|
967
|
+
pillBg: "rgba(14, 203, 129, 0.12)",
|
|
968
|
+
pillBorder: "rgba(14, 203, 129, 0.45)",
|
|
969
|
+
pillColor: "#0ecb81",
|
|
970
|
+
icon: lucideReact.LineChart
|
|
971
|
+
},
|
|
972
|
+
portfolio: {
|
|
973
|
+
label: "Portfolio Signal",
|
|
974
|
+
accent: "#6c8cff",
|
|
975
|
+
pillBg: "rgba(108, 140, 255, 0.12)",
|
|
976
|
+
pillBorder: "rgba(108, 140, 255, 0.45)",
|
|
977
|
+
pillColor: "#c9d5ff",
|
|
978
|
+
icon: lucideReact.Sparkles
|
|
979
|
+
}
|
|
980
|
+
};
|
|
981
|
+
var getTypeMeta = (type) => {
|
|
982
|
+
if (!type) return TYPE_META.property;
|
|
983
|
+
const key = type;
|
|
984
|
+
if (key in TYPE_META) return TYPE_META[key];
|
|
985
|
+
return {
|
|
986
|
+
label: type.toString(),
|
|
987
|
+
accent: "#f5f5f5",
|
|
988
|
+
pillBg: "rgba(255,255,255,0.08)",
|
|
989
|
+
pillBorder: "rgba(255,255,255,0.25)",
|
|
990
|
+
pillColor: "#ffffff",
|
|
991
|
+
icon: lucideReact.Newspaper
|
|
992
|
+
};
|
|
993
|
+
};
|
|
994
|
+
var formatDate = (value) => {
|
|
995
|
+
const date = typeof value === "string" ? new Date(value) : value;
|
|
996
|
+
if (Number.isNaN(date.getTime())) return typeof value === "string" ? value : "";
|
|
997
|
+
return date.toLocaleDateString(void 0, {
|
|
998
|
+
month: "short",
|
|
999
|
+
day: "numeric",
|
|
1000
|
+
year: "numeric"
|
|
1001
|
+
});
|
|
1002
|
+
};
|
|
1003
|
+
var PropertyNewsUpdates = React5__namespace.forwardRef(
|
|
1004
|
+
({ className, heading = "Latest property intelligence", subheading, items, emptyState, ...props }, ref) => {
|
|
1005
|
+
const hasItems = Array.isArray(items) && items.length > 0;
|
|
1006
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1007
|
+
"div",
|
|
1008
|
+
{
|
|
1009
|
+
ref,
|
|
1010
|
+
className: cn(
|
|
1011
|
+
"w-full max-w-[480px] rounded-[20px] border border-white/10 bg-gradient-to-br from-[#06090f] via-[#0f1621] to-[#111b2a] p-6 text-white shadow-[0_30px_80px_rgba(3,7,18,0.65)] backdrop-blur-xl",
|
|
1012
|
+
className
|
|
1013
|
+
),
|
|
1014
|
+
...props,
|
|
1015
|
+
children: [
|
|
1016
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
|
|
1017
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[0.85rem] uppercase tracking-[0.25em] text-white/50", children: heading }),
|
|
1018
|
+
subheading ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-white/60", children: subheading }) : null
|
|
1019
|
+
] }),
|
|
1020
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-5 flex flex-col gap-4", children: hasItems ? items.map((item, index) => {
|
|
1021
|
+
const meta = getTypeMeta(item.type);
|
|
1022
|
+
const Icon = meta.icon;
|
|
1023
|
+
const key = item.id ?? `${item.title}-${index}`;
|
|
1024
|
+
const content = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1025
|
+
"div",
|
|
1026
|
+
{
|
|
1027
|
+
className: "relative flex w-full gap-4 rounded-2xl border border-white/5 bg-white/[0.04] p-4 transition hover:border-white/15 hover:bg-white/[0.06]",
|
|
1028
|
+
children: [
|
|
1029
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center", children: [
|
|
1030
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1031
|
+
"div",
|
|
1032
|
+
{
|
|
1033
|
+
className: "flex h-12 w-12 items-center justify-center rounded-full border text-white",
|
|
1034
|
+
style: {
|
|
1035
|
+
background: meta.pillBg,
|
|
1036
|
+
borderColor: meta.pillBorder,
|
|
1037
|
+
color: meta.pillColor
|
|
1038
|
+
},
|
|
1039
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "h-5 w-5" })
|
|
1040
|
+
}
|
|
1041
|
+
),
|
|
1042
|
+
index !== items.length - 1 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 h-full w-px flex-1 bg-white/10" }) : null
|
|
1043
|
+
] }),
|
|
1044
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col", children: [
|
|
1045
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
|
|
1046
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[0.7rem] font-semibold uppercase tracking-[0.3em]", style: { color: meta.accent }, children: meta.label }),
|
|
1047
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center text-xs text-white/60", children: [
|
|
1048
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarDays, { className: "mr-1 h-3.5 w-3.5" }),
|
|
1049
|
+
formatDate(item.date)
|
|
1050
|
+
] })
|
|
1051
|
+
] }),
|
|
1052
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 text-base font-semibold leading-snug", children: item.title }),
|
|
1053
|
+
item.description ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-white/65", children: item.description }) : null,
|
|
1054
|
+
(item.href || item.onAction) && item.actionLabel ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1055
|
+
"button",
|
|
1056
|
+
{
|
|
1057
|
+
type: "button",
|
|
1058
|
+
className: "group mt-3 inline-flex items-center gap-1 text-sm font-semibold text-white transition hover:text-white/80",
|
|
1059
|
+
onClick: () => {
|
|
1060
|
+
if (item.href) {
|
|
1061
|
+
window?.open?.(item.href, "_blank", "noopener,noreferrer");
|
|
1062
|
+
}
|
|
1063
|
+
item.onAction?.(item);
|
|
1064
|
+
},
|
|
1065
|
+
children: [
|
|
1066
|
+
item.actionLabel,
|
|
1067
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUpRight, { className: "h-4 w-4 transition group-hover:translate-x-0.5 group-hover:-translate-y-0.5" })
|
|
1068
|
+
]
|
|
1069
|
+
}
|
|
1070
|
+
) : null
|
|
1071
|
+
] })
|
|
1072
|
+
]
|
|
1073
|
+
},
|
|
1074
|
+
key
|
|
1075
|
+
);
|
|
1076
|
+
return content;
|
|
1077
|
+
}) : emptyState ?? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center rounded-2xl border border-dashed border-white/20 px-6 py-10 text-center text-sm text-white/60", children: [
|
|
1078
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Newspaper, { className: "mb-3 h-8 w-8 text-white/40" }),
|
|
1079
|
+
"No property news yet. Updates will land here as soon as we receive new intelligence."
|
|
1080
|
+
] }) })
|
|
1081
|
+
]
|
|
1082
|
+
}
|
|
1083
|
+
);
|
|
1084
|
+
}
|
|
1085
|
+
);
|
|
1086
|
+
PropertyNewsUpdates.displayName = "PropertyNewsUpdates";
|
|
1087
|
+
var clampPct = (pct) => Math.min(100, Math.max(0, pct));
|
|
1088
|
+
var EditIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1089
|
+
"svg",
|
|
1090
|
+
{
|
|
1091
|
+
viewBox: "0 0 24 24",
|
|
1092
|
+
fill: "none",
|
|
1093
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1094
|
+
className,
|
|
1095
|
+
children: [
|
|
1096
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1097
|
+
"path",
|
|
1098
|
+
{
|
|
1099
|
+
d: "M12 20H21",
|
|
1100
|
+
stroke: "currentColor",
|
|
1101
|
+
strokeWidth: "2",
|
|
1102
|
+
strokeLinecap: "round",
|
|
1103
|
+
strokeLinejoin: "round"
|
|
1104
|
+
}
|
|
1105
|
+
),
|
|
1106
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1107
|
+
"path",
|
|
1108
|
+
{
|
|
1109
|
+
d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5Z",
|
|
1110
|
+
stroke: "currentColor",
|
|
1111
|
+
strokeWidth: "2",
|
|
1112
|
+
strokeLinecap: "round",
|
|
1113
|
+
strokeLinejoin: "round"
|
|
1114
|
+
}
|
|
1115
|
+
)
|
|
1116
|
+
]
|
|
1117
|
+
}
|
|
1118
|
+
);
|
|
1119
|
+
var YourOrders = React5__namespace.forwardRef(
|
|
1120
|
+
({
|
|
1121
|
+
className,
|
|
1122
|
+
title = "Your Orders",
|
|
1123
|
+
orders,
|
|
1124
|
+
onEditPrice,
|
|
1125
|
+
onEditAmount,
|
|
1126
|
+
onCancel,
|
|
1127
|
+
...props
|
|
1128
|
+
}, ref) => {
|
|
1129
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1130
|
+
Card,
|
|
1131
|
+
{
|
|
1132
|
+
ref,
|
|
1133
|
+
className: cn(
|
|
1134
|
+
"w-full min-h-[301.52px] rounded-[12px] border border-white/10 bg-black/30 text-white backdrop-blur-md max-[1024px]:min-h-[250px] max-[480px]:min-h-[200px]",
|
|
1135
|
+
className
|
|
1136
|
+
),
|
|
1137
|
+
...props,
|
|
1138
|
+
children: [
|
|
1139
|
+
/* @__PURE__ */ jsxRuntime.jsx(CardHeader, { className: "px-6 pb-2 pt-6", children: /* @__PURE__ */ jsxRuntime.jsx(CardTitle, { className: "m-0 text-[1.1rem] font-semibold text-white", children: title }) }),
|
|
1140
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-6 pb-6 pt-2", children: [
|
|
1141
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-[1.2fr_0.8fr_1fr_1fr_1fr_1fr_1.2fr_0.8fr] border-b border-white/10 pb-2 text-[0.85rem] font-medium text-white/60", children: [
|
|
1142
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2", children: "Asset" }),
|
|
1143
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2", children: "Type" }),
|
|
1144
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2", children: "Date" }),
|
|
1145
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2", children: "Price" }),
|
|
1146
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2", children: "Amount" }),
|
|
1147
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2", children: "Total" }),
|
|
1148
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2", children: "Filled" }),
|
|
1149
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 text-center", children: "Actions" })
|
|
1150
|
+
] }),
|
|
1151
|
+
orders.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-10 text-center text-sm text-white/50", children: "No orders" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { children: orders.map((order) => {
|
|
1152
|
+
const sideClass = order.side === "buy" ? "text-[#0ecb81]" : "text-[#f6465d]";
|
|
1153
|
+
const filled = clampPct(order.filledPercent);
|
|
1154
|
+
const canEditPrice = Boolean(onEditPrice);
|
|
1155
|
+
const canEditAmount = Boolean(onEditAmount);
|
|
1156
|
+
const canCancel = Boolean(onCancel);
|
|
1157
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1158
|
+
"div",
|
|
1159
|
+
{
|
|
1160
|
+
className: "grid grid-cols-[1.5fr_0.8fr_0.8fr_1fr_0.8fr_1fr_1fr_0.8fr] items-center border-b border-white/5 py-2 text-[0.9rem] transition-colors hover:bg-white/[0.03]",
|
|
1161
|
+
children: [
|
|
1162
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate px-2 font-medium", children: order.asset }),
|
|
1163
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("px-2 font-medium uppercase", sideClass), children: order.side }),
|
|
1164
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 font-medium", children: order.date }),
|
|
1165
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-2 font-medium", children: [
|
|
1166
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "tabular-nums", children: [
|
|
1167
|
+
"$",
|
|
1168
|
+
order.price.toLocaleString()
|
|
1169
|
+
] }),
|
|
1170
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1171
|
+
"button",
|
|
1172
|
+
{
|
|
1173
|
+
type: "button",
|
|
1174
|
+
onClick: canEditPrice ? () => onEditPrice?.(order) : void 0,
|
|
1175
|
+
className: cn(
|
|
1176
|
+
"ml-1 inline-flex items-center justify-center text-white/60 transition-colors",
|
|
1177
|
+
canEditPrice ? "cursor-pointer hover:text-[#C9A227] active:translate-y-px" : "cursor-default"
|
|
1178
|
+
),
|
|
1179
|
+
"aria-label": "Edit price",
|
|
1180
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(EditIcon, { className: "h-[14px] w-[14px]" })
|
|
1181
|
+
}
|
|
1182
|
+
)
|
|
1183
|
+
] }),
|
|
1184
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-2 font-medium", children: [
|
|
1185
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "tabular-nums", children: order.amount.toLocaleString() }),
|
|
1186
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1187
|
+
"button",
|
|
1188
|
+
{
|
|
1189
|
+
type: "button",
|
|
1190
|
+
onClick: canEditAmount ? () => onEditAmount?.(order) : void 0,
|
|
1191
|
+
className: cn(
|
|
1192
|
+
"ml-1 inline-flex items-center justify-center text-white/60 transition-colors",
|
|
1193
|
+
canEditAmount ? "cursor-pointer hover:text-[#C9A227] active:translate-y-px" : "cursor-default"
|
|
1194
|
+
),
|
|
1195
|
+
"aria-label": "Edit amount",
|
|
1196
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(EditIcon, { className: "h-[14px] w-[14px]" })
|
|
1197
|
+
}
|
|
1198
|
+
)
|
|
1199
|
+
] }),
|
|
1200
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-2 font-medium tabular-nums", children: [
|
|
1201
|
+
"$",
|
|
1202
|
+
order.total.toLocaleString()
|
|
1203
|
+
] }),
|
|
1204
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-2", children: [
|
|
1205
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-[0.875rem] font-medium tabular-nums", children: [
|
|
1206
|
+
filled.toFixed(0),
|
|
1207
|
+
"%"
|
|
1208
|
+
] }),
|
|
1209
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 h-1 w-4/5 overflow-hidden rounded-sm bg-white/10", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full rounded-sm bg-[#C9A227]", style: { width: `${filled}%` } }) })
|
|
1210
|
+
] }),
|
|
1211
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 text-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1212
|
+
"button",
|
|
1213
|
+
{
|
|
1214
|
+
type: "button",
|
|
1215
|
+
onClick: canCancel ? () => onCancel?.(order) : void 0,
|
|
1216
|
+
className: cn(
|
|
1217
|
+
"rounded border border-white/40 px-3 py-1 text-[0.8rem] text-white/70 transition-colors",
|
|
1218
|
+
canCancel ? "cursor-pointer hover:bg-white/10 active:text-[#f6465d] active:border-[#f6465d] active:translate-y-px" : "cursor-default"
|
|
1219
|
+
),
|
|
1220
|
+
children: "Cancel"
|
|
1221
|
+
}
|
|
1222
|
+
) })
|
|
1223
|
+
]
|
|
1224
|
+
},
|
|
1225
|
+
order.id
|
|
1226
|
+
);
|
|
1227
|
+
}) })
|
|
1228
|
+
] })
|
|
1229
|
+
]
|
|
1230
|
+
}
|
|
1231
|
+
);
|
|
1232
|
+
}
|
|
1233
|
+
);
|
|
1234
|
+
YourOrders.displayName = "YourOrders";
|
|
1235
|
+
var defaultRanges = ["1D", "1W", "1M", "3M", "1Y"];
|
|
1236
|
+
var formatPrice = (value, currencySymbol) => {
|
|
1237
|
+
return `${currencySymbol}${value.toLocaleString(void 0, {
|
|
1238
|
+
minimumFractionDigits: 2,
|
|
1239
|
+
maximumFractionDigits: 2
|
|
1240
|
+
})}`;
|
|
1241
|
+
};
|
|
1242
|
+
var PriceChart = React5__namespace.forwardRef(
|
|
1243
|
+
({
|
|
1244
|
+
className,
|
|
1245
|
+
title = "Price Chart",
|
|
1246
|
+
ranges = defaultRanges,
|
|
1247
|
+
selectedRange,
|
|
1248
|
+
onRangeChange,
|
|
1249
|
+
data,
|
|
1250
|
+
price,
|
|
1251
|
+
changePercent,
|
|
1252
|
+
currencySymbol = "$",
|
|
1253
|
+
height = 301.52,
|
|
1254
|
+
...props
|
|
1255
|
+
}, ref) => {
|
|
1256
|
+
const containerRef = React5__namespace.useRef(null);
|
|
1257
|
+
const chartRef = React5__namespace.useRef(null);
|
|
1258
|
+
const seriesRef = React5__namespace.useRef(null);
|
|
1259
|
+
const priceLineRef = React5__namespace.useRef(null);
|
|
1260
|
+
const [hoveredRange, setHoveredRange] = React5__namespace.useState(null);
|
|
1261
|
+
const resolvedPrice = React5__namespace.useMemo(() => {
|
|
1262
|
+
if (price != null) return price;
|
|
1263
|
+
const last = data.at(-1);
|
|
1264
|
+
return last?.close;
|
|
1265
|
+
}, [data, price]);
|
|
1266
|
+
const inferredChangePercent = React5__namespace.useMemo(() => {
|
|
1267
|
+
if (changePercent != null) return changePercent;
|
|
1268
|
+
const first = data[0]?.open;
|
|
1269
|
+
const last = data.at(-1)?.close;
|
|
1270
|
+
if (first == null || last == null || first === 0) return void 0;
|
|
1271
|
+
return (last - first) / first * 100;
|
|
1272
|
+
}, [changePercent, data]);
|
|
1273
|
+
React5__namespace.useEffect(() => {
|
|
1274
|
+
const el = containerRef.current;
|
|
1275
|
+
if (!el) return;
|
|
1276
|
+
const chart = lightweightCharts.createChart(el, {
|
|
1277
|
+
autoSize: true,
|
|
1278
|
+
layout: {
|
|
1279
|
+
background: { color: "transparent" },
|
|
1280
|
+
textColor: "rgba(255,255,255,0.55)",
|
|
1281
|
+
fontFamily: "inherit"
|
|
1282
|
+
},
|
|
1283
|
+
grid: {
|
|
1284
|
+
vertLines: { color: "rgba(255,255,255,0.06)" },
|
|
1285
|
+
horzLines: { color: "rgba(255,255,255,0.06)" }
|
|
1286
|
+
},
|
|
1287
|
+
rightPriceScale: {
|
|
1288
|
+
borderColor: "rgba(230, 200, 126, 0.25)",
|
|
1289
|
+
textColor: "rgba(230, 200, 126, 0.7)"
|
|
1290
|
+
},
|
|
1291
|
+
timeScale: {
|
|
1292
|
+
borderColor: "rgba(255,255,255,0.06)",
|
|
1293
|
+
timeVisible: true,
|
|
1294
|
+
secondsVisible: false
|
|
1295
|
+
},
|
|
1296
|
+
crosshair: {
|
|
1297
|
+
vertLine: { color: "rgba(255,255,255,0.12)" },
|
|
1298
|
+
horzLine: { color: "rgba(255,255,255,0.12)" }
|
|
1299
|
+
}
|
|
1300
|
+
});
|
|
1301
|
+
const series = chart.addCandlestickSeries({
|
|
1302
|
+
upColor: "#0ecb81",
|
|
1303
|
+
downColor: "#f6465d",
|
|
1304
|
+
borderVisible: false,
|
|
1305
|
+
wickUpColor: "#0ecb81",
|
|
1306
|
+
wickDownColor: "#f6465d"
|
|
1307
|
+
});
|
|
1308
|
+
chartRef.current = chart;
|
|
1309
|
+
seriesRef.current = series;
|
|
1310
|
+
return () => {
|
|
1311
|
+
chartRef.current = null;
|
|
1312
|
+
seriesRef.current = null;
|
|
1313
|
+
chart.remove();
|
|
1314
|
+
};
|
|
1315
|
+
}, []);
|
|
1316
|
+
React5__namespace.useEffect(() => {
|
|
1317
|
+
const chart = chartRef.current;
|
|
1318
|
+
const series = seriesRef.current;
|
|
1319
|
+
if (!chart || !series) return;
|
|
1320
|
+
series.setData(data);
|
|
1321
|
+
if (priceLineRef.current) {
|
|
1322
|
+
series.removePriceLine(priceLineRef.current);
|
|
1323
|
+
priceLineRef.current = null;
|
|
1324
|
+
}
|
|
1325
|
+
if (resolvedPrice != null) {
|
|
1326
|
+
const priceLineColor = "rgba(230, 200, 126, 0.9)";
|
|
1327
|
+
priceLineRef.current = series.createPriceLine({
|
|
1328
|
+
price: resolvedPrice,
|
|
1329
|
+
color: priceLineColor,
|
|
1330
|
+
lineWidth: 1,
|
|
1331
|
+
lineStyle: 2,
|
|
1332
|
+
axisLabelVisible: true,
|
|
1333
|
+
title: resolvedPrice.toFixed(2)
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
chart.timeScale().fitContent();
|
|
1337
|
+
}, [data, resolvedPrice]);
|
|
1338
|
+
const sign = inferredChangePercent == null ? null : inferredChangePercent >= 0 ? "+" : "";
|
|
1339
|
+
const changeClass = inferredChangePercent == null ? "" : inferredChangePercent >= 0 ? "text-[#0ecb81]" : "text-[#f6465d]";
|
|
1340
|
+
const badgeClass = inferredChangePercent == null ? "" : inferredChangePercent >= 0 ? "bg-[#0ecb81]/15 text-[#0ecb81]" : "bg-[#f6465d]/15 text-[#f6465d]";
|
|
1341
|
+
const btnBaseStyle = {
|
|
1342
|
+
backgroundColor: "var(--color-card-dark, rgba(255, 255, 255, 0.05))",
|
|
1343
|
+
borderColor: "var(--color-border, rgba(255, 255, 255, 0.12))",
|
|
1344
|
+
color: "var(--color-text-secondary, rgba(255, 255, 255, 0.7))"
|
|
1345
|
+
};
|
|
1346
|
+
const btnHoverStyle = {
|
|
1347
|
+
backgroundColor: "var(--color-accent-dark, rgba(230, 200, 126, 0.15))",
|
|
1348
|
+
color: "var(--color-text, #ffffff)"
|
|
1349
|
+
};
|
|
1350
|
+
const btnActiveStyle = {
|
|
1351
|
+
backgroundColor: "var(--color-accent, #e6c87e)",
|
|
1352
|
+
borderColor: "var(--color-accent, #e6c87e)",
|
|
1353
|
+
color: "#000000"
|
|
1354
|
+
};
|
|
1355
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1356
|
+
Card,
|
|
1357
|
+
{
|
|
1358
|
+
ref,
|
|
1359
|
+
className: cn(
|
|
1360
|
+
"w-full min-h-[450px] rounded-lg border border-white/10 bg-black/30 text-white backdrop-blur-md",
|
|
1361
|
+
className
|
|
1362
|
+
),
|
|
1363
|
+
...props,
|
|
1364
|
+
children: [
|
|
1365
|
+
/* @__PURE__ */ jsxRuntime.jsxs(CardHeader, { className: "flex flex-row items-start justify-between gap-4 px-6 pb-2 pt-6", children: [
|
|
1366
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1367
|
+
/* @__PURE__ */ jsxRuntime.jsx(CardTitle, { className: "m-0 text-[1.1rem] font-semibold text-white", children: title }),
|
|
1368
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 flex items-center gap-2", children: ranges.map((r) => {
|
|
1369
|
+
const active = r === selectedRange;
|
|
1370
|
+
const hovered = hoveredRange === r;
|
|
1371
|
+
const style = {
|
|
1372
|
+
...btnBaseStyle,
|
|
1373
|
+
...hovered ? btnHoverStyle : null,
|
|
1374
|
+
...active ? btnActiveStyle : null
|
|
1375
|
+
};
|
|
1376
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1377
|
+
"button",
|
|
1378
|
+
{
|
|
1379
|
+
type: "button",
|
|
1380
|
+
onClick: () => onRangeChange?.(r),
|
|
1381
|
+
onMouseEnter: () => setHoveredRange(r),
|
|
1382
|
+
onMouseLeave: () => setHoveredRange((prev) => prev === r ? null : prev),
|
|
1383
|
+
style,
|
|
1384
|
+
className: cn(
|
|
1385
|
+
"rounded border px-3 py-1 text-[0.85rem] font-medium transition-all duration-200"
|
|
1386
|
+
),
|
|
1387
|
+
children: r
|
|
1388
|
+
},
|
|
1389
|
+
r
|
|
1390
|
+
);
|
|
1391
|
+
}) })
|
|
1392
|
+
] }),
|
|
1393
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
1394
|
+
resolvedPrice == null ? null : /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("text-xl font-semibold tabular-nums", changeClass), children: formatPrice(resolvedPrice, currencySymbol) }),
|
|
1395
|
+
inferredChangePercent == null ? null : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("rounded-md px-2 py-1 text-xs font-semibold tabular-nums", badgeClass), children: [
|
|
1396
|
+
sign,
|
|
1397
|
+
inferredChangePercent?.toFixed(2),
|
|
1398
|
+
"%"
|
|
1399
|
+
] })
|
|
1400
|
+
] })
|
|
1401
|
+
] }),
|
|
1402
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-6 pb-6 pt-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1403
|
+
"div",
|
|
1404
|
+
{
|
|
1405
|
+
ref: containerRef,
|
|
1406
|
+
className: "w-full overflow-hidden rounded-lg",
|
|
1407
|
+
style: { height }
|
|
1408
|
+
}
|
|
1409
|
+
) })
|
|
1410
|
+
]
|
|
1411
|
+
}
|
|
1412
|
+
);
|
|
1413
|
+
}
|
|
1414
|
+
);
|
|
1415
|
+
PriceChart.displayName = "PriceChart";
|
|
1416
|
+
var formatPrice2 = (value, currencySymbol) => {
|
|
1417
|
+
return `${currencySymbol}${value.toLocaleString(void 0, {
|
|
1418
|
+
minimumFractionDigits: 3,
|
|
1419
|
+
maximumFractionDigits: 3
|
|
1420
|
+
})}`;
|
|
1421
|
+
};
|
|
1422
|
+
var PropertyHeroHeader = React5__namespace.forwardRef(
|
|
1423
|
+
({
|
|
1424
|
+
className,
|
|
1425
|
+
imageUrl,
|
|
1426
|
+
imageAlt,
|
|
1427
|
+
name,
|
|
1428
|
+
location,
|
|
1429
|
+
price,
|
|
1430
|
+
currencySymbol = "$",
|
|
1431
|
+
changePercent,
|
|
1432
|
+
beds,
|
|
1433
|
+
baths,
|
|
1434
|
+
cars,
|
|
1435
|
+
propertyTypeLabel,
|
|
1436
|
+
onTrade,
|
|
1437
|
+
onMakeOffer,
|
|
1438
|
+
...props
|
|
1439
|
+
}, ref) => {
|
|
1440
|
+
const isPositive = changePercent == null ? void 0 : changePercent >= 0;
|
|
1441
|
+
const tradeHoverColor = "var(--color-accent-hover, #f8d12f)";
|
|
1442
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1443
|
+
"div",
|
|
1444
|
+
{
|
|
1445
|
+
ref,
|
|
1446
|
+
className: cn(
|
|
1447
|
+
"relative w-full overflow-hidden bg-black h-[500px] rounded-[12px] max-[768px]:h-[400px] max-[768px]:rounded-lg max-[480px]:h-[350px] max-[480px]:rounded-md",
|
|
1448
|
+
className
|
|
1449
|
+
),
|
|
1450
|
+
...props,
|
|
1451
|
+
children: [
|
|
1452
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1453
|
+
"img",
|
|
1454
|
+
{
|
|
1455
|
+
src: imageUrl,
|
|
1456
|
+
alt: imageAlt ?? name,
|
|
1457
|
+
className: "h-full w-full object-cover object-center block max-w-none min-w-[120%] min-h-[120%]",
|
|
1458
|
+
style: { transform: "scale(1.0)", transformOrigin: "center" }
|
|
1459
|
+
}
|
|
1460
|
+
),
|
|
1461
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute bottom-0 left-0 right-0 flex w-full items-end justify-between p-8 max-[768px]:flex-col max-[768px]:items-start max-[768px]:gap-4 max-[768px]:p-6 max-[480px]:p-4", children: [
|
|
1462
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-block w-auto max-w-[70%] rounded-lg bg-black/15 px-4 py-3 text-white shadow-[0px_1px_1px_rgba(0,0,0,0.3)] backdrop-blur-[3px] max-[768px]:w-full max-[768px]:max-w-full max-[768px]:px-3 max-[768px]:py-3 max-[480px]:px-3 max-[480px]:py-2", children: [
|
|
1463
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "mb-2 text-[2.5rem] leading-tight text-white [text-shadow:0_2px_4px_rgba(0,0,0,0.3)] max-[768px]:mb-[0.4rem] max-[768px]:text-[2rem] max-[480px]:mb-[0.3rem] max-[480px]:text-[1.75rem]", children: name }),
|
|
1464
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3 flex flex-wrap items-center text-[1.25rem] text-white/90 max-[768px]:mb-[0.6rem] max-[768px]:text-[1.1rem] max-[480px]:mb-[0.5rem] max-[480px]:text-[1rem]", children: [
|
|
1465
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: location }),
|
|
1466
|
+
price == null ? null : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1467
|
+
"span",
|
|
1468
|
+
{
|
|
1469
|
+
className: "ml-4 flex items-center border-l border-white/30 pl-4 font-semibold",
|
|
1470
|
+
style: { color: "var(--color-accent, #e6c87e)" },
|
|
1471
|
+
children: [
|
|
1472
|
+
formatPrice2(price, currencySymbol),
|
|
1473
|
+
changePercent == null ? null : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1474
|
+
"span",
|
|
1475
|
+
{
|
|
1476
|
+
className: cn(
|
|
1477
|
+
"ml-2 flex items-center text-[0.875rem] font-medium",
|
|
1478
|
+
isPositive ? "text-[#0ecb81]" : "text-[#f6465d]"
|
|
1479
|
+
),
|
|
1480
|
+
children: [
|
|
1481
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1482
|
+
"svg",
|
|
1483
|
+
{
|
|
1484
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1485
|
+
width: "12",
|
|
1486
|
+
height: "12",
|
|
1487
|
+
viewBox: "0 0 24 24",
|
|
1488
|
+
fill: "currentColor",
|
|
1489
|
+
className: "mr-[0.15rem]",
|
|
1490
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: isPositive ? "M7 14l5-5 5 5H7z" : "M7 10l5 5 5-5H7z" })
|
|
1491
|
+
}
|
|
1492
|
+
),
|
|
1493
|
+
Math.abs(changePercent).toFixed(2),
|
|
1494
|
+
"%"
|
|
1495
|
+
]
|
|
1496
|
+
}
|
|
1497
|
+
)
|
|
1498
|
+
]
|
|
1499
|
+
}
|
|
1500
|
+
)
|
|
1501
|
+
] }),
|
|
1502
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-6 text-[0.95rem] text-white/90 max-[768px]:hidden", children: [
|
|
1503
|
+
beds == null ? null : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center", children: [
|
|
1504
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.BedDouble, { className: "mr-2 h-[18px] w-[18px]" }),
|
|
1505
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
1506
|
+
beds,
|
|
1507
|
+
" Beds"
|
|
1508
|
+
] })
|
|
1509
|
+
] }),
|
|
1510
|
+
baths == null ? null : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center", children: [
|
|
1511
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bath, { className: "mr-2 h-[18px] w-[18px]" }),
|
|
1512
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
1513
|
+
baths,
|
|
1514
|
+
" Baths"
|
|
1515
|
+
] })
|
|
1516
|
+
] }),
|
|
1517
|
+
cars == null ? null : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center", children: [
|
|
1518
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CarFront, { className: "mr-2 h-[18px] w-[18px]" }),
|
|
1519
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
1520
|
+
cars,
|
|
1521
|
+
" Cars"
|
|
1522
|
+
] })
|
|
1523
|
+
] }),
|
|
1524
|
+
propertyTypeLabel == null ? null : /* @__PURE__ */ jsxRuntime.jsx("div", { children: propertyTypeLabel })
|
|
1525
|
+
] })
|
|
1526
|
+
] }),
|
|
1527
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 max-[768px]:w-full max-[768px]:flex-row max-[768px]:justify-between max-[768px]:gap-2 max-[480px]:gap-2", children: [
|
|
1528
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1529
|
+
"button",
|
|
1530
|
+
{
|
|
1531
|
+
type: "button",
|
|
1532
|
+
onClick: onTrade,
|
|
1533
|
+
className: "rounded border border-transparent px-6 py-3 font-semibold transition-all hover:-translate-y-0.5 hover:shadow-[0_4px_8px_rgba(0,0,0,0.2)] active:translate-y-0 active:shadow-[0_2px_4px_rgba(0,0,0,0.1)] max-[768px]:flex-1 max-[768px]:px-5 max-[768px]:py-2.5 max-[768px]:text-[0.95rem] max-[480px]:px-4 max-[480px]:py-2 max-[480px]:text-[0.9rem]",
|
|
1534
|
+
style: { backgroundColor: "var(--color-accent, #e6c87e)", color: "black" },
|
|
1535
|
+
onMouseEnter: (e) => {
|
|
1536
|
+
e.currentTarget.style.backgroundColor = tradeHoverColor;
|
|
1537
|
+
},
|
|
1538
|
+
onMouseLeave: (e) => {
|
|
1539
|
+
e.currentTarget.style.backgroundColor = "var(--color-accent, #e6c87e)";
|
|
1540
|
+
},
|
|
1541
|
+
children: "Trade"
|
|
1542
|
+
}
|
|
1543
|
+
),
|
|
1544
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1545
|
+
"button",
|
|
1546
|
+
{
|
|
1547
|
+
type: "button",
|
|
1548
|
+
onClick: onMakeOffer,
|
|
1549
|
+
className: "rounded border px-6 py-3 font-semibold transition-all hover:-translate-y-0.5 hover:shadow-[0_4px_8px_rgba(0,0,0,0.2)] active:translate-y-0 active:shadow-[0_2px_4px_rgba(0,0,0,0.1)] max-[768px]:flex-1 max-[768px]:px-5 max-[768px]:py-2.5 max-[768px]:text-[0.95rem] max-[480px]:px-4 max-[480px]:py-2 max-[480px]:text-[0.9rem]",
|
|
1550
|
+
style: {
|
|
1551
|
+
backgroundColor: "transparent",
|
|
1552
|
+
borderColor: "var(--color-accent, #e6c87e)",
|
|
1553
|
+
color: "var(--color-accent, #e6c87e)"
|
|
1554
|
+
},
|
|
1555
|
+
onMouseEnter: (e) => {
|
|
1556
|
+
e.currentTarget.style.backgroundColor = "rgba(240, 185, 11, 0.1)";
|
|
1557
|
+
},
|
|
1558
|
+
onMouseLeave: (e) => {
|
|
1559
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
1560
|
+
},
|
|
1561
|
+
children: "Make Offer"
|
|
1562
|
+
}
|
|
1563
|
+
)
|
|
1564
|
+
] })
|
|
1565
|
+
] })
|
|
1566
|
+
]
|
|
1567
|
+
}
|
|
1568
|
+
);
|
|
1569
|
+
}
|
|
1570
|
+
);
|
|
1571
|
+
PropertyHeroHeader.displayName = "PropertyHeroHeader";
|
|
1572
|
+
var PropertySubheader = React5__namespace.forwardRef(
|
|
1573
|
+
({ className, tabs, activeTabId, onTabChange, actions, ...props }, ref) => {
|
|
1574
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1575
|
+
"div",
|
|
1576
|
+
{
|
|
1577
|
+
ref,
|
|
1578
|
+
className: cn(
|
|
1579
|
+
"w-full font-normal",
|
|
1580
|
+
"flex flex-col gap-3",
|
|
1581
|
+
"md:flex-row md:items-center md:justify-between",
|
|
1582
|
+
className
|
|
1583
|
+
),
|
|
1584
|
+
...props,
|
|
1585
|
+
children: [
|
|
1586
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1587
|
+
"div",
|
|
1588
|
+
{
|
|
1589
|
+
className: cn(
|
|
1590
|
+
"flex items-center border-b border-white/10",
|
|
1591
|
+
"overflow-x-auto md:overflow-visible",
|
|
1592
|
+
"[-webkit-overflow-scrolling:touch]",
|
|
1593
|
+
"[scrollbar-width:none]",
|
|
1594
|
+
"[scroll-behavior:smooth]",
|
|
1595
|
+
"[touch-action:pan-x]",
|
|
1596
|
+
"md:border-b-0"
|
|
1597
|
+
),
|
|
1598
|
+
style: { WebkitTapHighlightColor: "transparent" },
|
|
1599
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-w-max", children: tabs.map((tab) => {
|
|
1600
|
+
const active = tab.id === activeTabId;
|
|
1601
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1602
|
+
"button",
|
|
1603
|
+
{
|
|
1604
|
+
type: "button",
|
|
1605
|
+
onClick: () => onTabChange?.(tab.id),
|
|
1606
|
+
className: cn(
|
|
1607
|
+
"relative whitespace-nowrap",
|
|
1608
|
+
"px-6 py-4",
|
|
1609
|
+
"font-normal",
|
|
1610
|
+
"transition-colors",
|
|
1611
|
+
"max-[768px]:px-[1.2rem] max-[768px]:py-[0.8rem]",
|
|
1612
|
+
"max-[480px]:px-4 max-[480px]:py-[0.7rem] max-[480px]:text-[0.9rem]",
|
|
1613
|
+
active ? "font-semibold text-[var(--color-accent,#e6c87e)]" : "text-white/60 hover:text-white"
|
|
1614
|
+
),
|
|
1615
|
+
style: {
|
|
1616
|
+
borderBottom: active ? "2px solid var(--color-accent, #e6c87e)" : "2px solid transparent",
|
|
1617
|
+
minWidth: "80px",
|
|
1618
|
+
touchAction: "manipulation"
|
|
1619
|
+
},
|
|
1620
|
+
children: [
|
|
1621
|
+
tab.label,
|
|
1622
|
+
tab.hasNotification ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1623
|
+
"span",
|
|
1624
|
+
{
|
|
1625
|
+
className: "absolute right-[10px] top-[10px] h-2 w-2 rounded-full animate-pulse",
|
|
1626
|
+
style: {
|
|
1627
|
+
backgroundColor: tab.notificationColor ?? "#f6465d",
|
|
1628
|
+
boxShadow: "0 0 0 0 rgba(246, 70, 93, 0.7)"
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
) : null
|
|
1632
|
+
]
|
|
1633
|
+
},
|
|
1634
|
+
tab.id
|
|
1635
|
+
);
|
|
1636
|
+
}) })
|
|
1637
|
+
}
|
|
1638
|
+
),
|
|
1639
|
+
actions != null && actions.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1640
|
+
"div",
|
|
1641
|
+
{
|
|
1642
|
+
className: cn(
|
|
1643
|
+
"flex items-center gap-[10px]",
|
|
1644
|
+
"overflow-x-auto md:overflow-visible",
|
|
1645
|
+
"[scrollbar-width:none]",
|
|
1646
|
+
"md:justify-end",
|
|
1647
|
+
"max-[768px]:w-full max-[768px]:justify-center max-[768px]:pb-2 max-[768px]:mb-4"
|
|
1648
|
+
),
|
|
1649
|
+
children: actions.map((action) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1650
|
+
"button",
|
|
1651
|
+
{
|
|
1652
|
+
type: "button",
|
|
1653
|
+
onClick: action.onClick,
|
|
1654
|
+
className: cn(
|
|
1655
|
+
"flex shrink-0 items-center gap-[5px] whitespace-nowrap",
|
|
1656
|
+
"rounded",
|
|
1657
|
+
"border border-white/10",
|
|
1658
|
+
"bg-transparent",
|
|
1659
|
+
"px-3 py-1.5 text-[14px] font-normal",
|
|
1660
|
+
"transition-all",
|
|
1661
|
+
"max-[768px]:px-2.5 max-[768px]:py-[5px] max-[768px]:text-[13px]",
|
|
1662
|
+
"hover:bg-white/5 hover:border-[var(--color-accent,#e6c87e)] hover:text-[var(--color-accent,#e6c87e)]"
|
|
1663
|
+
),
|
|
1664
|
+
children: [
|
|
1665
|
+
action.icon,
|
|
1666
|
+
action.label
|
|
1667
|
+
]
|
|
1668
|
+
},
|
|
1669
|
+
action.id
|
|
1670
|
+
))
|
|
1671
|
+
}
|
|
1672
|
+
) : null
|
|
1673
|
+
]
|
|
1674
|
+
}
|
|
1675
|
+
);
|
|
1676
|
+
}
|
|
1677
|
+
);
|
|
1678
|
+
PropertySubheader.displayName = "PropertySubheader";
|
|
1679
|
+
|
|
1680
|
+
exports.Badge = Badge;
|
|
1681
|
+
exports.Button = Button;
|
|
1682
|
+
exports.Card = Card;
|
|
1683
|
+
exports.CardContent = CardContent;
|
|
1684
|
+
exports.CardDescription = CardDescription;
|
|
1685
|
+
exports.CardFooter = CardFooter;
|
|
1686
|
+
exports.CardHeader = CardHeader;
|
|
1687
|
+
exports.CardTitle = CardTitle;
|
|
1688
|
+
exports.HousePositionSlider = HousePositionSlider;
|
|
1689
|
+
exports.Orderbook = Orderbook;
|
|
1690
|
+
exports.PortfolioSummary = PortfolioSummary;
|
|
1691
|
+
exports.PriceChart = PriceChart;
|
|
1692
|
+
exports.PropertyHeroHeader = PropertyHeroHeader;
|
|
1693
|
+
exports.PropertyNewsUpdates = PropertyNewsUpdates;
|
|
1694
|
+
exports.PropertySubheader = PropertySubheader;
|
|
1695
|
+
exports.PropertyTour = PropertyTour;
|
|
1696
|
+
exports.YourOrders = YourOrders;
|
|
1697
|
+
exports.badgeVariants = badgeVariants;
|
|
1698
|
+
exports.buttonVariants = buttonVariants;
|
|
1699
|
+
//# sourceMappingURL=index.js.map
|
|
1700
|
+
//# sourceMappingURL=index.js.map
|