Privates Portfolio von eldov (Jan Wagner). Next.js 16 / React 19 / Tailwind 4 /
SQLite. Eigenes Dark-/Terminal-Theme (Magenta+Grün-Akzente, ASCII-Boxen).
Public Routes (DE default, /en für Englisch):
- /, /ueber-mich, /projekte, /projekte/[slug], /kontakt, /impressum, /datenschutz
- Sitemap, robots, OG, JSON-LD
Admin (HMAC-Single-User, HttpOnly-Cookie):
- /admin/login, /admin/dashboard, /admin/profile, /admin/projects (CRUD)
- API: /api/admin/{login,logout,session,profile,projects,projects/[slug]}
Initial-Seed: Hermes, Casino-Bot, Polymarket-Trader, QuantMuse, Crypto-/Trade-Bot,
TS6-Bot, Freewarez-Landingpage, Minecraft-Portal, OSS-Themes, AI-Subscription-Manager,
LAMP-Link-Themes, Android. KEIN Batchmaker/W-Make (das gehört zu w-make.com).
Stack:
- better-sqlite3 mit Schema-Migration + idempotentem Seed
- HMAC-signiertes Session-Cookie mit timingSafeEqual
- Rate-Limit für /api/admin/login
- Docker + deploy-vps.sh analog w-make-com → free-warez.top
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
"use client";
|
|
import Link from "next/link";
|
|
import type { Locale } from "@/i18n/routes";
|
|
import { switchLocale } from "@/i18n/routes";
|
|
|
|
export function LanguageSwitcher({
|
|
currentLocale,
|
|
className = "",
|
|
}: {
|
|
currentLocale: Locale;
|
|
className?: string;
|
|
}) {
|
|
// Die aktuelle Path wird über die Server-Komponente nicht direkt übergeben;
|
|
// stattdessen rendern wir einen Link, der die aktuelle URL auf die andere
|
|
// Locale umschreibt. Da der Switcher in jeder Page gesetzt wird, geben wir
|
|
// ein kleines Client-Skript mit, das die URL window.location.pathname
|
|
// zur Laufzeit austauscht.
|
|
const target: Locale = currentLocale === "de" ? "en" : "de";
|
|
return (
|
|
<Link
|
|
href="#"
|
|
data-locale-target={target}
|
|
data-locale-from={currentLocale}
|
|
aria-label={`Switch language to ${target}`}
|
|
className={`font-mono text-xs uppercase text-muted hover:text-accent ${className}`}
|
|
onClick={(e) => {
|
|
// Fallback, falls JS aus ist: statischer Link auf die andere Locale der Homepage.
|
|
e.preventDefault();
|
|
if (typeof window === "undefined") return;
|
|
const path = window.location.pathname;
|
|
const next = switchLocale(path, target) ?? (target === "en" ? "/en" : "/");
|
|
window.location.href = next;
|
|
}}
|
|
>
|
|
[{target}]
|
|
</Link>
|
|
);
|
|
}
|