"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 }, ], }, ]; const COLUMNS_ES = [ { title: "Explorar", links: [ { href: "/series", label: "Series ESP32" }, { href: "/comparacao", label: "Comparador" }, { href: "/catalogo", label: "Catálogo de placas" }, ], }, { title: "Herramientas", links: [ { href: "/seletor", label: "Selector inteligente" }, { href: "/diagnostico", label: "Diagnóstico" }, { href: "/componentes", label: "Component Registry" }, { href: "/frameworks", label: "Frameworks y SDKs" }, ], }, { title: "Proyecto", links: [ { href: "/sobre", label: "Acerca de ESPDocs" }, { href: "/glossario", label: "Glosario" }, { href: SITE.repositorio, label: "Repositorio", external: true }, { href: `${SITE.repositorio}/issues`, label: "Reportar un problema", external: true }, ], }, ]; const COLUMNS_FR = [ { title: "Explorer", links: [ { href: "/series", label: "Séries ESP32" }, { href: "/comparacao", label: "Comparateur" }, { href: "/catalogo", label: "Catalogue de cartes" }, ], }, { title: "Outils", links: [ { href: "/seletor", label: "Sélecteur intelligent" }, { href: "/diagnostico", label: "Diagnostic" }, { href: "/componentes", label: "Component Registry" }, { href: "/frameworks", label: "Frameworks et SDKs" }, ], }, { title: "Projet", links: [ { href: "/sobre", label: "À propos d'ESPDocs" }, { href: "/glossario", label: "Glossaire" }, { href: SITE.repositorio, label: "Dépôt", external: true }, { href: `${SITE.repositorio}/issues`, label: "Signaler un problème", external: true }, ], }, ]; const COLUMNS_DE = [ { title: "Erkunden", links: [ { href: "/series", label: "ESP32-Serien" }, { href: "/comparacao", label: "Vergleich" }, { href: "/catalogo", label: "Board-Katalog" }, ], }, { title: "Werkzeuge", links: [ { href: "/seletor", label: "Intelligente Auswahl" }, { href: "/diagnostico", label: "Diagnose" }, { href: "/componentes", label: "Component Registry" }, { href: "/frameworks", label: "Frameworks & SDKs" }, ], }, { title: "Projekt", links: [ { href: "/sobre", label: "Über ESPDocs" }, { href: "/glossario", label: "Glossar" }, { href: SITE.repositorio, label: "Repository", external: true }, { href: `${SITE.repositorio}/issues`, label: "Problem melden", 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 isEn = currentLocale === "en"; const isEs = currentLocale === "es"; const isFr = currentLocale === "fr"; const isDe = currentLocale === "de"; const getLinkHref = (href) => getLocalizedHref(`/${currentLocale}${href}`, currentLocale); const columns = isPt ? COLUMNS_PT.map((column) => ({ ...column, links: column.links.filter((link) => link.href !== "/livro" || isPt), })) : isEs ? COLUMNS_ES : isFr ? COLUMNS_FR : isDe ? COLUMNS_DE : COLUMNS_EN; return ( ); }