import type { BaseContext } from "koa"; import type { FlatTemplatable } from "tempstream"; import { SignInURL, LogoutURL } from "../urls.js"; export async function default_navbar(ctx: BaseContext): Promise { const isLoggedIn = !!ctx.$context.session_id; const linkData = isLoggedIn ? [{ text: "Logout", url: LogoutURL }] : [{ text: "Sign in", url: SignInURL }]; const linksHTML = linkData .map((link) => link.url === new URL(ctx.url, "https://a.com").pathname ? `
  • ${link.text}
  • ` : /* HTML */ `
  • ${link.text}
  • ` ) .join("\n"); return /* HTML */ ` `; }