Translate admin panel to all 6 languages

This commit is contained in:
openhands committed 2026-07-04 21:21:15 +02:00
1 parent f381aa987f
commit befa4ec282
63 files changed
+9353 -1443

No files matched your search

+24 -22
View File
@@ -7,6 +7,7 @@ import {
} from "@/actions/admin-ip";
import { StatusCard } from "@/components/admin/dashboard";
import { prisma } from "@/lib/prisma";
import { getTranslations } from "next-intl/server";
export const dynamic = "force-dynamic";
@@ -22,6 +23,7 @@ function formatDate(d: Date | null): string {
}
export default async function AdminIp() {
const t = await getTranslations("pages.admin.ip");
let whitelist: IpRow[] = [];
let blacklist: IpRow[] = [];
@@ -50,20 +52,20 @@ export default async function AdminIp() {
<Shield size={20} className="text-[var(--color-primary)]" />
</div>
<div>
<h1 className="m-0 text-xl font-extrabold text-[var(--color-text)]">IP Management</h1>
<p className="m-0 text-xs text-[var(--color-text-muted)] mt-0.5">Allow or block IP addresses (and ASNs) at the website edge.</p>
<h1 className="m-0 text-xl font-extrabold text-[var(--color-text)]">{t("title")}</h1>
<p className="m-0 text-xs text-[var(--color-text-muted)] mt-0.5">{t("subtitle")}</p>
</div>
</div>
<div className="grid grid-cols-[repeat(auto-fit,minmax(180px,1fr))] gap-3.5 mb-6">
<StatusCard
label="Whitelisted"
label={t("whitelisted")}
value={whitelist.length}
state={whitelist.length > 0 ? "ok" : "neutral"}
icon="✅"
/>
<StatusCard
label="Blacklisted"
label={t("blacklisted")}
value={blacklist.length}
state={blacklist.length > 0 ? "danger" : "neutral"}
icon="🚫"
@@ -73,33 +75,33 @@ export default async function AdminIp() {
<div className="grid cols-2">
{/* ── Whitelist ──────────────────── */}
<section className="mt-6">
<h2 className="admin-section-title">Whitelist</h2>
<h2 className="admin-section-title">{t("whitelist")}</h2>
<form action={addWhitelist} className="admin-card mb-4">
<div className="flex gap-2 flex-wrap">
<input
name="ipAddress"
placeholder="IP address"
placeholder={t("ipAddressPlaceholder")}
required
className="flex-1 min-w-[140px]"
/>
<input name="asn" placeholder="ASN (optional)" className="w-[140px]" />
<input name="asn" placeholder={t("asnPlaceholder")} className="w-[140px]" />
<button type="submit" className="btn btn-secondary">
Add
{t("add")}
</button>
</div>
</form>
{whitelist.length === 0 ? (
<div className="admin-empty">No whitelisted IPs.</div>
<div className="admin-empty">{t("noWhitelistedIps")}</div>
) : (
<div className="overflow-x-auto">
<table>
<thead>
<tr>
<th>IP</th>
<th>ASN</th>
<th>Added</th>
<th>{t("colIp")}</th>
<th>{t("colAsn")}</th>
<th>{t("colAdded")}</th>
<th />
</tr>
</thead>
@@ -113,7 +115,7 @@ export default async function AdminIp() {
<form action={deleteWhitelist}>
<input type="hidden" name="id" value={String(w.id)} />
<button type="submit" className="btn btn-danger">
Remove
{t("remove")}
</button>
</form>
</td>
@@ -127,33 +129,33 @@ export default async function AdminIp() {
{/* ── Blacklist ──────────────────── */}
<section className="mt-6">
<h2 className="admin-section-title">Blacklist</h2>
<h2 className="admin-section-title">{t("blacklist")}</h2>
<form action={addBlacklist} className="admin-card mb-4">
<div className="flex gap-2 flex-wrap">
<input
name="ipAddress"
placeholder="IP address"
placeholder={t("ipAddressPlaceholder")}
required
className="flex-1 min-w-[140px]"
/>
<input name="asn" placeholder="ASN (optional)" className="w-[140px]" />
<input name="asn" placeholder={t("asnPlaceholder")} className="w-[140px]" />
<button type="submit" className="btn btn-danger">
Add
{t("add")}
</button>
</div>
</form>
{blacklist.length === 0 ? (
<div className="admin-empty">No blacklisted IPs.</div>
<div className="admin-empty">{t("noBlacklistedIps")}</div>
) : (
<div className="overflow-x-auto">
<table>
<thead>
<tr>
<th>IP</th>
<th>ASN</th>
<th>Added</th>
<th>{t("colIp")}</th>
<th>{t("colAsn")}</th>
<th>{t("colAdded")}</th>
<th />
</tr>
</thead>
@@ -167,7 +169,7 @@ export default async function AdminIp() {
<form action={deleteBlacklist}>
<input type="hidden" name="id" value={String(b.id)} />
<button type="submit" className="btn btn-danger">
Remove
{t("remove")}
</button>
</form>
</td>