From 0d4f2946f35ee5a5812f8f8cbc99c656459bbff2 Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Wed, 11 Dec 2024 13:26:26 -0500 Subject: [PATCH] fix: correct title of profile creation page --- internal/gateway/handlers/register/data.go | 8 ++++++++ internal/gateway/handlers/register/handlers.go | 11 ++--------- internal/gateway/handlers/register/views.templ | 2 +- internal/gateway/handlers/register/views_templ.go | 2 +- pkg/common/styles/layout/container.templ | 2 +- pkg/common/styles/layout/container_templ.go | 2 +- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/internal/gateway/handlers/register/data.go b/internal/gateway/handlers/register/data.go index 0063025e5..b0109d9c0 100644 --- a/internal/gateway/handlers/register/data.go +++ b/internal/gateway/handlers/register/data.go @@ -6,6 +6,7 @@ import ( "net/http" "github.com/labstack/echo/v4" + "golang.org/x/exp/rand" ) // Define the credential structure matching our frontend data @@ -76,3 +77,10 @@ func extractCredentialDescriptor(jsonString string) (*Credential, error) { ) return cred, nil } + +func randomCreateProfileData() CreateProfileData { + return CreateProfileData{ + FirstNumber: rand.Intn(5) + 1, + LastNumber: rand.Intn(4) + 1, + } +} diff --git a/internal/gateway/handlers/register/handlers.go b/internal/gateway/handlers/register/handlers.go index 26c5b9563..c04dff73f 100644 --- a/internal/gateway/handlers/register/handlers.go +++ b/internal/gateway/handlers/register/handlers.go @@ -8,11 +8,11 @@ import ( "github.com/labstack/echo/v4" "github.com/onsonr/sonr/crypto/mpc" "github.com/onsonr/sonr/pkg/common/response" - "golang.org/x/exp/rand" ) func HandleCreateProfile(c echo.Context) error { - return response.TemplEcho(c, ProfileFormView(randomCreateProfileData())) + d := randomCreateProfileData() + return response.TemplEcho(c, ProfileFormView(d)) } func HandlePasskeyStart(c echo.Context) error { @@ -47,10 +47,3 @@ func HandlePasskeyFinish(c echo.Context) error { } return response.TemplEcho(c, LoadingVaultView()) } - -func randomCreateProfileData() CreateProfileData { - return CreateProfileData{ - FirstNumber: rand.Intn(5) + 1, - LastNumber: rand.Intn(4) + 1, - } -} diff --git a/internal/gateway/handlers/register/views.templ b/internal/gateway/handlers/register/views.templ index 97da3831b..ad9a9b9ce 100644 --- a/internal/gateway/handlers/register/views.templ +++ b/internal/gateway/handlers/register/views.templ @@ -6,7 +6,7 @@ import ( ) templ ProfileFormView(data CreateProfileData) { - @layout.Root("Create Profile | Sonr.ID") { + @layout.Root("New Profile | Sonr.ID") { @layout.Container() { @text.Header("Basic Info", "Tell us a little about yourself.") @formCreateProfile("/register/start", "POST", data) diff --git a/internal/gateway/handlers/register/views_templ.go b/internal/gateway/handlers/register/views_templ.go index 955e0c7a6..8012f3e57 100644 --- a/internal/gateway/handlers/register/views_templ.go +++ b/internal/gateway/handlers/register/views_templ.go @@ -78,7 +78,7 @@ func ProfileFormView(data CreateProfileData) templ.Component { } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = layout.Root("Create Profile | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = layout.Root("New Profile | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/pkg/common/styles/layout/container.templ b/pkg/common/styles/layout/container.templ index 98ddf9f05..a3f4c9413 100644 --- a/pkg/common/styles/layout/container.templ +++ b/pkg/common/styles/layout/container.templ @@ -10,7 +10,7 @@ templ Columns() { templ Container() {
-
+
{ children... }
diff --git a/pkg/common/styles/layout/container_templ.go b/pkg/common/styles/layout/container_templ.go index 5d5590bc9..3df14298a 100644 --- a/pkg/common/styles/layout/container_templ.go +++ b/pkg/common/styles/layout/container_templ.go @@ -67,7 +67,7 @@ func Container() templ.Component { templ_7745c5c3_Var2 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }