"use client"; import { useState } from "react"; import { useTranslation } from "@/i18n/navigation"; import Footer from "@/app/components/Footer"; const RATES = [ { from: "CNY", to: "USD", rate: 0.14 }, { from: "CNY", to: "EUR", rate: 0.13 }, { from: "CNY", to: "THB", rate: 5.2 }, { from: "USD", to: "CNY", rate: 7.2 }, ]; export default function ToolsPage() { const { t } = useTranslation("tools"); const [income, setIncome] = useState(100000); const [cnyAmount, setCnyAmount] = useState(10000); const [visaDate, setVisaDate] = useState("2025-06-15"); const taxEstimate = Math.round(income * 0.15); const cnyToUsd = (v: number) => (v * 0.14).toFixed(2); const daysLeft = Math.ceil( (new Date(visaDate).getTime() - Date.now()) / (1000 * 60 * 60 * 24) ); return (

{t("title")}

{t("subtitle")}

💱 {t("exchange")}

{RATES.map((r) => (

{r.from} → {r.to}

{r.rate}

))}
setCnyAmount(Number(e.target.value) || 0)} className="flex-1 rounded-lg border border-gray-200 dark:border-gray-700 px-3 py-2 text-sm bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100" /> ≈ ${cnyToUsd(cnyAmount)}

{t("disclaimer")}

📊 {t("tax")}

setIncome(Number(e.target.value))} className="w-full rounded-lg border border-gray-200 dark:border-gray-700 px-4 py-2 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100" />

{t("estimate")}: 约 ¥{taxEstimate.toLocaleString()}/年

{t("taxDisclaimer")}

🛂 {t("visa")}

setVisaDate(e.target.value)} className="w-full rounded-lg border border-gray-200 dark:border-gray-700 px-4 py-2 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100" />

{daysLeft > 0 ? `${daysLeft} ${t("daysLeft")}` : t("expired")}

🌱 {t("fireCalculator")}

{t("fireDesc")}

{t("comingSoon")}

🌤️ {t("climateFinder")}

{t("climateDesc")}

{t("comingSoon")}
); }