Revert "Add missing admin action files and navigation links"
This reverts commit 41be6835bf.
This commit is contained in:
1 parent
4a1e1115b3
commit
4d515bc400
338 files changed
+5949
-28144
No files matched your search
@@ -12,7 +12,11 @@ import { toggleReaction } from "@/actions/article-reactions";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> {
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ slug: string }>;
|
||||
}): Promise<Metadata> {
|
||||
const appUrl = process.env.APP_URL ?? "http://localhost:3000";
|
||||
const { slug } = await params;
|
||||
const article = await prisma.websiteArticles
|
||||
@@ -45,25 +49,18 @@ function formatDate(d: Date | null | undefined): string {
|
||||
return d ? d.toISOString().slice(0, 10) : "";
|
||||
}
|
||||
|
||||
export default async function ArticlePage({ params }: { params: Promise<{ slug: string }> }) {
|
||||
export default async function ArticlePage({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ slug: string }>;
|
||||
}) {
|
||||
const { slug } = await params;
|
||||
const t = await getTranslations("pages.article");
|
||||
|
||||
const article = await prisma.websiteArticles
|
||||
.findUnique({
|
||||
where: { slug },
|
||||
select: {
|
||||
id: true,
|
||||
slug: true,
|
||||
title: true,
|
||||
shortStory: true,
|
||||
fullStory: true,
|
||||
image: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
},
|
||||
})
|
||||
.catch(() => null);
|
||||
const article = await prisma.websiteArticles.findUnique({
|
||||
where: { slug },
|
||||
select: { id: true, slug: true, title: true, shortStory: true, fullStory: true, image: true, createdAt: true, updatedAt: true },
|
||||
}).catch(() => null);
|
||||
if (!article) notFound();
|
||||
|
||||
const articleId = article.id;
|
||||
@@ -131,7 +128,11 @@ export default async function ArticlePage({ params }: { params: Promise<{ slug:
|
||||
>
|
||||
{article.image ? (
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
<img src={article.image} alt="" style={{ width: "100%", borderRadius: 10, margin: "0 0 1rem" }} />
|
||||
<img
|
||||
src={article.image}
|
||||
alt=""
|
||||
style={{ width: "100%", borderRadius: 10, margin: "0 0 1rem" }}
|
||||
/>
|
||||
) : null}
|
||||
{/* Article body is rich HTML (atom uses TinyMCE) — sanitised server-side. */}
|
||||
{/* biome-ignore lint/security/noDangerouslySetInnerHtml: sanitised article body */}
|
||||
@@ -157,7 +158,10 @@ export default async function ArticlePage({ params }: { params: Promise<{ slug:
|
||||
title={active ? t("removeReaction") : t("reactWith", { reaction: r.key })}
|
||||
>
|
||||
<span>{label}</span>
|
||||
<span className="muted" style={{ fontSize: "0.85rem", color: "inherit", opacity: 0.85 }}>
|
||||
<span
|
||||
className="muted"
|
||||
style={{ fontSize: "0.85rem", color: "inherit", opacity: 0.85 }}
|
||||
>
|
||||
{count}
|
||||
</span>
|
||||
</button>
|
||||
@@ -192,9 +196,7 @@ export default async function ArticlePage({ params }: { params: Promise<{ slug:
|
||||
<ContentCard
|
||||
icon="🗨️"
|
||||
title={t("commentsTitle")}
|
||||
subtitle={
|
||||
comments.length > 0 ? t("commentsCount", { count: comments.length }) : t("commentsSubtitle")
|
||||
}
|
||||
subtitle={comments.length > 0 ? t("commentsCount", { count: comments.length }) : t("commentsSubtitle")}
|
||||
>
|
||||
{comments.length === 0 ? (
|
||||
<EmptyState icon="🗨️">{t("noComments")}</EmptyState>
|
||||
@@ -222,7 +224,10 @@ export default async function ArticlePage({ params }: { params: Promise<{ slug:
|
||||
{loggedIn ? (
|
||||
<form action={postComment} className="card">
|
||||
<input type="hidden" name="articleId" value={String(articleId)} />
|
||||
<label htmlFor="comment" style={{ display: "block", fontWeight: 700, marginBottom: "0.5rem" }}>
|
||||
<label
|
||||
htmlFor="comment"
|
||||
style={{ display: "block", fontWeight: 700, marginBottom: "0.5rem" }}
|
||||
>
|
||||
{t("addComment")}
|
||||
</label>
|
||||
<textarea
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
export default function NewsLoading() {
|
||||
return (
|
||||
<div style={{ display: "flex", justifyContent: "center", padding: "4rem 0" }}>
|
||||
<div
|
||||
className="animate-spin w-8 h-8 border-4 rounded-full"
|
||||
style={{ borderColor: "var(--color-primary)", borderTopColor: "transparent" }}
|
||||
/>
|
||||
<div className="animate-spin w-8 h-8 border-4 rounded-full" style={{ borderColor: "var(--color-primary)", borderTopColor: "transparent" }} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user