"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import Logo from "@/components/Logo"; import GiteaMark from "@/components/GiteaMark"; import { ArrowUpRight } from "lucide-react"; import { SITE } from "@/lib/seo"; import { LOCALES, getLocalizedHref } from "@/i18n/links"; const COLUMNS_PT = [ { title: "Explorar", links: [ { href: "/series", label: "Séries ESP32" }, { href: "/comparacao", label: "Comparador" }, { href: "/catalogo", label: "Catálogo de placas" }, { href: "/livro", label: "O livro" }, ], }, { title: "Ferramentas", links: [ { href: "/seletor", label: "Seletor inteligente" }, { href: "/diagnostico", label: "Diagnóstico" }, { href: "/componentes", label: "Component Registry" }, { href: "/frameworks", label: "Frameworks e SDKs" }, ], }, { title: "Projeto", links: [ { href: "/sobre", label: "Sobre o ESPDocs" }, { href: "/glossario", label: "Glossário" }, { href: SITE.repositorio, label: "Repositório", external: true }, { href: `${SITE.repositorio}/issues`, label: "Reportar um problema", external: true }, ], }, ]; const COLUMNS_EN = [ { title: "Explore", links: [ { href: "/series", label: "ESP32 Series" }, { href: "/comparacao", label: "Comparator" }, { href: "/catalogo", label: "Board Catalog" }, ], }, { title: "Tools", links: [ { href: "/seletor", label: "Smart Selector" }, { href: "/diagnostico", label: "Diagnostics" }, { href: "/componentes", label: "Component Registry" }, { href: "/frameworks", label: "Frameworks & SDKs" }, ], }, { title: "Project", links: [ { href: "/sobre", label: "About ESPDocs" }, { href: "/glossario", label: "Glossary" }, { href: SITE.repositorio, label: "Repository", external: true }, { href: `${SITE.repositorio}/issues`, label: "Report an issue", external: true }, ], }, ]; export default function Footer() { const pathname = usePathname() || ""; const year = new Date().getFullYear(); const currentLocale = LOCALES.find((l) => pathname === `/${l.code}` || pathname.startsWith(`/${l.code}/`))?.code || "pt"; const isPt = currentLocale === "pt"; const getLinkHref = (href) => getLocalizedHref(`/${currentLocale}${href}`, currentLocale); const columns = isPt ? COLUMNS_PT.map((column) => ({ ...column, links: column.links.filter((link) => link.href !== "/livro" || isPt), })) : COLUMNS_EN; return ( ); }