feat(ui): nav spacing + conditional sign-in/sign-out
Some checks failed
Build and Deploy / build-push-deploy (push) Has been cancelled

Split public links (About, Tutorial, Extend) and auth into two groups
with 2rem gap between them and the separator. Uses inline style gap
to avoid Tailwind CSS bundle gaps.

Auth link is now session-aware: shows "Sign out" (POST form with
DELETE override) when logged in, "Sign in" (href to NewSessionAction)
when not. Implemented via currentUserOrNothing @User in the layout.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-03 01:20:45 +02:00
parent c74fb8fddd
commit 61dfe126e8

View File

@@ -147,7 +147,19 @@ instance InitControllerContext WebApplication where
initAuthentication @User
defaultLayout :: (?context :: ControllerContext, ?request :: Request) => Layout
defaultLayout inner = [hsx|
defaultLayout inner =
let authWidget :: Html
authWidget = case currentUserOrNothing @User of
Just _ -> [hsx|
<form method="POST" action={DeleteSessionAction} style="display:inline">
<input type="hidden" name="_method" value="DELETE" />
<button type="submit" class="text-sm text-gray-500 hover:text-gray-700 bg-transparent border-0 p-0 cursor-pointer">Sign out</button>
</form>
|]
Nothing -> [hsx|
<a href={NewSessionAction} class="text-sm text-gray-500 hover:text-gray-900">Sign in</a>
|]
in [hsx|
<!DOCTYPE html>
<html lang="en">
<head>
@@ -163,15 +175,14 @@ defaultLayout inner = [hsx|
<body class="bg-gray-50 text-gray-900" style="min-height:100vh;display:flex;flex-direction:column">
<nav class="bg-white border-b border-gray-200 px-6 py-3 flex items-center">
<a href={LandingAction} class="font-semibold text-indigo-600">inter-hub</a>
<div class="ml-auto flex items-center gap-5">
<div class="ml-auto flex items-center" style="gap:2rem">
<div class="flex items-center gap-5">
<a href={CapabilitiesAction} class="text-sm text-gray-500 hover:text-gray-900">About</a>
<a href={TutorialAction} class="text-sm text-gray-500 hover:text-gray-900">Tutorial</a>
<a href={ExtensionGuideAction} class="text-sm text-gray-500 hover:text-gray-900">Extend</a>
</div>
<span class="text-gray-200">|</span>
<form method="POST" action={DeleteSessionAction} style="display:inline">
<input type="hidden" name="_method" value="DELETE" />
<button type="submit" class="text-sm text-gray-500 hover:text-gray-700 bg-transparent border-0 p-0 cursor-pointer">Sign out</button>
</form>
{authWidget}
</div>
</nav>
<div class="flex" style="flex:1">