Spaces:
Paused
Paused
File size: 6,077 Bytes
d8804ab b50322f 587459d d8804ab b50322f d8804ab b50322f d8804ab b50322f d8804ab b50322f d8804ab b50322f d8804ab b50322f d8804ab b50322f d8804ab b50322f d8804ab b50322f d8804ab b50322f d8804ab b50322f 587459d d8804ab b50322f d8804ab b50322f d8804ab b50322f d8804ab b50322f 587459d b50322f d8804ab b50322f d8804ab b50322f d8804ab 587459d b50322f d8804ab b50322f d8804ab 587459d b50322f d8804ab b50322f d8804ab b50322f d8804ab | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | "use client";
import { topCountries } from "../data/country-data";
import { useLanguage } from "@/components/LanguageContext";
function PreviewMetricRow({ label, value }: { label: string; value: string }) {
return (
<li className="flex items-center justify-between gap-x-3 w-full">
<h3 className="m-0 font-mono font-medium text-xs text-muted-foreground uppercase tracking-tight">
{label}
</h3>
<div className="flex-1 border-b border-dashed border-primary/15 mx-2 min-w-[1rem]" aria-hidden="true" />
<span className="text-foreground font-mono text-xs font-semibold tabular-nums text-right shrink-0">
{value}
</span>
</li>
);
}
function PreviewFeatureCard({
title,
description,
items,
footer,
}: {
title: string;
description?: string;
items?: string[];
footer?: { label: string; note: string };
}) {
return (
<div className="premium-glass-card p-5 md:p-6 w-full h-full transition-colors duration-300 shadow-sm dark:shadow-none clip-cyber-card corner-bracket relative group">
<div className="corner-bracket-inner" aria-hidden="true" />
<div className="space-y-2 relative z-10">
<h2 className="my-0 font-mono font-bold text-xs tracking-tight uppercase text-muted-foreground group-hover:text-primary transition-colors">
{title}
</h2>
{description && (
<p className="text-sm text-muted-foreground font-mono leading-relaxed mt-2">
{description}
</p>
)}
{items && items.length > 0 && (
<ul className="space-y-1.5 list-none pl-0 mt-3">
{items.map((item) => (
<li
key={item}
className="font-mono text-xs text-primary/80 uppercase tracking-tight flex items-center gap-2"
>
<span className="text-primary/50" aria-hidden="true">
▸
</span>
{item}
</li>
))}
</ul>
)}
{footer && (
<div className="mt-4 pt-3 border-t border-primary/10">
<p className="text-xs font-mono text-muted-foreground uppercase">{footer.label}</p>
<p className="text-[10px] font-mono text-primary/70 mt-1 uppercase tracking-widest">
{footer.note}
</p>
</div>
)}
</div>
</div>
);
}
export function DashboardPreviewMetrics() {
const { t } = useLanguage();
const metrics = [
{ label: t("dashboardMetricApiKeys"), value: t("dashboardMetricApiKeysValue") },
{ label: t("dashboardMetricModels"), value: t("dashboardMetricModelsValue") },
{ label: t("dashboardMetricRequests"), value: t("dashboardMetricRequestsValue") },
{ label: t("dashboardMetricBalance"), value: t("dashboardMetricBalanceValue") },
{ label: t("dashboardMetricTopModel"), value: t("dashboardMetricTopModelValue") },
{ label: t("dashboardMetricSpend"), value: t("dashboardMetricSpendValue") },
];
return (
<div className="space-y-3">
<div className="flex items-center justify-between gap-2">
<h2 className="my-0 font-mono font-medium text-sm tracking-tight uppercase text-muted-foreground">
{t("dashboardPreviewOnly")}
</h2>
</div>
<ul className="list-none pl-0 space-y-2">
{metrics.map((m) => (
<PreviewMetricRow key={m.label} label={m.label} value={m.value} />
))}
</ul>
</div>
);
}
export function PlannedProviderRegions() {
const { t } = useLanguage();
return (
<div className="space-y-2">
<h2 className="my-0 font-mono font-medium text-sm tracking-tight uppercase text-muted-foreground">
{t("dashboardPlannedRegions")}
</h2>
<ul className="list-none pl-0 space-y-1.5">
{topCountries.map((country) => (
<li
key={country.code}
className="flex items-center gap-x-2 font-mono text-sm text-foreground"
>
<span style={{ color: country.color }} className="text-sm" aria-hidden="true">
■
</span>
<span className="font-medium tracking-tight">{country.code}</span>
</li>
))}
</ul>
</div>
);
}
export function RegionCount() {
const { t } = useLanguage();
return (
<div className="flex items-center w-full md:w-fit justify-between md:justify-start mt-2">
<span aria-hidden="true" className="inline-block translate-y-[-2px] text-primary/60 text-[10px]">
▲
</span>
<span className="font-mono text-sm text-muted-foreground tracking-tight">
{t("dashboardRegionCountLabel")}
</span>
</div>
);
}
export function StatsGrid() {
const { t } = useLanguage();
const cards = [
{ title: t("dashboardCard1Title"), description: t("dashboardCard1Desc") },
{ title: t("dashboardCard2Title"), description: t("dashboardCard2Desc") },
{ title: t("dashboardCard3Title"), description: t("dashboardCard3Desc") },
{ title: t("dashboardCard4Title"), description: t("dashboardCard4Desc") },
{ title: t("dashboardCard5Title"), description: t("dashboardCard5Desc") },
{ title: t("dashboardCard6Title"), description: t("dashboardCard6Desc") },
{
title: t("dashboardCard7Title"),
items: [
t("dashboardCard7Item1"),
t("dashboardCard7Item2"),
t("dashboardCard7Item3"),
t("dashboardCard7Item4"),
t("dashboardCard7Item5"),
],
},
{
title: t("dashboardCard8Title"),
description: t("dashboardCard8Desc"),
footer: {
label: t("dashboardCard8Savings"),
note: t("dashboardCard8SavingsNote"),
},
},
];
return (
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-1.5">
{cards.map((card) => (
<PreviewFeatureCard
key={card.title}
title={card.title}
description={card.description}
items={card.items}
footer={card.footer}
/>
))}
</div>
);
}
|