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