Reapply "Add missing admin action files and navigation links"

This reverts commit 4d515bc400.
This commit is contained in:
Simo committed 2026-07-11 20:52:56 +02:00
1 parent 96ed768f14
commit 5b4228261a
338 files changed
+28143 -5948

No files matched your search

+23 -28
View File
@@ -12,11 +12,7 @@ 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
@@ -49,18 +45,25 @@ 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;
@@ -128,11 +131,7 @@ export default async function ArticlePage({
>
{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 */}
@@ -158,10 +157,7 @@ export default async function ArticlePage({
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>
@@ -196,7 +192,9 @@ export default async function ArticlePage({
<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>
@@ -224,10 +222,7 @@ export default async function ArticlePage({
{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
+4 -1
View File
@@ -1,7 +1,10 @@
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>
);
}