feat(belo): add current quote card and improve date formats on analysis page
This commit is contained in:
@@ -27,9 +27,16 @@ function formatDate(d: Date): string {
|
|||||||
return `${y}-${m}-${day}`;
|
return `${y}-${m}-${day}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const dateFormatter = new Intl.DateTimeFormat("es-AR", {
|
||||||
|
day: "numeric",
|
||||||
|
month: "long",
|
||||||
|
year: "numeric",
|
||||||
|
});
|
||||||
|
|
||||||
function formatShortDate(iso: string): string {
|
function formatShortDate(iso: string): string {
|
||||||
const [, m, d] = iso.split("-");
|
const datePart = iso.split(" ")[0];
|
||||||
return `${d}/${m}`;
|
const [y, m, d] = datePart.split("-").map(Number);
|
||||||
|
return dateFormatter.format(new Date(y, m - 1, d));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function BeloAnalysisPage() {
|
export function BeloAnalysisPage() {
|
||||||
@@ -155,7 +162,15 @@ export function BeloAnalysisPage() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid gap-4 md:grid-cols-4">
|
<div className="grid gap-4 md:grid-cols-5">
|
||||||
|
<div className="rounded-lg border p-4">
|
||||||
|
<p className="text-sm text-muted-foreground mb-2">
|
||||||
|
Cotización actual (compra)
|
||||||
|
</p>
|
||||||
|
<p className="text-2xl font-bold">
|
||||||
|
${priceFormatter.format(currentBuy)}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<div className="rounded-lg border p-4">
|
<div className="rounded-lg border p-4">
|
||||||
<p className="text-sm text-muted-foreground mb-2">
|
<p className="text-sm text-muted-foreground mb-2">
|
||||||
Mínimo histórico (compra)
|
Mínimo histórico (compra)
|
||||||
@@ -169,7 +184,7 @@ export function BeloAnalysisPage() {
|
|||||||
</p>
|
</p>
|
||||||
{historical?.minBuyDate && (
|
{historical?.minBuyDate && (
|
||||||
<p className="text-xs text-muted-foreground mt-0.5">
|
<p className="text-xs text-muted-foreground mt-0.5">
|
||||||
{formatShortDate(historical.minBuyDate)}
|
el {formatShortDate(historical.minBuyDate)}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
@@ -188,7 +203,7 @@ export function BeloAnalysisPage() {
|
|||||||
</p>
|
</p>
|
||||||
{historical?.maxBuyDate && (
|
{historical?.maxBuyDate && (
|
||||||
<p className="text-xs text-muted-foreground mt-0.5">
|
<p className="text-xs text-muted-foreground mt-0.5">
|
||||||
{formatShortDate(historical.maxBuyDate)}
|
el {formatShortDate(historical.maxBuyDate)}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user