2153 lines
113 KiB
Go
2153 lines
113 KiB
Go
|
|
// Code generated by templ - DO NOT EDIT.
|
||
|
|
|
||
|
|
// templ: version: v0.3.977
|
||
|
|
package views
|
||
|
|
|
||
|
|
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||
|
|
|
||
|
|
import "github.com/a-h/templ"
|
||
|
|
import templruntime "github.com/a-h/templ/runtime"
|
||
|
|
|
||
|
|
import (
|
||
|
|
"nebula/layouts"
|
||
|
|
"nebula/models"
|
||
|
|
"strconv"
|
||
|
|
"strings"
|
||
|
|
"time"
|
||
|
|
)
|
||
|
|
|
||
|
|
func SettingsPage(data models.SettingsData, activeTab string) 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_Var1 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var1 == nil {
|
||
|
|
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_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 {
|
||
|
|
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_Err = settingsStyles().Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, " <header class=\"page-header\"><div class=\"wa-stack wa-gap-2xs\"><span class=\"wa-heading-xl\">Settings</span> <span class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500);\">Manage your account preferences and security</span></div></header><div class=\"settings-container\"><wa-tab-group class=\"settings-tabs\"><wa-tab panel=\"profile\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if activeTab == "" || activeTab == "profile" {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, " active")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "><wa-icon name=\"user\"></wa-icon> Profile</wa-tab> <wa-tab panel=\"devices\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if activeTab == "devices" {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, " active")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "><wa-icon name=\"laptop\"></wa-icon> Devices</wa-tab> <wa-tab panel=\"oauth\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if activeTab == "oauth" {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, " active")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "><wa-icon name=\"key\"></wa-icon> OAuth</wa-tab> <wa-tab panel=\"notifications\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if activeTab == "notifications" {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, " active")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "><wa-icon name=\"bell\"></wa-icon> Notifications</wa-tab> <wa-tab panel=\"emails\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if activeTab == "emails" {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, " active")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "><wa-icon name=\"envelope\"></wa-icon> Emails</wa-tab> <wa-tab panel=\"phones\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if activeTab == "phones" {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, " active")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "><wa-icon name=\"phone\"></wa-icon> Phone Numbers</wa-tab> <wa-tab panel=\"developer\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if activeTab == "developer" {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, " active")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "><wa-icon name=\"code\"></wa-icon> Developer</wa-tab> <wa-tab-panel name=\"profile\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = ProfileTab(data.Profile).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "</wa-tab-panel> <wa-tab-panel name=\"devices\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = DevicesTab(data.Devices).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "</wa-tab-panel> <wa-tab-panel name=\"oauth\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = OAuthTab(data.OAuth).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "</wa-tab-panel> <wa-tab-panel name=\"notifications\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = NotificationsTab(data.Notifications).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "</wa-tab-panel> <wa-tab-panel name=\"emails\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = EmailsTab(data.Emails).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "</wa-tab-panel> <wa-tab-panel name=\"phones\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = PhonesTab(data.Phones, data.SMSSettings).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "</wa-tab-panel> <wa-tab-panel name=\"developer\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = DeveloperTab(data.Developer).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "</wa-tab-panel></wa-tab-group></div>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = AddEmailDialog().Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, " ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = AddPhoneDialog().Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, " ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = AddDeviceDialog().Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, " ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = GenerateKeyDialog().Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, " ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = AddWebhookDialog().Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, " ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = settingsScripts().Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
templ_7745c5c3_Err = layouts.DashboardLayout("Settings - Sonr", layouts.WalletUser{Name: "Sonr Wallet", Address: "sonr1x9f...7k2m"}, "settings").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func ProfileTab(profile models.ProfileSettings) 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_Var3 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var3 == nil {
|
||
|
|
templ_7745c5c3_Var3 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "<div class=\"wa-stack wa-gap-xl\"><div class=\"form-section\"><div class=\"form-row\"><div class=\"form-label\"><span class=\"wa-heading-s\">Avatar</span><p class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500); margin: var(--wa-space-2xs) 0 0;\">Your public profile image</p></div><div class=\"avatar-upload\"><wa-avatar initials=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var4 string
|
||
|
|
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(profile.Initials)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 91, Col: 43}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "\" style=\"background: linear-gradient(135deg, #17c2ff, #0090ff);\"></wa-avatar><div class=\"wa-stack wa-gap-s\"><div class=\"wa-cluster wa-gap-s\"><wa-button size=\"small\" variant=\"neutral\" appearance=\"outlined\"><wa-icon slot=\"start\" name=\"upload\"></wa-icon> Upload</wa-button> <wa-button size=\"small\" variant=\"neutral\" appearance=\"plain\">Remove</wa-button></div><span class=\"wa-caption-xs\" style=\"color: var(--wa-color-neutral-500);\">JPG, PNG or GIF. Max 2MB.</span></div></div></div></div><div class=\"form-section\"><div class=\"form-row\"><div class=\"form-label\"><span class=\"wa-heading-s\">Display Name</span><p class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500); margin: var(--wa-space-2xs) 0 0;\">Shown on your public profile</p></div><wa-input value=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var5 string
|
||
|
|
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(profile.DisplayName)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 111, Col: 41}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "\" placeholder=\"Enter display name\" name=\"profile-display-name\"></wa-input></div></div><div class=\"form-section\"><div class=\"form-row\"><div class=\"form-label\"><span class=\"wa-heading-s\">Username</span><p class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500); margin: var(--wa-space-2xs) 0 0;\">Your unique identifier</p></div><wa-input value=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var6 string
|
||
|
|
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(profile.Username)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 120, Col: 38}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "\" placeholder=\"Enter username\" name=\"profile-username\"><span slot=\"prefix\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var7 string
|
||
|
|
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs("@")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 121, Col: 30}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "</span></wa-input></div></div><div class=\"form-section\"><div class=\"form-row\"><div class=\"form-label\"><span class=\"wa-heading-s\">Bio</span><p class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500); margin: var(--wa-space-2xs) 0 0;\">Brief description for your profile</p></div><wa-textarea rows=\"3\" placeholder=\"Tell us about yourself...\" value=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var8 string
|
||
|
|
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(profile.Bio)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 131, Col: 85}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "\" name=\"profile-bio\"></wa-textarea></div></div><div class=\"form-section\"><div class=\"form-row\"><div class=\"form-label\"><span class=\"wa-heading-s\">Website</span><p class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500); margin: var(--wa-space-2xs) 0 0;\">Your personal or project website</p></div><wa-input type=\"url\" value=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var9 string
|
||
|
|
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(profile.Website)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 140, Col: 48}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "\" placeholder=\"https://example.com\" name=\"profile-website\"><wa-icon slot=\"prefix\" name=\"globe\"></wa-icon></wa-input></div></div><div class=\"form-section\"><div class=\"form-row\"><div class=\"form-label\"><span class=\"wa-heading-s\">Social Links</span><p class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500); margin: var(--wa-space-2xs) 0 0;\">Connect your social accounts</p></div><div class=\"wa-stack wa-gap-m\"><wa-input placeholder=\"twitter.com/username\" value=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var10 string
|
||
|
|
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(profile.SocialLinks.Twitter)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 152, Col: 85}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "\" name=\"profile-twitter\"><wa-icon slot=\"prefix\" name=\"x-twitter\" variant=\"brand\"></wa-icon></wa-input> <wa-input placeholder=\"github.com/username\" value=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var11 string
|
||
|
|
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(profile.SocialLinks.GitHub)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 155, Col: 83}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "\" name=\"profile-github\"><wa-icon slot=\"prefix\" name=\"github\" variant=\"brand\"></wa-icon></wa-input> <wa-input placeholder=\"discord.gg/invite\" value=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var12 string
|
||
|
|
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(profile.SocialLinks.Discord)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 158, Col: 82}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "\" name=\"profile-discord\"><wa-icon slot=\"prefix\" name=\"discord\" variant=\"brand\"></wa-icon></wa-input></div></div></div><div class=\"form-section\"><div class=\"form-row\"><div class=\"form-label\"><span class=\"wa-heading-s\">Profile Visibility</span><p class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500); margin: var(--wa-space-2xs) 0 0;\">Control who can see your profile</p></div><wa-radio-group value=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var13 string
|
||
|
|
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(profile.Visibility)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 170, Col: 46}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "\" name=\"profile-visibility\"><wa-radio value=\"public\"><div class=\"wa-stack wa-gap-0\"><span>Public</span> <span class=\"wa-caption-xs\" style=\"color: var(--wa-color-neutral-500);\">Anyone can view your profile</span></div></wa-radio> <wa-radio value=\"connections\"><div class=\"wa-stack wa-gap-0\"><span>Connections Only</span> <span class=\"wa-caption-xs\" style=\"color: var(--wa-color-neutral-500);\">Only connected apps and users</span></div></wa-radio> <wa-radio value=\"private\"><div class=\"wa-stack wa-gap-0\"><span>Private</span> <span class=\"wa-caption-xs\" style=\"color: var(--wa-color-neutral-500);\">Only you can see your profile</span></div></wa-radio></wa-radio-group></div></div><div class=\"wa-cluster wa-gap-s\" style=\"justify-content: flex-end;\"><wa-button variant=\"neutral\" appearance=\"outlined\">Cancel</wa-button> <wa-button variant=\"brand\" hx-post=\"/api/settings/profile\" hx-include=\"[name^='profile-']\">Save Changes</wa-button></div></div>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func DevicesTab(devices []models.Device) 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_Var14 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var14 == nil {
|
||
|
|
templ_7745c5c3_Var14 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "<div class=\"wa-stack wa-gap-xl\"><div class=\"wa-flank\"><div class=\"wa-stack wa-gap-2xs\"><span class=\"wa-heading-m\">Linked Devices</span> <span class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500);\">Passkeys and security keys registered with your account</span></div><wa-button size=\"small\" variant=\"brand\" id=\"add-device-btn\"><wa-icon slot=\"start\" name=\"plus\"></wa-icon> Add Device</wa-button></div><div class=\"wa-stack wa-gap-m\" id=\"devices-list\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
for _, device := range devices {
|
||
|
|
templ_7745c5c3_Err = DeviceItem(device).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "</div><wa-callout variant=\"neutral\"><wa-icon slot=\"icon\" name=\"shield-check\"></wa-icon><div class=\"wa-stack wa-gap-2xs\"><span class=\"wa-heading-xs\">Security Recommendation</span> <span class=\"wa-caption-s\">Register at least 2 devices to ensure account recovery if one is lost.</span></div></wa-callout></div>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func DeviceItem(device models.Device) 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_Var15 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var15 == nil {
|
||
|
|
templ_7745c5c3_Var15 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "<div class=\"device-item\" id=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var16 string
|
||
|
|
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs("device-" + device.ID)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 227, Col: 52}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "\"><div class=\"device-icon\"><wa-icon name=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var17 string
|
||
|
|
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(deviceIcon(device.Type))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 229, Col: 42}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "\" style=\"font-size: 24px;\"></wa-icon></div><div class=\"device-info\"><div class=\"wa-stack wa-gap-0\"><div class=\"wa-cluster wa-gap-xs\"><span class=\"wa-heading-s\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var18 string
|
||
|
|
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(device.Name)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 234, Col: 45}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "</span> ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if device.IsCurrent {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "<wa-badge variant=\"success\" pill>Current</wa-badge>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "</div><span class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500);\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if device.Browser != "" {
|
||
|
|
var templ_7745c5c3_Var19 string
|
||
|
|
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(device.Browser)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 241, Col: 22}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, " on ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var20 string
|
||
|
|
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(device.OS)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 241, Col: 39}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, " - ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var21 string
|
||
|
|
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(device.AuthType)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 243, Col: 22}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "</span></div></div><div class=\"wa-stack wa-gap-0 wa-align-items-end\"><span class=\"wa-caption-s\">Added ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var22 string
|
||
|
|
templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(formatDate(device.AddedAt))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 248, Col: 64}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "</span> <span class=\"wa-caption-xs\" style=\"color: var(--wa-color-neutral-500);\">Last used: ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var23 string
|
||
|
|
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(formatRelativeTime(device.LastUsed))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 249, Col: 123}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "</span></div><wa-dropdown><wa-icon-button slot=\"trigger\" name=\"ellipsis-vertical\" label=\"Options\"></wa-icon-button> <wa-dropdown-item><wa-icon slot=\"icon\" name=\"pen\"></wa-icon> Rename</wa-dropdown-item> <wa-divider></wa-divider> <wa-dropdown-item style=\"color: var(--wa-color-danger);\" hx-delete=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var24 string
|
||
|
|
templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs("/api/devices/" + device.ID)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 260, Col: 43}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "\" hx-target=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var25 string
|
||
|
|
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs("#device-" + device.ID)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 261, Col: 38}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "\" hx-swap=\"delete\" hx-confirm=\"Remove this device?\"><wa-icon slot=\"icon\" name=\"trash\"></wa-icon> Remove</wa-dropdown-item></wa-dropdown></div>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func deviceIcon(deviceType string) string {
|
||
|
|
switch deviceType {
|
||
|
|
case "laptop":
|
||
|
|
return "laptop"
|
||
|
|
case "mobile":
|
||
|
|
return "mobile"
|
||
|
|
case "key":
|
||
|
|
return "key"
|
||
|
|
case "desktop":
|
||
|
|
return "desktop"
|
||
|
|
default:
|
||
|
|
return "laptop"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func OAuthTab(oauth models.OAuthSettings) 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_Var26 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var26 == nil {
|
||
|
|
templ_7745c5c3_Var26 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "<div class=\"wa-stack wa-gap-xl\"><div class=\"wa-flank\"><div class=\"wa-stack wa-gap-2xs\"><span class=\"wa-heading-m\">OAuth Settings</span> <span class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500);\">Configure your identity provider settings</span></div></div><div class=\"form-section\"><div class=\"form-row\"><div class=\"form-label\"><span class=\"wa-heading-s\">Default Scopes</span><p class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500); margin: var(--wa-space-2xs) 0 0;\">Permissions granted by default</p></div><div class=\"wa-stack wa-gap-s\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
for _, scope := range oauth.DefaultScopes {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "<wa-checkbox")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if scope.Enabled {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, " checked")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if scope.Required {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, " disabled")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "><div class=\"wa-stack wa-gap-0\"><span>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var27 string
|
||
|
|
templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(scope.Name)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 305, Col: 26}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "</span> <span class=\"wa-caption-xs\" style=\"color: var(--wa-color-neutral-500);\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var28 string
|
||
|
|
templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(scope.Description)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 306, Col: 99}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "</span></div></wa-checkbox>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, "</div></div></div><div class=\"form-section\"><div class=\"form-row\"><div class=\"form-label\"><span class=\"wa-heading-s\">Session Duration</span><p class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500); margin: var(--wa-space-2xs) 0 0;\">How long OAuth sessions remain valid</p></div><wa-select value=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var29 string
|
||
|
|
templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(oauth.SessionDuration)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 319, Col: 44}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, "\"><wa-option value=\"1h\">1 hour</wa-option> <wa-option value=\"24h\">24 hours</wa-option> <wa-option value=\"7d\">7 days</wa-option> <wa-option value=\"30d\">30 days</wa-option> <wa-option value=\"never\">Never expire</wa-option></wa-select></div></div><div class=\"form-section\"><div class=\"form-row\"><div class=\"form-label\"><span class=\"wa-heading-s\">Consent Prompt</span><p class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500); margin: var(--wa-space-2xs) 0 0;\">When to show permission dialogs</p></div><wa-radio-group value=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var30 string
|
||
|
|
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(oauth.ConsentPrompt)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 334, Col: 47}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "\"><wa-radio value=\"always\">Always prompt for consent</wa-radio> <wa-radio value=\"first\">Only on first connection</wa-radio> <wa-radio value=\"scope\">When new scopes requested</wa-radio></wa-radio-group></div></div><wa-divider></wa-divider><div class=\"wa-stack wa-gap-m\"><div class=\"wa-flank\"><span class=\"wa-heading-m\">Authorized Clients</span> <wa-button size=\"small\" variant=\"neutral\" appearance=\"outlined\">View All</wa-button></div><div class=\"wa-stack wa-gap-s\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
for _, client := range oauth.Clients {
|
||
|
|
templ_7745c5c3_Err = AuthorizedClientCard(client).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "</div></div><div class=\"wa-cluster wa-gap-s\" style=\"justify-content: flex-end;\"><wa-button variant=\"neutral\" appearance=\"outlined\">Cancel</wa-button> <wa-button variant=\"brand\">Save Changes</wa-button></div></div>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func AuthorizedClientCard(client models.AuthorizedClient) 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_Var31 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var31 == nil {
|
||
|
|
templ_7745c5c3_Var31 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "<div class=\"oauth-client-card\"><div class=\"wa-flank\"><div class=\"wa-cluster wa-gap-m\"><wa-avatar initials=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var32 string
|
||
|
|
templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(client.Initials)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 364, Col: 41}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "\" style=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var33 string
|
||
|
|
templ_7745c5c3_Var33, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues("--size: 40px; background: " + client.Color + ";")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 364, Col: 101}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "\"></wa-avatar><div class=\"wa-stack wa-gap-0\"><span class=\"wa-heading-s\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var34 string
|
||
|
|
templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(client.Name)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 366, Col: 45}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "</span> <span class=\"wa-caption-xs\" style=\"color: var(--wa-color-neutral-500);\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var35 string
|
||
|
|
templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(client.Domain)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 367, Col: 92}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, "</span></div></div><div class=\"wa-cluster wa-gap-s\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if client.Status == "active" {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "<wa-badge variant=\"success\" pill>Active</wa-badge> ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, "<wa-badge variant=\"neutral\" pill>Idle</wa-badge> ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 72, "<wa-button size=\"small\" variant=\"danger\" appearance=\"plain\" hx-post=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var36 string
|
||
|
|
templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs("/api/oauth/clients/" + client.ID + "/revoke")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 376, Col: 119}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 73, "\" hx-swap=\"none\">Revoke</wa-button></div></div></div>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func NotificationsTab(prefs models.NotificationPrefs) 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_Var37 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var37 == nil {
|
||
|
|
templ_7745c5c3_Var37 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 74, "<div class=\"wa-stack wa-gap-xl\"><div class=\"wa-stack wa-gap-2xs\"><span class=\"wa-heading-m\">Notification Preferences</span> <span class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500);\">Choose how and when you receive notifications</span></div><wa-card><span slot=\"header\" class=\"wa-heading-s\">Security Alerts</span><div class=\"wa-stack\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
for _, item := range prefs.SecurityAlerts {
|
||
|
|
templ_7745c5c3_Err = NotificationRow(item).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 75, "</div></wa-card> <wa-card><span slot=\"header\" class=\"wa-heading-s\">Transaction Notifications</span><div class=\"wa-stack\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
for _, item := range prefs.Transactions {
|
||
|
|
templ_7745c5c3_Err = NotificationRow(item).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 76, "</div></wa-card> <wa-card><span slot=\"header\" class=\"wa-heading-s\">App Notifications</span><div class=\"wa-stack\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
for _, item := range prefs.Apps {
|
||
|
|
templ_7745c5c3_Err = NotificationRow(item).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 77, "</div></wa-card> <wa-card><span slot=\"header\" class=\"wa-heading-s\">Marketing & Updates</span><div class=\"wa-stack\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
for _, item := range prefs.Marketing {
|
||
|
|
templ_7745c5c3_Err = NotificationRow(item).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 78, "</div></wa-card><div class=\"wa-cluster wa-gap-s\" style=\"justify-content: flex-end;\"><wa-button variant=\"brand\" hx-post=\"/api/settings/notifications\" hx-swap=\"none\">Save Preferences</wa-button></div></div>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func NotificationRow(item models.NotificationItem) 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_Var38 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var38 == nil {
|
||
|
|
templ_7745c5c3_Var38 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 79, "<div class=\"notification-row\"><div class=\"wa-stack wa-gap-0\"><span class=\"wa-heading-xs\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var39 string
|
||
|
|
templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs(item.Title)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 429, Col: 43}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 80, "</span> <span class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500);\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var40 string
|
||
|
|
templ_7745c5c3_Var40, templ_7745c5c3_Err = templ.JoinStringErrs(item.Description)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 430, Col: 92}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var40))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 81, "</span></div>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if item.Threshold > 0 {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 82, "<div class=\"wa-cluster wa-gap-s\"><wa-input type=\"number\" value=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var41 string
|
||
|
|
templ_7745c5c3_Var41, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(item.Threshold))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 434, Col: 56}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 83, "\" size=\"small\" style=\"width: 100px;\"><span slot=\"suffix\">USD</span></wa-input> <wa-switch")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if item.Enabled {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 84, " checked")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 85, " hx-post=\"/api/settings/notifications\" hx-vals=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var42 string
|
||
|
|
templ_7745c5c3_Var42, templ_7745c5c3_Err = templ.JoinStringErrs(`{"key":"` + item.Key + `"}`)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 437, Col: 117}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var42))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 86, "\" hx-swap=\"none\"></wa-switch></div>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 87, "<wa-switch")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if item.Enabled {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 88, " checked")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 89, " hx-post=\"/api/settings/notifications\" hx-vals=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var43 string
|
||
|
|
templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(`{"key":"` + item.Key + `"}`)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 440, Col: 116}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 90, "\" hx-swap=\"none\"></wa-switch>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 91, "</div>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func EmailsTab(emails []models.Email) 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_Var44 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var44 == nil {
|
||
|
|
templ_7745c5c3_Var44 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 92, "<div class=\"wa-stack wa-gap-xl\"><div class=\"wa-flank\"><div class=\"wa-stack wa-gap-2xs\"><span class=\"wa-heading-m\">Email Addresses</span> <span class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500);\">Manage email addresses linked to your account</span></div><wa-button size=\"small\" variant=\"brand\" id=\"add-email-btn\"><wa-icon slot=\"start\" name=\"plus\"></wa-icon> Add Email</wa-button></div><div class=\"wa-stack wa-gap-m\" id=\"emails-list\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
for _, email := range emails {
|
||
|
|
templ_7745c5c3_Err = EmailItem(email).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 93, "</div><wa-callout variant=\"neutral\"><wa-icon slot=\"icon\" name=\"circle-info\"></wa-icon> <span class=\"wa-caption-s\">Your primary email is used for account recovery and important notifications. You must have at least one verified email.</span></wa-callout></div>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func EmailItem(email models.Email) 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_Var45 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var45 == nil {
|
||
|
|
templ_7745c5c3_Var45 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 94, "<div class=\"contact-item\" id=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var46 string
|
||
|
|
templ_7745c5c3_Var46, templ_7745c5c3_Err = templ.JoinStringErrs("email-" + email.ID)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 470, Col: 51}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var46))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 95, "\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if email.IsVerified {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 96, "<wa-icon name=\"envelope\" style=\"font-size: 20px; color: var(--wa-color-neutral-500);\"></wa-icon>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 97, "<wa-icon name=\"envelope\" style=\"font-size: 20px; color: var(--wa-color-warning);\"></wa-icon>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 98, "<div class=\"wa-stack wa-gap-0\" style=\"flex: 1;\"><div class=\"wa-cluster wa-gap-xs\"><span class=\"wa-heading-s\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var47 string
|
||
|
|
templ_7745c5c3_Var47, templ_7745c5c3_Err = templ.JoinStringErrs(email.Address)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 478, Col: 46}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var47))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 99, "</span> ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if email.IsPrimary {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 100, "<wa-badge variant=\"success\" pill>Primary</wa-badge> ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if email.IsVerified {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 101, "<wa-badge variant=\"brand\" pill>Verified</wa-badge>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 102, "<wa-badge variant=\"warning\" pill>Pending</wa-badge>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 103, "</div>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if email.IsVerified {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 104, "<span class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500);\">Added ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var48 string
|
||
|
|
templ_7745c5c3_Var48, templ_7745c5c3_Err = templ.JoinStringErrs(formatDate(email.AddedAt))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 489, Col: 108}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var48))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 105, "</span>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 106, "<span class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500);\">Verification sent - check your inbox</span>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 107, "</div><wa-dropdown><wa-icon-button slot=\"trigger\" name=\"ellipsis-vertical\" label=\"Options\"></wa-icon-button> <wa-dropdown-item")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if email.IsPrimary {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 108, " disabled")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 109, "><wa-icon slot=\"icon\" name=\"star\"></wa-icon> Set as Primary</wa-dropdown-item> <wa-dropdown-item hx-post=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var49 string
|
||
|
|
templ_7745c5c3_Var49, templ_7745c5c3_Err = templ.JoinStringErrs("/api/settings/emails/" + email.ID + "/resend")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 500, Col: 77}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var49))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 110, "\" hx-swap=\"none\"><wa-icon slot=\"icon\" name=\"paper-plane\"></wa-icon> Resend Verification</wa-dropdown-item> <wa-divider></wa-divider> <wa-dropdown-item")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if email.IsPrimary {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 111, " disabled")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 112, " style=\"color: var(--wa-color-danger);\" hx-delete=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var50 string
|
||
|
|
templ_7745c5c3_Var50, templ_7745c5c3_Err = templ.JoinStringErrs("/api/settings/emails/" + email.ID)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 508, Col: 50}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var50))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 113, "\" hx-target=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var51 string
|
||
|
|
templ_7745c5c3_Var51, templ_7745c5c3_Err = templ.JoinStringErrs("#email-" + email.ID)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 509, Col: 36}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var51))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 114, "\" hx-swap=\"delete\"><wa-icon slot=\"icon\" name=\"trash\"></wa-icon> Remove</wa-dropdown-item></wa-dropdown></div>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func PhonesTab(phones []models.Phone, smsSettings models.SMSSettings) 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_Var52 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var52 == nil {
|
||
|
|
templ_7745c5c3_Var52 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 115, "<div class=\"wa-stack wa-gap-xl\"><div class=\"wa-flank\"><div class=\"wa-stack wa-gap-2xs\"><span class=\"wa-heading-m\">Phone Numbers</span> <span class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500);\">Manage phone numbers for 2FA and recovery</span></div><wa-button size=\"small\" variant=\"brand\" id=\"add-phone-btn\"><wa-icon slot=\"start\" name=\"plus\"></wa-icon> Add Phone</wa-button></div><div class=\"wa-stack wa-gap-m\" id=\"phones-list\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
for _, phone := range phones {
|
||
|
|
templ_7745c5c3_Err = PhoneItem(phone).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 116, "</div><wa-card><span slot=\"header\" class=\"wa-heading-s\">SMS Authentication</span><div class=\"wa-stack\"><div class=\"notification-row\"><div class=\"wa-stack wa-gap-0\"><span class=\"wa-heading-xs\">Enable SMS 2FA</span> <span class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500);\">Receive codes via SMS for high-risk actions</span></div><wa-switch")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if smsSettings.Enabled {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 117, " checked")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 118, "></wa-switch></div><div class=\"notification-row\"><div class=\"wa-stack wa-gap-0\"><span class=\"wa-heading-xs\">SMS recovery codes</span> <span class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500);\">Allow account recovery via SMS</span></div><wa-switch")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if smsSettings.RecoveryCodes {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 119, " checked")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 120, "></wa-switch></div></div></wa-card> <wa-callout variant=\"warning\"><wa-icon slot=\"icon\" name=\"triangle-alert\"></wa-icon><div class=\"wa-stack wa-gap-2xs\"><span class=\"wa-heading-xs\">SMS Security Notice</span> <span class=\"wa-caption-s\">SMS-based authentication is less secure than passkeys. We recommend using passkeys as your primary authentication method.</span></div></wa-callout></div>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func PhoneItem(phone models.Phone) 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_Var53 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var53 == nil {
|
||
|
|
templ_7745c5c3_Var53 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 121, "<div class=\"contact-item\" id=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var54 string
|
||
|
|
templ_7745c5c3_Var54, templ_7745c5c3_Err = templ.JoinStringErrs("phone-" + phone.ID)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 566, Col: 51}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var54))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 122, "\"><wa-icon name=\"phone\" style=\"font-size: 20px; color: var(--wa-color-neutral-500);\"></wa-icon><div class=\"wa-stack wa-gap-0\" style=\"flex: 1;\"><div class=\"wa-cluster wa-gap-xs\"><span class=\"wa-heading-s\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var55 string
|
||
|
|
templ_7745c5c3_Var55, templ_7745c5c3_Err = templ.JoinStringErrs(phone.Number)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 570, Col: 45}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var55))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 123, "</span> ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if phone.IsPrimary {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 124, "<wa-badge variant=\"success\" pill>Primary</wa-badge> ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if phone.IsVerified {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 125, "<wa-badge variant=\"brand\" pill>Verified</wa-badge>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 126, "</div><span class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500);\">Added ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var56 string
|
||
|
|
templ_7745c5c3_Var56, templ_7745c5c3_Err = templ.JoinStringErrs(formatDate(phone.AddedAt))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 579, Col: 37}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var56))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 127, " ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if phone.Use2FA {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 128, "- Used for 2FA")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 129, "</span></div><wa-dropdown><wa-icon-button slot=\"trigger\" name=\"ellipsis-vertical\" label=\"Options\"></wa-icon-button> <wa-dropdown-item")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if phone.IsPrimary {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 130, " disabled")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 131, "><wa-icon slot=\"icon\" name=\"star\"></wa-icon> Set as Primary</wa-dropdown-item> <wa-dropdown-item hx-post=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var57 string
|
||
|
|
templ_7745c5c3_Var57, templ_7745c5c3_Err = templ.JoinStringErrs("/api/settings/phones/" + phone.ID + "/test")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 591, Col: 75}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var57))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 132, "\" hx-swap=\"none\"><wa-icon slot=\"icon\" name=\"message\"></wa-icon> Send Test SMS</wa-dropdown-item> <wa-divider></wa-divider> <wa-dropdown-item")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if phone.IsPrimary {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 133, " disabled")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 134, " style=\"color: var(--wa-color-danger);\" hx-delete=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var58 string
|
||
|
|
templ_7745c5c3_Var58, templ_7745c5c3_Err = templ.JoinStringErrs("/api/settings/phones/" + phone.ID)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 599, Col: 50}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var58))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 135, "\" hx-target=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var59 string
|
||
|
|
templ_7745c5c3_Var59, templ_7745c5c3_Err = templ.JoinStringErrs("#phone-" + phone.ID)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 600, Col: 36}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var59))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 136, "\" hx-swap=\"delete\"><wa-icon slot=\"icon\" name=\"trash\"></wa-icon> Remove</wa-dropdown-item></wa-dropdown></div>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func DeveloperTab(dev models.DeveloperSettings) 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_Var60 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var60 == nil {
|
||
|
|
templ_7745c5c3_Var60 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 137, "<div class=\"wa-stack wa-gap-xl\"><div class=\"wa-stack wa-gap-2xs\"><span class=\"wa-heading-m\">Developer Settings</span> <span class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500);\">API access and integration options</span></div><wa-card><div slot=\"header\" class=\"wa-flank\"><span class=\"wa-heading-s\">API Keys</span> <wa-button size=\"small\" variant=\"neutral\" appearance=\"outlined\" id=\"generate-key-btn\"><wa-icon slot=\"start\" name=\"plus\"></wa-icon> Generate Key</wa-button></div><div class=\"wa-stack wa-gap-m\" id=\"api-keys-list\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
for _, key := range dev.APIKeys {
|
||
|
|
templ_7745c5c3_Err = APIKeyCard(key).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 138, "</div></wa-card> <wa-card><div slot=\"header\" class=\"wa-flank\"><span class=\"wa-heading-s\">Webhooks</span> <wa-button size=\"small\" variant=\"neutral\" appearance=\"outlined\" id=\"add-webhook-btn\"><wa-icon slot=\"start\" name=\"plus\"></wa-icon> Add Endpoint</wa-button></div><div class=\"wa-stack wa-gap-m\" id=\"webhooks-list\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
for _, wh := range dev.Webhooks {
|
||
|
|
templ_7745c5c3_Err = WebhookCard(wh).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 139, "</div></wa-card>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = OAuthAppConfigCard(dev.OAuthApp).Render(ctx, templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 140, "<wa-card><span slot=\"header\" class=\"wa-heading-s\">Developer Mode</span><div class=\"wa-stack\"><div class=\"notification-row\"><div class=\"wa-stack wa-gap-0\"><span class=\"wa-heading-xs\">Enable debug logging</span> <span class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500);\">Log detailed API requests and responses</span></div><wa-switch")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if dev.DebugMode {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 141, " checked")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 142, "></wa-switch></div><div class=\"notification-row\"><div class=\"wa-stack wa-gap-0\"><span class=\"wa-heading-xs\">Test mode</span> <span class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500);\">Use testnet for all transactions</span></div><wa-switch")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if dev.TestMode {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 143, " checked")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 144, "></wa-switch></div><div class=\"notification-row\"><div class=\"wa-stack wa-gap-0\"><span class=\"wa-heading-xs\">Show raw responses</span> <span class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500);\">Display JSON in UI for debugging</span></div><wa-switch")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if dev.ShowRaw {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 145, " checked")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 146, "></wa-switch></div></div></wa-card> <wa-callout variant=\"neutral\"><wa-icon slot=\"icon\" name=\"book\"></wa-icon><div class=\"wa-stack wa-gap-2xs\"><span class=\"wa-heading-xs\">API Documentation</span> <span class=\"wa-caption-s\">View our <a href=\"#\" style=\"color: var(--wa-color-primary);\">API reference</a> and <a href=\"#\" style=\"color: var(--wa-color-primary);\">integration guides</a> to get started.</span></div></wa-callout><div class=\"wa-cluster wa-gap-s\" style=\"justify-content: flex-end;\"><wa-button variant=\"neutral\" appearance=\"outlined\">Cancel</wa-button> <wa-button variant=\"brand\">Save Changes</wa-button></div></div>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func APIKeyCard(key models.APIKey) 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_Var61 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var61 == nil {
|
||
|
|
templ_7745c5c3_Var61 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 147, "<div class=\"wa-stack wa-gap-s\"><div class=\"wa-flank\"><div class=\"wa-stack wa-gap-0\"><span class=\"wa-heading-xs\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var62 string
|
||
|
|
templ_7745c5c3_Var62, templ_7745c5c3_Err = templ.JoinStringErrs(key.Name)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 692, Col: 42}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var62))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 148, "</span> <span class=\"wa-caption-xs\" style=\"color: var(--wa-color-neutral-500);\">Created ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var63 string
|
||
|
|
templ_7745c5c3_Var63, templ_7745c5c3_Err = templ.JoinStringErrs(formatDate(key.CreatedAt))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 693, Col: 111}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var63))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 149, "</span></div>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if key.Environment == "live" {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 150, "<wa-badge variant=\"success\" pill>Active</wa-badge>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 151, "<wa-badge variant=\"neutral\" pill>Test Mode</wa-badge>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 152, "</div><div class=\"api-key-display\"><span>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var64 string
|
||
|
|
templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(key.KeyPreview)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 702, Col: 25}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var64))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 153, "</span> <wa-copy-button value=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var65 string
|
||
|
|
templ_7745c5c3_Var65, templ_7745c5c3_Err = templ.JoinStringErrs(key.KeyFull)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 703, Col: 38}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var65))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 154, "\"></wa-copy-button> <wa-tooltip content=\"Reveal key\"><wa-icon-button name=\"eye\" label=\"Reveal\"></wa-icon-button></wa-tooltip></div></div>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func WebhookCard(wh models.Webhook) 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_Var66 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var66 == nil {
|
||
|
|
templ_7745c5c3_Var66 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 155, "<div class=\"webhook-item\"><div class=\"wa-flank\"><div class=\"wa-stack wa-gap-0\"><div class=\"wa-cluster wa-gap-xs\"><span class=\"wa-heading-xs\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var67 string
|
||
|
|
templ_7745c5c3_Var67, templ_7745c5c3_Err = templ.JoinStringErrs(wh.URL)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 716, Col: 41}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var67))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 156, "</span> ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if wh.Status == "active" {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 157, "<wa-badge variant=\"success\" pill>Active</wa-badge>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 158, "<wa-badge variant=\"warning\" pill>Failing</wa-badge>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 159, "</div>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
if wh.Status == "failing" {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 160, "<span class=\"wa-caption-xs\" style=\"color: var(--wa-color-danger);\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var68 string
|
||
|
|
templ_7745c5c3_Var68, templ_7745c5c3_Err = templ.JoinStringErrs(formatEvents(wh.Events))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 724, Col: 97}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var68))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 161, " events - ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var69 string
|
||
|
|
templ_7745c5c3_Var69, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(wh.FailureCount))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 724, Col: 132}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var69))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 162, " failures in last hour</span>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 163, "<span class=\"wa-caption-xs\" style=\"color: var(--wa-color-neutral-500);\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var70 string
|
||
|
|
templ_7745c5c3_Var70, templ_7745c5c3_Err = templ.JoinStringErrs(formatEvents(wh.Events))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 726, Col: 102}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var70))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 164, " events - Last triggered ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var71 string
|
||
|
|
templ_7745c5c3_Var71, templ_7745c5c3_Err = templ.JoinStringErrs(formatRelativeTime(wh.LastTriggered))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 726, Col: 167}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var71))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 165, "</span>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 166, "</div><wa-dropdown><wa-icon-button slot=\"trigger\" name=\"ellipsis-vertical\" label=\"Options\"></wa-icon-button> <wa-dropdown-item><wa-icon slot=\"icon\" name=\"pen\"></wa-icon> Edit</wa-dropdown-item> <wa-dropdown-item hx-post=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var72 string
|
||
|
|
templ_7745c5c3_Var72, templ_7745c5c3_Err = templ.JoinStringErrs("/api/webhooks/" + wh.ID + "/test")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 735, Col: 66}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var72))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 167, "\" hx-swap=\"none\"><wa-icon slot=\"icon\" name=\"paper-plane\"></wa-icon> Send Test</wa-dropdown-item> <wa-dropdown-item><wa-icon slot=\"icon\" name=\"clock-rotate-left\"></wa-icon> View Logs</wa-dropdown-item> <wa-divider></wa-divider> <wa-dropdown-item style=\"color: var(--wa-color-danger);\" hx-delete=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var73 string
|
||
|
|
templ_7745c5c3_Var73, templ_7745c5c3_Err = templ.JoinStringErrs("/api/webhooks/" + wh.ID)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 744, Col: 97}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var73))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 168, "\" hx-target=\"closest .webhook-item\" hx-swap=\"delete\"><wa-icon slot=\"icon\" name=\"trash\"></wa-icon> Delete</wa-dropdown-item></wa-dropdown></div></div>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func OAuthAppConfigCard(config models.OAuthAppConfig) 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_Var74 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var74 == nil {
|
||
|
|
templ_7745c5c3_Var74 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 169, "<wa-card><span slot=\"header\" class=\"wa-heading-s\">OAuth Application</span><div class=\"wa-stack wa-gap-l\"><div class=\"form-row\" style=\"grid-template-columns: 140px 1fr;\"><span class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500);\">Client ID</span><div class=\"wa-cluster wa-gap-s\"><code style=\"font-family: var(--wa-font-mono); font-size: var(--wa-font-size-s);\">")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var75 string
|
||
|
|
templ_7745c5c3_Var75, templ_7745c5c3_Err = templ.JoinStringErrs(config.ClientID)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 760, Col: 104}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var75))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 170, "</code> <wa-copy-button value=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var76 string
|
||
|
|
templ_7745c5c3_Var76, templ_7745c5c3_Err = templ.JoinStringErrs(config.ClientID)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 761, Col: 44}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var76))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 171, "\"></wa-copy-button></div></div><div class=\"form-row\" style=\"grid-template-columns: 140px 1fr;\"><span class=\"wa-caption-s\" style=\"color: var(--wa-color-neutral-500);\">Client Secret</span><div class=\"wa-cluster wa-gap-s\"><code style=\"font-family: var(--wa-font-mono); font-size: var(--wa-font-size-s);\">••••••••••••••••</code> <wa-copy-button value=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var77 string
|
||
|
|
templ_7745c5c3_Var77, templ_7745c5c3_Err = templ.JoinStringErrs(config.ClientSecret)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 768, Col: 48}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var77))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 172, "\"></wa-copy-button> <wa-button size=\"small\" appearance=\"plain\">Regenerate</wa-button></div></div><wa-divider></wa-divider><div class=\"wa-stack wa-gap-s\"><span class=\"wa-heading-xs\">Redirect URIs</span> ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
for _, uri := range config.RedirectURIs {
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 173, "<wa-input value=\"")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
var templ_7745c5c3_Var78 string
|
||
|
|
templ_7745c5c3_Var78, templ_7745c5c3_Err = templ.JoinStringErrs(uri)
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/settings.templ`, Line: 776, Col: 26}
|
||
|
|
}
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var78))
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 174, "\" placeholder=\"https://example.com/callback\"><wa-icon-button slot=\"suffix\" name=\"trash\" label=\"Remove\"></wa-icon-button></wa-input> ")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 175, "<wa-button size=\"small\" appearance=\"plain\"><wa-icon slot=\"start\" name=\"plus\"></wa-icon> Add URI</wa-button></div></div></wa-card>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func AddEmailDialog() 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_Var79 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var79 == nil {
|
||
|
|
templ_7745c5c3_Var79 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 176, "<wa-dialog label=\"Add Email Address\" id=\"add-email-dialog\" style=\"--width: 420px;\"><div class=\"wa-stack wa-gap-l\"><wa-input type=\"email\" label=\"Email Address\" placeholder=\"you@example.com\" autofocus name=\"email\"><wa-icon slot=\"prefix\" name=\"envelope\"></wa-icon></wa-input> <wa-callout variant=\"neutral\"><wa-icon slot=\"icon\" name=\"circle-info\"></wa-icon> <span class=\"wa-caption-s\">We'll send a verification link to this address.</span></wa-callout></div><div slot=\"footer\" class=\"wa-cluster wa-gap-s\" style=\"justify-content: flex-end; width: 100%;\"><wa-button variant=\"neutral\" appearance=\"outlined\" data-dialog=\"close\">Cancel</wa-button> <wa-button variant=\"brand\" hx-post=\"/api/settings/emails\" hx-target=\"#emails-list\" hx-swap=\"beforeend\">Send Verification</wa-button></div></wa-dialog>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func AddPhoneDialog() 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_Var80 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var80 == nil {
|
||
|
|
templ_7745c5c3_Var80 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 177, "<wa-dialog label=\"Add Phone Number\" id=\"add-phone-dialog\" style=\"--width: 420px;\"><div class=\"wa-stack wa-gap-l\"><div class=\"wa-cluster wa-gap-s\"><wa-select value=\"+1\" style=\"width: 100px;\" name=\"country-code\"><wa-option value=\"+1\">+1</wa-option> <wa-option value=\"+44\">+44</wa-option> <wa-option value=\"+49\">+49</wa-option> <wa-option value=\"+33\">+33</wa-option> <wa-option value=\"+81\">+81</wa-option></wa-select> <wa-input type=\"tel\" label=\"Phone Number\" placeholder=\"(555) 123-4567\" style=\"flex: 1;\" name=\"phone\"><wa-icon slot=\"prefix\" name=\"phone\"></wa-icon></wa-input></div><wa-callout variant=\"neutral\"><wa-icon slot=\"icon\" name=\"circle-info\"></wa-icon> <span class=\"wa-caption-s\">We'll send a verification code via SMS.</span></wa-callout></div><div slot=\"footer\" class=\"wa-cluster wa-gap-s\" style=\"justify-content: flex-end; width: 100%;\"><wa-button variant=\"neutral\" appearance=\"outlined\" data-dialog=\"close\">Cancel</wa-button> <wa-button variant=\"brand\" hx-post=\"/api/settings/phones\" hx-target=\"#phones-list\" hx-swap=\"beforeend\">Send Code</wa-button></div></wa-dialog>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func AddDeviceDialog() 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_Var81 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var81 == nil {
|
||
|
|
templ_7745c5c3_Var81 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 178, "<wa-dialog label=\"Add Device\" id=\"add-device-dialog\" style=\"--width: 480px;\"><div class=\"wa-stack wa-gap-l\" style=\"text-align: center;\"><wa-icon name=\"fingerprint\" style=\"font-size: 64px; color: var(--wa-color-primary);\"></wa-icon><div class=\"wa-stack wa-gap-xs\"><span class=\"wa-heading-m\">Register a Passkey</span> <span class=\"wa-caption-m\" style=\"color: var(--wa-color-neutral-500);\">Use your device's built-in authenticator (Face ID, Touch ID, Windows Hello) or a security key.</span></div><wa-button variant=\"brand\" size=\"large\" style=\"width: 100%;\" id=\"register-passkey-btn\"><wa-icon slot=\"start\" name=\"plus\"></wa-icon> Register Device</wa-button> <wa-divider>or</wa-divider> <wa-button variant=\"neutral\" appearance=\"outlined\" style=\"width: 100%;\" id=\"register-security-key-btn\"><wa-icon slot=\"start\" name=\"key\"></wa-icon> Use Security Key</wa-button></div><div slot=\"footer\" class=\"wa-cluster\" style=\"justify-content: center; width: 100%;\"><wa-button variant=\"neutral\" appearance=\"plain\" data-dialog=\"close\">Cancel</wa-button></div></wa-dialog>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func GenerateKeyDialog() 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_Var82 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var82 == nil {
|
||
|
|
templ_7745c5c3_Var82 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 179, "<wa-dialog label=\"Generate API Key\" id=\"generate-key-dialog\" style=\"--width: 420px;\"><div class=\"wa-stack wa-gap-l\"><wa-input label=\"Key Name\" placeholder=\"e.g., Production Server\" autofocus name=\"key-name\"><wa-icon slot=\"prefix\" name=\"tag\"></wa-icon></wa-input> <wa-select label=\"Environment\" value=\"test\" name=\"key-env\"><wa-option value=\"test\">Test Mode</wa-option> <wa-option value=\"live\">Production</wa-option></wa-select> <wa-select label=\"Permissions\" value=\"full\" name=\"key-perms\"><wa-option value=\"full\">Full Access</wa-option> <wa-option value=\"read\">Read Only</wa-option> <wa-option value=\"write\">Write Only</wa-option></wa-select> <wa-callout variant=\"warning\"><wa-icon slot=\"icon\" name=\"triangle-alert\"></wa-icon> <span class=\"wa-caption-s\">Your secret key will only be shown once. Store it securely.</span></wa-callout></div><div slot=\"footer\" class=\"wa-cluster wa-gap-s\" style=\"justify-content: flex-end; width: 100%;\"><wa-button variant=\"neutral\" appearance=\"outlined\" data-dialog=\"close\">Cancel</wa-button> <wa-button variant=\"brand\" hx-post=\"/api/settings/api-keys\" hx-target=\"#api-keys-list\" hx-swap=\"beforeend\">Generate Key</wa-button></div></wa-dialog>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func AddWebhookDialog() 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_Var83 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var83 == nil {
|
||
|
|
templ_7745c5c3_Var83 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 180, "<wa-dialog label=\"Add Webhook Endpoint\" id=\"add-webhook-dialog\" style=\"--width: 480px;\"><div class=\"wa-stack wa-gap-l\"><wa-input label=\"Endpoint URL\" placeholder=\"https://api.example.com/webhooks\" type=\"url\" name=\"webhook-url\"><wa-icon slot=\"prefix\" name=\"globe\"></wa-icon></wa-input> <wa-input label=\"Description\" placeholder=\"Optional description\" name=\"webhook-desc\"><wa-icon slot=\"prefix\" name=\"align-left\"></wa-icon></wa-input><div class=\"wa-stack wa-gap-s\"><span class=\"wa-heading-xs\">Events to Subscribe</span> <wa-checkbox checked name=\"webhook-event-tx\"><div class=\"wa-stack wa-gap-0\"><span>transaction.*</span> <span class=\"wa-caption-xs\" style=\"color: var(--wa-color-neutral-500);\">All transaction events</span></div></wa-checkbox> <wa-checkbox checked name=\"webhook-event-conn\"><div class=\"wa-stack wa-gap-0\"><span>connection.*</span> <span class=\"wa-caption-xs\" style=\"color: var(--wa-color-neutral-500);\">App connection events</span></div></wa-checkbox> <wa-checkbox name=\"webhook-event-sig\"><div class=\"wa-stack wa-gap-0\"><span>signature.*</span> <span class=\"wa-caption-xs\" style=\"color: var(--wa-color-neutral-500);\">Signature request events</span></div></wa-checkbox> <wa-checkbox name=\"webhook-event-acct\"><div class=\"wa-stack wa-gap-0\"><span>account.*</span> <span class=\"wa-caption-xs\" style=\"color: var(--wa-color-neutral-500);\">Account update events</span></div></wa-checkbox></div></div><div slot=\"footer\" class=\"wa-cluster wa-gap-s\" style=\"justify-content: flex-end; width: 100%;\"><wa-button variant=\"neutral\" appearance=\"outlined\" data-dialog=\"close\">Cancel</wa-button> <wa-button variant=\"brand\" hx-post=\"/api/settings/webhooks\" hx-target=\"#webhooks-list\" hx-swap=\"beforeend\">Create Webhook</wa-button></div></wa-dialog>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func itoa(i int) string {
|
||
|
|
return strconv.Itoa(i)
|
||
|
|
}
|
||
|
|
|
||
|
|
func formatDate(t time.Time) string {
|
||
|
|
return t.Format("Jan 2, 2006")
|
||
|
|
}
|
||
|
|
|
||
|
|
func formatRelativeTime(t time.Time) string {
|
||
|
|
diff := time.Since(t)
|
||
|
|
if diff < time.Minute {
|
||
|
|
return "Just now"
|
||
|
|
}
|
||
|
|
if diff < time.Hour {
|
||
|
|
mins := int(diff.Minutes())
|
||
|
|
if mins == 1 {
|
||
|
|
return "1 minute ago"
|
||
|
|
}
|
||
|
|
return strconv.Itoa(mins) + " minutes ago"
|
||
|
|
}
|
||
|
|
if diff < 24*time.Hour {
|
||
|
|
hours := int(diff.Hours())
|
||
|
|
if hours == 1 {
|
||
|
|
return "1 hour ago"
|
||
|
|
}
|
||
|
|
return strconv.Itoa(hours) + " hours ago"
|
||
|
|
}
|
||
|
|
days := int(diff.Hours() / 24)
|
||
|
|
if days == 1 {
|
||
|
|
return "1 day ago"
|
||
|
|
}
|
||
|
|
if days < 14 {
|
||
|
|
return strconv.Itoa(days) + " days ago"
|
||
|
|
}
|
||
|
|
weeks := days / 7
|
||
|
|
if weeks == 1 {
|
||
|
|
return "1 week ago"
|
||
|
|
}
|
||
|
|
return strconv.Itoa(weeks) + " weeks ago"
|
||
|
|
}
|
||
|
|
|
||
|
|
func formatEvents(events []string) string {
|
||
|
|
if len(events) == 1 && events[0] == "*" {
|
||
|
|
return "All"
|
||
|
|
}
|
||
|
|
return strings.Join(events, ", ")
|
||
|
|
}
|
||
|
|
|
||
|
|
func settingsStyles() 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_Var84 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var84 == nil {
|
||
|
|
templ_7745c5c3_Var84 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 181, "<style>\n\t\t.page-header {\n\t\t\tmargin-bottom: var(--wa-space-xl);\n\t\t}\n\t\t.settings-container {\n\t\t\tbackground: var(--wa-color-surface);\n\t\t\tborder-radius: var(--wa-radius-l);\n\t\t\toverflow: hidden;\n\t\t}\n\t\t.settings-tabs {\n\t\t\t--indicator-color: var(--wa-color-primary);\n\t\t}\n\t\t.settings-tabs wa-tab-panel {\n\t\t\tpadding: var(--wa-space-xl);\n\t\t}\n\t\t.settings-tabs wa-tab-group::part(base) {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t}\n\t\t.settings-tabs wa-tab-group::part(nav) {\n\t\t\tbackground: var(--wa-color-surface);\n\t\t\tborder-bottom: 1px solid var(--wa-color-neutral-200);\n\t\t\tpadding: 0 var(--wa-space-m);\n\t\t}\n\t\t.form-section {\n\t\t\tpadding: var(--wa-space-l) 0;\n\t\t\tborder-bottom: 1px solid var(--wa-color-neutral-100);\n\t\t}\n\t\t.form-section:first-child {\n\t\t\tpadding-top: 0;\n\t\t}\n\t\t.form-section:last-child {\n\t\t\tborder-bottom: none;\n\t\t\tpadding-bottom: 0;\n\t\t}\n\t\t.form-row {\n\t\t\tdisplay: grid;\n\t\t\tgrid-template-columns: 200px 1fr;\n\t\t\tgap: var(--wa-space-xl);\n\t\t\talign-items: start;\n\t\t}\n\t\t@media (max-width: 768px) {\n\t\t\t.form-row {\n\t\t\t\tgrid-template-columns: 1fr;\n\t\t\t\tgap: var(--wa-space-s);\n\t\t\t}\n\t\t}\n\t\t.form-label {\n\t\t\tpadding-top: var(--wa-space-xs);\n\t\t}\n\t\t.avatar-upload {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: var(--wa-space-l);\n\t\t}\n\t\t.avatar-upload wa-avatar {\n\t\t\t--size: 80px;\n\t\t}\n\t\t.device-item {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: var(--wa-space-m);\n\t\t\tpadding: var(--wa-space-m);\n\t\t\tbackground: var(--wa-color-surface-alt);\n\t\t\tborder-radius: var(--wa-radius-m);\n\t\t}\n\t\t.device-icon {\n\t\t\twidth: 48px;\n\t\t\theight: 48px;\n\t\t\tborder-radius: var(--wa-radius-m);\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tbackground: var(--wa-color-surface);\n\t\t\tborder: 1px solid var(--wa-color-neutral-200);\n\t\t}\n\t\t.device-info {\n\t\t\tflex: 1;\n\t\t}\n\t\t.contact-item {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: var(--wa-space-m);\n\t\t\tpadding: var(--wa-space-m);\n\t\t\tbackground: var(--wa-color-surface-alt);\n\t\t\tborder-radius: var(--wa-radius-m);\n\t\t}\n\t\t.api-key-display {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tgap: var(--wa-space-s);\n\t\t\tpadding: var(--wa-space-m);\n\t\t\tbackground: var(--wa-color-neutral-900);\n\t\t\tcolor: var(--wa-color-neutral-100);\n\t\t\tborder-radius: var(--wa-radius-m);\n\t\t\tfont-family: var(--wa-font-mono);\n\t\t\tfont-size: var(--wa-font-size-s);\n\t\t}\n\t\t.api-key-display span {\n\t\t\tflex: 1;\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t}\n\t\t.webhook-item {\n\t\t\tpadding: var(--wa-space-m);\n\t\t\tbackground: var(--wa-color-surface-alt);\n\t\t\tborder-radius: var(--wa-radius-m);\n\t\t}\n\t\t.notification-row {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: space-between;\n\t\t\tpadding: var(--wa-space-m) 0;\n\t\t\tborder-bottom: 1px solid var(--wa-color-neutral-100);\n\t\t}\n\t\t.notification-row:last-child {\n\t\t\tborder-bottom: none;\n\t\t}\n\t\t.oauth-client-card {\n\t\t\tpadding: var(--wa-space-m);\n\t\t\tbackground: var(--wa-color-surface-alt);\n\t\t\tborder-radius: var(--wa-radius-m);\n\t\t}\n\t</style>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
func settingsScripts() 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_Var85 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var85 == nil {
|
||
|
|
templ_7745c5c3_Var85 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 182, "<script>\n\t\t(function() {\n\t\t\tconst addEmailDialog = document.getElementById('add-email-dialog');\n\t\t\tconst addPhoneDialog = document.getElementById('add-phone-dialog');\n\t\t\tconst addDeviceDialog = document.getElementById('add-device-dialog');\n\t\t\tconst generateKeyDialog = document.getElementById('generate-key-dialog');\n\t\t\tconst addWebhookDialog = document.getElementById('add-webhook-dialog');\n\n\t\t\tdocument.getElementById('add-email-btn')?.addEventListener('click', () => {\n\t\t\t\taddEmailDialog.open = true;\n\t\t\t});\n\n\t\t\tdocument.getElementById('add-phone-btn')?.addEventListener('click', () => {\n\t\t\t\taddPhoneDialog.open = true;\n\t\t\t});\n\n\t\t\tdocument.getElementById('add-device-btn')?.addEventListener('click', () => {\n\t\t\t\taddDeviceDialog.open = true;\n\t\t\t});\n\n\t\t\tdocument.getElementById('generate-key-btn')?.addEventListener('click', () => {\n\t\t\t\tgenerateKeyDialog.open = true;\n\t\t\t});\n\n\t\t\tdocument.getElementById('add-webhook-btn')?.addEventListener('click', () => {\n\t\t\t\taddWebhookDialog.open = true;\n\t\t\t});\n\n\t\t\tdocument.querySelectorAll('[data-dialog=\"close\"]').forEach(btn => {\n\t\t\t\tbtn.addEventListener('click', () => {\n\t\t\t\t\tbtn.closest('wa-dialog').open = false;\n\t\t\t\t});\n\t\t\t});\n\t\t})();\n\t</script>")
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
var _ = templruntime.GeneratedTemplate
|