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,3 +1,4 @@
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import {
|
||||
createCategory,
|
||||
createValue,
|
||||
@@ -13,6 +14,8 @@ export const dynamic = "force-dynamic";
|
||||
const CURRENCY_TYPES = ["diamonds", "credits", "duckets", "points"];
|
||||
|
||||
export default async function AdminRareValues() {
|
||||
const t = await getTranslations("pages.admin.rareValues");
|
||||
|
||||
let categories: Awaited<ReturnType<typeof prisma.websiteRareValueCategories.findMany>> = [];
|
||||
try {
|
||||
categories = await prisma.websiteRareValueCategories.findMany({
|
||||
@@ -46,28 +49,28 @@ export default async function AdminRareValues() {
|
||||
<Gem size={20} className="text-[var(--color-primary)]" />
|
||||
</div>
|
||||
<div>
|
||||
<h1 className="m-0 text-xl font-extrabold text-[var(--color-text)]">Rare Values</h1>
|
||||
<p className="m-0 text-xs text-[var(--color-text-muted)] mt-0.5">Catalog of rare furni and their trade values, grouped by category. Each category is rendered as a tab on the public rare values page.</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="Categories" value={categories.length} icon="🗂️" />
|
||||
<StatusCard label="Rare items" value={values.length} icon="💎" />
|
||||
<StatusCard label={t("categories")} value={categories.length} icon="🗂️" />
|
||||
<StatusCard label={t("items")} value={values.length} icon="💎" />
|
||||
</div>
|
||||
|
||||
<form action={createCategory} className="admin-card mb-6">
|
||||
<h3 className="text-sm font-bold text-[var(--color-text)] m-0 mb-3">New category</h3>
|
||||
<h3 className="text-sm font-bold text-[var(--color-text)] m-0 mb-3">{t("addCategory")}</h3>
|
||||
<div className="flex gap-2 flex-wrap">
|
||||
<input name="name" placeholder="Category name" required className="flex-1 min-w-[160px]" />
|
||||
<input name="badge" placeholder="Badge code" required />
|
||||
<input name="priority" type="number" min={1} defaultValue={1} placeholder="Priority" className="w-[110px]" />
|
||||
<button type="submit" className="btn btn-primary">Add category</button>
|
||||
<input name="name" placeholder={t("categoryForm.namePlaceholder")} required className="flex-1 min-w-[160px]" />
|
||||
<input name="badge" placeholder={t("badgePlaceholder")} required />
|
||||
<input name="priority" type="number" min={1} defaultValue={1} placeholder={t("priorityPlaceholder")} className="w-[110px]" />
|
||||
<button type="submit" className="btn btn-primary">{t("addCategoryButton")}</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{categories.length === 0 ? (
|
||||
<div className="admin-empty">No categories yet. Add one above to start.</div>
|
||||
<div className="admin-empty">{t("noCategories")}</div>
|
||||
) : null}
|
||||
|
||||
<div className="grid">
|
||||
@@ -79,25 +82,25 @@ export default async function AdminRareValues() {
|
||||
<div className="flex gap-3 items-baseline justify-between flex-wrap">
|
||||
<div style={{ display: "flex", gap: "0.6rem", alignItems: "baseline", flexWrap: "wrap" }}>
|
||||
<strong>{cat.name}</strong>
|
||||
<span className="inline-block text-[0.72rem] font-bold px-2 py-0.5 rounded-full bg-[var(--color-primary)]/18 text-[var(--color-text)]">badge {cat.badge}</span>
|
||||
<span className="inline-block text-[0.72rem] font-bold px-2 py-0.5 rounded-full bg-[var(--color-primary)]/18 text-[var(--color-text)]">priority {cat.priority}</span>
|
||||
<span className="text-sm text-gray-500 dark:text-gray-400">{rows.length} item{rows.length === 1 ? "" : "s"}</span>
|
||||
<span className="inline-block text-[0.72rem] font-bold px-2 py-0.5 rounded-full bg-[var(--color-primary)]/18 text-[var(--color-text)]">{t("badgeLabel", { badge: cat.badge })}</span>
|
||||
<span className="inline-block text-[0.72rem] font-bold px-2 py-0.5 rounded-full bg-[var(--color-primary)]/18 text-[var(--color-text)]">{t("priorityLabel", { priority: cat.priority })}</span>
|
||||
<span className="text-sm text-gray-500 dark:text-gray-400">{t("itemCount", { count: rows.length })}</span>
|
||||
</div>
|
||||
<form action={deleteCategory}>
|
||||
<input type="hidden" name="id" value={catId} />
|
||||
<button type="submit" className="btn btn-danger">Delete category</button>
|
||||
<button type="submit" className="btn btn-danger">{t("deleteCategory")}</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<table style={{ marginTop: "0.75rem" }}>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Item ID</th>
|
||||
<th>Credit value</th>
|
||||
<th>Currency value</th>
|
||||
<th>Currency</th>
|
||||
<th>Icon</th>
|
||||
<th>{t("colItemName")}</th>
|
||||
<th>{t("colItemId")}</th>
|
||||
<th>{t("colCredits")}</th>
|
||||
<th>{t("colCurrencyValue")}</th>
|
||||
<th>{t("colCurrency")}</th>
|
||||
<th>{t("colIcon")}</th>
|
||||
<th />
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -124,24 +127,24 @@ export default async function AdminRareValues() {
|
||||
</table>
|
||||
{rows.length === 0 ? (
|
||||
<p className="text-xs text-gray-500 dark:text-gray-400" style={{ margin: "0.5rem 0 0" }}>
|
||||
No values in this category yet.
|
||||
{t("noValuesInCategory")}
|
||||
</p>
|
||||
) : null}
|
||||
|
||||
<form action={createValue} style={{ marginTop: "0.75rem" }}>
|
||||
<input type="hidden" name="categoryId" value={catId} />
|
||||
<div className="flex gap-2 flex-wrap">
|
||||
<input name="name" placeholder="Item name" required className="flex-1 min-w-[140px]" />
|
||||
<input name="itemId" type="number" min={1} placeholder="Item ID" className="w-[110px]" />
|
||||
<input name="furnitureIcon" placeholder="Furniture icon" required className="min-w-[140px]" />
|
||||
<input name="creditValue" placeholder="Credit value" className="w-[130px]" />
|
||||
<input name="currencyValue" placeholder="Currency value" className="w-[130px]" />
|
||||
<input name="name" placeholder={t("itemForm.itemNamePlaceholder")} required className="flex-1 min-w-[140px]" />
|
||||
<input name="itemId" type="number" min={1} placeholder={t("itemForm.itemIdPlaceholder")} className="w-[110px]" />
|
||||
<input name="furnitureIcon" placeholder={t("itemForm.iconPlaceholder")} required className="min-w-[140px]" />
|
||||
<input name="creditValue" placeholder={t("itemForm.creditsPlaceholder")} className="w-[130px]" />
|
||||
<input name="currencyValue" placeholder={t("itemForm.currencyValuePlaceholder")} className="w-[130px]" />
|
||||
<select name="currencyType" defaultValue="diamonds">
|
||||
{CURRENCY_TYPES.map((c) => (
|
||||
<option key={c} value={c}>{c}</option>
|
||||
))}
|
||||
</select>
|
||||
<button type="submit" className="btn btn-primary">Add value</button>
|
||||
<button type="submit" className="btn btn-primary">{t("itemForm.addValue")}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user