couple more fixes
All checks were successful
Build / build (push) Successful in 2m25s

This commit is contained in:
Nareshkumar Rao
2025-04-05 01:12:38 +02:00
parent f640afbcb1
commit 82ce4b345a
3 changed files with 25 additions and 20 deletions

View File

@@ -20,6 +20,7 @@ export default async function Blog({
const pageNumber = await getPageNumber(searchParams);
const { tag } = await params;
const currentTag = tag != null && tag.length >= 1 ? tag[0] : null;
if ((tag?.length ?? 0) > 1) {
notFound();
}
@@ -28,9 +29,7 @@ export default async function Blog({
pageNumber,
currentTag
);
if (pageNumber > numberOfPages) {
notFound();
}
const loggedIn = (await auth())?.user != null;
const tags = await getTags(loggedIn);
@@ -46,13 +45,23 @@ export default async function Blog({
<span style={{ fontSize: 18 }}>naresh writes</span>
<span style={{ fontSize: 12 }}>...occasionally</span>
</div>
<TagOverview tags={tags} currentTag={currentTag} />
{metadata
.filter((m) => loggedIn || !m.is_draft)
.map((m) => (
<PostSummary metadata={m} key={m.slug} loggedIn={loggedIn} />
))}
<Pagination numberOfPages={numberOfPages} pageNumber={pageNumber} />
{pageNumber > numberOfPages ? (
<div style={{ marginTop: "1rem" }}>
ah fuck.
<br /> it seems like i haven&apos;t written anything yet
<br /> so much for a blog, eh?
</div>
) : (
<>
<TagOverview tags={tags} currentTag={currentTag} />
{metadata
.filter((m) => loggedIn || !m.is_draft)
.map((m) => (
<PostSummary metadata={m} key={m.slug} loggedIn={loggedIn} />
))}
<Pagination numberOfPages={numberOfPages} pageNumber={pageNumber} />
</>
)}
<ActionButtons loggedIn={loggedIn} />
</>
);