From dd46bcddc7c4fe8f7fb00e13263aec9a991a19cf Mon Sep 17 00:00:00 2001 From: denshooter Date: Thu, 16 Apr 2026 14:39:17 +0200 Subject: [PATCH] fix: i18n for project section strings, unique SVG pattern IDs, remove hardcoded text - Projects.tsx: use t() for title, subtitle, viewAll, noProjects - ProjectsPageClient.tsx: use tList('title') instead of hardcoded 'Archive' - ProjectThumbnail.tsx: useId() for unique SVG pattern IDs to avoid collisions - Remove unused sizeClasses variable - en.json: update project subtitle and add noProjects key - de.json: update German translations for project section --- app/_ui/ProjectsPageClient.tsx | 2 +- app/components/ProjectThumbnail.tsx | 47 +++++++++++++---------------- app/components/Projects.tsx | 14 ++++----- messages/de.json | 7 +++-- messages/en.json | 7 +++-- 5 files changed, 37 insertions(+), 40 deletions(-) diff --git a/app/_ui/ProjectsPageClient.tsx b/app/_ui/ProjectsPageClient.tsx index 319b308..7643578 100644 --- a/app/_ui/ProjectsPageClient.tsx +++ b/app/_ui/ProjectsPageClient.tsx @@ -75,7 +75,7 @@ export default function ProjectsPageClient({

- Archive. + {tList("title")}.

{tList("intro")} diff --git a/app/components/ProjectThumbnail.tsx b/app/components/ProjectThumbnail.tsx index d81f92c..44eec1f 100644 --- a/app/components/ProjectThumbnail.tsx +++ b/app/components/ProjectThumbnail.tsx @@ -1,6 +1,6 @@ "use client"; -import { useMemo } from "react"; +import { useMemo, useId } from "react"; import { Terminal, Smartphone, @@ -103,42 +103,42 @@ const slugIcons: Record = { "task-management-dashboard": LayoutDashboard, }; -function PatternOverlay({ pattern }: { pattern: string }) { - const patternMap: Record = { +function PatternOverlay({ pattern, id }: { pattern: string; id: string }) { + const patterns: Record = { dots: ( - + - + ), grid: ( - + - + ), diagonal: ( - + - + ), circuit: ( - + @@ -147,36 +147,36 @@ function PatternOverlay({ pattern }: { pattern: string }) { - + ), waves: ( - + - + ), terminal: ( - + $_ - + 404 - + ERR - + ), }; - return patternMap[pattern] || patternMap.dots; + return patterns[pattern] || patterns.dots; } export default function ProjectThumbnail({ @@ -186,6 +186,7 @@ export default function ProjectThumbnail({ slug, size = "card", }: ProjectThumbnailProps) { + const uniqueId = useId(); const theme = useMemo(() => { if (slug && slugIcons[slug]) { const matchedTheme = categoryThemes[category || ""] || categoryThemes.default; @@ -195,20 +196,14 @@ export default function ProjectThumbnail({ }, [category, slug]); const Icon = theme.icon; - const isHero = size === "hero"; - const displayTags = tags?.slice(0, 3) ?? []; - const sizeClasses = isHero - ? "" - : ""; - return (

- +
{ const [projects, setProjects] = useState([]); const [loading, setLoading] = useState(true); const locale = useLocale(); - useTranslations("home.projects"); + const t = useTranslations("home.projects"); useEffect(() => { const loadProjects = async () => { @@ -53,22 +53,22 @@ const Projects = () => {

- Selected Work. + {t("title")}.

- Projects that pushed my boundaries. + {t("subtitle")}

- - View Archive - + + {t("viewAll")} +
{projects.length === 0 && !loading ? (
- No projects yet. + {t("noProjects")}
) : ( projects.map((project) => ( diff --git a/messages/de.json b/messages/de.json index 804867c..d3e56b9 100644 --- a/messages/de.json +++ b/messages/de.json @@ -86,10 +86,11 @@ } }, "projects": { - "title": "Ausgewählte Projekte", - "subtitle": "Eine Auswahl an Projekten, an denen ich gearbeitet habe – von Web-Apps bis zu Experimenten.", + "title": "Ausgewählte Arbeiten", + "subtitle": "Projekte, die meine Grenzen erweitert haben.", "featured": "Featured", - "viewAll": "Alle Projekte ansehen" + "viewAll": "Archiv ansehen", + "noProjects": "Noch keine Projekte." }, "contact": { "title": "Kontakt", diff --git a/messages/en.json b/messages/en.json index 189c247..b8cff94 100644 --- a/messages/en.json +++ b/messages/en.json @@ -87,10 +87,11 @@ } }, "projects": { - "title": "Selected Works", - "subtitle": "A collection of projects I've worked on, ranging from web applications to experiments.", + "title": "Selected Work", + "subtitle": "Projects that pushed my boundaries.", "featured": "Featured", - "viewAll": "View All Projects" + "viewAll": "View Archive", + "noProjects": "No projects yet." }, "contact": { "title": "Contact Me",