mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
feature/did swt ante (#22)
* feat: add support for vault allocation * feat(dwn): Add IPFS client * refactor: move GetDefaultBypassFeeMessages to ibc/module.go * refactor(did): clean up genesis state definition * feat: remove global integrity proof requirement * feat: remove gas consumption for tx size * feat: add registration route * refactor: centralize response handling in the package * feat(types): add account and pubkey types * refactor: simplify dockerfile process-compose.yaml copy
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
package islands
|
||||
|
||||
import "github.com/labstack/echo/v4"
|
||||
|
||||
templ BasicInfo(c echo.Context, state FormState) {
|
||||
switch (state) {
|
||||
default:
|
||||
<div class="border rounded-lg shadow-sm bg-card text-neutral-900">
|
||||
<div class="flex flex-col space-y-1.5 p-6">
|
||||
<h3 class="text-lg font-semibold leading-none tracking-tight">Account</h3>
|
||||
<p class="text-sm text-neutral-500">Make changes to your account here. Click save when you're done.</p>
|
||||
</div>
|
||||
<div class="p-6 pt-0 space-y-2">
|
||||
<div class="space-y-1"><label class="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" for="name">Name</label><input type="text" id="name" placeholder="Adam Wathan" class="flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-neutral-300 ring-offset-background placeholder:text-neutral-400 focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50"/></div>
|
||||
<div class="space-y-1"><label class="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" for="username">Handle</label><input type="text" id="handle" placeholder="angelo.snr" class="flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-neutral-300 ring-offset-background placeholder:text-neutral-400 focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50"/></div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
templ CreateCredentials(c echo.Context, state FormState) {
|
||||
}
|
||||
|
||||
templ PrivacyTerms(c echo.Context, state FormState) {
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.778
|
||||
package islands
|
||||
|
||||
//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 BasicInfo(c echo.Context, state FormState) 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)
|
||||
switch state {
|
||||
default:
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"border rounded-lg shadow-sm bg-card text-neutral-900\"><div class=\"flex flex-col space-y-1.5 p-6\"><h3 class=\"text-lg font-semibold leading-none tracking-tight\">Account</h3><p class=\"text-sm text-neutral-500\">Make changes to your account here. Click save when you're done.</p></div><div class=\"p-6 pt-0 space-y-2\"><div class=\"space-y-1\"><label class=\"text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\" for=\"name\">Name</label><input type=\"text\" id=\"name\" placeholder=\"Adam Wathan\" class=\"flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-neutral-300 ring-offset-background placeholder:text-neutral-400 focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50\"></div><div class=\"space-y-1\"><label class=\"text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\" for=\"username\">Handle</label><input type=\"text\" id=\"handle\" placeholder=\"angelo.snr\" class=\"flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-neutral-300 ring-offset-background placeholder:text-neutral-400 focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50\"></div></div></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func CreateCredentials(c echo.Context, state FormState) 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_Var2 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var2 == nil {
|
||||
templ_7745c5c3_Var2 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func PrivacyTerms(c echo.Context, state FormState) 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_Var3 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var3 == nil {
|
||||
templ_7745c5c3_Var3 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
@@ -0,0 +1,14 @@
|
||||
package nebula
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/pkg/nebula/pages"
|
||||
)
|
||||
|
||||
func RegisterHandlers(e *echo.Echo) {
|
||||
e.GET("/home", pages.Home)
|
||||
e.GET("/login", pages.Login)
|
||||
e.GET("/register", pages.Register)
|
||||
e.GET("/profile", pages.Profile)
|
||||
e.GET("/authorize", pages.Authorize)
|
||||
}
|
||||
@@ -5,7 +5,11 @@ import (
|
||||
"github.com/onsonr/sonr/pkg/nebula/blocks"
|
||||
)
|
||||
|
||||
templ Home(c echo.Context) {
|
||||
func Home(c echo.Context) error {
|
||||
return echoResponse(c, homeView())
|
||||
}
|
||||
|
||||
templ homeView() {
|
||||
@blocks.Card("home-view", blocks.SizeLarge) {
|
||||
@blocks.H1("Sonr.ID")
|
||||
@blocks.Text("A Decentralized Web Node Client for the Sonr Network.")
|
||||
|
||||
@@ -13,7 +13,11 @@ import (
|
||||
"github.com/onsonr/sonr/pkg/nebula/blocks"
|
||||
)
|
||||
|
||||
func Home(c echo.Context) templ.Component {
|
||||
func Home(c echo.Context) error {
|
||||
return echoResponse(c, homeView())
|
||||
}
|
||||
|
||||
func homeView() 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 {
|
||||
|
||||
@@ -5,7 +5,11 @@ import (
|
||||
"github.com/onsonr/sonr/pkg/nebula/blocks"
|
||||
)
|
||||
|
||||
templ Login(c echo.Context) {
|
||||
func Login(c echo.Context) error {
|
||||
return echoResponse(c, loginView(c))
|
||||
}
|
||||
|
||||
templ loginView(c echo.Context) {
|
||||
@blocks.Card("login-view", blocks.SizeLarge) {
|
||||
@blocks.H1("Sonr.ID")
|
||||
@blocks.Text("Neo-tree is a file manager for NeoFS.")
|
||||
|
||||
@@ -13,7 +13,11 @@ import (
|
||||
"github.com/onsonr/sonr/pkg/nebula/blocks"
|
||||
)
|
||||
|
||||
func Login(c echo.Context) templ.Component {
|
||||
func Login(c echo.Context) error {
|
||||
return echoResponse(c, loginView(c))
|
||||
}
|
||||
|
||||
func loginView(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 {
|
||||
|
||||
@@ -5,7 +5,11 @@ import (
|
||||
"github.com/onsonr/sonr/pkg/nebula/blocks"
|
||||
)
|
||||
|
||||
templ Authorize(c echo.Context) {
|
||||
func Authorize(c echo.Context) error {
|
||||
return echoResponse(c, authorizeView(c))
|
||||
}
|
||||
|
||||
templ authorizeView(c echo.Context) {
|
||||
@blocks.Card("authorize-view", blocks.SizeMedium) {
|
||||
@blocks.H1("Sonr.ID")
|
||||
@blocks.Text("Neo-tree is a file manager for NeoFS.")
|
||||
|
||||
@@ -13,7 +13,11 @@ import (
|
||||
"github.com/onsonr/sonr/pkg/nebula/blocks"
|
||||
)
|
||||
|
||||
func Authorize(c echo.Context) templ.Component {
|
||||
func Authorize(c echo.Context) error {
|
||||
return echoResponse(c, authorizeView(c))
|
||||
}
|
||||
|
||||
func authorizeView(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 {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package islands
|
||||
package pages
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
func echoFormResponse(c echo.Context, cmp templ.Component, state FormState) error {
|
||||
func echoResponse(c echo.Context, cmp templ.Component) error {
|
||||
// Create a buffer to store the rendered HTML
|
||||
buf := &bytes.Buffer{}
|
||||
// Render the component to the buffer
|
||||
@@ -18,24 +18,8 @@ func echoFormResponse(c echo.Context, cmp templ.Component, state FormState) erro
|
||||
|
||||
// Set the content type
|
||||
c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML)
|
||||
c.Response().Header().Set("X-Status", string(state))
|
||||
|
||||
// Write the buffered content to the response
|
||||
_, err = c.Response().Write(buf.Bytes())
|
||||
return err
|
||||
}
|
||||
|
||||
type FormState string
|
||||
|
||||
const (
|
||||
InitialForm FormState = "initial"
|
||||
ErrorForm FormState = "error"
|
||||
SuccessForm FormState = "success"
|
||||
WarningForm FormState = "warning"
|
||||
)
|
||||
|
||||
type Form struct {
|
||||
State FormState
|
||||
Title string
|
||||
Description string
|
||||
}
|
||||
@@ -5,7 +5,11 @@ import (
|
||||
"github.com/onsonr/sonr/pkg/nebula/blocks"
|
||||
)
|
||||
|
||||
templ Profile(c echo.Context) {
|
||||
func Profile(c echo.Context) error {
|
||||
return echoResponse(c, profileView(c))
|
||||
}
|
||||
|
||||
templ profileView(c echo.Context) {
|
||||
@blocks.Card("profile-view", blocks.SizeLarge) {
|
||||
@blocks.ProfileCard()
|
||||
@blocks.Tabs()
|
||||
|
||||
@@ -13,7 +13,11 @@ import (
|
||||
"github.com/onsonr/sonr/pkg/nebula/blocks"
|
||||
)
|
||||
|
||||
func Profile(c echo.Context) templ.Component {
|
||||
func Profile(c echo.Context) error {
|
||||
return echoResponse(c, profileView(c))
|
||||
}
|
||||
|
||||
func profileView(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 {
|
||||
|
||||
@@ -3,18 +3,46 @@ package pages
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/pkg/nebula/blocks"
|
||||
"github.com/onsonr/sonr/pkg/nebula/islands"
|
||||
)
|
||||
|
||||
templ Register(c echo.Context) {
|
||||
type FormState string
|
||||
|
||||
const (
|
||||
InitialForm FormState = "initial"
|
||||
ErrorForm FormState = "error"
|
||||
SuccessForm FormState = "success"
|
||||
WarningForm FormState = "warning"
|
||||
)
|
||||
|
||||
func Register(c echo.Context) error {
|
||||
return echoResponse(c, registerView(c))
|
||||
}
|
||||
|
||||
templ registerView(c echo.Context) {
|
||||
@blocks.Card("register-view", blocks.SizeMedium) {
|
||||
@blocks.H2("Account Registration")
|
||||
@blocks.Spacer()
|
||||
@blocks.Breadcrumbs()
|
||||
@islands.BasicInfo(c, islands.InitialForm)
|
||||
@basicInfoForm(InitialForm)
|
||||
@blocks.Spacer()
|
||||
@blocks.Button(blocks.GET("/", "#register-view")) {
|
||||
@blocks.Text("Cancel")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
templ basicInfoForm(state FormState) {
|
||||
switch (state) {
|
||||
default:
|
||||
<div class="border rounded-lg shadow-sm bg-card text-neutral-900">
|
||||
<div class="flex flex-col space-y-1.5 p-6">
|
||||
<h3 class="text-lg font-semibold leading-none tracking-tight">Account</h3>
|
||||
<p class="text-sm text-neutral-500">Make changes to your account here. Click save when you're done.</p>
|
||||
</div>
|
||||
<div class="p-6 pt-0 space-y-2">
|
||||
<div class="space-y-1"><label class="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" for="name">Name</label><input type="text" id="name" placeholder="Adam Wathan" class="flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-neutral-300 ring-offset-background placeholder:text-neutral-400 focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50"/></div>
|
||||
<div class="space-y-1"><label class="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" for="username">Handle</label><input type="text" id="handle" placeholder="angelo.snr" class="flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-neutral-300 ring-offset-background placeholder:text-neutral-400 focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50"/></div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,22 @@ import templruntime "github.com/a-h/templ/runtime"
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/pkg/nebula/blocks"
|
||||
"github.com/onsonr/sonr/pkg/nebula/islands"
|
||||
)
|
||||
|
||||
func Register(c echo.Context) templ.Component {
|
||||
type FormState string
|
||||
|
||||
const (
|
||||
InitialForm FormState = "initial"
|
||||
ErrorForm FormState = "error"
|
||||
SuccessForm FormState = "success"
|
||||
WarningForm FormState = "warning"
|
||||
)
|
||||
|
||||
func Register(c echo.Context) error {
|
||||
return echoResponse(c, registerView(c))
|
||||
}
|
||||
|
||||
func registerView(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 {
|
||||
@@ -71,7 +83,7 @@ func Register(c echo.Context) templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = islands.BasicInfo(c, islands.InitialForm).Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = basicInfoForm(InitialForm).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -119,4 +131,36 @@ func Register(c echo.Context) templ.Component {
|
||||
})
|
||||
}
|
||||
|
||||
func basicInfoForm(state FormState) 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_Var4 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var4 == nil {
|
||||
templ_7745c5c3_Var4 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
switch state {
|
||||
default:
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"border rounded-lg shadow-sm bg-card text-neutral-900\"><div class=\"flex flex-col space-y-1.5 p-6\"><h3 class=\"text-lg font-semibold leading-none tracking-tight\">Account</h3><p class=\"text-sm text-neutral-500\">Make changes to your account here. Click save when you're done.</p></div><div class=\"p-6 pt-0 space-y-2\"><div class=\"space-y-1\"><label class=\"text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\" for=\"name\">Name</label><input type=\"text\" id=\"name\" placeholder=\"Adam Wathan\" class=\"flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-neutral-300 ring-offset-background placeholder:text-neutral-400 focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50\"></div><div class=\"space-y-1\"><label class=\"text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\" for=\"username\">Handle</label><input type=\"text\" id=\"handle\" placeholder=\"angelo.snr\" class=\"flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-neutral-300 ring-offset-background placeholder:text-neutral-400 focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50\"></div></div></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package nebula
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/pkg/nebula/routes"
|
||||
"github.com/onsonr/sonr/pkg/nebula/view"
|
||||
)
|
||||
|
||||
func RouteViews(e *echo.Echo) {
|
||||
e.GET("/home", view.Render(routes.HomeRoute))
|
||||
e.GET("/login", view.Render(routes.LoginRoute))
|
||||
e.GET("/register", view.Render(routes.RegisterRoute))
|
||||
e.GET("/profile", view.Render(routes.ProfileRoute))
|
||||
e.GET("/authorize", view.Render(routes.AuthorizeRoute))
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"github.com/a-h/templ"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/pkg/nebula/pages"
|
||||
)
|
||||
|
||||
type Route string
|
||||
|
||||
const (
|
||||
HomeRoute Route = "/home"
|
||||
LoginRoute Route = "/login"
|
||||
RegisterRoute Route = "/register"
|
||||
ProfileRoute Route = "/profile"
|
||||
AuthorizeRoute Route = "/authorize"
|
||||
)
|
||||
|
||||
func (r Route) Route() string {
|
||||
return string(r)
|
||||
}
|
||||
|
||||
func (r Route) Component(c echo.Context) templ.Component {
|
||||
switch r {
|
||||
case HomeRoute:
|
||||
return pages.Home(c)
|
||||
case LoginRoute:
|
||||
return pages.Login(c)
|
||||
case RegisterRoute:
|
||||
return pages.Register(c)
|
||||
case ProfileRoute:
|
||||
return pages.Profile(c)
|
||||
case AuthorizeRoute:
|
||||
return pages.Authorize(c)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,20 +1,18 @@
|
||||
package view
|
||||
package nebula
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"github.com/a-h/templ"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/pkg/nebula/routes"
|
||||
)
|
||||
|
||||
// render renders a templ.Component
|
||||
func Render(r routes.Route) echo.HandlerFunc {
|
||||
func Render(cmp templ.Component) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
// Create a buffer to store the rendered HTML
|
||||
buf := bytes.NewBuffer(nil)
|
||||
|
||||
buf := &bytes.Buffer{}
|
||||
// Render the component to the buffer
|
||||
err := r.Component(c).Render(c.Request().Context(), buf)
|
||||
err := cmp.Render(c.Request().Context(), buf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -4,7 +4,6 @@ compatibility_date = "2024-07-26"
|
||||
|
||||
[dev]
|
||||
ip = "localhost"
|
||||
port = 4202
|
||||
|
||||
[build]
|
||||
command = "devbox run build:motr"
|
||||
|
||||
Reference in New Issue
Block a user