From 5c3966a9d6f438392ed5087b9b73d7f5f0ec5ada Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Sun, 8 Dec 2024 21:45:37 -0500 Subject: [PATCH] fix: remove line-clamp from tailwind config --- devbox.json | 12 +- pkg/blocks/cards/profile-card.templ | 31 ++++++ pkg/blocks/cards/profile-card_templ.go | 105 ++++++++++++++++++ pkg/blocks/layout/scripts.templ | 2 +- pkg/blocks/layout/scripts_templ.go | 2 +- pkg/gateway/handlers/index_handler.go | 7 +- pkg/gateway/handlers/register_handler.go | 3 +- .../internal/pages/register/page.templ | 8 +- .../internal/pages/register/page_templ.go | 22 +--- pkg/gateway/internal/session/context.go | 7 ++ 10 files changed, 162 insertions(+), 37 deletions(-) create mode 100644 pkg/blocks/cards/profile-card.templ create mode 100644 pkg/blocks/cards/profile-card_templ.go diff --git a/devbox.json b/devbox.json index fbf599d53..cdf4e3159 100644 --- a/devbox.json +++ b/devbox.json @@ -40,10 +40,16 @@ "gum spin --title='Uploading to Bucket' -- make deploy-cdn" ], "devnet:start": [ - "process-compose up -f deploy/devnet/process-compose.yaml --detached --hide-disabled" + "process-compose up -f deploy/devnet/process-compose.yaml" + ], + "devnet:attach": [ + "cd deploy/devnet", + "process-compose attach" + ], + "devnet:stop": [ + "cd deploy/devnet", + "process-compose down " ], - "devnet:attach": ["cd deploy/devnet", "process-compose attach"], - "devnet:stop": ["cd deploy/devnet", "process-compose down "], "testnet:start": [ "process-compose up -f deploy/testnet/process-compose.yaml --detached --hide-disabled" ], diff --git a/pkg/blocks/cards/profile-card.templ b/pkg/blocks/cards/profile-card.templ new file mode 100644 index 000000000..26a6de7aa --- /dev/null +++ b/pkg/blocks/cards/profile-card.templ @@ -0,0 +1,31 @@ +package cards + +templ ProfileCard(address string, handle string, name string, chainID string, creationBlock string) { +
+
+
+
+

{ chainID }

+

{ handle }

+
+
+
+
+
+
+
+ { address } +
+
+
+

Block Created

+

#{ creationBlock }

+
+
+

Issued to

+

{ name }

+
+
+
+
+} diff --git a/pkg/blocks/cards/profile-card_templ.go b/pkg/blocks/cards/profile-card_templ.go new file mode 100644 index 000000000..d32050265 --- /dev/null +++ b/pkg/blocks/cards/profile-card_templ.go @@ -0,0 +1,105 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.793 +package cards + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import templruntime "github.com/a-h/templ/runtime" + +func ProfileCard(address string, handle string, name string, chainID string, creationBlock string) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var2 string + templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(chainID) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/blocks/cards/profile-card.templ`, Line: 8, Col: 18} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var3 string + templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(handle) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/blocks/cards/profile-card.templ`, Line: 9, Col: 43} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var4 string + templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(address) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/blocks/cards/profile-card.templ`, Line: 17, Col: 35} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Block Created

#") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var5 string + templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(creationBlock) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/blocks/cards/profile-card.templ`, Line: 22, Col: 55} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Issued to

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var6 string + templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(name) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/blocks/cards/profile-card.templ`, Line: 26, Col: 32} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) +} + +var _ = templruntime.GeneratedTemplate diff --git a/pkg/blocks/layout/scripts.templ b/pkg/blocks/layout/scripts.templ index 8ad03b00c..e7fbaf921 100644 --- a/pkg/blocks/layout/scripts.templ +++ b/pkg/blocks/layout/scripts.templ @@ -18,7 +18,7 @@ var ( // Tailwind css dependencies templ Tailwind() { @tailwindHandle.Once() { - + } } diff --git a/pkg/blocks/layout/scripts_templ.go b/pkg/blocks/layout/scripts_templ.go index ddb01809e..c7000c1c3 100644 --- a/pkg/blocks/layout/scripts_templ.go +++ b/pkg/blocks/layout/scripts_templ.go @@ -57,7 +57,7 @@ func Tailwind() templ.Component { }() } ctx = templ.InitializeContext(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/pkg/gateway/handlers/index_handler.go b/pkg/gateway/handlers/index_handler.go index 0a9b420b4..24ac87f91 100644 --- a/pkg/gateway/handlers/index_handler.go +++ b/pkg/gateway/handlers/index_handler.go @@ -1,8 +1,6 @@ package handlers import ( - "net/http" - "github.com/labstack/echo/v4" "github.com/onsonr/sonr/pkg/common/response" "github.com/onsonr/sonr/pkg/gateway/internal/pages/index" @@ -10,13 +8,10 @@ import ( ) func HandleIndex(c echo.Context) error { - if isInitial(c) { - return response.TemplEcho(c, index.InitialView()) - } if isExpired(c) { return response.TemplEcho(c, index.ReturningView()) } - return c.Render(http.StatusOK, "index.templ", nil) + return response.TemplEcho(c, index.InitialView()) } // ╭─────────────────────────────────────────────────────────╮ diff --git a/pkg/gateway/handlers/register_handler.go b/pkg/gateway/handlers/register_handler.go index eeb623412..c36179317 100644 --- a/pkg/gateway/handlers/register_handler.go +++ b/pkg/gateway/handlers/register_handler.go @@ -28,8 +28,7 @@ func HandleRegisterStart(c echo.Context) error { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - req := getLinkCredentialRequest(c, ks.Address(), handle, ks.UserJSON()) - return response.TemplEcho(c, register.LinkCredentialView(req)) + return response.TemplEcho(c, register.LinkCredentialView(ks.Address(), handle)) } func HandleRegisterFinish(c echo.Context) error { diff --git a/pkg/gateway/internal/pages/register/page.templ b/pkg/gateway/internal/pages/register/page.templ index 135f984cb..7075316d4 100644 --- a/pkg/gateway/internal/pages/register/page.templ +++ b/pkg/gateway/internal/pages/register/page.templ @@ -21,16 +21,14 @@ templ ProfileFormView(turnstileSiteKey string) { } } -templ LinkCredentialView(req LinkCredentialRequest) { +templ LinkCredentialView(addr string, handle string) { @layout.Root("Register | Sonr.ID") { @layout.Container() { @text.Header("Link a PassKey", "This will be used to login to your vault.") @form.Form("/register/finish", "POST", form.PasskeyInput("passkey"), "65", false) { @details.PropertyList() { - @details.Property("Address", req.Address, "wallet") - @details.Property("Handle", req.Handle, "at-sign") - @details.Property("Platform", req.Platform, "device-iphone") - @details.Property("Model", req.DeviceModel, "laptop") + @details.Property("Address", addr, "wallet") + @details.Property("Handle", handle, "at-sign") } } } diff --git a/pkg/gateway/internal/pages/register/page_templ.go b/pkg/gateway/internal/pages/register/page_templ.go index b98dbd4de..3690df84f 100644 --- a/pkg/gateway/internal/pages/register/page_templ.go +++ b/pkg/gateway/internal/pages/register/page_templ.go @@ -122,7 +122,7 @@ func ProfileFormView(turnstileSiteKey string) templ.Component { }) } -func LinkCredentialView(req LinkCredentialRequest) templ.Component { +func LinkCredentialView(addr string, handle 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 { @@ -199,7 +199,7 @@ func LinkCredentialView(req LinkCredentialRequest) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = details.Property("Address", req.Address, "wallet").Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = details.Property("Address", addr, "wallet").Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -207,23 +207,7 @@ func LinkCredentialView(req LinkCredentialRequest) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = details.Property("Handle", req.Handle, "at-sign").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = details.Property("Platform", req.Platform, "device-iphone").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = details.Property("Model", req.DeviceModel, "laptop").Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = details.Property("Handle", handle, "at-sign").Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/pkg/gateway/internal/session/context.go b/pkg/gateway/internal/session/context.go index ace6e4b15..796f32ef5 100644 --- a/pkg/gateway/internal/session/context.go +++ b/pkg/gateway/internal/session/context.go @@ -1,6 +1,7 @@ package session import ( + "fmt" "regexp" "strings" @@ -33,6 +34,12 @@ func (s *HTTPContext) InitSession() error { return err } } + fmt.Println(sess.BrowserName) + fmt.Println(sess.BrowserVersion) + fmt.Println(sess.UserArchitecture) + fmt.Println(sess.Platform) + fmt.Println(sess.PlatformVersion) + fmt.Println(sess.DeviceModel) s.sess = &sess return nil