Translate admin panel to all 6 languages
This commit is contained in:
1 parent
f381aa987f
commit
befa4ec282
63 files changed
+9353
-1443
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import Link from "next/link";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { notFound } from "next/navigation";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
|
||||
@@ -35,6 +36,8 @@ export default async function AdminCatalogPage({
|
||||
}: {
|
||||
params: Promise<{ id: string }>;
|
||||
}) {
|
||||
const t = await getTranslations("pages.admin.catalog");
|
||||
|
||||
const { id } = await params;
|
||||
const pageId = Number(id);
|
||||
if (!Number.isInteger(pageId)) notFound();
|
||||
@@ -89,32 +92,32 @@ export default async function AdminCatalogPage({
|
||||
return (
|
||||
<main>
|
||||
<p className="muted">
|
||||
<Link href="/admin/catalog">← Catalog</Link>
|
||||
<Link href="/admin/catalog">← {t("title")}</Link>
|
||||
</p>
|
||||
<h1>{page.caption}</h1>
|
||||
<p className="muted">
|
||||
Page #{page.id} · layout {page.pageLayout} · min rank {page.minRank} ·{" "}
|
||||
{hidden ? "Hidden" : "Visible"}
|
||||
{page.parentId > 0 ? ` · parent #${page.parentId}` : ""}
|
||||
{page.clubOnly === "1" ? " · HC only" : ""}
|
||||
{page.vipOnly === "1" ? " · VIP only" : ""}
|
||||
{t("pageLabel", { id: page.id })} · {t("layoutLabel", { layout: page.pageLayout })} · {t("minRankLabel", { rank: page.minRank })} ·{" "}
|
||||
{hidden ? t("statusHidden") : t("statusVisible")}
|
||||
{page.parentId > 0 ? ` · ${t("parentLabel", { id: page.parentId })}` : ""}
|
||||
{page.clubOnly === "1" ? ` · ${t("hcOnly")}` : ""}
|
||||
{page.vipOnly === "1" ? ` · ${t("vipOnly")}` : ""}
|
||||
</p>
|
||||
|
||||
<h2 style={{ marginTop: "1.5rem" }}>Items</h2>
|
||||
<h2 style={{ marginTop: "1.5rem" }}>{t("items")}</h2>
|
||||
{items.length === 0 ? (
|
||||
<p className="muted">No items on this page.</p>
|
||||
<p className="muted">{t("noItems")}</p>
|
||||
) : (
|
||||
<table style={{ width: "100%", borderCollapse: "collapse" }}>
|
||||
<thead>
|
||||
<tr style={{ textAlign: "left", color: "var(--muted)" }}>
|
||||
<th>ID</th>
|
||||
<th>Catalog name</th>
|
||||
<th>Item IDs</th>
|
||||
<th>Amount</th>
|
||||
<th>Credits</th>
|
||||
<th>Points</th>
|
||||
<th>Limited</th>
|
||||
<th>Order</th>
|
||||
<th>{t("colId")}</th>
|
||||
<th>{t("catalogName")}</th>
|
||||
<th>{t("itemIds")}</th>
|
||||
<th>{t("amount")}</th>
|
||||
<th>{t("colCostCredits")}</th>
|
||||
<th>{t("colCostPoints")}</th>
|
||||
<th>{t("colLimited")}</th>
|
||||
<th>{t("colOrder")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -124,7 +127,7 @@ export default async function AdminCatalogPage({
|
||||
<td>
|
||||
{it.catalogName}
|
||||
{it.clubOnly === "1" ? (
|
||||
<span className="muted"> · HC</span>
|
||||
<span className="muted"> · {t("hc")}</span>
|
||||
) : null}
|
||||
</td>
|
||||
<td className="muted">{it.itemIds}</td>
|
||||
@@ -138,7 +141,7 @@ export default async function AdminCatalogPage({
|
||||
</td>
|
||||
<td className="muted">
|
||||
{it.costPoints > 0
|
||||
? `${it.costPoints} (type ${it.pointsType})`
|
||||
? `${it.costPoints} (${t("typeLabel", { type: it.pointsType })})`
|
||||
: "—"}
|
||||
</td>
|
||||
<td className="muted">
|
||||
@@ -154,7 +157,7 @@ export default async function AdminCatalogPage({
|
||||
)}
|
||||
|
||||
<p className="muted" style={{ marginTop: "1rem" }}>
|
||||
{items.length} item{items.length === 1 ? "" : "s"}
|
||||
{t("itemCount", { count: items.length })}
|
||||
</p>
|
||||
</main>
|
||||
);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Link from "next/link";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { StatusCard } from "@/components/admin/dashboard";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { Package } from "lucide-react";
|
||||
@@ -17,6 +18,8 @@ type CatalogPageRow = {
|
||||
};
|
||||
|
||||
export default async function AdminCatalog() {
|
||||
const t = await getTranslations("pages.admin.catalog");
|
||||
|
||||
let pages: CatalogPageRow[] = [];
|
||||
try {
|
||||
pages = await prisma.catalogPages.findMany({
|
||||
@@ -37,7 +40,6 @@ export default async function AdminCatalog() {
|
||||
pages = [];
|
||||
}
|
||||
|
||||
// Build a quick caption lookup so we can show parent names instead of raw ids.
|
||||
const captionById = new Map<number, string>();
|
||||
for (const p of pages) captionById.set(p.id, p.caption);
|
||||
|
||||
@@ -54,39 +56,39 @@ export default async function AdminCatalog() {
|
||||
<Package size={20} className="text-[var(--color-primary)]" />
|
||||
</div>
|
||||
<div>
|
||||
<h1 className="m-0 text-xl font-extrabold text-[var(--color-text)]">Catalog</h1>
|
||||
<p className="m-0 text-xs text-[var(--color-text-muted)] mt-0.5">Browse catalog pages and the items they contain. Read-only.</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="Pages" value={pages.length} icon="📚" />
|
||||
<StatusCard label="Visible" value={visibleCount} state="ok" icon="👁️" />
|
||||
<StatusCard label={t("pages")} value={pages.length} icon="📚" />
|
||||
<StatusCard label={t("visible")} value={visibleCount} state="ok" icon="👁️" />
|
||||
<StatusCard
|
||||
label="Hidden"
|
||||
label={t("hidden")}
|
||||
value={hiddenCount}
|
||||
state={hiddenCount > 0 ? "warn" : "neutral"}
|
||||
icon="🚫"
|
||||
/>
|
||||
<StatusCard label="Root pages" value={rootCount} icon="🗂️" />
|
||||
<StatusCard label={t("rootPages")} value={rootCount} icon="🗂️" />
|
||||
</div>
|
||||
|
||||
<section className="mt-6">
|
||||
<h2>Pages ({pages.length})</h2>
|
||||
<h2>{t("pages")} ({pages.length})</h2>
|
||||
{pages.length === 0 ? (
|
||||
<p className="muted">No catalog pages found.</p>
|
||||
<p className="muted">{t("noPages")}</p>
|
||||
) : (
|
||||
<div style={{ overflowX: "auto" }}>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Caption</th>
|
||||
<th>Parent</th>
|
||||
<th>Layout</th>
|
||||
<th>Min rank</th>
|
||||
<th>Order</th>
|
||||
<th>Status</th>
|
||||
<th>{t("colId")}</th>
|
||||
<th>{t("caption")}</th>
|
||||
<th>{t("colParent")}</th>
|
||||
<th>{t("colLayout")}</th>
|
||||
<th>{t("colMinRank")}</th>
|
||||
<th>{t("colOrder")}</th>
|
||||
<th>{t("colStatus")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -112,7 +114,7 @@ export default async function AdminCatalog() {
|
||||
<td>{p.orderNum}</td>
|
||||
<td>
|
||||
<span className={`inline-block text-[0.72rem] font-bold px-2 py-0.5 rounded-full ${hidden ? "bg-red-500/22 text-[var(--color-text)]" : "bg-green-600/20 text-[var(--color-text)]"}`}>
|
||||
{hidden ? "Hidden" : "Visible"}
|
||||
{hidden ? t("statusHidden") : t("statusVisible")}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in new issue
Block a user