mirror of
https://tangled.org/evan.jarrett.net/at-container-registry
synced 2026-09-21 01:34:16 +00:00
36 lines
1.9 KiB
HTML
36 lines
1.9 KiB
HTML
{{ define "nav-user" }}
|
|
{{ if .User }}
|
|
<details class="dropdown dropdown-end">
|
|
<summary class="btn btn-ghost gap-2 list-none focus-visible:outline-2 focus-visible:outline-primary focus-visible:outline-offset-2" aria-label="User menu" aria-haspopup="menu">
|
|
<div class="avatar{{ if not .User.Avatar }} avatar-placeholder{{ end }}">
|
|
{{ if .User.Avatar }}
|
|
<div class="w-7 rounded-full bg-secondary text-secondary-content flex items-center justify-center relative">
|
|
<span aria-hidden="true" class="text-xs">{{ firstChar .User.Handle }}</span>
|
|
<img src="{{ resizeImage .User.Avatar 96 }}" alt="" aria-hidden="true" width="28" height="28"
|
|
class="absolute inset-0 w-full h-full rounded-full object-cover"
|
|
onerror="this.remove()" />
|
|
</div>
|
|
{{ else }}
|
|
<div class="bg-secondary text-secondary-content w-7 rounded-full">
|
|
<span aria-hidden="true" class="text-xs">{{ firstChar .User.Handle }}</span>
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
<span class="hidden sm:inline truncate max-w-48">@{{ .User.Handle }}</span>
|
|
{{ icon "chevron-down" "size-3.5" }}
|
|
</summary>
|
|
<ul class="dropdown-content menu bg-base-200 text-base-content rounded-box z-50 w-52 p-2 shadow-lg">
|
|
<li><a href="/u/{{ .User.Handle }}">Your Repositories</a></li>
|
|
<li><a href="/u/{{ .User.Handle }}/starred">Starred Repositories</a></li>
|
|
<li><a href="/settings">Settings</a></li>
|
|
<li class="border-t border-base-300 mt-2 pt-2">
|
|
<button type="submit" form="logout-form" class="text-error">Logout</button>
|
|
</li>
|
|
</ul>
|
|
<form id="logout-form" action="/auth/logout" method="POST" hidden></form>
|
|
</details>
|
|
{{ else }}
|
|
<a href="/auth/oauth/login?return_to={{ urlquery (or .CurrentPath "/") }}" class="btn btn-secondary btn-sm">Login</a>
|
|
{{ end }}
|
|
{{ end }}
|