brickwise 0.1.1 → 0.1.7
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/package.json +1 -1
- package/public/fonts/Stack_Sans_Notch/OFL.txt +93 -0
- package/public/fonts/Stack_Sans_Notch/README.txt +68 -0
- package/public/fonts/Stack_Sans_Notch/StackSansNotch-VariableFont_wght.ttf +0 -0
- package/public/fonts/Stack_Sans_Notch/static/StackSansNotch-Bold.ttf +0 -0
- package/public/fonts/Stack_Sans_Notch/static/StackSansNotch-ExtraLight.ttf +0 -0
- package/public/fonts/Stack_Sans_Notch/static/StackSansNotch-Light.ttf +0 -0
- package/public/fonts/Stack_Sans_Notch/static/StackSansNotch-Medium.ttf +0 -0
- package/public/fonts/Stack_Sans_Notch/static/StackSansNotch-Regular.ttf +0 -0
- package/public/fonts/Stack_Sans_Notch/static/StackSansNotch-SemiBold.ttf +0 -0
- package/src/app/favorites/page.tsx +218 -116
- package/src/app/globals.css +123 -26
- package/src/app/layout.tsx +10 -4
- package/src/app/listing/[id]/page.tsx +18 -3
- package/src/app/page.tsx +6 -6
- package/src/app/search/page.tsx +3 -85
- package/src/components/Nav.tsx +5 -6
- package/src/components/PsqftChart.tsx +12 -5
- package/src/components/ReformScenario.tsx +123 -0
- package/src/lib/db.ts +9 -2
- package/src/lib/store.ts +8 -1
- package/src/lib/types.ts +8 -0
- package/src/lib/yield.ts +26 -15
- package/src/app/api/search/route.ts +0 -26
- package/src/components/FiltersForm.tsx +0 -240
- package/src/components/ListingCard.tsx +0 -145
- package/src/lib/dedupe.ts +0 -34
package/package.json
CHANGED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2025 The Stack Sans Project Authors (https://github.com/DylanYoungKoto/Stack-Sans)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
https://openfontlicense.org
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Stack Sans Notch Variable Font
|
|
2
|
+
==============================
|
|
3
|
+
|
|
4
|
+
This download contains Stack Sans Notch as both a variable font and static fonts.
|
|
5
|
+
|
|
6
|
+
Stack Sans Notch is a variable font with this axis:
|
|
7
|
+
wght
|
|
8
|
+
|
|
9
|
+
This means all the styles are contained in a single file:
|
|
10
|
+
Stack_Sans_Notch/StackSansNotch-VariableFont_wght.ttf
|
|
11
|
+
|
|
12
|
+
If your app fully supports variable fonts, you can now pick intermediate styles
|
|
13
|
+
that aren’t available as static fonts. Not all apps support variable fonts, and
|
|
14
|
+
in those cases you can use the static font files for Stack Sans Notch:
|
|
15
|
+
Stack_Sans_Notch/static/StackSansNotch-ExtraLight.ttf
|
|
16
|
+
Stack_Sans_Notch/static/StackSansNotch-Light.ttf
|
|
17
|
+
Stack_Sans_Notch/static/StackSansNotch-Regular.ttf
|
|
18
|
+
Stack_Sans_Notch/static/StackSansNotch-Medium.ttf
|
|
19
|
+
Stack_Sans_Notch/static/StackSansNotch-SemiBold.ttf
|
|
20
|
+
Stack_Sans_Notch/static/StackSansNotch-Bold.ttf
|
|
21
|
+
|
|
22
|
+
Get started
|
|
23
|
+
-----------
|
|
24
|
+
|
|
25
|
+
1. Install the font files you want to use
|
|
26
|
+
|
|
27
|
+
2. Use your app's font picker to view the font family and all the
|
|
28
|
+
available styles
|
|
29
|
+
|
|
30
|
+
Learn more about variable fonts
|
|
31
|
+
-------------------------------
|
|
32
|
+
|
|
33
|
+
https://developers.google.com/web/fundamentals/design-and-ux/typography/variable-fonts
|
|
34
|
+
https://variablefonts.typenetwork.com
|
|
35
|
+
https://medium.com/variable-fonts
|
|
36
|
+
|
|
37
|
+
In desktop apps
|
|
38
|
+
|
|
39
|
+
https://theblog.adobe.com/can-variable-fonts-illustrator-cc
|
|
40
|
+
https://helpx.adobe.com/nz/photoshop/using/fonts.html#variable_fonts
|
|
41
|
+
|
|
42
|
+
Online
|
|
43
|
+
|
|
44
|
+
https://developers.google.com/fonts/docs/getting_started
|
|
45
|
+
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Fonts/Variable_Fonts_Guide
|
|
46
|
+
https://developer.microsoft.com/en-us/microsoft-edge/testdrive/demos/variable-fonts
|
|
47
|
+
|
|
48
|
+
Installing fonts
|
|
49
|
+
|
|
50
|
+
MacOS: https://support.apple.com/en-us/HT201749
|
|
51
|
+
Linux: https://www.google.com/search?q=how+to+install+a+font+on+gnu%2Blinux
|
|
52
|
+
Windows: https://support.microsoft.com/en-us/help/314960/how-to-install-or-remove-a-font-in-windows
|
|
53
|
+
|
|
54
|
+
Android Apps
|
|
55
|
+
|
|
56
|
+
https://developers.google.com/fonts/docs/android
|
|
57
|
+
https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts
|
|
58
|
+
|
|
59
|
+
License
|
|
60
|
+
-------
|
|
61
|
+
Please read the full license text (OFL.txt) to understand the permissions,
|
|
62
|
+
restrictions and requirements for usage, redistribution, and modification.
|
|
63
|
+
|
|
64
|
+
You can use them in your products & projects – print or digital,
|
|
65
|
+
commercial or otherwise.
|
|
66
|
+
|
|
67
|
+
This isn't legal advice, please consider consulting a lawyer and see the full
|
|
68
|
+
license for all details.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -34,15 +34,31 @@ interface FavRow {
|
|
|
34
34
|
|
|
35
35
|
const GYM_SVG = `<svg viewBox="0 0 24 24" width="14" height="14" fill="#fff" xmlns="http://www.w3.org/2000/svg"><path d="M2 10h2v4H2zM5 8h2v8H5zM17 8h2v8h-2zM20 10h2v4h-2zM8 11h8v2H8z"/></svg>`;
|
|
36
36
|
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
if (y >= 0.07) return "#059669";
|
|
40
|
-
if (y >= 0.055) return "#65a30d";
|
|
41
|
-
if (y >= 0.04) return "#d97706";
|
|
42
|
-
return "#dc2626";
|
|
37
|
+
function matchesBedFilter(r: { bedrooms: number | null }, bedFilter: number[]): boolean {
|
|
38
|
+
return bedFilter.length === 0 || (r.bedrooms != null && bedFilter.includes(r.bedrooms));
|
|
43
39
|
}
|
|
44
40
|
|
|
45
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Relative color scale: red (lowest yield in the set) → turquoise (highest).
|
|
43
|
+
* Absolute thresholds made every Dubai listing green because yields are all high;
|
|
44
|
+
* scaling to the actual min/max makes the differences readable on the map.
|
|
45
|
+
*/
|
|
46
|
+
function yieldColor(y: number | null, min: number, max: number): string {
|
|
47
|
+
if (y == null) return "#8a8a8a";
|
|
48
|
+
const t = max > min ? Math.min(1, Math.max(0, (y - min) / (max - min))) : 0.5;
|
|
49
|
+
const hue = t * 174; // 0° red → 174° turquoise
|
|
50
|
+
return `hsl(${Math.round(hue)}, 66%, 44%)`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Min/max of the located favorites' yields, for the relative color scale. */
|
|
54
|
+
function yieldRange(rows: FavRow[] | null): { min: number; max: number } {
|
|
55
|
+
const ys = (rows ?? [])
|
|
56
|
+
.filter((r) => r.lat != null && r.lon != null && r.gross_yield != null)
|
|
57
|
+
.map((r) => r.gross_yield as number);
|
|
58
|
+
return ys.length ? { min: Math.min(...ys), max: Math.max(...ys) } : { min: 0, max: 1 };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function popupHtml(r: FavRow, min: number, max: number): string {
|
|
46
62
|
const img = r.images?.[0]?.medium || r.images?.[0]?.small;
|
|
47
63
|
const yieldTxt = r.gross_yield != null ? (r.gross_yield * 100).toFixed(1) + " %" : "sin datos";
|
|
48
64
|
return `
|
|
@@ -51,7 +67,7 @@ function popupHtml(r: FavRow): string {
|
|
|
51
67
|
<div style="font-weight:600;margin-top:6px;line-height:1.3">${r.title}</div>
|
|
52
68
|
<div style="color:#666;font-size:12px;margin-top:2px">${r.tower_name ?? ""}</div>
|
|
53
69
|
<div style="margin-top:4px;font-size:14px">
|
|
54
|
-
Rentabilidad: <span style="color:${yieldColor(r.gross_yield)};font-weight:700">${yieldTxt}</span>
|
|
70
|
+
Rentabilidad: <span style="color:${yieldColor(r.gross_yield, min, max)};font-weight:700">${yieldTxt}</span>
|
|
55
71
|
</div>
|
|
56
72
|
<div style="margin-top:6px;display:flex;gap:10px;font-size:12px">
|
|
57
73
|
<a href="/listing/${r.id}">Ver análisis</a>
|
|
@@ -88,6 +104,8 @@ export default function FavoritesMapPage() {
|
|
|
88
104
|
const [gymsVisible, setGymsVisible] = useState(false);
|
|
89
105
|
const [gymsLoading, setGymsLoading] = useState(false);
|
|
90
106
|
const [gymCount, setGymCount] = useState<number | null>(null);
|
|
107
|
+
const [sortBy, setSortBy] = useState<"yield" | "price">("yield");
|
|
108
|
+
const [bedFilter, setBedFilter] = useState<number[]>([]);
|
|
91
109
|
|
|
92
110
|
const mapRef = useRef<LeafletMap | null>(null);
|
|
93
111
|
const leafletRef = useRef<typeof import("leaflet") | null>(null);
|
|
@@ -187,19 +205,20 @@ export default function FavoritesMapPage() {
|
|
|
187
205
|
if (!L || !map || !mapReady || !rows) return;
|
|
188
206
|
Object.values(markersRef.current).forEach((m) => m.remove());
|
|
189
207
|
markersRef.current = {};
|
|
208
|
+
const { min, max } = yieldRange(rows);
|
|
190
209
|
const bounds: [number, number][] = [];
|
|
191
210
|
for (const r of rows) {
|
|
192
211
|
if (r.lat == null || r.lon == null) continue;
|
|
193
212
|
const y = r.gross_yield != null ? (r.gross_yield * 100).toFixed(1) + "%" : "—";
|
|
194
213
|
const icon = L.divIcon({
|
|
195
214
|
className: "",
|
|
196
|
-
html: `<div class="bw-pin" style="--pin-color:${yieldColor(r.gross_yield)}"><div class="bw-pin-label">${y}</div><div class="bw-pin-tail"></div></div>`,
|
|
215
|
+
html: `<div class="bw-pin" style="--pin-color:${yieldColor(r.gross_yield, min, max)}"><div class="bw-pin-label">${y}</div><div class="bw-pin-tail"></div></div>`,
|
|
197
216
|
iconSize: [0, 0],
|
|
198
217
|
iconAnchor: [0, 0],
|
|
199
218
|
});
|
|
200
219
|
const marker = L.marker([r.lat, r.lon], { icon })
|
|
201
220
|
.addTo(map)
|
|
202
|
-
.bindPopup(popupHtml(r), { maxWidth: 260, offset: [0, -34] });
|
|
221
|
+
.bindPopup(popupHtml(r, min, max), { maxWidth: 260, offset: [0, -34] });
|
|
203
222
|
marker.on("mouseover", () => {
|
|
204
223
|
setHoveredId(r.id);
|
|
205
224
|
document.getElementById(`fav-${r.id}`)?.scrollIntoView({ block: "nearest", behavior: "smooth" });
|
|
@@ -223,6 +242,16 @@ export default function FavoritesMapPage() {
|
|
|
223
242
|
}
|
|
224
243
|
}, [hoveredId]);
|
|
225
244
|
|
|
245
|
+
// --- Filter: dim (darker + transparent) the markers that don't match -----
|
|
246
|
+
useEffect(() => {
|
|
247
|
+
const byId = new Map((rows ?? []).map((r) => [r.id, r]));
|
|
248
|
+
for (const [id, m] of Object.entries(markersRef.current)) {
|
|
249
|
+
const r = byId.get(id);
|
|
250
|
+
const dim = !!r && !matchesBedFilter(r, bedFilter);
|
|
251
|
+
m.getElement()?.querySelector(".bw-pin")?.classList.toggle("bw-pin--dim", dim);
|
|
252
|
+
}
|
|
253
|
+
}, [bedFilter, rows, mapReady]);
|
|
254
|
+
|
|
226
255
|
// --- Add-by-URL queue ----------------------------------------------------
|
|
227
256
|
useEffect(() => {
|
|
228
257
|
if (processing.current || queue.length === 0) return;
|
|
@@ -327,7 +356,7 @@ export default function FavoritesMapPage() {
|
|
|
327
356
|
const mapsUrl = `https://www.google.com/maps/search/?api=1&query=${g.lat}%2C${g.lon}`;
|
|
328
357
|
L.marker([g.lat, g.lon], { icon })
|
|
329
358
|
.bindPopup(
|
|
330
|
-
`<b
|
|
359
|
+
`<b>${safeName}</b><br><a href="${mapsUrl}" target="_blank" rel="noopener noreferrer" style="font-size:12px">Ver en Google Maps ↗</a>`,
|
|
331
360
|
{ offset: [0, -16] }
|
|
332
361
|
)
|
|
333
362
|
.addTo(layer);
|
|
@@ -368,6 +397,104 @@ export default function FavoritesMapPage() {
|
|
|
368
397
|
|
|
369
398
|
const busy = queue.length > 0;
|
|
370
399
|
|
|
400
|
+
const sorted = [...(rows ?? [])].sort((a, b) =>
|
|
401
|
+
sortBy === "price"
|
|
402
|
+
? a.price - b.price
|
|
403
|
+
: (b.gross_yield ?? -1) - (a.gross_yield ?? -1)
|
|
404
|
+
);
|
|
405
|
+
const visible = sorted.filter((r) => matchesBedFilter(r, bedFilter));
|
|
406
|
+
const dimmed = sorted.filter((r) => !matchesBedFilter(r, bedFilter));
|
|
407
|
+
const bedOptions = Array.from(
|
|
408
|
+
new Set((rows ?? []).map((r) => r.bedrooms).filter((b): b is number => b != null))
|
|
409
|
+
).sort((a, b) => a - b);
|
|
410
|
+
const bedLabel = (b: number) => (b === 0 ? "Studio" : String(b));
|
|
411
|
+
const toggleBed = (b: number) =>
|
|
412
|
+
setBedFilter((prev) => (prev.includes(b) ? prev.filter((x) => x !== b) : [...prev, b]));
|
|
413
|
+
|
|
414
|
+
const renderCard = (r: FavRow, dim = false) => (
|
|
415
|
+
<div
|
|
416
|
+
key={r.id}
|
|
417
|
+
id={`fav-${r.id}`}
|
|
418
|
+
onMouseEnter={() => setHoveredId(r.id)}
|
|
419
|
+
onMouseLeave={() => setHoveredId(null)}
|
|
420
|
+
className={`border-b border-neutral-100 p-3 transition-colors dark:border-neutral-800 ${
|
|
421
|
+
hoveredId === r.id ? "bg-blue-50 dark:bg-neutral-800" : ""
|
|
422
|
+
} ${dim ? "opacity-40 grayscale" : ""}`}
|
|
423
|
+
>
|
|
424
|
+
<div className="flex gap-3">
|
|
425
|
+
{r.images?.[0] && (
|
|
426
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
427
|
+
<img
|
|
428
|
+
src={r.images[0].small}
|
|
429
|
+
alt=""
|
|
430
|
+
onClick={() => focus(r)}
|
|
431
|
+
className="h-16 w-24 shrink-0 cursor-pointer rounded-lg object-cover"
|
|
432
|
+
loading="lazy"
|
|
433
|
+
/>
|
|
434
|
+
)}
|
|
435
|
+
<div className="min-w-0 flex-1">
|
|
436
|
+
<div className="flex items-start justify-between gap-2">
|
|
437
|
+
<button
|
|
438
|
+
onClick={() => focus(r)}
|
|
439
|
+
className="line-clamp-1 text-left font-sans text-sm font-semibold normal-case tracking-normal hover:underline"
|
|
440
|
+
title="Centrar en el mapa"
|
|
441
|
+
>
|
|
442
|
+
{r.title}
|
|
443
|
+
</button>
|
|
444
|
+
<button
|
|
445
|
+
onClick={() => remove(r.id)}
|
|
446
|
+
title="Quitar de favoritos"
|
|
447
|
+
className="shrink-0 rounded-md px-1.5 text-xs text-neutral-400 hover:bg-red-50 hover:text-red-600 dark:hover:bg-red-950"
|
|
448
|
+
>
|
|
449
|
+
✕
|
|
450
|
+
</button>
|
|
451
|
+
</div>
|
|
452
|
+
<div className="truncate text-xs text-neutral-500">
|
|
453
|
+
{r.tower_name} · {r.bedrooms === 0 ? "Studio" : `${r.bedrooms ?? "?"} hab`} / {r.bathrooms ?? "?"} baños ·{" "}
|
|
454
|
+
{fmtSqft(r.size_sqft)}
|
|
455
|
+
</div>
|
|
456
|
+
<div className="mt-1 flex items-center gap-2">
|
|
457
|
+
<YieldBadge value={r.gross_yield} n={r.rent_n ?? undefined} />
|
|
458
|
+
{r.asking_yield != null && (
|
|
459
|
+
<span className="text-xs text-neutral-500">s/ anuncio: {(r.asking_yield * 100).toFixed(1)} %</span>
|
|
460
|
+
)}
|
|
461
|
+
</div>
|
|
462
|
+
</div>
|
|
463
|
+
</div>
|
|
464
|
+
|
|
465
|
+
<div className="mt-2 grid grid-cols-2 gap-x-4 gap-y-0.5 text-xs text-neutral-600 dark:text-neutral-400">
|
|
466
|
+
<span>
|
|
467
|
+
Precio: <b className="text-neutral-900 dark:text-neutral-100">{fmtAED(r.price)}</b>
|
|
468
|
+
</span>
|
|
469
|
+
<span>AED/sqft: {r.price_per_sqft ? Math.round(r.price_per_sqft) : "—"}</span>
|
|
470
|
+
<span>
|
|
471
|
+
Renta mediana: {fmtAED(r.median_rent)}
|
|
472
|
+
{r.rent_n ? ` (${r.rent_n})` : ""}
|
|
473
|
+
</span>
|
|
474
|
+
<span>
|
|
475
|
+
Venta mediana: {fmtAED(r.median_sale_price)}
|
|
476
|
+
{r.buy_n ? ` (${r.buy_n})` : ""}
|
|
477
|
+
</span>
|
|
478
|
+
<span title={r.gym_name ?? undefined}>Gym: {fmtDist(r.gym_distance_m)}</span>
|
|
479
|
+
<span className="flex gap-2">
|
|
480
|
+
<Link href={`/listing/${r.id}`} className="font-medium text-blue-600 hover:underline dark:text-blue-400">
|
|
481
|
+
Ver análisis
|
|
482
|
+
</Link>
|
|
483
|
+
<a href={r.url} target="_blank" rel="noopener noreferrer" className="font-medium text-blue-600 hover:underline dark:text-blue-400">
|
|
484
|
+
PF ↗
|
|
485
|
+
</a>
|
|
486
|
+
</span>
|
|
487
|
+
</div>
|
|
488
|
+
|
|
489
|
+
<textarea
|
|
490
|
+
className="mt-2 h-9 w-full resize-none rounded-md border border-transparent bg-neutral-50 px-2 py-1 text-xs outline-none focus:border-neutral-300 dark:bg-neutral-950 dark:focus:border-neutral-700"
|
|
491
|
+
defaultValue={r.notes}
|
|
492
|
+
placeholder="notas…"
|
|
493
|
+
onBlur={(e) => saveNotes(r.id, e.target.value)}
|
|
494
|
+
/>
|
|
495
|
+
</div>
|
|
496
|
+
);
|
|
497
|
+
|
|
371
498
|
return (
|
|
372
499
|
<div className="fixed inset-0 flex overflow-hidden">
|
|
373
500
|
{/* ------------------------------------------------ sidebar */}
|
|
@@ -377,15 +504,12 @@ export default function FavoritesMapPage() {
|
|
|
377
504
|
className="flex min-h-0 shrink-0 flex-col border-r border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900"
|
|
378
505
|
>
|
|
379
506
|
<div className="flex items-center gap-3 border-b border-neutral-200 px-3 py-2 dark:border-neutral-800">
|
|
380
|
-
<Link href="/" className="text-sm font-bold tracking-tight">
|
|
381
|
-
|
|
507
|
+
<Link href="/" className="font-brand text-sm font-bold tracking-tight">
|
|
508
|
+
Brickwise
|
|
382
509
|
</Link>
|
|
383
510
|
<span className="ml-auto flex items-center gap-1 text-xs">
|
|
384
|
-
<Link href="/
|
|
385
|
-
|
|
386
|
-
</Link>
|
|
387
|
-
<Link href="/" className="rounded-full px-2.5 py-1 font-medium text-neutral-600 hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-800">
|
|
388
|
-
📊 Analizados
|
|
511
|
+
<Link href="/" className="btn-font rounded-full px-2.5 py-1 font-medium text-neutral-600 hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-800">
|
|
512
|
+
Analizados
|
|
389
513
|
</Link>
|
|
390
514
|
</span>
|
|
391
515
|
</div>
|
|
@@ -403,7 +527,7 @@ export default function FavoritesMapPage() {
|
|
|
403
527
|
disabled={!input.trim() || busy}
|
|
404
528
|
className="rounded-lg bg-blue-600 px-4 py-1.5 text-xs font-bold text-white hover:bg-blue-500 disabled:opacity-50"
|
|
405
529
|
>
|
|
406
|
-
{busy ? `Analizando ${queue.length}…` : "
|
|
530
|
+
{busy ? `Analizando ${queue.length}…` : "Añadir y analizar"}
|
|
407
531
|
</button>
|
|
408
532
|
<button
|
|
409
533
|
type="button"
|
|
@@ -415,9 +539,9 @@ export default function FavoritesMapPage() {
|
|
|
415
539
|
? "Buscando…"
|
|
416
540
|
: gymCount != null
|
|
417
541
|
? gymsVisible
|
|
418
|
-
?
|
|
419
|
-
:
|
|
420
|
-
: "
|
|
542
|
+
? `Ocultar gyms (${gymCount})`
|
|
543
|
+
: `Mostrar gyms (${gymCount})`
|
|
544
|
+
: "Gimnasios"}
|
|
421
545
|
</button>
|
|
422
546
|
<button
|
|
423
547
|
type="button"
|
|
@@ -428,7 +552,7 @@ export default function FavoritesMapPage() {
|
|
|
428
552
|
: "border-neutral-300 hover:bg-neutral-100 dark:border-neutral-700 dark:hover:bg-neutral-800"
|
|
429
553
|
}`}
|
|
430
554
|
>
|
|
431
|
-
|
|
555
|
+
Sincronizar con PF
|
|
432
556
|
</button>
|
|
433
557
|
</div>
|
|
434
558
|
{errors.length > 0 && (
|
|
@@ -454,7 +578,7 @@ export default function FavoritesMapPage() {
|
|
|
454
578
|
className="mx-0.5 inline-block cursor-grab rounded bg-neutral-900 px-2 py-0.5 font-bold text-white dark:bg-white dark:text-neutral-900"
|
|
455
579
|
draggable
|
|
456
580
|
>
|
|
457
|
-
|
|
581
|
+
Guardados a Brickwise
|
|
458
582
|
</a>
|
|
459
583
|
</li>
|
|
460
584
|
<li>
|
|
@@ -471,7 +595,7 @@ export default function FavoritesMapPage() {
|
|
|
471
595
|
onClick={pasteFromPf}
|
|
472
596
|
className="rounded bg-blue-600 px-2 py-0.5 font-bold text-white hover:bg-blue-500"
|
|
473
597
|
>
|
|
474
|
-
|
|
598
|
+
Pegar de Property Finder
|
|
475
599
|
</button>
|
|
476
600
|
</li>
|
|
477
601
|
</ol>
|
|
@@ -488,103 +612,62 @@ export default function FavoritesMapPage() {
|
|
|
488
612
|
<p className="animate-pulse p-4 text-sm text-neutral-500">Cargando…</p>
|
|
489
613
|
) : rows.length === 0 ? (
|
|
490
614
|
<p className="p-4 text-sm text-neutral-500">
|
|
491
|
-
No hay favoritos aún. Pega arriba un enlace de Property Finder o
|
|
492
|
-
<Link href="/search" className="font-semibold text-blue-600 hover:underline dark:text-blue-400">
|
|
493
|
-
Buscar
|
|
494
|
-
</Link>
|
|
495
|
-
.
|
|
615
|
+
No hay favoritos aún. Pega arriba un enlace de Property Finder o usa Sincronizar con PF.
|
|
496
616
|
</p>
|
|
497
617
|
) : (
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
<div className="min-w-0 flex-1">
|
|
520
|
-
<div className="flex items-start justify-between gap-2">
|
|
618
|
+
<>
|
|
619
|
+
{/* sort + bedroom filter */}
|
|
620
|
+
<div className="sticky top-0 z-10 flex flex-wrap items-center gap-1.5 border-b border-neutral-200 bg-white/95 px-3 py-2 backdrop-blur dark:border-neutral-800 dark:bg-neutral-900/95">
|
|
621
|
+
<span className="btn-font text-[10px] text-neutral-500">Ordenar</span>
|
|
622
|
+
{(["yield", "price"] as const).map((k) => (
|
|
623
|
+
<button
|
|
624
|
+
key={k}
|
|
625
|
+
onClick={() => setSortBy(k)}
|
|
626
|
+
className={`rounded px-2 py-0.5 text-[11px] ${
|
|
627
|
+
sortBy === k
|
|
628
|
+
? "bg-neutral-900 text-white dark:bg-white dark:text-neutral-900"
|
|
629
|
+
: "border border-neutral-300 text-neutral-600 dark:border-neutral-700 dark:text-neutral-300"
|
|
630
|
+
}`}
|
|
631
|
+
>
|
|
632
|
+
{k === "yield" ? "Rentabilidad" : "Precio"}
|
|
633
|
+
</button>
|
|
634
|
+
))}
|
|
635
|
+
{bedOptions.length > 0 && (
|
|
636
|
+
<>
|
|
637
|
+
<span className="btn-font ml-2 text-[10px] text-neutral-500">Hab</span>
|
|
638
|
+
{bedOptions.map((b) => (
|
|
521
639
|
<button
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
640
|
+
key={b}
|
|
641
|
+
onClick={() => toggleBed(b)}
|
|
642
|
+
className={`rounded px-2 py-0.5 text-[11px] ${
|
|
643
|
+
bedFilter.includes(b)
|
|
644
|
+
? "bg-blue-600 text-white"
|
|
645
|
+
: "border border-neutral-300 text-neutral-600 dark:border-neutral-700 dark:text-neutral-300"
|
|
646
|
+
}`}
|
|
525
647
|
>
|
|
526
|
-
{
|
|
648
|
+
{bedLabel(b)}
|
|
527
649
|
</button>
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
>
|
|
533
|
-
✕
|
|
650
|
+
))}
|
|
651
|
+
{bedFilter.length > 0 && (
|
|
652
|
+
<button onClick={() => setBedFilter([])} className="px-1 text-[11px] text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-200">
|
|
653
|
+
Limpiar
|
|
534
654
|
</button>
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
{fmtSqft(r.size_sqft)}
|
|
539
|
-
</div>
|
|
540
|
-
<div className="mt-1 flex items-center gap-2">
|
|
541
|
-
<YieldBadge value={r.gross_yield} n={r.rent_n ?? undefined} />
|
|
542
|
-
{r.asking_yield != null && (
|
|
543
|
-
<span className="text-xs text-neutral-500">
|
|
544
|
-
s/ anuncio: {(r.asking_yield * 100).toFixed(1)} %
|
|
545
|
-
</span>
|
|
546
|
-
)}
|
|
547
|
-
</div>
|
|
548
|
-
</div>
|
|
549
|
-
</div>
|
|
550
|
-
|
|
551
|
-
<div className="mt-2 grid grid-cols-2 gap-x-4 gap-y-0.5 text-xs text-neutral-600 dark:text-neutral-400">
|
|
552
|
-
<span>
|
|
553
|
-
Precio: <b className="text-neutral-900 dark:text-neutral-100">{fmtAED(r.price)}</b>
|
|
554
|
-
</span>
|
|
555
|
-
<span>AED/sqft: {r.price_per_sqft ? Math.round(r.price_per_sqft) : "—"}</span>
|
|
556
|
-
<span>
|
|
557
|
-
Renta mediana: {fmtAED(r.median_rent)}
|
|
558
|
-
{r.rent_n ? ` (${r.rent_n})` : ""}
|
|
559
|
-
</span>
|
|
560
|
-
<span>
|
|
561
|
-
Venta mediana: {fmtAED(r.median_sale_price)}
|
|
562
|
-
{r.buy_n ? ` (${r.buy_n})` : ""}
|
|
563
|
-
</span>
|
|
564
|
-
<span title={r.gym_name ?? undefined}>Gym: {fmtDist(r.gym_distance_m)}</span>
|
|
565
|
-
<span className="flex gap-2">
|
|
566
|
-
<Link href={`/listing/${r.id}`} className="font-medium text-blue-600 hover:underline dark:text-blue-400">
|
|
567
|
-
Ver análisis
|
|
568
|
-
</Link>
|
|
569
|
-
<a
|
|
570
|
-
href={r.url}
|
|
571
|
-
target="_blank"
|
|
572
|
-
rel="noopener noreferrer"
|
|
573
|
-
className="font-medium text-blue-600 hover:underline dark:text-blue-400"
|
|
574
|
-
>
|
|
575
|
-
PF ↗
|
|
576
|
-
</a>
|
|
577
|
-
</span>
|
|
578
|
-
</div>
|
|
579
|
-
|
|
580
|
-
<textarea
|
|
581
|
-
className="mt-2 h-9 w-full resize-none rounded-md border border-transparent bg-neutral-50 px-2 py-1 text-xs outline-none focus:border-neutral-300 dark:bg-neutral-950 dark:focus:border-neutral-700"
|
|
582
|
-
defaultValue={r.notes}
|
|
583
|
-
placeholder="notas…"
|
|
584
|
-
onBlur={(e) => saveNotes(r.id, e.target.value)}
|
|
585
|
-
/>
|
|
655
|
+
)}
|
|
656
|
+
</>
|
|
657
|
+
)}
|
|
586
658
|
</div>
|
|
587
|
-
|
|
659
|
+
|
|
660
|
+
{visible.map((r) => renderCard(r))}
|
|
661
|
+
|
|
662
|
+
{bedFilter.length > 0 && dimmed.length > 0 && (
|
|
663
|
+
<>
|
|
664
|
+
<div className="btn-font border-y border-neutral-200 bg-neutral-100 px-3 py-1.5 text-[10px] text-neutral-500 dark:border-neutral-800 dark:bg-neutral-950">
|
|
665
|
+
No coinciden con el filtro ({dimmed.length})
|
|
666
|
+
</div>
|
|
667
|
+
{dimmed.map((r) => renderCard(r, true))}
|
|
668
|
+
</>
|
|
669
|
+
)}
|
|
670
|
+
</>
|
|
588
671
|
)}
|
|
589
672
|
</div>
|
|
590
673
|
</aside>
|
|
@@ -597,7 +680,26 @@ export default function FavoritesMapPage() {
|
|
|
597
680
|
/>
|
|
598
681
|
|
|
599
682
|
{/* ------------------------------------------------ map */}
|
|
600
|
-
<div
|
|
683
|
+
<div className="relative min-h-0 min-w-0 flex-1">
|
|
684
|
+
<div ref={containerRef} className="absolute inset-0" />
|
|
685
|
+
{(() => {
|
|
686
|
+
const { min, max } = yieldRange(rows);
|
|
687
|
+
if (!(max > min)) return null;
|
|
688
|
+
return (
|
|
689
|
+
<div className="pointer-events-none absolute bottom-4 left-3 z-[500] rounded border border-black/10 bg-white/90 px-2 py-1.5 text-[10px] text-neutral-700 shadow-lg dark:border-white/10 dark:bg-neutral-900/90 dark:text-neutral-200">
|
|
690
|
+
<div className="btn-font mb-1 text-[9px] text-neutral-500">Rentabilidad</div>
|
|
691
|
+
<div className="flex items-center gap-1.5">
|
|
692
|
+
<span>{(min * 100).toFixed(1)}%</span>
|
|
693
|
+
<span
|
|
694
|
+
className="h-2 w-24 rounded-sm"
|
|
695
|
+
style={{ background: `linear-gradient(90deg, hsl(0,66%,44%), hsl(87,66%,44%), hsl(174,66%,44%))` }}
|
|
696
|
+
/>
|
|
697
|
+
<span>{(max * 100).toFixed(1)}%</span>
|
|
698
|
+
</div>
|
|
699
|
+
</div>
|
|
700
|
+
);
|
|
701
|
+
})()}
|
|
702
|
+
</div>
|
|
601
703
|
</div>
|
|
602
704
|
);
|
|
603
705
|
}
|