"use client";
import { Card } from "@/components/ui/card";
import { useT } from "@/lib/i18n";
function Bars({ rows, total }: { rows: [string, number][]; total: number }) {
return
{rows.slice(0, 8).map(([label, value]) =>
)}
;
}
export function TrendsClient({ ads, active, longRunners, newAds, niches, media, countries, stores, history }: {
ads: any[];
active: any[];
longRunners: any[];
newAds: any[];
niches: [string, number][];
media: [string, number][];
countries: [string, number][];
stores: any[];
history: any[];
}) {
const t = useT();
return (
{t("trends.title")}
{t("trends.description")}
{t("trends.totalAds")}
{ads.length}
{t("trends.activeAds")}
{active.length}
{t("trends.longRunners")}
{longRunners.length}
{t("trends.newAds")}
{newAds.length}
{t("trends.nicheDistribution")}
{t("trends.mediaFormat")}
{t("trends.countrySignal")}
sum + ad.countries.length, 0)} />
{t("trends.fastGrowingStores")}
{t("trends.byMonthlyGrowth")}
{stores.slice(0, 8).map((store) => (
{store.name}
{store.niche || t("trends.noNiche")} · {store.country || "—"}
+{store.monthlyVisitGrowth || 0}%
))}
{t("trends.historyTitle")}
{t("trends.historyDescription")}
{history.map((snapshot) => {
const metrics = snapshot.metrics as any;
return (
{snapshot.date.toLocaleDateString("tr-TR")}
{metrics.ads?.active || 0} {t("trends.activeAds")}
{metrics.tiktok?.total || 0} {t("trends.tiktokProducts")}
);
})}
{!history.length &&
{t("trends.noSnapshotYet")}
}
);
}