move shops to new page; live vs mock navbar
This commit is contained in:
+96
-32
@@ -1,5 +1,6 @@
|
||||
{{- $loggedIn := and (and .Identity .Identity.AccessToken) true -}}
|
||||
{{- $hasAccount := and (and .Identity .Identity.Account) true -}}
|
||||
{{- $acctID := 0 }}
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
@@ -47,8 +48,9 @@
|
||||
{{- end }}
|
||||
>
|
||||
<header>
|
||||
<nav
|
||||
class="
|
||||
{{- $path := or .Request.URL.Path "/" }}
|
||||
|
||||
{{ define "navbar-class" }}class="
|
||||
w-full
|
||||
text-xl
|
||||
overflow-x-hidden
|
||||
@@ -56,13 +58,9 @@
|
||||
|
||||
flex
|
||||
justify-center
|
||||
"
|
||||
>
|
||||
{{- $path := or .Request.URL.Path "/" }}
|
||||
"{{ end }}
|
||||
|
||||
<ul
|
||||
hx-swap="morph:innerHTML"
|
||||
class="
|
||||
{{ define "navbar-ul-class" }}class="
|
||||
max-w-full
|
||||
overflow-x-auto
|
||||
overflow-y-hidden
|
||||
@@ -70,42 +68,108 @@
|
||||
|
||||
flex
|
||||
basis-[fit-content]
|
||||
"
|
||||
style="
|
||||
"
|
||||
"}}
|
||||
{{ end }}
|
||||
|
||||
{{ define "navbar-link" }}
|
||||
{{/* Href, NoHXBoost, Selected, Content */}}
|
||||
<li class="pt-[1em] pb-[1em]">
|
||||
<a
|
||||
href={{.Href}}
|
||||
{{if .NoHXBoost}}hx-boost="false"{{end}}
|
||||
class="p-[1em] font-display {{if .Selected}}selected{{ end }}"
|
||||
>
|
||||
{{.Content}}
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
|
||||
<nav {{ template "navbar-class" . }}>
|
||||
<ul
|
||||
hx-swap="morph:innerHTML"
|
||||
{{ template "navbar-ul-class" }}
|
||||
>
|
||||
{{- if not $loggedIn }}
|
||||
|
||||
<li class="pt-[1em] pb-[1em]">
|
||||
<a href="/api/auth/login" hx-boost="false" class="p-[1em] font-display {{ if eq $path "/auth/login" }}selected{{ end }}">
|
||||
Log In
|
||||
</a>
|
||||
</li>
|
||||
{{ template "navbar-link" (props
|
||||
"Href" "/api/auth/login"
|
||||
"NoHXBoost" true
|
||||
"Selected" (eq $path "/auth/login")
|
||||
"Content" "Log In"
|
||||
)}}
|
||||
|
||||
{{- else if $hasAccount }}
|
||||
{{- $acctID := .Identity.Account.AccountID }}
|
||||
{{- $acctID = .Identity.Account.AccountID }}
|
||||
|
||||
<li class="pt-[1em] pb-[1em]">
|
||||
<a href="/ui/accounts/{{$acctID}}" class="p-[1em] font-display {{ if eq $path (printf "/accounts/%d" $acctID) }}selected{{ end }}">
|
||||
Account
|
||||
</a>
|
||||
</li>
|
||||
{{ template "navbar-link" (props
|
||||
"Href" (printf "/ui/accounts/%d" $acctID)
|
||||
"Selected" (eq $path (printf "/accounts/%d" $acctID))
|
||||
"Content" "Account"
|
||||
)}}
|
||||
|
||||
<li class="pt-[1em] pb-[1em]">
|
||||
<a href="/ui/accounts/{{$acctID}}/inventory" class="p-[1em] font-display {{ if eq $path (printf "/accounts/%d/inventory" $acctID) }}selected{{ end }}">
|
||||
Inventory
|
||||
</a>
|
||||
</li>
|
||||
{{ template "navbar-link" (props
|
||||
"Href" (printf "/ui/accounts/%d/shops" $acctID)
|
||||
"Selected" (hasPrefix $path (printf "/accounts/%d/shops" $acctID))
|
||||
"Content" "Shops"
|
||||
)}}
|
||||
|
||||
<li class="pt-[1em] pb-[1em]">
|
||||
<a href="/ui/accounts/{{$acctID}}/reports" class="p-[1em] font-display {{ if eq $path (printf "/accounts/%d/reports" $acctID) }}selected{{ end }}">
|
||||
Reports
|
||||
</a>
|
||||
</li>
|
||||
{{ template "navbar-link" (props
|
||||
"Href" (printf "/ui/accounts/%d/inventory" $acctID)
|
||||
"Selected" (hasPrefix $path (printf "/accounts/%d/inventory" $acctID))
|
||||
"Content" "Inventory"
|
||||
)}}
|
||||
|
||||
{{ template "navbar-link" (props
|
||||
"Href" (printf "/ui/accounts/%d/reports" $acctID)
|
||||
"Selected" (hasPrefix $path (printf "/accounts/%d/reports" $acctID))
|
||||
"Content" "Reports"
|
||||
)}}
|
||||
|
||||
{{- end }}
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
{{- if hasPrefix $path (printf "/accounts/%d/shops" $acctID) }}
|
||||
<nav {{ template "navbar-class" . }}>
|
||||
<ul
|
||||
hx-swap="morph:innerHTML"
|
||||
{{ template "navbar-ul-class" }}
|
||||
>
|
||||
{{ template "navbar-link" (props
|
||||
"Href" (printf "/ui/accounts/%d/shops" $acctID)
|
||||
"Selected" (eq $path (printf "/accounts/%d/shops" $acctID))
|
||||
"Content" "Live"
|
||||
)}}
|
||||
|
||||
{{ template "navbar-link" (props
|
||||
"Href" (printf "/ui/accounts/%d/shops/mocks" $acctID)
|
||||
"Selected" (eq $path (printf "/accounts/%d/shops/mocks" $acctID))
|
||||
"Content" "Mock"
|
||||
)}}
|
||||
</ul>
|
||||
</nav>
|
||||
{{- end }}
|
||||
|
||||
{{- if hasPrefix $path (printf "/accounts/%d/inventory" $acctID) }}
|
||||
<nav {{ template "navbar-class" . }}>
|
||||
<ul
|
||||
hx-swap="morph:innerHTML"
|
||||
{{ template "navbar-ul-class" }}
|
||||
>
|
||||
{{ template "navbar-link" (props
|
||||
"Href" (printf "/ui/accounts/%d/inventory" $acctID)
|
||||
"Selected" (eq $path (printf "/accounts/%d/inventory" $acctID))
|
||||
"Content" "Live"
|
||||
)}}
|
||||
|
||||
{{ template "navbar-link" (props
|
||||
"Href" (printf "/ui/accounts/%d/inventory/mock" $acctID)
|
||||
"Selected" (eq $path (printf "/accounts/%d/inventory/mock" $acctID))
|
||||
"Content" "Mock"
|
||||
)}}
|
||||
</ul>
|
||||
</nav>
|
||||
{{- end }}
|
||||
</header>
|
||||
|
||||
<main class="basis-full grow max-w-full">
|
||||
|
||||
Reference in New Issue
Block a user