diff --git a/handlers/user.go b/handlers/user.go index 506f379..977ca7e 100644 --- a/handlers/user.go +++ b/handlers/user.go @@ -80,7 +80,7 @@ func account(s *service.Service, w http.ResponseWriter, r *http.Request) httputi http.Redirect(w, r, "/", http.StatusSeeOther) return nil } - passkeySettings, err := s.PasskeySettings(r.Context(), user.KTHID) + passkeys, err := s.ListPasskeysForUser(r.Context(), user.KTHID) if err != nil { return err } @@ -88,7 +88,7 @@ func account(s *service.Service, w http.ResponseWriter, r *http.Request) httputi if err != nil { return err } - return templates.Account(*user, passkeySettings, isAdmin) + return templates.Account(*user, passkeys, isAdmin) } func acceptInvite(s *service.Service, w http.ResponseWriter, r *http.Request) httputil.ToResponse { diff --git a/pkg/static/public/style.dist.css b/pkg/static/public/style.dist.css index a381dee..8c6e5f4 100644 --- a/pkg/static/public/style.dist.css +++ b/pkg/static/public/style.dist.css @@ -570,6 +570,10 @@ html { grid-column: 1 / -1; } +.mt-1 { + margin-top: 0.25rem; +} + .block { display: block; } @@ -626,6 +630,10 @@ html { min-height: 100vh; } +.w-16 { + width: 4rem; +} + .w-3\/5 { width: 60%; } @@ -654,6 +662,10 @@ html { max-width: calc(100vw - 2rem); } +.max-w-lg { + max-width: 32rem; +} + .shrink-0 { flex-shrink: 0; } @@ -662,10 +674,6 @@ html { flex-grow: 1; } -.basis-full { - flex-basis: 100%; -} - .select-none { -webkit-user-select: none; -moz-user-select: none; @@ -712,6 +720,14 @@ html { gap: 1rem; } +.gap-8 { + gap: 2rem; +} + +.overflow-auto { + overflow: auto; +} + .rounded { border-radius: 0.25rem; } @@ -835,6 +851,11 @@ html { line-height: 1.25rem; } +.text-xl { + font-size: 1.25rem; + line-height: 1.75rem; +} + .uppercase { text-transform: uppercase; } @@ -844,6 +865,21 @@ html { color: rgb(245 245 245 / var(--tw-text-opacity)); } +.text-cerise-regular { + --tw-text-opacity: 1; + color: rgb(232 61 132 / var(--tw-text-opacity)); +} + +.text-cerise-strong { + --tw-text-opacity: 1; + color: rgb(238 42 123 / var(--tw-text-opacity)); +} + +.text-cerise-light { + --tw-text-opacity: 1; + color: rgb(236 95 153 / var(--tw-text-opacity)); +} + .outline-none { outline: 2px solid transparent; outline-offset: 2px; @@ -1023,6 +1059,10 @@ html { padding-right: 0.75rem; } +.\[\&\>a\]\:shrink-0>a { + flex-shrink: 0; +} + .\[\&\>a\]\:items-center>a { align-items: center; } diff --git a/service/passkey.go b/service/passkey.go index 377450b..ba5cd2f 100644 --- a/service/passkey.go +++ b/service/passkey.go @@ -42,11 +42,3 @@ func (s *Service) ListPasskeysForUser(ctx context.Context, kthid string) ([]mode func (s *Service) PasskeyLogin() func() templ.Component { return func() templ.Component { return templates.PasskeyLoginForm("", nil) } } - -func (s *Service) PasskeySettings(ctx context.Context, kthid string) (func() templ.Component, error) { - passkeys, err := s.ListPasskeysForUser(ctx, kthid) - if err != nil { - return nil, err - } - return func() templ.Component { return templates.PasskeySettings(passkeys) }, nil -} diff --git a/templates/admin.templ b/templates/admin.templ index 0a3405f..f3a028b 100644 --- a/templates/admin.templ +++ b/templates/admin.templ @@ -1,30 +1,16 @@ package templates -import ( - "fmt" - "github.com/datasektionen/logout/pkg/static" -) +import "fmt" + +templ adminNav() { + Members + OIDC Clients + Invites +} templ AdminPage() { - @page() { - -
{ message }
} - -var input = ` - border border-neutral-500 grow - outline-none focus:border-cerise-strong hover:border-cerise-light - bg-slate-800 p-1.5 rounded h-8 -` - -var button = ` - bg-[#3f4c66] p-1 h-8 block rounded border text-center - select-none border-transparent outline-none - focus:border-cerise-strong hover:border-cerise-light -` - -var roundButton = ` - bg-[#3f4c66] shrink-0 h-5 w-5 rounded-full - grid place-items-center pointer - border border-transparent outline-none focus:border-cerise-strong hover:border-cerise-light relative - [&>img]:w-3/5 [&>img]:h-3/5 [&>img]:invert - [&>p]:text-center [&>p]:leading-none -` diff --git a/templates/admin_invites_templ.go b/templates/admin_invites_templ.go index b6fd436..e14e870 100644 --- a/templates/admin_invites_templ.go +++ b/templates/admin_invites_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.778 +// templ: version: v0.2.793 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/templates/admin_oidc_clients_templ.go b/templates/admin_oidc_clients_templ.go index 4264666..70366f2 100644 --- a/templates/admin_oidc_clients_templ.go +++ b/templates/admin_oidc_clients_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.778 +// templ: version: v0.2.793 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/templates/admin_templ.go b/templates/admin_templ.go index fb54a54..9ed357b 100644 --- a/templates/admin_templ.go +++ b/templates/admin_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.778 +// templ: version: v0.2.793 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -8,12 +8,9 @@ package templates import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" -import ( - "fmt" - "github.com/datasektionen/logout/pkg/static" -) +import "fmt" -func AdminPage() templ.Component { +func adminNav() templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { @@ -34,7 +31,36 @@ func AdminPage() templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Members OIDC Clients Invites") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) +} + +func AdminPage() templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var2 := templ.GetChildren(ctx) + if templ_7745c5c3_Var2 == nil { + templ_7745c5c3_Var2 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var3 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { @@ -46,29 +72,13 @@ func AdminPage() templ.Component { }() } ctx = templ.InitializeContext(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("