diff --git a/src/components/header.tsx b/src/components/header.tsx new file mode 100644 index 0000000..85644f6 --- /dev/null +++ b/src/components/header.tsx @@ -0,0 +1,38 @@ +import Html from "@kitajs/html"; +import { Session } from "lucia"; + +export function Header({ session }: { session: Session }) { + return ( +
+ {session ? ( + <> +

+ We've been waiting for you, {session.user.name}. +

+ + Log Out + + {session.user.roles.includes("ADMIN") ? ( + + New Post + + ) : null} + + ) : ( + + Log In + + )} +
+ ); +} diff --git a/src/pages/(admin)/new-post.tsx b/src/pages/(admin)/new-post.tsx index 31c5f34..3542cad 100644 --- a/src/pages/(admin)/new-post.tsx +++ b/src/pages/(admin)/new-post.tsx @@ -1,5 +1,6 @@ import Elysia from "elysia"; import { BaseHtml } from "../../components/base"; +import { Header } from "../../components/header"; import { ctx } from "../../context"; export const newPost = new Elysia() @@ -13,6 +14,7 @@ export const newPost = new Elysia() return html( +