Reapply "Add missing admin action files and navigation links"
This reverts commit 4d515bc400.
This commit is contained in:
1 parent
96ed768f14
commit
5b4228261a
338 files changed
+28143
-5948
No files matched your search
@@ -1,10 +1,5 @@
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import {
|
||||
createCategory,
|
||||
createValue,
|
||||
deleteCategory,
|
||||
deleteValue,
|
||||
} from "@/actions/admin-rare-values";
|
||||
import { createCategory, createValue, deleteCategory, deleteValue } from "@/actions/admin-rare-values";
|
||||
import { StatusCard } from "@/components/admin/dashboard";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { Gem } from "lucide-react";
|
||||
@@ -62,16 +57,28 @@ export default async function AdminRareValues() {
|
||||
<form action={createCategory} className="admin-card mb-6">
|
||||
<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={t("categoryForm.namePlaceholder")} required className="flex-1 min-w-[160px]" />
|
||||
<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>
|
||||
<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">{t("noCategories")}</div>
|
||||
) : null}
|
||||
{categories.length === 0 ? <div className="admin-empty">{t("noCategories")}</div> : null}
|
||||
|
||||
<div className="grid">
|
||||
{categories.map((cat) => {
|
||||
@@ -82,13 +89,21 @@ 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)]">{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>
|
||||
<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">{t("deleteCategory")}</button>
|
||||
<button type="submit" className="btn btn-danger">
|
||||
{t("deleteCategory")}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -108,17 +123,25 @@ export default async function AdminRareValues() {
|
||||
{rows.map((v) => (
|
||||
<tr key={String(v.id)}>
|
||||
<td>{v.name}</td>
|
||||
<td className="text-sm text-gray-500 dark:text-gray-400 whitespace-nowrap">{v.itemId ?? "—"}</td>
|
||||
<td className="text-sm text-gray-500 dark:text-gray-400 whitespace-nowrap">
|
||||
{v.itemId ?? "—"}
|
||||
</td>
|
||||
<td>{v.creditValue ?? "—"}</td>
|
||||
<td>{v.currencyValue ?? "—"}</td>
|
||||
<td>
|
||||
<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)]">{v.currencyType}</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)]">
|
||||
{v.currencyType}
|
||||
</span>
|
||||
</td>
|
||||
<td className="text-sm text-gray-500 dark:text-gray-400 whitespace-nowrap">
|
||||
{v.furnitureIcon}
|
||||
</td>
|
||||
<td className="text-sm text-gray-500 dark:text-gray-400 whitespace-nowrap">{v.furnitureIcon}</td>
|
||||
<td>
|
||||
<form action={deleteValue}>
|
||||
<input type="hidden" name="id" value={String(v.id)} />
|
||||
<button type="submit" className="btn btn-danger">✕</button>
|
||||
<button type="submit" className="btn btn-danger">
|
||||
✕
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -134,17 +157,45 @@ export default async function AdminRareValues() {
|
||||
<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={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]" />
|
||||
<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>
|
||||
<option key={c} value={c}>
|
||||
{c}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<button type="submit" className="btn btn-primary">{t("itemForm.addValue")}</button>
|
||||
<button type="submit" className="btn btn-primary">
|
||||
{t("itemForm.addValue")}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user