diff --git a/cmd/motr/proxy.go b/cmd/motr/proxy.go index c0fe54093..38b7c9bfb 100644 --- a/cmd/motr/proxy.go +++ b/cmd/motr/proxy.go @@ -26,6 +26,9 @@ func NewProxyCmd() *cobra.Command { } e.GET("/", pages.Home) + e.GET("/login", pages.Login) + e.GET("/register", pages.Register) + e.GET("/profile", pages.Profile) e.GET("/allocate", pages.Profile) if err := e.Start(":1323"); err != http.ErrServerClosed { diff --git a/pkg/nebula/pages/openid.templ b/pkg/nebula/components/grant/view.templ similarity index 67% rename from pkg/nebula/pages/openid.templ rename to pkg/nebula/components/grant/view.templ index db54ae970..12eefcc79 100644 --- a/pkg/nebula/pages/openid.templ +++ b/pkg/nebula/components/grant/view.templ @@ -1,15 +1,11 @@ -package pages +package grant import ( "github.com/labstack/echo/v4" "github.com/onsonr/sonr/pkg/nebula/components/blocks" ) -func Authorize(c echo.Context) error { - return echoResponse(c, authorizeView(c)) -} - -templ authorizeView(c echo.Context) { +templ View(c echo.Context) { @blocks.Layout("Sonr.ID", true) { @blocks.Card("authorize-view", blocks.SizeMedium) { @blocks.H1("Sonr.ID") diff --git a/pkg/nebula/pages/openid_templ.go b/pkg/nebula/components/grant/view_templ.go similarity index 95% rename from pkg/nebula/pages/openid_templ.go rename to pkg/nebula/components/grant/view_templ.go index 6aa854f2a..fc3ee4105 100644 --- a/pkg/nebula/pages/openid_templ.go +++ b/pkg/nebula/components/grant/view_templ.go @@ -1,7 +1,7 @@ // Code generated by templ - DO NOT EDIT. // templ: version: v0.2.778 -package pages +package grant //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -13,11 +13,7 @@ import ( "github.com/onsonr/sonr/pkg/nebula/components/blocks" ) -func Authorize(c echo.Context) error { - return echoResponse(c, authorizeView(c)) -} - -func authorizeView(c echo.Context) templ.Component { +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 { diff --git a/pkg/nebula/components/home/view.templ b/pkg/nebula/components/home/view.templ new file mode 100644 index 000000000..8e5d5d2d6 --- /dev/null +++ b/pkg/nebula/components/home/view.templ @@ -0,0 +1,19 @@ +package home + +import ( + "github.com/onsonr/sonr/pkg/nebula/components/blocks" + "github.com/onsonr/sonr/pkg/nebula/models" +) + +templ View(hero *models.Hero) { + @blocks.LayoutNoBody("Sonr.ID", true) { + @MarketingHeader() + @SectionHero(hero) + @Highlights() + @Features() + @Bento() + @Lowlights() + @CallToAction() + @MarketingFooter() + } +} diff --git a/pkg/nebula/pages/home_templ.go b/pkg/nebula/components/home/view_templ.go similarity index 80% rename from pkg/nebula/pages/home_templ.go rename to pkg/nebula/components/home/view_templ.go index 5219a0182..97190de17 100644 --- a/pkg/nebula/pages/home_templ.go +++ b/pkg/nebula/components/home/view_templ.go @@ -1,7 +1,7 @@ // Code generated by templ - DO NOT EDIT. // templ: version: v0.2.778 -package pages +package home //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -9,21 +9,11 @@ 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/components/blocks" - "github.com/onsonr/sonr/pkg/nebula/components/home" "github.com/onsonr/sonr/pkg/nebula/models" ) -func Home(c echo.Context) error { - mdls, err := models.GetModels() - if err != nil { - return err - } - return echoResponse(c, homeView(mdls.Hero)) -} - -func homeView(hero *models.Hero) templ.Component { +func View(hero *models.Hero) 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 { @@ -56,7 +46,7 @@ func homeView(hero *models.Hero) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = home.MarketingHeader().Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = MarketingHeader().Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -64,7 +54,7 @@ func homeView(hero *models.Hero) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = home.SectionHero(hero).Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = SectionHero(hero).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -72,7 +62,7 @@ func homeView(hero *models.Hero) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = home.Highlights().Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = Highlights().Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -80,7 +70,7 @@ func homeView(hero *models.Hero) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = home.Features().Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = Features().Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -88,7 +78,7 @@ func homeView(hero *models.Hero) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = home.Bento().Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = Bento().Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -96,7 +86,7 @@ func homeView(hero *models.Hero) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = home.Lowlights().Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = Lowlights().Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -104,7 +94,7 @@ func homeView(hero *models.Hero) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = home.CallToAction().Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = CallToAction().Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -112,7 +102,7 @@ func homeView(hero *models.Hero) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = home.MarketingFooter().Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = MarketingFooter().Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/pkg/nebula/components/login/modal.templ b/pkg/nebula/components/login/modal.templ new file mode 100644 index 000000000..cc600fd06 --- /dev/null +++ b/pkg/nebula/components/login/modal.templ @@ -0,0 +1,74 @@ +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 new file mode 100644 index 000000000..21ae8bc19 --- /dev/null +++ b/pkg/nebula/components/login/modal_templ.go @@ -0,0 +1,42 @@ +// 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/pages/login.templ b/pkg/nebula/components/login/view.templ similarity index 77% rename from pkg/nebula/pages/login.templ rename to pkg/nebula/components/login/view.templ index 290cf78e3..822362fb8 100644 --- a/pkg/nebula/pages/login.templ +++ b/pkg/nebula/components/login/view.templ @@ -1,15 +1,11 @@ -package pages +package login import ( "github.com/labstack/echo/v4" "github.com/onsonr/sonr/pkg/nebula/components/blocks" ) -func Login(c echo.Context) error { - return echoResponse(c, loginView(c)) -} - -templ loginView(c echo.Context) { +templ View(c echo.Context) { @blocks.Layout("Sonr.ID", true) { @blocks.Card("login-view", blocks.SizeLarge) { @blocks.H1("Sonr.ID") diff --git a/pkg/nebula/pages/login_templ.go b/pkg/nebula/components/login/view_templ.go similarity index 97% rename from pkg/nebula/pages/login_templ.go rename to pkg/nebula/components/login/view_templ.go index a3c85fbee..7d5b0b744 100644 --- a/pkg/nebula/pages/login_templ.go +++ b/pkg/nebula/components/login/view_templ.go @@ -1,7 +1,7 @@ // Code generated by templ - DO NOT EDIT. // templ: version: v0.2.778 -package pages +package login //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -13,11 +13,7 @@ import ( "github.com/onsonr/sonr/pkg/nebula/components/blocks" ) -func Login(c echo.Context) error { - return echoResponse(c, loginView(c)) -} - -func loginView(c echo.Context) templ.Component { +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 { diff --git a/pkg/nebula/pages/profile.templ b/pkg/nebula/components/profile/view.templ similarity index 64% rename from pkg/nebula/pages/profile.templ rename to pkg/nebula/components/profile/view.templ index 82d6961b0..cbcded882 100644 --- a/pkg/nebula/pages/profile.templ +++ b/pkg/nebula/components/profile/view.templ @@ -1,15 +1,11 @@ -package pages +package profile import ( "github.com/labstack/echo/v4" "github.com/onsonr/sonr/pkg/nebula/components/blocks" ) -func Profile(c echo.Context) error { - return echoResponse(c, profileView(c)) -} - -templ profileView(c echo.Context) { +templ View(c echo.Context) { @blocks.Layout("Sonr.ID", true) { @blocks.Card("profile-view", blocks.SizeLarge) { @blocks.ProfileCard() diff --git a/pkg/nebula/pages/profile_templ.go b/pkg/nebula/components/profile/view_templ.go similarity index 95% rename from pkg/nebula/pages/profile_templ.go rename to pkg/nebula/components/profile/view_templ.go index d19329074..35ed75868 100644 --- a/pkg/nebula/pages/profile_templ.go +++ b/pkg/nebula/components/profile/view_templ.go @@ -1,7 +1,7 @@ // Code generated by templ - DO NOT EDIT. // templ: version: v0.2.778 -package pages +package profile //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -13,11 +13,7 @@ import ( "github.com/onsonr/sonr/pkg/nebula/components/blocks" ) -func Profile(c echo.Context) error { - return echoResponse(c, profileView(c)) -} - -func profileView(c echo.Context) templ.Component { +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 { diff --git a/pkg/nebula/components/register/modal.templ b/pkg/nebula/components/register/modal.templ new file mode 100644 index 000000000..6d8576d86 --- /dev/null +++ b/pkg/nebula/components/register/modal.templ @@ -0,0 +1,66 @@ +package register + +import ( + "github.com/labstack/echo/v4" + "github.com/onsonr/sonr/pkg/nebula/components/blocks" + "github.com/onsonr/sonr/pkg/nebula/models/formstate" +) + +templ Modal(c echo.Context) { +
+ + +
+} diff --git a/pkg/nebula/components/register/modal_templ.go b/pkg/nebula/components/register/modal_templ.go new file mode 100644 index 000000000..bdbff4358 --- /dev/null +++ b/pkg/nebula/components/register/modal_templ.go @@ -0,0 +1,92 @@ +// 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" + +import ( + "github.com/labstack/echo/v4" + "github.com/onsonr/sonr/pkg/nebula/components/blocks" + "github.com/onsonr/sonr/pkg/nebula/models/formstate" +) + +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/pages/register.templ b/pkg/nebula/components/register/view.templ similarity index 93% rename from pkg/nebula/pages/register.templ rename to pkg/nebula/components/register/view.templ index 7dbf62e14..c5d2ca951 100644 --- a/pkg/nebula/pages/register.templ +++ b/pkg/nebula/components/register/view.templ @@ -1,4 +1,4 @@ -package pages +package register import ( "github.com/labstack/echo/v4" @@ -6,11 +6,7 @@ import ( "github.com/onsonr/sonr/pkg/nebula/models/formstate" ) -func Register(c echo.Context) error { - return echoResponse(c, registerView(c)) -} - -templ registerView(c echo.Context) { +templ View(c echo.Context) { @blocks.Layout("Sonr.ID", true) { @blocks.Card("register-view", blocks.SizeMedium) { @blocks.H2("Account Registration") diff --git a/pkg/nebula/pages/register_templ.go b/pkg/nebula/components/register/view_templ.go similarity index 98% rename from pkg/nebula/pages/register_templ.go rename to pkg/nebula/components/register/view_templ.go index a419fd775..8db4b3e64 100644 --- a/pkg/nebula/pages/register_templ.go +++ b/pkg/nebula/components/register/view_templ.go @@ -1,7 +1,7 @@ // Code generated by templ - DO NOT EDIT. // templ: version: v0.2.778 -package pages +package register //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -14,11 +14,7 @@ import ( "github.com/onsonr/sonr/pkg/nebula/models/formstate" ) -func Register(c echo.Context) error { - return echoResponse(c, registerView(c)) -} - -func registerView(c echo.Context) templ.Component { +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 { diff --git a/pkg/nebula/nebula.go b/pkg/nebula/nebula.go index 8cde2b5f9..8a06ce455 100644 --- a/pkg/nebula/nebula.go +++ b/pkg/nebula/nebula.go @@ -14,7 +14,7 @@ import ( //go:embed assets var embeddedFiles embed.FS -//go:embed assets/static.pkl +//go:embed nebula.pkl var config []byte func getHTTPFS() (http.FileSystem, error) { diff --git a/pkg/nebula/assets/static.pkl b/pkg/nebula/nebula.pkl similarity index 90% rename from pkg/nebula/assets/static.pkl rename to pkg/nebula/nebula.pkl index d8f6de5f5..7c50c3c67 100644 --- a/pkg/nebula/assets/static.pkl +++ b/pkg/nebula/nebula.pkl @@ -14,9 +14,9 @@ hero = new Hero { href = "/about"; }; image = new Image { - src = "https://cdn.sonr.id/img/hero-clipped.svg"; - width = "560"; - height = "560"; + src = "https://cdn.sonr.id/img/hero-clipped.png"; + width = "520"; + height = "520"; }; }; diff --git a/pkg/nebula/pages/grant.go b/pkg/nebula/pages/grant.go new file mode 100644 index 000000000..96beb6b6e --- /dev/null +++ b/pkg/nebula/pages/grant.go @@ -0,0 +1,11 @@ +package pages + +import ( + "github.com/labstack/echo/v4" + + "github.com/onsonr/sonr/pkg/nebula/components/grant" +) + +func Authorize(c echo.Context) error { + return echoResponse(c, grant.View(c)) +} diff --git a/pkg/nebula/pages/home.go b/pkg/nebula/pages/home.go new file mode 100644 index 000000000..98c70ecf3 --- /dev/null +++ b/pkg/nebula/pages/home.go @@ -0,0 +1,15 @@ +package pages + +import ( + "github.com/labstack/echo/v4" + "github.com/onsonr/sonr/pkg/nebula/components/home" + "github.com/onsonr/sonr/pkg/nebula/models" +) + +func Home(c echo.Context) error { + mdls, err := models.GetModels() + if err != nil { + return err + } + return echoResponse(c, home.View(mdls.Hero)) +} diff --git a/pkg/nebula/pages/home.templ b/pkg/nebula/pages/home.templ deleted file mode 100644 index aa23c357b..000000000 --- a/pkg/nebula/pages/home.templ +++ /dev/null @@ -1,29 +0,0 @@ -package pages - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/pkg/nebula/components/blocks" - "github.com/onsonr/sonr/pkg/nebula/components/home" - "github.com/onsonr/sonr/pkg/nebula/models" -) - -func Home(c echo.Context) error { - mdls, err := models.GetModels() - if err != nil { - return err - } - return echoResponse(c, homeView(mdls.Hero)) -} - -templ homeView(hero *models.Hero) { - @blocks.LayoutNoBody("Sonr.ID", true) { - @home.MarketingHeader() - @home.SectionHero(hero) - @home.Highlights() - @home.Features() - @home.Bento() - @home.Lowlights() - @home.CallToAction() - @home.MarketingFooter() - } -} diff --git a/pkg/nebula/pages/login.go b/pkg/nebula/pages/login.go new file mode 100644 index 000000000..0541968d3 --- /dev/null +++ b/pkg/nebula/pages/login.go @@ -0,0 +1,11 @@ +package pages + +import ( + "github.com/labstack/echo/v4" + + "github.com/onsonr/sonr/pkg/nebula/components/login" +) + +func Login(c echo.Context) error { + return echoResponse(c, login.Modal(c)) +} diff --git a/pkg/nebula/pages/profile.go b/pkg/nebula/pages/profile.go new file mode 100644 index 000000000..af7cbdeaa --- /dev/null +++ b/pkg/nebula/pages/profile.go @@ -0,0 +1,11 @@ +package pages + +import ( + "github.com/labstack/echo/v4" + + "github.com/onsonr/sonr/pkg/nebula/components/profile" +) + +func Profile(c echo.Context) error { + return echoResponse(c, profile.View(c)) +} diff --git a/pkg/nebula/pages/register.go b/pkg/nebula/pages/register.go new file mode 100644 index 000000000..78b0e0a98 --- /dev/null +++ b/pkg/nebula/pages/register.go @@ -0,0 +1,11 @@ +package pages + +import ( + "github.com/labstack/echo/v4" + + "github.com/onsonr/sonr/pkg/nebula/components/register" +) + +func Register(c echo.Context) error { + return echoResponse(c, register.Modal(c)) +} diff --git a/pkg/nebula/pages/pages.go b/pkg/nebula/pages/utils.go similarity index 100% rename from pkg/nebula/pages/pages.go rename to pkg/nebula/pages/utils.go