"use client"; import { useTranslation } from "@/i18n/navigation"; import type { ToolsCategory } from "@/app/lib/theme-data"; type ToolsProps = { data: { categories: ToolsCategory[] }; }; function truncateDesc(desc: string, maxLen = 5) { if (!desc || desc.length <= maxLen) return desc; return desc.slice(0, maxLen) + "..."; } export default function Tools({ data }: ToolsProps) { const categories = data.categories; const { t } = useTranslation("tools"); const total = categories.reduce((s, c) => s + c.tools.length, 0); const toolStats = [ { value: `${total}+`, key: "tools" as const }, { value: String(categories.length), key: "categories" as const }, { value: "数字游民", key: "nomad" as const }, { value: "佣金", key: "affiliate" as const }, ]; return (
{t("badge")}

{t("title")}

{t("subtitle")}

{categories.map((cat) => (
{cat.icon}

{cat.title}

{cat.tools.length}
))}
{toolStats.map((s) => (
{s.value}
{t(`stats.${s.key}`)}
))}
); }