oops quick fix
All checks were successful
Build / build (push) Successful in 2m33s

This commit is contained in:
Nareshkumar Rao 2025-04-03 00:14:33 +02:00
parent 4d5b1692c4
commit dcde0cb893
3 changed files with 39 additions and 30 deletions

View File

@ -0,0 +1,37 @@
"use client";
import { useRouter } from "next/navigation";
export default function ActionButtons({ loggedIn }: { loggedIn: boolean }) {
const router = useRouter();
return loggedIn ? (
<div
style={{
marginTop: "2rem",
padding: "0.5rem 1rem",
backgroundColor: "#333",
width: "fit-content",
userSelect: "none",
cursor: "pointer",
}}
onClick={() => router.push("/blog/write")}
>
write a post
</div>
) : (
<div
style={{
marginTop: "2rem",
padding: "0.3rem 0.5rem",
backgroundColor: "#333",
width: "fit-content",
userSelect: "none",
cursor: "pointer",
fontSize: "0.8rem",
}}
onClick={() => router.push("/blog/login")}
>
login
</div>
);
}

View File

@ -191,36 +191,6 @@ export default function PostSummary({
</span>
</div>
</div>
{loggedIn ? (
<div
style={{
marginTop: "2rem",
padding: "0.5rem 1rem",
backgroundColor: "#333",
width: "fit-content",
userSelect: "none",
cursor: "pointer",
}}
onClick={() => router.push("/blog/write")}
>
write a post
</div>
) : (
<div
style={{
marginTop: "2rem",
padding: "0.3rem 0.5rem",
backgroundColor: "#333",
width: "fit-content",
userSelect: "none",
cursor: "pointer",
fontSize: "0.8rem",
}}
onClick={() => router.push("/blog/login")}
>
login
</div>
)}
</>
);
}

View File

@ -8,6 +8,7 @@ import PostSummary from "./PostSummary";
import Pagination from "./Pagination";
import TagOverview from "./TagOverview";
import { isLoggedIn } from "@/components/auth";
import ActionButtons from "./ActionButtons";
export default async function Blog({
params,
@ -52,6 +53,7 @@ export default async function Blog({
<PostSummary metadata={m} key={m.slug} loggedIn={loggedIn} />
))}
<Pagination numberOfPages={numberOfPages} pageNumber={pageNumber} />
<ActionButtons loggedIn={loggedIn} />
</>
);
}