MockMode: made global in templates; increase bort of navbar in mock mode
This commit is contained in:
+11
-1
@@ -170,6 +170,14 @@ func (s *webpageRouter) serveTemplate(c *gin.Context) (response.Response, error)
|
||||
|
||||
r := c.Request
|
||||
ctx := r.Context()
|
||||
id := auth.GetIdentity(ctx)
|
||||
var mockMode bool
|
||||
if id.Account != nil {
|
||||
var err error
|
||||
if mockMode, err = s.accts.GetMockMode(ctx, id.Account.AccountID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
args := []any{
|
||||
"Request",
|
||||
@@ -183,10 +191,12 @@ func (s *webpageRouter) serveTemplate(c *gin.Context) (response.Response, error)
|
||||
s.accts.WithContext(ctx),
|
||||
"Etsy",
|
||||
s.etsy.WithContext(ctx),
|
||||
"MockMode",
|
||||
mockMode,
|
||||
|
||||
// auth tooling
|
||||
"Identity",
|
||||
auth.GetIdentity(ctx),
|
||||
id,
|
||||
"Auth",
|
||||
newTemplateAuthenticator(r),
|
||||
}
|
||||
|
||||
@@ -515,6 +515,10 @@
|
||||
border-style: var(--tw-border-style);
|
||||
border-width: 1px;
|
||||
}
|
||||
.border-\[2px\] {
|
||||
border-style: var(--tw-border-style);
|
||||
border-width: 2px;
|
||||
}
|
||||
.border-b-\[2px\] {
|
||||
border-bottom-style: var(--tw-border-style);
|
||||
border-bottom-width: 2px;
|
||||
@@ -523,6 +527,18 @@
|
||||
--tw-border-style: solid;
|
||||
border-style: solid;
|
||||
}
|
||||
.border-\[gray\] {
|
||||
border-color: gray;
|
||||
}
|
||||
.border-\[red\] {
|
||||
border-color: red;
|
||||
}
|
||||
.border-\[white\] {
|
||||
border-color: white;
|
||||
}
|
||||
.border-accent {
|
||||
border-color: var(--accent);
|
||||
}
|
||||
.border-border {
|
||||
border-color: var(--border);
|
||||
}
|
||||
@@ -535,6 +551,9 @@
|
||||
.border-sidebar-border {
|
||||
border-color: var(--sidebar-border);
|
||||
}
|
||||
.bg-\[red\] {
|
||||
background-color: red;
|
||||
}
|
||||
.bg-accent {
|
||||
background-color: var(--accent);
|
||||
}
|
||||
@@ -645,9 +664,16 @@
|
||||
outline-style: var(--tw-outline-style);
|
||||
outline-width: 1px;
|
||||
}
|
||||
.outline-\[1px\] {
|
||||
outline-style: var(--tw-outline-style);
|
||||
outline-width: 1px;
|
||||
}
|
||||
.outline-\(--table-tfoot\) {
|
||||
outline-color: var(--table-tfoot);
|
||||
}
|
||||
.outline-\[red\] {
|
||||
outline-color: red;
|
||||
}
|
||||
.filter {
|
||||
filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
hx-trigger="sse:accounts_{{$acctID}}_mock-mode"
|
||||
hx-swap="morph"
|
||||
>
|
||||
{{- $mockMode := .Accounts.GetMockMode $acctID }}
|
||||
{{- $mockMode := .MockMode }}
|
||||
|
||||
<form id="mock-mode-form">
|
||||
<label class="flex items-center gap-[0.5em] font-display text-[1.5em]">
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
{{- $loggedIn := and (and .Identity .Identity.AccessToken) true -}}
|
||||
{{- $hasAccount := and (and .Identity .Identity.Account) true -}}
|
||||
{{- $acctID := 0 }}
|
||||
{{- $mockMode := false }}
|
||||
{{- if $hasAccount }}
|
||||
{{- $acctID = .Identity.Account.AccountID }}
|
||||
{{- $mockMode = .Accounts.GetMockMode $acctID }}
|
||||
{{- end }}
|
||||
{{- $mockMode := .MockMode }}
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
@@ -63,6 +62,11 @@
|
||||
|
||||
flex
|
||||
justify-center
|
||||
|
||||
{{ if .MockMode }}
|
||||
border-[2px]
|
||||
border-[gray]
|
||||
{{ end }}
|
||||
"{{ end }}
|
||||
|
||||
{{ define "navbar-ul-class" }}class="
|
||||
@@ -108,7 +112,7 @@
|
||||
>
|
||||
<ul
|
||||
hx-swap="morph:innerHTML"
|
||||
{{ template "navbar-ul-class" }}
|
||||
{{ template "navbar-ul-class" . }}
|
||||
>
|
||||
{{- if not $loggedIn }}
|
||||
|
||||
@@ -177,7 +181,7 @@
|
||||
<nav {{ template "navbar-class" . }}>
|
||||
<ul
|
||||
hx-swap="morph:innerHTML"
|
||||
{{ template "navbar-ul-class" }}
|
||||
{{ template "navbar-ul-class" . }}
|
||||
>
|
||||
{{ template "navbar-link" (props
|
||||
"Href" (printf "/ui/accounts/%d/shops" $acctID)
|
||||
@@ -198,7 +202,7 @@
|
||||
<nav {{ template "navbar-class" . }}>
|
||||
<ul
|
||||
hx-swap="morph:innerHTML"
|
||||
{{ template "navbar-ul-class" }}
|
||||
{{ template "navbar-ul-class" . }}
|
||||
>
|
||||
{{ template "navbar-link" (props
|
||||
"Href" (printf "/ui/accounts/%d/inventory" $acctID)
|
||||
|
||||
Reference in New Issue
Block a user