diff --git a/pkg/nebula/components/register/modal.templ b/pkg/nebula/components/auth/modal.templ similarity index 96% rename from pkg/nebula/components/register/modal.templ rename to pkg/nebula/components/auth/modal.templ index 557fd3aa5..2f69f3fa1 100644 --- a/pkg/nebula/components/register/modal.templ +++ b/pkg/nebula/components/auth/modal.templ @@ -1,9 +1,10 @@ -package register +package auth import ( "github.com/labstack/echo/v4" "github.com/onsonr/sonr/pkg/nebula/global/styles" "github.com/onsonr/sonr/pkg/nebula/global/ui" + "github.com/onsonr/sonr/pkg/nebula/components/auth/forms" ) templ Modal(c echo.Context) { @@ -47,7 +48,7 @@ templ Modal(c echo.Context) {

Enter your account information below to create your account.

@ui.Breadcrumbs() - @basicInfoForm() + @forms.ProfileDetailsForm() @styles.Spacer()
diff --git a/pkg/nebula/components/register/modal_templ.go b/pkg/nebula/components/auth/modal_templ.go similarity index 96% rename from pkg/nebula/components/register/modal_templ.go rename to pkg/nebula/components/auth/modal_templ.go index 9cd7c8aed..efd88f67a 100644 --- a/pkg/nebula/components/register/modal_templ.go +++ b/pkg/nebula/components/auth/modal_templ.go @@ -1,7 +1,7 @@ // Code generated by templ - DO NOT EDIT. // templ: version: v0.2.778 -package register +package auth //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -10,6 +10,7 @@ import templruntime "github.com/a-h/templ/runtime" import ( "github.com/labstack/echo/v4" + "github.com/onsonr/sonr/pkg/nebula/components/auth/forms" "github.com/onsonr/sonr/pkg/nebula/global/styles" "github.com/onsonr/sonr/pkg/nebula/global/ui" ) @@ -43,7 +44,7 @@ func Modal(c echo.Context) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = basicInfoForm().Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = forms.ProfileDetailsForm().Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/pkg/nebula/components/home/view.templ b/pkg/nebula/components/home/page.templ similarity index 100% rename from pkg/nebula/components/home/view.templ rename to pkg/nebula/components/home/page.templ diff --git a/pkg/nebula/components/home/view_templ.go b/pkg/nebula/components/home/page_templ.go similarity index 100% rename from pkg/nebula/components/home/view_templ.go rename to pkg/nebula/components/home/page_templ.go diff --git a/pkg/nebula/components/login/modal.templ b/pkg/nebula/components/login/modal.templ deleted file mode 100644 index 95ddc5606..000000000 --- a/pkg/nebula/components/login/modal.templ +++ /dev/null @@ -1,73 +0,0 @@ -package login - -import "github.com/labstack/echo/v4" - -templ Modal(c echo.Context) { -
- -
-} diff --git a/pkg/nebula/components/login/modal_templ.go b/pkg/nebula/components/login/modal_templ.go deleted file mode 100644 index f3797dd6d..000000000 --- a/pkg/nebula/components/login/modal_templ.go +++ /dev/null @@ -1,42 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package login - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -import "github.com/labstack/echo/v4" - -func Modal(c echo.Context) 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 - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/pkg/nebula/components/login/view.templ b/pkg/nebula/components/login/view.templ deleted file mode 100644 index 67642100e..000000000 --- a/pkg/nebula/components/login/view.templ +++ /dev/null @@ -1,21 +0,0 @@ -package login - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/pkg/nebula/global/styles" - "github.com/onsonr/sonr/pkg/nebula/global/ui" -) - -templ View(c echo.Context) { - @styles.Layout("Sonr.ID", true) { - @ui.Card("login-view", styles.SizeLarge) { - @styles.H1("Sonr.ID") - @styles.Text("Neo-tree is a file manager for NeoFS.") - @styles.Spacer() - @styles.Spacer() - @ui.Button(ui.GET("/", "#login-view")) { - @styles.Text("Cancel") - } - } - } -} diff --git a/pkg/nebula/components/login/view_templ.go b/pkg/nebula/components/login/view_templ.go deleted file mode 100644 index e55aafdf0..000000000 --- a/pkg/nebula/components/login/view_templ.go +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package login - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/pkg/nebula/global/styles" - "github.com/onsonr/sonr/pkg/nebula/global/ui" -) - -func View(c echo.Context) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var3 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = styles.H1("Sonr.ID").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 = styles.Text("Neo-tree is a file manager for NeoFS.").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 = styles.Spacer().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 = styles.Spacer().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_Var4 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = styles.Text("Cancel").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = ui.Button(ui.GET("/", "#login-view")).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = ui.Card("login-view", styles.SizeLarge).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = styles.Layout("Sonr.ID", true).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/pkg/nebula/components/register/view.templ b/pkg/nebula/components/register/view.templ deleted file mode 100644 index 64bdcbe22..000000000 --- a/pkg/nebula/components/register/view.templ +++ /dev/null @@ -1,11 +0,0 @@ -package register - -templ basicInfoForm() { -
-
-
-
-
-
-
-} diff --git a/pkg/nebula/components/register/view_templ.go b/pkg/nebula/components/register/view_templ.go deleted file mode 100644 index e29262c8e..000000000 --- a/pkg/nebula/components/register/view_templ.go +++ /dev/null @@ -1,40 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package register - -//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 basicInfoForm() 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 - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/pkg/nebula/global/events.go b/pkg/nebula/global/events.go new file mode 100644 index 000000000..e6cf05459 --- /dev/null +++ b/pkg/nebula/global/events.go @@ -0,0 +1,13 @@ +package global + +type Event string + +const ( + // Auth + AuthLoginSuccess Event = "login_success" + AuthLogoutSuccess Event = "logout_success" + AuthRegisterSuccess Event = "register_success" + AuthRegisterFailure Event = "register_failure" + + WalletTransactionConfirmed Event = "transaction_confirmed" +) diff --git a/pkg/nebula/router/state.go b/pkg/nebula/router/state.go deleted file mode 100644 index 10b1ce322..000000000 --- a/pkg/nebula/router/state.go +++ /dev/null @@ -1,13 +0,0 @@ -package router - -type Status string - -const ( - StatusOK Status = "ok" - StatusError Status = "error" - StatusNotFound Status = "not-found" - StatusUnauthorized Status = "unauthorized" - StatusForbidden Status = "forbidden" - StatusInternalServerError Status = "internal-server-error" - StatusBadRequest Status = "bad-request" -) diff --git a/pkg/nebula/router/router.go b/pkg/nebula/routes/routes.go similarity index 77% rename from pkg/nebula/router/router.go rename to pkg/nebula/routes/routes.go index 04242ff0d..3bd754f7e 100644 --- a/pkg/nebula/router/router.go +++ b/pkg/nebula/routes/routes.go @@ -1,4 +1,4 @@ -package router +package routes import ( "bytes" @@ -6,9 +6,8 @@ import ( "github.com/a-h/templ" "github.com/labstack/echo/v4" + "github.com/onsonr/sonr/pkg/nebula/components/auth" "github.com/onsonr/sonr/pkg/nebula/components/home" - "github.com/onsonr/sonr/pkg/nebula/components/login" - "github.com/onsonr/sonr/pkg/nebula/components/register" "github.com/onsonr/sonr/pkg/nebula/models" ) @@ -28,12 +27,32 @@ func Home(c echo.Context) error { // │ Authentication Views │ // ╰───────────────────────────────────────────────────────────╯ -func Login(c echo.Context) error { - return render(c, login.Modal(c)) +func AuthorizeStart(c echo.Context) error { + return render(c, auth.Modal(c)) } -func Register(c echo.Context) error { - return render(c, register.Modal(c)) +func AuthorizeFinish(c echo.Context) error { + return render(c, auth.Modal(c)) +} + +func LoginDevice(c echo.Context) error { + return render(c, auth.Modal(c)) +} + +func LoginStart(c echo.Context) error { + return render(c, auth.Modal(c)) +} + +func LoginFinish(c echo.Context) error { + return render(c, auth.Modal(c)) +} + +func RegisterStart(c echo.Context) error { + return render(c, auth.Modal(c)) +} + +func RegisterFinish(c echo.Context) error { + return render(c, auth.Modal(c)) } // ╭───────────────────────────────────────────────────────────╮