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
+4
-18
@@ -49,11 +49,7 @@ const ARTICLE_SELECT = {
|
||||
position: true,
|
||||
} as const;
|
||||
|
||||
export default async function ShopPage({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ category?: string }>;
|
||||
}) {
|
||||
export default async function ShopPage({ searchParams }: { searchParams: Promise<{ category?: string }> }) {
|
||||
const t = await getTranslations("pages.shop");
|
||||
const sp = await searchParams;
|
||||
const rawCategory = (sp.category ?? "").trim();
|
||||
@@ -104,20 +100,14 @@ export default async function ShopPage({
|
||||
articles = [];
|
||||
}
|
||||
|
||||
const activeCategory = categoryId
|
||||
? categories.find((c) => String(c.id) === categoryId)
|
||||
: undefined;
|
||||
const activeCategory = categoryId ? categories.find((c) => String(c.id) === categoryId) : undefined;
|
||||
|
||||
return (
|
||||
<main style={{ display: "grid", gap: "1.5rem" }}>
|
||||
<ContentCard
|
||||
icon="🛒"
|
||||
title={t("title")}
|
||||
subtitle={
|
||||
activeCategory
|
||||
? t("browsingCategory", { category: activeCategory.name })
|
||||
: t("subtitle")
|
||||
}
|
||||
subtitle={activeCategory ? t("browsingCategory", { category: activeCategory.name }) : t("subtitle")}
|
||||
>
|
||||
{categories.length > 0 ? (
|
||||
<div
|
||||
@@ -146,11 +136,7 @@ export default async function ShopPage({
|
||||
<ContentCard
|
||||
icon="📦"
|
||||
title={activeCategory ? activeCategory.name : t("allPackages")}
|
||||
subtitle={
|
||||
articles.length > 0
|
||||
? t("packagesAvailable", { count: articles.length })
|
||||
: undefined
|
||||
}
|
||||
subtitle={articles.length > 0 ? t("packagesAvailable", { count: articles.length }) : undefined}
|
||||
padded={articles.length === 0}
|
||||
>
|
||||
{articles.length === 0 ? (
|
||||
|
||||
@@ -71,9 +71,7 @@ export default function TopUpForm({
|
||||
error?: string;
|
||||
};
|
||||
if (res.ok && data.ok) {
|
||||
setSuccess(
|
||||
`Payment complete! ${(data.credits ?? 0).toLocaleString()} credits were added.`,
|
||||
);
|
||||
setSuccess(`Payment complete! ${(data.credits ?? 0).toLocaleString()} credits were added.`);
|
||||
} else {
|
||||
setError(data.error ?? "We couldn't confirm your payment. Contact staff if charged.");
|
||||
}
|
||||
@@ -109,10 +107,7 @@ export default function TopUpForm({
|
||||
}
|
||||
|
||||
return (
|
||||
<form
|
||||
onSubmit={startCheckout}
|
||||
style={{ display: "flex", flexDirection: "column", gap: "0.75rem" }}
|
||||
>
|
||||
<form onSubmit={startCheckout} style={{ display: "flex", flexDirection: "column", gap: "0.75rem" }}>
|
||||
<label htmlFor="amount" style={{ fontWeight: 700 }}>
|
||||
Amount ({currency})
|
||||
</label>
|
||||
@@ -148,8 +143,7 @@ export default function TopUpForm({
|
||||
</div>
|
||||
|
||||
<p className="muted" style={{ margin: 0 }}>
|
||||
You'll receive{" "}
|
||||
<strong>{credits.toLocaleString()}</strong> credits.
|
||||
You'll receive <strong>{credits.toLocaleString()}</strong> credits.
|
||||
</p>
|
||||
|
||||
<div>
|
||||
|
||||
@@ -8,11 +8,7 @@ import { creditsPerUnit, isPayPalConfigured, PAYPAL_CURRENCY } from "@/lib/servi
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function TopUpPage({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ status?: string }>;
|
||||
}) {
|
||||
export default async function TopUpPage({ searchParams }: { searchParams: Promise<{ status?: string }> }) {
|
||||
const session = await auth();
|
||||
if (!session?.user?.id) redirect("/login");
|
||||
|
||||
@@ -37,11 +33,7 @@ export default async function TopUpPage({
|
||||
|
||||
return (
|
||||
<main style={{ display: "grid", gap: "1.5rem" }}>
|
||||
<ContentCard
|
||||
icon="💳"
|
||||
title={t("title")}
|
||||
subtitle={t("subtitle")}
|
||||
/>
|
||||
<ContentCard icon="💳" title={t("title")} subtitle={t("subtitle")} />
|
||||
|
||||
{sp.status === "cancel" ? (
|
||||
<div className="card" style={{ borderColor: "var(--color-danger)" }}>
|
||||
@@ -55,9 +47,8 @@ export default async function TopUpPage({
|
||||
<TopUpForm currency={PAYPAL_CURRENCY} creditsPerUnit={rate} />
|
||||
) : (
|
||||
<p className="muted" style={{ margin: 0 }}>
|
||||
{t("notConfiguredPre")} <code>PAYPAL_CLIENT_ID</code>{" "}
|
||||
{t("notConfiguredAnd")} <code>PAYPAL_SECRET</code>{" "}
|
||||
{t("notConfiguredOptional")} <code>PAYPAL_API</code>{" "}
|
||||
{t("notConfiguredPre")} <code>PAYPAL_CLIENT_ID</code> {t("notConfiguredAnd")}{" "}
|
||||
<code>PAYPAL_SECRET</code> {t("notConfiguredOptional")} <code>PAYPAL_API</code>{" "}
|
||||
{t("notConfiguredPost")}
|
||||
</p>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user