refactor(components): extract data models into shared models package

This commit is contained in:
2026-01-07 12:38:31 -05:00
parent cb580b48fd
commit c551a08641
13 changed files with 233 additions and 680 deletions

View File

@@ -1,50 +1,11 @@
package views
import "nebula/layouts"
import (
"nebula/layouts"
"nebula/models"
)
type AppInfo struct {
Name string
Domain string
LogoIcon string
Verified bool
}
type WalletInfo struct {
Name string
Address string
Balance string
}
type TokenAmount struct {
Symbol string
Amount string
USD string
Initials string
}
type TxDetails struct {
Type string
FromToken TokenAmount
ToToken TokenAmount
Network string
NetworkFee string
MaxFee string
Slippage string
Contract string
Function string
RawData string
}
type AuthRequest struct {
Type string
App AppInfo
Wallet WalletInfo
Message string
MessageHex string
Transaction *TxDetails
}
templ AuthorizePage(req AuthRequest) {
templ AuthorizePage(req models.AuthRequest) {
@layouts.CenteredCard("Authorize - Sonr") {
<div id="auth-content">
@AuthorizeContent(req)
@@ -55,7 +16,7 @@ templ AuthorizePage(req AuthRequest) {
}
}
templ AuthorizeContent(req AuthRequest) {
templ AuthorizeContent(req models.AuthRequest) {
@authorizeStyles()
@AppIdentityHeader(req.App)
<wa-divider></wa-divider>
@@ -65,7 +26,7 @@ templ AuthorizeContent(req AuthRequest) {
</footer>
}
templ AppIdentityHeader(app AppInfo) {
templ AppIdentityHeader(app models.AppInfo) {
<div class="app-identity">
<div class="app-logo">
<wa-icon name={ app.LogoIcon } style="font-size: 32px; color: var(--wa-color-primary);"></wa-icon>
@@ -82,7 +43,7 @@ templ AppIdentityHeader(app AppInfo) {
</div>
}
templ RequestTypeTabs(req AuthRequest) {
templ RequestTypeTabs(req models.AuthRequest) {
<wa-tab-group class="request-tabs" id="auth-tabs">
<wa-tab panel="connect" if req.Type == "connect" || req.Type == "" {
active?={ true }
@@ -121,7 +82,7 @@ templ RequestTypeTabs(req AuthRequest) {
@tabScripts()
}
templ ConnectPanel(wallet WalletInfo) {
templ ConnectPanel(wallet models.WalletInfo) {
<div class="wa-stack wa-gap-m">
@WalletSelector(wallet, false, "")
<div class="wa-stack wa-gap-xs">
@@ -140,7 +101,7 @@ templ ConnectPanel(wallet WalletInfo) {
</div>
}
templ SignPanel(wallet WalletInfo, message string, messageHex string) {
templ SignPanel(wallet models.WalletInfo, message string, messageHex string) {
<div class="wa-stack wa-gap-m">
@WalletSelector(wallet, true, "Signing")
<div class="wa-stack wa-gap-xs">
@@ -164,7 +125,7 @@ templ SignPanel(wallet WalletInfo, message string, messageHex string) {
</div>
}
templ TransactionPanel(wallet WalletInfo, tx *TxDetails) {
templ TransactionPanel(wallet models.WalletInfo, tx *models.TxDetails) {
<div class="wa-stack wa-gap-m">
@WalletSelectorWithBalance(wallet)
if tx != nil {
@@ -196,7 +157,7 @@ templ TransactionPanel(wallet WalletInfo, tx *TxDetails) {
</div>
}
templ WalletSelector(wallet WalletInfo, showBadge bool, badgeText string) {
templ WalletSelector(wallet models.WalletInfo, showBadge bool, badgeText string) {
<div class="wallet-selector">
<div class="wa-flank">
<div class="wa-cluster wa-gap-s">
@@ -215,7 +176,7 @@ templ WalletSelector(wallet WalletInfo, showBadge bool, badgeText string) {
</div>
}
templ WalletSelectorWithBalance(wallet WalletInfo) {
templ WalletSelectorWithBalance(wallet models.WalletInfo) {
<div class="wallet-selector">
<div class="wa-flank">
<div class="wa-cluster wa-gap-s">
@@ -245,7 +206,7 @@ templ PermissionItem(icon string, variant string, title string, description stri
</div>
}
templ TransactionCard(tx *TxDetails) {
templ TransactionCard(tx *models.TxDetails) {
<wa-card>
<div class="wa-stack wa-gap-s">
<div class="wa-flank">
@@ -282,7 +243,7 @@ templ TransactionCard(tx *TxDetails) {
</wa-card>
}
templ TransactionDetails(tx *TxDetails) {
templ TransactionDetails(tx *models.TxDetails) {
<div class="wa-stack wa-gap-2xs">
<div class="tx-detail-row">
<span class="tx-label">Network</span>

View File

@@ -8,51 +8,12 @@ package views
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "nebula/layouts"
import (
"nebula/layouts"
"nebula/models"
)
type AppInfo struct {
Name string
Domain string
LogoIcon string
Verified bool
}
type WalletInfo struct {
Name string
Address string
Balance string
}
type TokenAmount struct {
Symbol string
Amount string
USD string
Initials string
}
type TxDetails struct {
Type string
FromToken TokenAmount
ToToken TokenAmount
Network string
NetworkFee string
MaxFee string
Slippage string
Contract string
Function string
RawData string
}
type AuthRequest struct {
Type string
App AppInfo
Wallet WalletInfo
Message string
MessageHex string
Transaction *TxDetails
}
func AuthorizePage(req AuthRequest) templ.Component {
func AuthorizePage(req models.AuthRequest) 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 {
@@ -107,7 +68,7 @@ func AuthorizePage(req AuthRequest) templ.Component {
})
}
func AuthorizeContent(req AuthRequest) templ.Component {
func AuthorizeContent(req models.AuthRequest) 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 {
@@ -160,7 +121,7 @@ func AuthorizeContent(req AuthRequest) templ.Component {
})
}
func AppIdentityHeader(app AppInfo) templ.Component {
func AppIdentityHeader(app models.AppInfo) 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 {
@@ -188,7 +149,7 @@ func AppIdentityHeader(app AppInfo) templ.Component {
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(app.LogoIcon)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 71, Col: 31}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 32, Col: 31}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
@@ -201,7 +162,7 @@ func AppIdentityHeader(app AppInfo) templ.Component {
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(app.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 75, Col: 41}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 36, Col: 41}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
@@ -224,7 +185,7 @@ func AppIdentityHeader(app AppInfo) templ.Component {
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(app.Domain)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 80, Col: 86}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 41, Col: 86}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
@@ -238,7 +199,7 @@ func AppIdentityHeader(app AppInfo) templ.Component {
})
}
func RequestTypeTabs(req AuthRequest) templ.Component {
func RequestTypeTabs(req models.AuthRequest) 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 {
@@ -331,7 +292,7 @@ func RequestTypeTabs(req AuthRequest) templ.Component {
})
}
func ConnectPanel(wallet WalletInfo) templ.Component {
func ConnectPanel(wallet models.WalletInfo) 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 {
@@ -384,7 +345,7 @@ func ConnectPanel(wallet WalletInfo) templ.Component {
})
}
func SignPanel(wallet WalletInfo, message string, messageHex string) templ.Component {
func SignPanel(wallet models.WalletInfo, message string, messageHex 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 {
@@ -420,7 +381,7 @@ func SignPanel(wallet WalletInfo, message string, messageHex string) templ.Compo
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(message)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 148, Col: 36}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 109, Col: 36}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
if templ_7745c5c3_Err != nil {
@@ -438,7 +399,7 @@ func SignPanel(wallet WalletInfo, message string, messageHex string) templ.Compo
var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(messageHex)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 160, Col: 47}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 121, Col: 47}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
if templ_7745c5c3_Err != nil {
@@ -457,7 +418,7 @@ func SignPanel(wallet WalletInfo, message string, messageHex string) templ.Compo
})
}
func TransactionPanel(wallet WalletInfo, tx *TxDetails) templ.Component {
func TransactionPanel(wallet models.WalletInfo, tx *models.TxDetails) 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 {
@@ -506,7 +467,7 @@ func TransactionPanel(wallet WalletInfo, tx *TxDetails) templ.Component {
var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(tx.Contract)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 185, Col: 43}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 146, Col: 43}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
if templ_7745c5c3_Err != nil {
@@ -519,7 +480,7 @@ func TransactionPanel(wallet WalletInfo, tx *TxDetails) templ.Component {
var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(tx.Function)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 189, Col: 43}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 150, Col: 43}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
if templ_7745c5c3_Err != nil {
@@ -532,7 +493,7 @@ func TransactionPanel(wallet WalletInfo, tx *TxDetails) templ.Component {
var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(tx.RawData)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 191, Col: 48}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 152, Col: 48}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
if templ_7745c5c3_Err != nil {
@@ -551,7 +512,7 @@ func TransactionPanel(wallet WalletInfo, tx *TxDetails) templ.Component {
})
}
func WalletSelector(wallet WalletInfo, showBadge bool, badgeText string) templ.Component {
func WalletSelector(wallet models.WalletInfo, showBadge bool, badgeText 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 {
@@ -579,7 +540,7 @@ func WalletSelector(wallet WalletInfo, showBadge bool, badgeText string) templ.C
var templ_7745c5c3_Var18 string
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(wallet.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 205, Col: 45}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 166, Col: 45}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
if templ_7745c5c3_Err != nil {
@@ -592,7 +553,7 @@ func WalletSelector(wallet WalletInfo, showBadge bool, badgeText string) templ.C
var templ_7745c5c3_Var19 string
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(wallet.Address)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 206, Col: 50}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 167, Col: 50}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
if templ_7745c5c3_Err != nil {
@@ -610,7 +571,7 @@ func WalletSelector(wallet WalletInfo, showBadge bool, badgeText string) templ.C
var templ_7745c5c3_Var20 string
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(badgeText)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 210, Col: 43}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 171, Col: 43}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
if templ_7745c5c3_Err != nil {
@@ -634,7 +595,7 @@ func WalletSelector(wallet WalletInfo, showBadge bool, badgeText string) templ.C
})
}
func WalletSelectorWithBalance(wallet WalletInfo) templ.Component {
func WalletSelectorWithBalance(wallet models.WalletInfo) 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 {
@@ -662,7 +623,7 @@ func WalletSelectorWithBalance(wallet WalletInfo) templ.Component {
var templ_7745c5c3_Var22 string
templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(wallet.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 224, Col: 45}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 185, Col: 45}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
if templ_7745c5c3_Err != nil {
@@ -675,7 +636,7 @@ func WalletSelectorWithBalance(wallet WalletInfo) templ.Component {
var templ_7745c5c3_Var23 string
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(wallet.Address)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 225, Col: 50}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 186, Col: 50}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
if templ_7745c5c3_Err != nil {
@@ -688,7 +649,7 @@ func WalletSelectorWithBalance(wallet WalletInfo) templ.Component {
var templ_7745c5c3_Var24 string
templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(wallet.Balance)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 230, Col: 47}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 191, Col: 47}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
if templ_7745c5c3_Err != nil {
@@ -752,7 +713,7 @@ func PermissionItem(icon string, variant string, title string, description strin
var templ_7745c5c3_Var28 string
templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(icon)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 239, Col: 23}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 200, Col: 23}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28))
if templ_7745c5c3_Err != nil {
@@ -765,7 +726,7 @@ func PermissionItem(icon string, variant string, title string, description strin
var templ_7745c5c3_Var29 string
templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 242, Col: 38}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 203, Col: 38}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
if templ_7745c5c3_Err != nil {
@@ -778,7 +739,7 @@ func PermissionItem(icon string, variant string, title string, description strin
var templ_7745c5c3_Var30 string
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(description)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 243, Col: 87}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 204, Col: 87}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
if templ_7745c5c3_Err != nil {
@@ -792,7 +753,7 @@ func PermissionItem(icon string, variant string, title string, description strin
})
}
func TransactionCard(tx *TxDetails) templ.Component {
func TransactionCard(tx *models.TxDetails) 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 {
@@ -820,7 +781,7 @@ func TransactionCard(tx *TxDetails) templ.Component {
var templ_7745c5c3_Var32 string
templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(tx.Type)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 252, Col: 40}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 213, Col: 40}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32))
if templ_7745c5c3_Err != nil {
@@ -833,7 +794,7 @@ func TransactionCard(tx *TxDetails) templ.Component {
var templ_7745c5c3_Var33 string
templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(tx.FromToken.Initials)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 259, Col: 49}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 220, Col: 49}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
if templ_7745c5c3_Err != nil {
@@ -846,7 +807,7 @@ func TransactionCard(tx *TxDetails) templ.Component {
var templ_7745c5c3_Var34 string
templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(tx.FromToken.Amount)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 261, Col: 55}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 222, Col: 55}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34))
if templ_7745c5c3_Err != nil {
@@ -859,7 +820,7 @@ func TransactionCard(tx *TxDetails) templ.Component {
var templ_7745c5c3_Var35 string
templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(tx.FromToken.Symbol)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 261, Col: 79}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 222, Col: 79}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35))
if templ_7745c5c3_Err != nil {
@@ -872,7 +833,7 @@ func TransactionCard(tx *TxDetails) templ.Component {
var templ_7745c5c3_Var36 string
templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(tx.FromToken.Symbol)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 262, Col: 99}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 223, Col: 99}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36))
if templ_7745c5c3_Err != nil {
@@ -885,7 +846,7 @@ func TransactionCard(tx *TxDetails) templ.Component {
var templ_7745c5c3_Var37 string
templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(tx.FromToken.USD)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 265, Col: 90}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 226, Col: 90}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37))
if templ_7745c5c3_Err != nil {
@@ -898,7 +859,7 @@ func TransactionCard(tx *TxDetails) templ.Component {
var templ_7745c5c3_Var38 string
templ_7745c5c3_Var38, templ_7745c5c3_Err = templ.JoinStringErrs(tx.ToToken.Initials)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 272, Col: 47}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 233, Col: 47}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var38))
if templ_7745c5c3_Err != nil {
@@ -911,7 +872,7 @@ func TransactionCard(tx *TxDetails) templ.Component {
var templ_7745c5c3_Var39 string
templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs(tx.ToToken.Amount)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 274, Col: 54}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 235, Col: 54}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39))
if templ_7745c5c3_Err != nil {
@@ -924,7 +885,7 @@ func TransactionCard(tx *TxDetails) templ.Component {
var templ_7745c5c3_Var40 string
templ_7745c5c3_Var40, templ_7745c5c3_Err = templ.JoinStringErrs(tx.ToToken.Symbol)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 274, Col: 76}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 235, Col: 76}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var40))
if templ_7745c5c3_Err != nil {
@@ -937,7 +898,7 @@ func TransactionCard(tx *TxDetails) templ.Component {
var templ_7745c5c3_Var41 string
templ_7745c5c3_Var41, templ_7745c5c3_Err = templ.JoinStringErrs(tx.ToToken.Symbol)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 275, Col: 97}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 236, Col: 97}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41))
if templ_7745c5c3_Err != nil {
@@ -950,7 +911,7 @@ func TransactionCard(tx *TxDetails) templ.Component {
var templ_7745c5c3_Var42 string
templ_7745c5c3_Var42, templ_7745c5c3_Err = templ.JoinStringErrs(tx.ToToken.USD)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 278, Col: 89}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 239, Col: 89}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var42))
if templ_7745c5c3_Err != nil {
@@ -964,7 +925,7 @@ func TransactionCard(tx *TxDetails) templ.Component {
})
}
func TransactionDetails(tx *TxDetails) templ.Component {
func TransactionDetails(tx *models.TxDetails) 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 {
@@ -992,7 +953,7 @@ func TransactionDetails(tx *TxDetails) templ.Component {
var templ_7745c5c3_Var44 string
templ_7745c5c3_Var44, templ_7745c5c3_Err = templ.JoinStringErrs(tx.Network)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 289, Col: 38}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 250, Col: 38}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var44))
if templ_7745c5c3_Err != nil {
@@ -1005,7 +966,7 @@ func TransactionDetails(tx *TxDetails) templ.Component {
var templ_7745c5c3_Var45 string
templ_7745c5c3_Var45, templ_7745c5c3_Err = templ.JoinStringErrs(tx.NetworkFee)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 293, Col: 41}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 254, Col: 41}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var45))
if templ_7745c5c3_Err != nil {
@@ -1018,7 +979,7 @@ func TransactionDetails(tx *TxDetails) templ.Component {
var templ_7745c5c3_Var46 string
templ_7745c5c3_Var46, templ_7745c5c3_Err = templ.JoinStringErrs(tx.MaxFee)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 297, Col: 37}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 258, Col: 37}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var46))
if templ_7745c5c3_Err != nil {
@@ -1031,7 +992,7 @@ func TransactionDetails(tx *TxDetails) templ.Component {
var templ_7745c5c3_Var47 string
templ_7745c5c3_Var47, templ_7745c5c3_Err = templ.JoinStringErrs(tx.Slippage)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 301, Col: 39}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 262, Col: 39}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var47))
if templ_7745c5c3_Err != nil {
@@ -1073,7 +1034,7 @@ func AuthFooterActions(requestType string) templ.Component {
var templ_7745c5c3_Var49 string
templ_7745c5c3_Var49, templ_7745c5c3_Err = templ.JoinStringErrs(`{"type":"` + requestType + `"}`)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 328, Col: 46}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/authorize.templ`, Line: 289, Col: 46}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var49))
if templ_7745c5c3_Err != nil {

View File

@@ -3,139 +3,10 @@ package views
import (
"nebula/components"
"nebula/layouts"
"nebula/models"
)
type Token struct {
Symbol string
Name string
Balance string
Value string
Change string
Positive bool
Color string
Initials string
Network string
}
type Transaction struct {
Type string
Asset string
Amount string
USD string
Date string
Time string
Hash string
Positive bool
Address string
}
type NFT struct {
Name string
Collection string
Image string
Floor string
Value string
Badge string
Verified bool
}
type DashboardData struct {
TotalBalance string
Change24h string
Tokens []Token
Transactions []Transaction
NFTs []NFT
PortfolioChart []components.AreaSeriesData
MarketCapBubble []components.BubbleData
}
func DefaultDashboardData() DashboardData {
return DashboardData{
TotalBalance: "12847.32",
Change24h: "+$302.18",
Tokens: []Token{
{Symbol: "SNR", Name: "Sonr", Balance: "8,432.50", Value: "$4,216.25", Change: "+5.67%", Positive: true, Color: "linear-gradient(135deg, #17c2ff, #0090ff)", Initials: "S", Network: "Sonr Mainnet"},
{Symbol: "ETH", Name: "Ethereum", Balance: "2.847", Value: "$6,682.04", Change: "+3.24%", Positive: true, Color: "#627eea", Initials: "E", Network: "Ethereum"},
{Symbol: "USDC", Name: "USD Coin", Balance: "1,250.00", Value: "$1,250.00", Change: "0.00%", Positive: true, Color: "#2775ca", Initials: "U", Network: "Ethereum"},
{Symbol: "AVAX", Name: "Avalanche", Balance: "24.83", Value: "$699.03", Change: "-2.18%", Positive: false, Color: "#e84142", Initials: "A", Network: "Avalanche"},
},
Transactions: []Transaction{
{Type: "receive", Asset: "ETH", Amount: "+0.25 ETH", USD: "$586.25", Date: "Today", Time: "2:34 PM", Hash: "0x8f4a2b1c...", Positive: true, Address: "0x742d...35Cb"},
{Type: "send", Asset: "SNR", Amount: "-500 SNR", USD: "$250.00", Date: "Yesterday", Time: "11:22 AM", Hash: "0x7d3e2a1b...", Positive: false, Address: "sonr1k4m...9p3q"},
{Type: "swap", Asset: "ETH → USDC", Amount: "0.5 ETH", USD: "→ 1,172.50 USDC", Date: "Jan 1", Time: "9:15 AM", Hash: "0x1a2b3c4d...", Positive: true, Address: "Uniswap V3"},
},
NFTs: []NFT{
{Name: "Bored Ape #4521", Collection: "Bored Ape Yacht Club", Image: "https://images.unsplash.com/photo-1620641788421-7a1c342ea42e?w=400&h=400&fit=crop", Floor: "28.5 ETH", Value: "32.0 ETH", Badge: "Listed", Verified: true},
{Name: "Sonr Genesis #001", Collection: "Sonr Genesis", Image: "https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?w=400&h=400&fit=crop", Floor: "0.8 ETH", Value: "2.5 ETH", Badge: "Rare", Verified: true},
},
PortfolioChart: DefaultPortfolioChartData(),
MarketCapBubble: DefaultMarketCapBubbleData(),
}
}
// DefaultPortfolioChartData returns sample stacked area data for portfolio performance by asset
func DefaultPortfolioChartData() []components.AreaSeriesData {
return []components.AreaSeriesData{
// Day 1
{Date: "2024-12-25", Industry: "ETH", Value: 3200},
{Date: "2024-12-25", Industry: "SNR", Value: 2100},
{Date: "2024-12-25", Industry: "USDC", Value: 1200},
{Date: "2024-12-25", Industry: "AVAX", Value: 500},
// Day 2
{Date: "2024-12-26", Industry: "ETH", Value: 3350},
{Date: "2024-12-26", Industry: "SNR", Value: 2200},
{Date: "2024-12-26", Industry: "USDC", Value: 1200},
{Date: "2024-12-26", Industry: "AVAX", Value: 520},
// Day 3
{Date: "2024-12-27", Industry: "ETH", Value: 3500},
{Date: "2024-12-27", Industry: "SNR", Value: 2350},
{Date: "2024-12-27", Industry: "USDC", Value: 1200},
{Date: "2024-12-27", Industry: "AVAX", Value: 480},
// Day 4
{Date: "2024-12-28", Industry: "ETH", Value: 3280},
{Date: "2024-12-28", Industry: "SNR", Value: 2400},
{Date: "2024-12-28", Industry: "USDC", Value: 1200},
{Date: "2024-12-28", Industry: "AVAX", Value: 510},
// Day 5
{Date: "2024-12-29", Industry: "ETH", Value: 3450},
{Date: "2024-12-29", Industry: "SNR", Value: 2550},
{Date: "2024-12-29", Industry: "USDC", Value: 1250},
{Date: "2024-12-29", Industry: "AVAX", Value: 530},
// Day 6
{Date: "2024-12-30", Industry: "ETH", Value: 3600},
{Date: "2024-12-30", Industry: "SNR", Value: 2680},
{Date: "2024-12-30", Industry: "USDC", Value: 1250},
{Date: "2024-12-30", Industry: "AVAX", Value: 550},
// Day 7
{Date: "2024-12-31", Industry: "ETH", Value: 3750},
{Date: "2024-12-31", Industry: "SNR", Value: 2800},
{Date: "2024-12-31", Industry: "USDC", Value: 1250},
{Date: "2024-12-31", Industry: "AVAX", Value: 580},
// Day 8
{Date: "2025-01-01", Industry: "ETH", Value: 3680},
{Date: "2025-01-01", Industry: "SNR", Value: 2900},
{Date: "2025-01-01", Industry: "USDC", Value: 1250},
{Date: "2025-01-01", Industry: "AVAX", Value: 600},
}
}
// DefaultMarketCapBubbleData returns sample bubble chart data for market cap dominance
func DefaultMarketCapBubbleData() []components.BubbleData {
return []components.BubbleData{
{Name: "BTC", Sector: "Layer 1", Value: 45000},
{Name: "ETH", Sector: "Layer 1", Value: 28000},
{Name: "SNR", Sector: "Layer 1", Value: 8500},
{Name: "SOL", Sector: "Layer 1", Value: 12000},
{Name: "AVAX", Sector: "Layer 1", Value: 6000},
{Name: "USDC", Sector: "Stablecoin", Value: 15000},
{Name: "USDT", Sector: "Stablecoin", Value: 18000},
{Name: "UNI", Sector: "DeFi", Value: 4500},
{Name: "AAVE", Sector: "DeFi", Value: 3200},
{Name: "LINK", Sector: "Oracle", Value: 5800},
}
}
templ DashboardPage(data DashboardData, activeTab string) {
templ DashboardPage(data models.DashboardData, activeTab string) {
@layouts.DashboardLayout("Dashboard - Sonr", layouts.WalletUser{Name: "Sonr Wallet", Address: "sonr1x9f...7k2m"}, activeTab) {
@dashboardStyles()
@DashboardContent(data, activeTab)
@@ -145,8 +16,7 @@ templ DashboardPage(data DashboardData, activeTab string) {
}
}
// DashboardContent renders just the tab content (for HTMX partial updates)
templ DashboardContent(data DashboardData, activeTab string) {
templ DashboardContent(data models.DashboardData, activeTab string) {
<div id="dashboard-content">
if activeTab == "" || activeTab == "overview" {
@OverviewPanel(data)
@@ -162,7 +32,7 @@ templ DashboardContent(data DashboardData, activeTab string) {
</div>
}
templ OverviewPanel(data DashboardData) {
templ OverviewPanel(data models.DashboardData) {
<header style="margin-bottom: var(--wa-space-l);">
<div class="wa-flank">
<div class="wa-stack wa-gap-2xs">
@@ -269,7 +139,7 @@ templ OverviewPanel(data DashboardData) {
@ConnectedAccountsCard()
}
templ TokenRow(token Token) {
templ TokenRow(token models.Token) {
<div class="token-row">
<div class="token-info">
<wa-avatar initials={ token.Initials } style={ "--size: 40px; background: " + token.Color + ";" }></wa-avatar>
@@ -295,7 +165,7 @@ templ TokenRow(token Token) {
</div>
}
templ TransactionTableRow(tx Transaction) {
templ TransactionTableRow(tx models.Transaction) {
<tr>
<td>
<span class={ "tx-type", tx.Type }>
@@ -371,7 +241,7 @@ templ AccountCard(initials string, name string, address string, color string, ac
</div>
}
templ TransactionsPanel(transactions []Transaction) {
templ TransactionsPanel(transactions []models.Transaction) {
@components.TxStyles()
<header style="margin-bottom: var(--wa-space-l);">
<div class="wa-flank">
@@ -405,7 +275,7 @@ templ StatCard(label string, value string, subtitle string, variant string) {
</wa-card>
}
templ TokensPanel(tokens []Token) {
templ TokensPanel(tokens []models.Token) {
<header style="margin-bottom: var(--wa-space-l);">
<div class="wa-flank">
<div class="wa-stack wa-gap-2xs">
@@ -471,7 +341,7 @@ templ TokensPanel(tokens []Token) {
</wa-card>
}
templ TokenTableRow(token Token) {
templ TokenTableRow(token models.Token) {
<tr>
<td>
<div class="token-cell">
@@ -517,7 +387,7 @@ templ TokenTableRow(token Token) {
</tr>
}
templ NFTsPanel(nfts []NFT) {
templ NFTsPanel(nfts []models.NFT) {
<header style="margin-bottom: var(--wa-space-l);">
<div class="wa-flank">
<div class="wa-stack wa-gap-2xs">
@@ -561,7 +431,7 @@ templ NFTsPanel(nfts []NFT) {
</wa-card>
}
templ NFTCard(nft NFT) {
templ NFTCard(nft models.NFT) {
<div class="nft-card">
<div class="nft-image">
<img src={ nft.Image } alt={ nft.Name }/>
@@ -606,10 +476,10 @@ func nftBadgeVariant(badge string) string {
}
templ ActivityPanel() {
@ActivityPanelWithData(DefaultMarketCapBubbleData())
@ActivityPanelWithData(models.DefaultMarketCapBubbleData())
}
templ ActivityPanelWithData(marketCapData []components.BubbleData) {
templ ActivityPanelWithData(marketCapData []models.BubbleData) {
<header style="margin-bottom: var(--wa-space-l);">
<div class="wa-flank">
<div class="wa-stack wa-gap-2xs">

View File

@@ -11,139 +11,10 @@ import templruntime "github.com/a-h/templ/runtime"
import (
"nebula/components"
"nebula/layouts"
"nebula/models"
)
type Token struct {
Symbol string
Name string
Balance string
Value string
Change string
Positive bool
Color string
Initials string
Network string
}
type Transaction struct {
Type string
Asset string
Amount string
USD string
Date string
Time string
Hash string
Positive bool
Address string
}
type NFT struct {
Name string
Collection string
Image string
Floor string
Value string
Badge string
Verified bool
}
type DashboardData struct {
TotalBalance string
Change24h string
Tokens []Token
Transactions []Transaction
NFTs []NFT
PortfolioChart []components.AreaSeriesData
MarketCapBubble []components.BubbleData
}
func DefaultDashboardData() DashboardData {
return DashboardData{
TotalBalance: "12847.32",
Change24h: "+$302.18",
Tokens: []Token{
{Symbol: "SNR", Name: "Sonr", Balance: "8,432.50", Value: "$4,216.25", Change: "+5.67%", Positive: true, Color: "linear-gradient(135deg, #17c2ff, #0090ff)", Initials: "S", Network: "Sonr Mainnet"},
{Symbol: "ETH", Name: "Ethereum", Balance: "2.847", Value: "$6,682.04", Change: "+3.24%", Positive: true, Color: "#627eea", Initials: "E", Network: "Ethereum"},
{Symbol: "USDC", Name: "USD Coin", Balance: "1,250.00", Value: "$1,250.00", Change: "0.00%", Positive: true, Color: "#2775ca", Initials: "U", Network: "Ethereum"},
{Symbol: "AVAX", Name: "Avalanche", Balance: "24.83", Value: "$699.03", Change: "-2.18%", Positive: false, Color: "#e84142", Initials: "A", Network: "Avalanche"},
},
Transactions: []Transaction{
{Type: "receive", Asset: "ETH", Amount: "+0.25 ETH", USD: "$586.25", Date: "Today", Time: "2:34 PM", Hash: "0x8f4a2b1c...", Positive: true, Address: "0x742d...35Cb"},
{Type: "send", Asset: "SNR", Amount: "-500 SNR", USD: "$250.00", Date: "Yesterday", Time: "11:22 AM", Hash: "0x7d3e2a1b...", Positive: false, Address: "sonr1k4m...9p3q"},
{Type: "swap", Asset: "ETH → USDC", Amount: "0.5 ETH", USD: "→ 1,172.50 USDC", Date: "Jan 1", Time: "9:15 AM", Hash: "0x1a2b3c4d...", Positive: true, Address: "Uniswap V3"},
},
NFTs: []NFT{
{Name: "Bored Ape #4521", Collection: "Bored Ape Yacht Club", Image: "https://images.unsplash.com/photo-1620641788421-7a1c342ea42e?w=400&h=400&fit=crop", Floor: "28.5 ETH", Value: "32.0 ETH", Badge: "Listed", Verified: true},
{Name: "Sonr Genesis #001", Collection: "Sonr Genesis", Image: "https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?w=400&h=400&fit=crop", Floor: "0.8 ETH", Value: "2.5 ETH", Badge: "Rare", Verified: true},
},
PortfolioChart: DefaultPortfolioChartData(),
MarketCapBubble: DefaultMarketCapBubbleData(),
}
}
// DefaultPortfolioChartData returns sample stacked area data for portfolio performance by asset
func DefaultPortfolioChartData() []components.AreaSeriesData {
return []components.AreaSeriesData{
// Day 1
{Date: "2024-12-25", Industry: "ETH", Value: 3200},
{Date: "2024-12-25", Industry: "SNR", Value: 2100},
{Date: "2024-12-25", Industry: "USDC", Value: 1200},
{Date: "2024-12-25", Industry: "AVAX", Value: 500},
// Day 2
{Date: "2024-12-26", Industry: "ETH", Value: 3350},
{Date: "2024-12-26", Industry: "SNR", Value: 2200},
{Date: "2024-12-26", Industry: "USDC", Value: 1200},
{Date: "2024-12-26", Industry: "AVAX", Value: 520},
// Day 3
{Date: "2024-12-27", Industry: "ETH", Value: 3500},
{Date: "2024-12-27", Industry: "SNR", Value: 2350},
{Date: "2024-12-27", Industry: "USDC", Value: 1200},
{Date: "2024-12-27", Industry: "AVAX", Value: 480},
// Day 4
{Date: "2024-12-28", Industry: "ETH", Value: 3280},
{Date: "2024-12-28", Industry: "SNR", Value: 2400},
{Date: "2024-12-28", Industry: "USDC", Value: 1200},
{Date: "2024-12-28", Industry: "AVAX", Value: 510},
// Day 5
{Date: "2024-12-29", Industry: "ETH", Value: 3450},
{Date: "2024-12-29", Industry: "SNR", Value: 2550},
{Date: "2024-12-29", Industry: "USDC", Value: 1250},
{Date: "2024-12-29", Industry: "AVAX", Value: 530},
// Day 6
{Date: "2024-12-30", Industry: "ETH", Value: 3600},
{Date: "2024-12-30", Industry: "SNR", Value: 2680},
{Date: "2024-12-30", Industry: "USDC", Value: 1250},
{Date: "2024-12-30", Industry: "AVAX", Value: 550},
// Day 7
{Date: "2024-12-31", Industry: "ETH", Value: 3750},
{Date: "2024-12-31", Industry: "SNR", Value: 2800},
{Date: "2024-12-31", Industry: "USDC", Value: 1250},
{Date: "2024-12-31", Industry: "AVAX", Value: 580},
// Day 8
{Date: "2025-01-01", Industry: "ETH", Value: 3680},
{Date: "2025-01-01", Industry: "SNR", Value: 2900},
{Date: "2025-01-01", Industry: "USDC", Value: 1250},
{Date: "2025-01-01", Industry: "AVAX", Value: 600},
}
}
// DefaultMarketCapBubbleData returns sample bubble chart data for market cap dominance
func DefaultMarketCapBubbleData() []components.BubbleData {
return []components.BubbleData{
{Name: "BTC", Sector: "Layer 1", Value: 45000},
{Name: "ETH", Sector: "Layer 1", Value: 28000},
{Name: "SNR", Sector: "Layer 1", Value: 8500},
{Name: "SOL", Sector: "Layer 1", Value: 12000},
{Name: "AVAX", Sector: "Layer 1", Value: 6000},
{Name: "USDC", Sector: "Stablecoin", Value: 15000},
{Name: "USDT", Sector: "Stablecoin", Value: 18000},
{Name: "UNI", Sector: "DeFi", Value: 4500},
{Name: "AAVE", Sector: "DeFi", Value: 3200},
{Name: "LINK", Sector: "Oracle", Value: 5800},
}
}
func DashboardPage(data DashboardData, activeTab string) templ.Component {
func DashboardPage(data models.DashboardData, 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 {
@@ -214,8 +85,7 @@ func DashboardPage(data DashboardData, activeTab string) templ.Component {
})
}
// DashboardContent renders just the tab content (for HTMX partial updates)
func DashboardContent(data DashboardData, activeTab string) templ.Component {
func DashboardContent(data models.DashboardData, 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 {
@@ -274,7 +144,7 @@ func DashboardContent(data DashboardData, activeTab string) templ.Component {
})
}
func OverviewPanel(data DashboardData) templ.Component {
func OverviewPanel(data models.DashboardData) 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 {
@@ -302,7 +172,7 @@ func OverviewPanel(data DashboardData) templ.Component {
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(data.TotalBalance)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 198, Col: 81}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 68, Col: 81}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
@@ -315,7 +185,7 @@ func OverviewPanel(data DashboardData) templ.Component {
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(data.Change24h)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 212, Col: 90}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 82, Col: 90}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
@@ -361,7 +231,7 @@ func OverviewPanel(data DashboardData) templ.Component {
})
}
func TokenRow(token Token) templ.Component {
func TokenRow(token models.Token) 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 {
@@ -389,7 +259,7 @@ func TokenRow(token Token) templ.Component {
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(token.Initials)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 275, Col: 39}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 145, Col: 39}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil {
@@ -402,7 +272,7 @@ func TokenRow(token Token) templ.Component {
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues("--size: 40px; background: " + token.Color + ";")
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 275, Col: 98}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 145, Col: 98}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
@@ -415,7 +285,7 @@ func TokenRow(token Token) templ.Component {
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(token.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 277, Col: 43}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 147, Col: 43}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
if templ_7745c5c3_Err != nil {
@@ -428,7 +298,7 @@ func TokenRow(token Token) templ.Component {
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(token.Symbol)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 278, Col: 90}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 148, Col: 90}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
if templ_7745c5c3_Err != nil {
@@ -441,7 +311,7 @@ func TokenRow(token Token) templ.Component {
var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(token.Balance)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 283, Col: 46}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 153, Col: 46}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
if templ_7745c5c3_Err != nil {
@@ -454,7 +324,7 @@ func TokenRow(token Token) templ.Component {
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(token.Value)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 284, Col: 89}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 154, Col: 89}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
if templ_7745c5c3_Err != nil {
@@ -468,7 +338,7 @@ func TokenRow(token Token) templ.Component {
})
}
func TransactionTableRow(tx Transaction) templ.Component {
func TransactionTableRow(tx models.Transaction) 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 {
@@ -538,7 +408,7 @@ func TransactionTableRow(tx Transaction) templ.Component {
var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(tx.Asset)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 314, Col: 16}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 184, Col: 16}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
if templ_7745c5c3_Err != nil {
@@ -551,7 +421,7 @@ func TransactionTableRow(tx Transaction) templ.Component {
var templ_7745c5c3_Var18 string
templ_7745c5c3_Var18, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues(txAmountStyle(tx.Positive))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 317, Col: 44}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 187, Col: 44}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
if templ_7745c5c3_Err != nil {
@@ -564,7 +434,7 @@ func TransactionTableRow(tx Transaction) templ.Component {
var templ_7745c5c3_Var19 string
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(tx.Amount)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 317, Col: 58}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 187, Col: 58}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
if templ_7745c5c3_Err != nil {
@@ -577,7 +447,7 @@ func TransactionTableRow(tx Transaction) templ.Component {
var templ_7745c5c3_Var20 string
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(tx.USD)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 318, Col: 84}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 188, Col: 84}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
if templ_7745c5c3_Err != nil {
@@ -590,7 +460,7 @@ func TransactionTableRow(tx Transaction) templ.Component {
var templ_7745c5c3_Var21 string
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(tx.Date)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 323, Col: 19}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 193, Col: 19}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
if templ_7745c5c3_Err != nil {
@@ -603,7 +473,7 @@ func TransactionTableRow(tx Transaction) templ.Component {
var templ_7745c5c3_Var22 string
templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(tx.Time)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 324, Col: 85}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 194, Col: 85}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
if templ_7745c5c3_Err != nil {
@@ -616,7 +486,7 @@ func TransactionTableRow(tx Transaction) templ.Component {
var templ_7745c5c3_Var23 string
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(tx.Hash)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 328, Col: 34}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 198, Col: 34}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
if templ_7745c5c3_Err != nil {
@@ -710,7 +580,7 @@ func AccountCard(initials string, name string, address string, color string, act
var templ_7745c5c3_Var26 string
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(initials)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 360, Col: 33}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 230, Col: 33}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
if templ_7745c5c3_Err != nil {
@@ -723,7 +593,7 @@ func AccountCard(initials string, name string, address string, color string, act
var templ_7745c5c3_Var27 string
templ_7745c5c3_Var27, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues("--size: 40px; background: " + color + ";")
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 360, Col: 86}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 230, Col: 86}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
if templ_7745c5c3_Err != nil {
@@ -736,7 +606,7 @@ func AccountCard(initials string, name string, address string, color string, act
var templ_7745c5c3_Var28 string
templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 362, Col: 37}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 232, Col: 37}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28))
if templ_7745c5c3_Err != nil {
@@ -749,7 +619,7 @@ func AccountCard(initials string, name string, address string, color string, act
var templ_7745c5c3_Var29 string
templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(address)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 363, Col: 40}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 233, Col: 40}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
if templ_7745c5c3_Err != nil {
@@ -778,7 +648,7 @@ func AccountCard(initials string, name string, address string, color string, act
})
}
func TransactionsPanel(transactions []Transaction) templ.Component {
func TransactionsPanel(transactions []models.Transaction) 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 {
@@ -865,7 +735,7 @@ func StatCard(label string, value string, subtitle string, variant string) templ
var templ_7745c5c3_Var32 string
templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(label)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 401, Col: 82}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 271, Col: 82}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32))
if templ_7745c5c3_Err != nil {
@@ -900,7 +770,7 @@ func StatCard(label string, value string, subtitle string, variant string) templ
var templ_7745c5c3_Var35 string
templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(value)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 402, Col: 142}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 272, Col: 142}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35))
if templ_7745c5c3_Err != nil {
@@ -913,7 +783,7 @@ func StatCard(label string, value string, subtitle string, variant string) templ
var templ_7745c5c3_Var36 string
templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(subtitle)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 403, Col: 85}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 273, Col: 85}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36))
if templ_7745c5c3_Err != nil {
@@ -927,7 +797,7 @@ func StatCard(label string, value string, subtitle string, variant string) templ
})
}
func TokensPanel(tokens []Token) templ.Component {
func TokensPanel(tokens []models.Token) 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 {
@@ -966,7 +836,7 @@ func TokensPanel(tokens []Token) templ.Component {
})
}
func TokenTableRow(token Token) templ.Component {
func TokenTableRow(token models.Token) 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 {
@@ -994,7 +864,7 @@ func TokenTableRow(token Token) templ.Component {
var templ_7745c5c3_Var39 string
templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs(token.Initials)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 478, Col: 40}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 348, Col: 40}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39))
if templ_7745c5c3_Err != nil {
@@ -1007,7 +877,7 @@ func TokenTableRow(token Token) templ.Component {
var templ_7745c5c3_Var40 string
templ_7745c5c3_Var40, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues("--size: 36px; background: " + token.Color + ";")
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 478, Col: 99}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 348, Col: 99}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var40))
if templ_7745c5c3_Err != nil {
@@ -1020,7 +890,7 @@ func TokenTableRow(token Token) templ.Component {
var templ_7745c5c3_Var41 string
templ_7745c5c3_Var41, templ_7745c5c3_Err = templ.JoinStringErrs(token.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 480, Col: 44}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 350, Col: 44}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41))
if templ_7745c5c3_Err != nil {
@@ -1033,7 +903,7 @@ func TokenTableRow(token Token) templ.Component {
var templ_7745c5c3_Var42 string
templ_7745c5c3_Var42, templ_7745c5c3_Err = templ.JoinStringErrs(token.Symbol)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 481, Col: 91}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 351, Col: 91}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var42))
if templ_7745c5c3_Err != nil {
@@ -1046,7 +916,7 @@ func TokenTableRow(token Token) templ.Component {
var templ_7745c5c3_Var43 string
templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(token.Network)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 488, Col: 19}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 358, Col: 19}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43))
if templ_7745c5c3_Err != nil {
@@ -1092,7 +962,7 @@ func TokenTableRow(token Token) templ.Component {
var templ_7745c5c3_Var46 string
templ_7745c5c3_Var46, templ_7745c5c3_Err = templ.JoinStringErrs(token.Change)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 498, Col: 18}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 368, Col: 18}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var46))
if templ_7745c5c3_Err != nil {
@@ -1105,7 +975,7 @@ func TokenTableRow(token Token) templ.Component {
var templ_7745c5c3_Var47 string
templ_7745c5c3_Var47, templ_7745c5c3_Err = templ.JoinStringErrs(token.Balance)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 501, Col: 21}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 371, Col: 21}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var47))
if templ_7745c5c3_Err != nil {
@@ -1118,7 +988,7 @@ func TokenTableRow(token Token) templ.Component {
var templ_7745c5c3_Var48 string
templ_7745c5c3_Var48, templ_7745c5c3_Err = templ.JoinStringErrs(token.Symbol)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 501, Col: 38}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 371, Col: 38}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var48))
if templ_7745c5c3_Err != nil {
@@ -1131,7 +1001,7 @@ func TokenTableRow(token Token) templ.Component {
var templ_7745c5c3_Var49 string
templ_7745c5c3_Var49, templ_7745c5c3_Err = templ.JoinStringErrs(token.Value)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 504, Col: 44}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 374, Col: 44}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var49))
if templ_7745c5c3_Err != nil {
@@ -1145,7 +1015,7 @@ func TokenTableRow(token Token) templ.Component {
})
}
func NFTsPanel(nfts []NFT) templ.Component {
func NFTsPanel(nfts []models.NFT) 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 {
@@ -1200,7 +1070,7 @@ func NFTsPanel(nfts []NFT) templ.Component {
})
}
func NFTCard(nft NFT) templ.Component {
func NFTCard(nft models.NFT) 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 {
@@ -1228,7 +1098,7 @@ func NFTCard(nft NFT) templ.Component {
var templ_7745c5c3_Var52 string
templ_7745c5c3_Var52, templ_7745c5c3_Err = templ.JoinStringErrs(nft.Image)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 567, Col: 23}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 437, Col: 23}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var52))
if templ_7745c5c3_Err != nil {
@@ -1241,7 +1111,7 @@ func NFTCard(nft NFT) templ.Component {
var templ_7745c5c3_Var53 string
templ_7745c5c3_Var53, templ_7745c5c3_Err = templ.JoinStringErrs(nft.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 567, Col: 40}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 437, Col: 40}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var53))
if templ_7745c5c3_Err != nil {
@@ -1259,7 +1129,7 @@ func NFTCard(nft NFT) templ.Component {
var templ_7745c5c3_Var54 string
templ_7745c5c3_Var54, templ_7745c5c3_Err = templ.JoinStringErrs(nftBadgeVariant(nft.Badge))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 570, Col: 51}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 440, Col: 51}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var54))
if templ_7745c5c3_Err != nil {
@@ -1272,7 +1142,7 @@ func NFTCard(nft NFT) templ.Component {
var templ_7745c5c3_Var55 string
templ_7745c5c3_Var55, templ_7745c5c3_Err = templ.JoinStringErrs(nft.Badge)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 570, Col: 70}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 440, Col: 70}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var55))
if templ_7745c5c3_Err != nil {
@@ -1300,7 +1170,7 @@ func NFTCard(nft NFT) templ.Component {
var templ_7745c5c3_Var56 string
templ_7745c5c3_Var56, templ_7745c5c3_Err = templ.JoinStringErrs(nft.Collection)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 587, Col: 54}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 457, Col: 54}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var56))
if templ_7745c5c3_Err != nil {
@@ -1313,7 +1183,7 @@ func NFTCard(nft NFT) templ.Component {
var templ_7745c5c3_Var57 string
templ_7745c5c3_Var57, templ_7745c5c3_Err = templ.JoinStringErrs(nft.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 589, Col: 35}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 459, Col: 35}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var57))
if templ_7745c5c3_Err != nil {
@@ -1326,7 +1196,7 @@ func NFTCard(nft NFT) templ.Component {
var templ_7745c5c3_Var58 string
templ_7745c5c3_Var58, templ_7745c5c3_Err = templ.JoinStringErrs(nft.Floor)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 591, Col: 46}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 461, Col: 46}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var58))
if templ_7745c5c3_Err != nil {
@@ -1339,7 +1209,7 @@ func NFTCard(nft NFT) templ.Component {
var templ_7745c5c3_Var59 string
templ_7745c5c3_Var59, templ_7745c5c3_Err = templ.JoinStringErrs(nft.Value)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 592, Col: 39}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 462, Col: 39}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var59))
if templ_7745c5c3_Err != nil {
@@ -1384,7 +1254,7 @@ func ActivityPanel() templ.Component {
templ_7745c5c3_Var60 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = ActivityPanelWithData(DefaultMarketCapBubbleData()).Render(ctx, templ_7745c5c3_Buffer)
templ_7745c5c3_Err = ActivityPanelWithData(models.DefaultMarketCapBubbleData()).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -1392,7 +1262,7 @@ func ActivityPanel() templ.Component {
})
}
func ActivityPanelWithData(marketCapData []components.BubbleData) templ.Component {
func ActivityPanelWithData(marketCapData []models.BubbleData) 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 {
@@ -1497,7 +1367,7 @@ func ActivityStatCard(icon string, label string, value string, color string) tem
var templ_7745c5c3_Var63 string
templ_7745c5c3_Var63, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues("background: " + color + "20;")
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 653, Col: 68}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 523, Col: 68}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var63))
if templ_7745c5c3_Err != nil {
@@ -1510,7 +1380,7 @@ func ActivityStatCard(icon string, label string, value string, color string) tem
var templ_7745c5c3_Var64 string
templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(icon)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 654, Col: 36}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 524, Col: 36}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var64))
if templ_7745c5c3_Err != nil {
@@ -1523,7 +1393,7 @@ func ActivityStatCard(icon string, label string, value string, color string) tem
var templ_7745c5c3_Var65 string
templ_7745c5c3_Var65, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues("color: " + color + ";")
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 654, Col: 70}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 524, Col: 70}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var65))
if templ_7745c5c3_Err != nil {
@@ -1536,7 +1406,7 @@ func ActivityStatCard(icon string, label string, value string, color string) tem
var templ_7745c5c3_Var66 string
templ_7745c5c3_Var66, templ_7745c5c3_Err = templ.JoinStringErrs(label)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 657, Col: 83}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 527, Col: 83}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var66))
if templ_7745c5c3_Err != nil {
@@ -1549,7 +1419,7 @@ func ActivityStatCard(icon string, label string, value string, color string) tem
var templ_7745c5c3_Var67 string
templ_7745c5c3_Var67, templ_7745c5c3_Err = templ.JoinStringErrs(value)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 658, Col: 40}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 528, Col: 40}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var67))
if templ_7745c5c3_Err != nil {
@@ -1636,7 +1506,7 @@ func PendingAction(icon string, color string, title string, desc string, primary
var templ_7745c5c3_Var70 string
templ_7745c5c3_Var70, templ_7745c5c3_Err = templ.JoinStringErrs(icon)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 681, Col: 46}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 551, Col: 46}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var70))
if templ_7745c5c3_Err != nil {
@@ -1649,7 +1519,7 @@ func PendingAction(icon string, color string, title string, desc string, primary
var templ_7745c5c3_Var71 string
templ_7745c5c3_Var71, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues("color: " + color + ";")
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 681, Col: 80}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 551, Col: 80}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var71))
if templ_7745c5c3_Err != nil {
@@ -1662,7 +1532,7 @@ func PendingAction(icon string, color string, title string, desc string, primary
var templ_7745c5c3_Var72 string
templ_7745c5c3_Var72, templ_7745c5c3_Err = templ.JoinStringErrs(title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 683, Col: 38}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 553, Col: 38}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var72))
if templ_7745c5c3_Err != nil {
@@ -1675,7 +1545,7 @@ func PendingAction(icon string, color string, title string, desc string, primary
var templ_7745c5c3_Var73 string
templ_7745c5c3_Var73, templ_7745c5c3_Err = templ.JoinStringErrs(desc)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 684, Col: 81}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 554, Col: 81}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var73))
if templ_7745c5c3_Err != nil {
@@ -1688,7 +1558,7 @@ func PendingAction(icon string, color string, title string, desc string, primary
var templ_7745c5c3_Var74 string
templ_7745c5c3_Var74, templ_7745c5c3_Err = templ.JoinStringErrs(primaryAction)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 688, Col: 58}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 558, Col: 58}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var74))
if templ_7745c5c3_Err != nil {
@@ -1701,7 +1571,7 @@ func PendingAction(icon string, color string, title string, desc string, primary
var templ_7745c5c3_Var75 string
templ_7745c5c3_Var75, templ_7745c5c3_Err = templ.JoinStringErrs(secondaryAction)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 689, Col: 84}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 559, Col: 84}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var75))
if templ_7745c5c3_Err != nil {
@@ -1796,7 +1666,7 @@ func SessionRow(icon string, color string, device string, details string, time s
var templ_7745c5c3_Var78 string
templ_7745c5c3_Var78, templ_7745c5c3_Err = templ.JoinStringErrs(icon)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 718, Col: 45}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 588, Col: 45}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var78))
if templ_7745c5c3_Err != nil {
@@ -1809,7 +1679,7 @@ func SessionRow(icon string, color string, device string, details string, time s
var templ_7745c5c3_Var79 string
templ_7745c5c3_Var79, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues("color: " + color + ";")
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 718, Col: 79}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 588, Col: 79}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var79))
if templ_7745c5c3_Err != nil {
@@ -1822,7 +1692,7 @@ func SessionRow(icon string, color string, device string, details string, time s
var templ_7745c5c3_Var80 string
templ_7745c5c3_Var80, templ_7745c5c3_Err = templ.JoinStringErrs(device)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 722, Col: 40}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 592, Col: 40}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var80))
if templ_7745c5c3_Err != nil {
@@ -1845,7 +1715,7 @@ func SessionRow(icon string, color string, device string, details string, time s
var templ_7745c5c3_Var81 string
templ_7745c5c3_Var81, templ_7745c5c3_Err = templ.JoinStringErrs(details)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 727, Col: 84}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 597, Col: 84}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var81))
if templ_7745c5c3_Err != nil {
@@ -1858,7 +1728,7 @@ func SessionRow(icon string, color string, device string, details string, time s
var templ_7745c5c3_Var82 string
templ_7745c5c3_Var82, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues(sessionTimeStyle(current))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 729, Col: 64}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 599, Col: 64}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var82))
if templ_7745c5c3_Err != nil {
@@ -1871,7 +1741,7 @@ func SessionRow(icon string, color string, device string, details string, time s
var templ_7745c5c3_Var83 string
templ_7745c5c3_Var83, templ_7745c5c3_Err = templ.JoinStringErrs(time)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 729, Col: 73}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 599, Col: 73}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var83))
if templ_7745c5c3_Err != nil {
@@ -1983,7 +1853,7 @@ func ConnectedAppRow(initials string, bg string, name string, domain string, bad
var templ_7745c5c3_Var86 string
templ_7745c5c3_Var86, templ_7745c5c3_Err = templ.JoinStringErrs(initials)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 768, Col: 32}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 638, Col: 32}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var86))
if templ_7745c5c3_Err != nil {
@@ -1996,7 +1866,7 @@ func ConnectedAppRow(initials string, bg string, name string, domain string, bad
var templ_7745c5c3_Var87 string
templ_7745c5c3_Var87, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues("--size: 36px; background: " + bg + ";")
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 768, Col: 82}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 638, Col: 82}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var87))
if templ_7745c5c3_Err != nil {
@@ -2009,7 +1879,7 @@ func ConnectedAppRow(initials string, bg string, name string, domain string, bad
var templ_7745c5c3_Var88 string
templ_7745c5c3_Var88, templ_7745c5c3_Err = templ.JoinStringErrs(name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 772, Col: 38}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 642, Col: 38}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var88))
if templ_7745c5c3_Err != nil {
@@ -2027,7 +1897,7 @@ func ConnectedAppRow(initials string, bg string, name string, domain string, bad
var templ_7745c5c3_Var89 string
templ_7745c5c3_Var89, templ_7745c5c3_Err = templ.JoinStringErrs(badge)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 774, Col: 46}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 644, Col: 46}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var89))
if templ_7745c5c3_Err != nil {
@@ -2045,7 +1915,7 @@ func ConnectedAppRow(initials string, bg string, name string, domain string, bad
var templ_7745c5c3_Var90 string
templ_7745c5c3_Var90, templ_7745c5c3_Err = templ.JoinStringErrs(domain)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 777, Col: 84}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/dashboard.templ`, Line: 647, Col: 84}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var90))
if templ_7745c5c3_Err != nil {

View File

@@ -1,14 +1,11 @@
package views
import "nebula/layouts"
import (
"nebula/layouts"
"nebula/models"
)
type LoginState struct {
Step string
Method string
Error string
}
templ LoginPage(state LoginState) {
templ LoginPage(state models.LoginState) {
@layouts.CenteredCard("Sign In - Sonr") {
<div id="step-content" class="step-content">
@LoginStepContent(state)
@@ -22,7 +19,7 @@ templ LoginPage(state LoginState) {
}
}
templ LoginStepContent(state LoginState) {
templ LoginStepContent(state models.LoginState) {
switch state.Step {
case "qr":
@LoginQRStep()
@@ -35,7 +32,7 @@ templ LoginStepContent(state LoginState) {
}
}
templ LoginStepWithOOB(state LoginState) {
templ LoginStepWithOOB(state models.LoginState) {
@LoginStepContent(state)
}

View File

@@ -8,15 +8,12 @@ package views
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "nebula/layouts"
import (
"nebula/layouts"
"nebula/models"
)
type LoginState struct {
Step string
Method string
Error string
}
func LoginPage(state LoginState) templ.Component {
func LoginPage(state models.LoginState) 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 {
@@ -79,7 +76,7 @@ func LoginPage(state LoginState) templ.Component {
})
}
func LoginStepContent(state LoginState) templ.Component {
func LoginStepContent(state models.LoginState) 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 {
@@ -126,7 +123,7 @@ func LoginStepContent(state LoginState) templ.Component {
})
}
func LoginStepWithOOB(state LoginState) templ.Component {
func LoginStepWithOOB(state models.LoginState) 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 {
@@ -254,7 +251,7 @@ func AuthMethodCard(method string, icon string, title string, description string
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(method)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/login.templ`, Line: 88, Col: 22}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/login.templ`, Line: 85, Col: 22}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
@@ -267,7 +264,7 @@ func AuthMethodCard(method string, icon string, title string, description string
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs("method-" + method)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/login.templ`, Line: 89, Col: 25}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/login.templ`, Line: 86, Col: 25}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
if templ_7745c5c3_Err != nil {
@@ -280,7 +277,7 @@ func AuthMethodCard(method string, icon string, title string, description string
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(icon)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/login.templ`, Line: 91, Col: 39}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/login.templ`, Line: 88, Col: 39}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
if templ_7745c5c3_Err != nil {
@@ -293,7 +290,7 @@ func AuthMethodCard(method string, icon string, title string, description string
var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/login.templ`, Line: 93, Col: 33}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/login.templ`, Line: 90, Col: 33}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
if templ_7745c5c3_Err != nil {
@@ -306,7 +303,7 @@ func AuthMethodCard(method string, icon string, title string, description string
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(description)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/login.templ`, Line: 94, Col: 40}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/login.templ`, Line: 91, Col: 40}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
if templ_7745c5c3_Err != nil {
@@ -324,7 +321,7 @@ func AuthMethodCard(method string, icon string, title string, description string
var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(method + "-spinner")
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/login.templ`, Line: 97, Col: 79}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/login.templ`, Line: 94, Col: 79}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
if templ_7745c5c3_Err != nil {

View File

@@ -3,6 +3,7 @@ package views
import (
"nebula/components"
"nebula/layouts"
"nebula/models"
)
var registerSteps = []string{"Detect", "Register", "Complete"}
@@ -14,23 +15,7 @@ func boolStr(b bool) string {
return "false"
}
// DeviceCapabilities holds the WebAuthn capability detection results
type DeviceCapabilities struct {
Platform bool // Biometrics (Face ID, Touch ID, Windows Hello)
CrossPlatform bool // Security keys (YubiKey, etc.)
Conditional bool // Passkey autofill support
}
// RegisterState holds the current registration state
type RegisterState struct {
Step int
Method string // "passkey", "security-key", or "qr-code"
Username string
Error string
}
// RegisterPage renders the full registration page with the specified step
templ RegisterPage(state RegisterState) {
templ RegisterPage(state models.RegisterState) {
@layouts.CenteredCard("Register - Sonr") {
<div slot="header" id="stepper-container" hx-swap-oob:inherited="true">
@components.OnboardingStepper(state.Step, registerSteps)
@@ -47,8 +32,7 @@ templ RegisterPage(state RegisterState) {
}
}
// RegisterStepContent renders the content for a specific step (used for HTMX partials)
templ RegisterStepContent(state RegisterState) {
templ RegisterStepContent(state models.RegisterState) {
switch state.Step {
case 1:
@RegisterStep1()
@@ -68,8 +52,7 @@ templ RegisterStepContent(state RegisterState) {
}
}
// RegisterStepWithStepper renders step content with OOB stepper update for HTMX 4
templ RegisterStepWithStepper(state RegisterState) {
templ RegisterStepWithStepper(state models.RegisterState) {
@RegisterStepContent(state)
<div id="stepper-container" hx-swap-oob="innerHTML">
@components.OnboardingStepper(state.Step, registerSteps)
@@ -150,14 +133,14 @@ templ CapabilityItem(id string, icon string, label string, supported bool, loadi
</div>
}
templ CapabilitiesResult(caps DeviceCapabilities) {
templ CapabilitiesResult(caps models.DeviceCapabilities) {
@CapabilityItem("cap-platform", "fingerprint", "Face or Fingerprint", caps.Platform, false)
@CapabilityItem("cap-cross-platform", "key", "Hardware Security Key", caps.CrossPlatform, false)
@CapabilityItem("cap-conditional", "bolt", "Quick Sign-in", caps.Conditional, false)
@capabilitiesScript(caps)
}
templ capabilitiesScript(caps DeviceCapabilities) {
templ capabilitiesScript(caps models.DeviceCapabilities) {
<div
id="caps-data"
data-platform={ boolStr(caps.Platform) }

View File

@@ -11,6 +11,7 @@ import templruntime "github.com/a-h/templ/runtime"
import (
"nebula/components"
"nebula/layouts"
"nebula/models"
)
var registerSteps = []string{"Detect", "Register", "Complete"}
@@ -22,23 +23,7 @@ func boolStr(b bool) string {
return "false"
}
// DeviceCapabilities holds the WebAuthn capability detection results
type DeviceCapabilities struct {
Platform bool // Biometrics (Face ID, Touch ID, Windows Hello)
CrossPlatform bool // Security keys (YubiKey, etc.)
Conditional bool // Passkey autofill support
}
// RegisterState holds the current registration state
type RegisterState struct {
Step int
Method string // "passkey", "security-key", or "qr-code"
Username string
Error string
}
// RegisterPage renders the full registration page with the specified step
func RegisterPage(state RegisterState) templ.Component {
func RegisterPage(state models.RegisterState) 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 {
@@ -109,8 +94,7 @@ func RegisterPage(state RegisterState) templ.Component {
})
}
// RegisterStepContent renders the content for a specific step (used for HTMX partials)
func RegisterStepContent(state RegisterState) templ.Component {
func RegisterStepContent(state models.RegisterState) 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 {
@@ -170,8 +154,7 @@ func RegisterStepContent(state RegisterState) templ.Component {
})
}
// RegisterStepWithStepper renders step content with OOB stepper update for HTMX 4
func RegisterStepWithStepper(state RegisterState) templ.Component {
func RegisterStepWithStepper(state models.RegisterState) 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 {
@@ -313,7 +296,7 @@ func CapabilityItem(id string, icon string, label string, supported bool, loadin
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(id)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/register.templ`, Line: 140, Col: 9}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/register.templ`, Line: 123, Col: 9}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
@@ -346,7 +329,7 @@ func CapabilityItem(id string, icon string, label string, supported bool, loadin
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(label)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/register.templ`, Line: 149, Col: 15}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/register.templ`, Line: 132, Col: 15}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
if templ_7745c5c3_Err != nil {
@@ -360,7 +343,7 @@ func CapabilityItem(id string, icon string, label string, supported bool, loadin
})
}
func CapabilitiesResult(caps DeviceCapabilities) templ.Component {
func CapabilitiesResult(caps models.DeviceCapabilities) 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 {
@@ -401,7 +384,7 @@ func CapabilitiesResult(caps DeviceCapabilities) templ.Component {
})
}
func capabilitiesScript(caps DeviceCapabilities) templ.Component {
func capabilitiesScript(caps models.DeviceCapabilities) 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 {
@@ -429,7 +412,7 @@ func capabilitiesScript(caps DeviceCapabilities) templ.Component {
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(boolStr(caps.Platform))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/register.templ`, Line: 163, Col: 40}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/register.templ`, Line: 146, Col: 40}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
if templ_7745c5c3_Err != nil {
@@ -442,7 +425,7 @@ func capabilitiesScript(caps DeviceCapabilities) templ.Component {
var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(boolStr(caps.CrossPlatform))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/register.templ`, Line: 164, Col: 51}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/register.templ`, Line: 147, Col: 51}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
if templ_7745c5c3_Err != nil {
@@ -455,7 +438,7 @@ func capabilitiesScript(caps DeviceCapabilities) templ.Component {
var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(boolStr(caps.Conditional))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/register.templ`, Line: 165, Col: 46}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/register.templ`, Line: 148, Col: 46}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
if templ_7745c5c3_Err != nil {