2026-02-06 09:01:35 +07:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
2026-02-08 10:33:24 +07:00
|
|
|
import { Badge } from "@/components/ui/badge";
|
|
|
|
|
import { Activity, Clock } from "lucide-react";
|
|
|
|
|
import { cn, getConfidenceColor } from "@/lib/utils";
|
2026-02-06 09:01:35 +07:00
|
|
|
|
|
|
|
|
interface RegimeCardProps {
|
|
|
|
|
name: string;
|
|
|
|
|
volatility: number;
|
|
|
|
|
confidence: number;
|
2026-02-08 10:33:24 +07:00
|
|
|
updatedAt?: string;
|
|
|
|
|
h1Bias?: string;
|
2026-02-06 09:01:35 +07:00
|
|
|
}
|
|
|
|
|
|
2026-02-08 10:33:24 +07:00
|
|
|
export function RegimeCard({ name, volatility, confidence, updatedAt, h1Bias }: RegimeCardProps) {
|
|
|
|
|
const getRegimeBadgeVariant = (regime: string) => {
|
|
|
|
|
const lower = regime.toLowerCase();
|
|
|
|
|
if (lower.includes("high") || lower.includes("volatile") || lower.includes("crisis")) return "danger";
|
|
|
|
|
if (lower.includes("low") || lower.includes("ranging")) return "success";
|
|
|
|
|
if (lower.includes("trend")) return "info";
|
|
|
|
|
return "warning";
|
2026-02-06 09:01:35 +07:00
|
|
|
};
|
|
|
|
|
|
2026-02-08 10:33:24 +07:00
|
|
|
const confidencePercent = confidence * 100;
|
|
|
|
|
|
2026-02-06 09:01:35 +07:00
|
|
|
return (
|
2026-02-08 10:33:24 +07:00
|
|
|
<Card className="glass">
|
|
|
|
|
<CardHeader>
|
|
|
|
|
<CardTitle className="text-[11px] font-medium text-muted-foreground flex items-center gap-1.5 uppercase tracking-wider">
|
|
|
|
|
<Activity className="h-3.5 w-3.5" />
|
|
|
|
|
Market Regime
|
|
|
|
|
{updatedAt && (
|
|
|
|
|
<span className="ml-auto flex items-center gap-1 text-[10px] text-muted-foreground/60 font-number normal-case tracking-normal">
|
|
|
|
|
<Clock className="h-2.5 w-2.5" />
|
|
|
|
|
{updatedAt}
|
|
|
|
|
</span>
|
|
|
|
|
)}
|
2026-02-06 09:01:35 +07:00
|
|
|
</CardTitle>
|
|
|
|
|
</CardHeader>
|
2026-02-08 10:33:24 +07:00
|
|
|
<CardContent className="space-y-2">
|
|
|
|
|
<Badge variant={getRegimeBadgeVariant(name) as any} className="text-xs font-bold">
|
|
|
|
|
{name || "Unknown"}
|
|
|
|
|
</Badge>
|
2026-02-06 09:01:35 +07:00
|
|
|
|
|
|
|
|
<div className="flex justify-between items-center">
|
2026-02-08 10:33:24 +07:00
|
|
|
<span className="text-[11px] text-muted-foreground">Volatility</span>
|
|
|
|
|
<span className="text-sm font-semibold font-number">{volatility.toFixed(2)}</span>
|
2026-02-06 09:01:35 +07:00
|
|
|
</div>
|
|
|
|
|
<div className="flex justify-between items-center">
|
2026-02-08 10:33:24 +07:00
|
|
|
<span className="text-[11px] text-muted-foreground">Confidence</span>
|
|
|
|
|
<span className={cn(
|
|
|
|
|
"text-sm font-semibold font-number",
|
|
|
|
|
getConfidenceColor(confidencePercent)
|
|
|
|
|
)}>
|
|
|
|
|
{confidencePercent.toFixed(0)}%
|
|
|
|
|
</span>
|
2026-02-06 09:01:35 +07:00
|
|
|
</div>
|
2026-02-08 10:33:24 +07:00
|
|
|
{h1Bias && (
|
|
|
|
|
<div className="flex justify-between items-center pt-1 border-t border-border">
|
|
|
|
|
<span className="text-[11px] text-muted-foreground">H1 Bias</span>
|
|
|
|
|
<span className={cn(
|
|
|
|
|
"text-xs font-bold",
|
|
|
|
|
h1Bias === "BULLISH" ? "text-success" :
|
|
|
|
|
h1Bias === "BEARISH" ? "text-danger" :
|
|
|
|
|
"text-muted-foreground"
|
|
|
|
|
)}>
|
|
|
|
|
{h1Bias === "BULLISH" ? "↑ " : h1Bias === "BEARISH" ? "↓ " : ""}{h1Bias}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-02-06 09:01:35 +07:00
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
);
|
|
|
|
|
}
|