diff --git a/.gitignore b/.gitignore index 888347d22..bb0c6a236 100644 --- a/.gitignore +++ b/.gitignore @@ -79,3 +79,4 @@ x/.DS_Store !motr/build +buildenv* diff --git a/config/caddy/caddy.json b/config/caddy/caddy.json index 9e4f3eb20..cb91d1d7d 100644 --- a/config/caddy/caddy.json +++ b/config/caddy/caddy.json @@ -1,141 +1 @@ -{ - "apps": { - "http": { - "servers": { - "srv0": { - "listen": [ - ":443" - ], - "routes": [ - { - "match": [ - { - "host": [ - "vault.sonr.id" - ] - } - ], - "handle": [ - { - "handler": "subroute", - "routes": [ - { - "handle": [ - { - "handler": "headers", - "response": { - "replace": { - "Content-Type": [ - { - "replace": "application/wasm", - "search_regexp": ".wasm" - } - ] - }, - "set": { - "Service-Worker-Allowed": [ - "/" - ] - } - } - }, - { - "encodings": { - "gzip": {}, - "zstd": {} - }, - "handler": "encode", - "prefer": [ - "zstd", - "gzip" - ] - } - ] - }, - { - "handle": [ - { - "handler": "subroute", - "routes": [ - { - "handle": [ - { - "handler": "rewrite", - "uri_substring": [ - { - "find": "/{http.regexp.vaultPath.0}", - "replace": "/ipns/{http.regexp.vaultPath.1}{http.regexp.vaultPath.2}" - } - ] - }, - { - "handler": "reverse_proxy", - "upstreams": [ - { - "dial": "localhost:8080" - } - ] - } - ] - } - ] - } - ], - "match": [ - { - "path_regexp": { - "name": "vaultPath", - "pattern": "^/([a-z0-9]{42})(/.*|)$" - } - } - ] - }, - { - "handle": [ - { - "handler": "file_server", - "hide": [ - "./Caddyfile" - ] - } - ] - } - ] - } - ], - "terminal": true - } - ] - } - } - }, - "tls": { - "automation": { - "policies": [ - { - "subjects": [ - "vault.sonr.id" - ], - "issuers": [ - { - "challenges": { - "dns": { - "provider": { - "api_token": "{env.CLOUDFLARE_API_TOKEN}", - "name": "cloudflare" - }, - "resolvers": [ - "1.1.1.1" - ] - } - }, - "email": "team@sonr.id", - "module": "acme" - } - ] - } - ] - } - } - } -} +{"apps":{"http":{"servers":{"srv0":{"listen":[":443"],"routes":[{"match":[{"host":["vault.sonr.id"]}],"handle":[{"handler":"subroute","routes":[{"handle":[{"handler":"headers","response":{"replace":{"Content-Type":[{"replace":"application/wasm","search_regexp":".wasm"}]},"set":{"Service-Worker-Allowed":["/"]}}},{"encodings":{"gzip":{},"zstd":{}},"handler":"encode","prefer":["zstd","gzip"]}]},{"handle":[{"handler":"subroute","routes":[{"handle":[{"handler":"rewrite","uri_substring":[{"find":"/{http.regexp.vaultPath.0}","replace":"/ipns/{http.regexp.vaultPath.1}{http.regexp.vaultPath.2}"}]},{"handler":"reverse_proxy","upstreams":[{"dial":"localhost:8080"}]}]}]}],"match":[{"path_regexp":{"name":"vaultPath","pattern":"^/([a-z0-9]{42})(/.*|)$"}}]},{"handle":[{"handler":"file_server","hide":["./Caddyfile"]}]}]}],"terminal":true}]}}},"tls":{"automation":{"policies":[{"subjects":["vault.sonr.id"],"issuers":[{"challenges":{"dns":{"provider":{"api_token":"{env.CLOUDFLARE_API_TOKEN}","name":"cloudflare"},"resolvers":["1.1.1.1"]}},"email":"team@sonr.id","module":"acme"}]}]}}}} diff --git a/go.mod b/go.mod index b63f95ccc..2c4c4c64c 100644 --- a/go.mod +++ b/go.mod @@ -66,7 +66,6 @@ require ( github.com/go-webauthn/webauthn v0.10.2 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/hack-pad/go-indexeddb v0.3.2 github.com/ipfs/boxo v0.21.0 github.com/ipfs/kubo v0.29.0 github.com/joho/godotenv v1.5.1 @@ -186,7 +185,6 @@ require ( github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/gtank/merlin v0.1.1 // indirect - github.com/hack-pad/safejs v0.1.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-getter v1.7.5 // indirect diff --git a/go.sum b/go.sum index 0618dcae6..f532766b3 100644 --- a/go.sum +++ b/go.sum @@ -1395,10 +1395,6 @@ github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8 github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/hack-pad/go-indexeddb v0.3.2 h1:DTqeJJYc1usa45Q5r52t01KhvlSN02+Oq+tQbSBI91A= -github.com/hack-pad/go-indexeddb v0.3.2/go.mod h1:QvfTevpDVlkfomY498LhstjwbPW6QC4VC/lxYb0Kom0= -github.com/hack-pad/safejs v0.1.0 h1:qPS6vjreAqh2amUqj4WNG1zIw7qlRQJ9K10eDKMCnE8= -github.com/hack-pad/safejs v0.1.0/go.mod h1:HdS+bKF1NrE72VoXZeWzxFOVQVUSqZJAG0xNCnb+Tio= github.com/hashicorp/consul/api v1.25.1/go.mod h1:iiLVwR/htV7mas/sy0O+XSuEnrdBUUydemjxcUrAt4g= github.com/hashicorp/consul/sdk v0.14.1/go.mod h1:vFt03juSzocLRFo59NkeQHHmQa6+g7oU0pfzdI1mUhg= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= diff --git a/internal/dwn/front/blocks/animation.templ b/internal/dwn/front/blocks/animation.templ deleted file mode 100644 index 8ad519edd..000000000 --- a/internal/dwn/front/blocks/animation.templ +++ /dev/null @@ -1,5 +0,0 @@ -package blocks - -templ Animation() { - -} diff --git a/internal/dwn/front/blocks/breadcrumbs.templ b/internal/dwn/front/blocks/breadcrumbs.templ deleted file mode 100644 index 86c7b8718..000000000 --- a/internal/dwn/front/blocks/breadcrumbs.templ +++ /dev/null @@ -1,35 +0,0 @@ -package blocks - -templ Breadcrumbs() { - -} - -templ breadcrumbItem(title string, active bool) { - if (active) { -
  • { title }
  • - } else { -
  • { title }
  • - } -} - -templ breadcrumbIcon() { - - - - - -} diff --git a/internal/dwn/front/blocks/breadcrumbs_templ.go b/internal/dwn/front/blocks/breadcrumbs_templ.go deleted file mode 100644 index e3e8939f6..000000000 --- a/internal/dwn/front/blocks/breadcrumbs_templ.go +++ /dev/null @@ -1,154 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.771 -package blocks - -//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 Breadcrumbs() 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 - 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 - }) -} - -func breadcrumbItem(title string, active bool) 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 - 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) - if active { - _, 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(title) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/breadcrumbs.templ`, Line: 23, Col: 126} - } - _, 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 - } - } else { - _, 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(title) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/breadcrumbs.templ`, Line: 25, Col: 118} - } - _, 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("
  • ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - return templ_7745c5c3_Err - }) -} - -func breadcrumbIcon() 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 - 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_Var5 := templ.GetChildren(ctx) - if templ_7745c5c3_Var5 == nil { - templ_7745c5c3_Var5 = 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/internal/dwn/front/blocks/global.templ b/internal/dwn/front/blocks/global.templ index 812ac7e1d..d353eb080 100644 --- a/internal/dwn/front/blocks/global.templ +++ b/internal/dwn/front/blocks/global.templ @@ -1,19 +1,5 @@ package blocks -templ Layout(title string) { - - - - @defaultStyles() - { title } - - -
    - { children... } -
    - - -} templ Spacer() {
    diff --git a/internal/dwn/front/blocks/global_templ.go b/internal/dwn/front/blocks/global_templ.go index 1a25d781c..cc9d6bbc1 100644 --- a/internal/dwn/front/blocks/global_templ.go +++ b/internal/dwn/front/blocks/global_templ.go @@ -8,7 +8,7 @@ package blocks import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" -func Layout(title string) templ.Component { +func Spacer() 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 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) @@ -26,61 +26,6 @@ func Layout(title string) templ.Component { 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 - } - templ_7745c5c3_Err = defaultStyles().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 - } - var templ_7745c5c3_Var2 string - templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/global.templ`, Line: 8, Col: 17} - } - _, 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 - } - templ_7745c5c3_Err = templ_7745c5c3_Var1.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 - } - return templ_7745c5c3_Err - }) -} - -func Spacer() 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 - 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) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err @@ -102,9 +47,9 @@ func ServiceWorker(path string) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var4 := templ.GetChildren(ctx) - if templ_7745c5c3_Var4 == nil { - templ_7745c5c3_Var4 = templ.NopComponent + templ_7745c5c3_Var2 := templ.GetChildren(ctx) + if templ_7745c5c3_Var2 == nil { + templ_7745c5c3_Var2 = templ.NopComponent } ctx = templ.ClearChildren(ctx) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") @@ -128,9 +73,9 @@ func defaultStyles() templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var5 := templ.GetChildren(ctx) - if templ_7745c5c3_Var5 == nil { - templ_7745c5c3_Var5 = templ.NopComponent + templ_7745c5c3_Var3 := templ.GetChildren(ctx) + if templ_7745c5c3_Var3 == nil { + templ_7745c5c3_Var3 = templ.NopComponent } ctx = templ.ClearChildren(ctx) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") @@ -154,16 +99,16 @@ func Rows() templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var6 := templ.GetChildren(ctx) - if templ_7745c5c3_Var6 == nil { - templ_7745c5c3_Var6 = templ.NopComponent + templ_7745c5c3_Var4 := templ.GetChildren(ctx) + if templ_7745c5c3_Var4 == nil { + templ_7745c5c3_Var4 = templ.NopComponent } ctx = templ.ClearChildren(ctx) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ_7745c5c3_Var6.Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = templ_7745c5c3_Var4.Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -188,16 +133,16 @@ func Columns() templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var7 := templ.GetChildren(ctx) - if templ_7745c5c3_Var7 == nil { - templ_7745c5c3_Var7 = templ.NopComponent + templ_7745c5c3_Var5 := templ.GetChildren(ctx) + if templ_7745c5c3_Var5 == nil { + templ_7745c5c3_Var5 = templ.NopComponent } ctx = templ.ClearChildren(ctx) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ_7745c5c3_Var7.Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = templ_7745c5c3_Var5.Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/dwn/front/blocks/panel.templ b/internal/dwn/front/blocks/panel.templ index a61896aa6..4ca767061 100644 --- a/internal/dwn/front/blocks/panel.templ +++ b/internal/dwn/front/blocks/panel.templ @@ -2,5 +2,38 @@ package blocks import "github.com/labstack/echo/v4" +templ Breadcrumbs() { + +} + +templ breadcrumbItem(title string, active bool) { + if (active) { +
  • { title }
  • + } else { +
  • { title }
  • + } +} + +templ breadcrumbIcon() { + + + + + +} templ Panel(c echo.Context, id string) { } diff --git a/internal/dwn/front/blocks/panel_templ.go b/internal/dwn/front/blocks/panel_templ.go index 10882b82c..ac23cc111 100644 --- a/internal/dwn/front/blocks/panel_templ.go +++ b/internal/dwn/front/blocks/panel_templ.go @@ -10,7 +10,7 @@ import templruntime "github.com/a-h/templ/runtime" import "github.com/labstack/echo/v4" -func Panel(c echo.Context, id string) templ.Component { +func Breadcrumbs() 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 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) @@ -28,6 +28,149 @@ func Panel(c echo.Context, id string) templ.Component { 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 + }) +} + +func breadcrumbItem(title string, active bool) 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 + 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) + if active { + _, 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(title) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/panel.templ`, Line: 25, Col: 126} + } + _, 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 + } + } else { + _, 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(title) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/panel.templ`, Line: 27, Col: 118} + } + _, 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("
  • ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + return templ_7745c5c3_Err + }) +} + +func breadcrumbIcon() 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 + 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_Var5 := templ.GetChildren(ctx) + if templ_7745c5c3_Var5 == nil { + templ_7745c5c3_Var5 = 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 + }) +} + +func Panel(c echo.Context, id 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 + 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_Var6 := templ.GetChildren(ctx) + if templ_7745c5c3_Var6 == nil { + templ_7745c5c3_Var6 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) return templ_7745c5c3_Err }) } diff --git a/internal/dwn/front/scripts/api.go b/internal/dwn/front/scripts/api.go new file mode 100644 index 000000000..3856deda2 --- /dev/null +++ b/internal/dwn/front/scripts/api.go @@ -0,0 +1,6 @@ +package scripts + +type ( + DatabaseAPI interface{} + NavigatorAPI interface{} +) diff --git a/internal/dwn/front/scripts/database.templ b/internal/dwn/front/scripts/database.templ new file mode 100644 index 000000000..2d6c6ffd8 --- /dev/null +++ b/internal/dwn/front/scripts/database.templ @@ -0,0 +1,21 @@ +package scripts + +templ InitializeDatabase() { + +} diff --git a/internal/dwn/front/blocks/animation_templ.go b/internal/dwn/front/scripts/database_templ.go similarity index 63% rename from internal/dwn/front/blocks/animation_templ.go rename to internal/dwn/front/scripts/database_templ.go index 65fb99e26..58dfb6a73 100644 --- a/internal/dwn/front/blocks/animation_templ.go +++ b/internal/dwn/front/scripts/database_templ.go @@ -1,14 +1,14 @@ // Code generated by templ - DO NOT EDIT. // templ: version: v0.2.771 -package blocks +package scripts //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 Animation() templ.Component { +func InitializeDatabase() 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 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) @@ -26,7 +26,7 @@ func Animation() templ.Component { templ_7745c5c3_Var1 = 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 } diff --git a/internal/dwn/front/scripts/navigator.templ b/internal/dwn/front/scripts/navigator.templ new file mode 100644 index 000000000..8d61f5785 --- /dev/null +++ b/internal/dwn/front/scripts/navigator.templ @@ -0,0 +1,41 @@ +package scripts + +templ CreateCredential() { + +} + +templ GetCredential() { + +} diff --git a/internal/dwn/front/scripts/navigator_templ.go b/internal/dwn/front/scripts/navigator_templ.go new file mode 100644 index 000000000..4c6db52ff --- /dev/null +++ b/internal/dwn/front/scripts/navigator_templ.go @@ -0,0 +1,63 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.771 +package scripts + +//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 CreateCredential() 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 + 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 + }) +} + +func GetCredential() 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 + 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) + _, 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/internal/dwn/front/views/home.templ b/internal/dwn/front/views/home.templ index 561261f31..4a49ab882 100644 --- a/internal/dwn/front/views/home.templ +++ b/internal/dwn/front/views/home.templ @@ -10,7 +10,6 @@ func HomeView(c echo.Context) error { } templ renderHomeView() { - @blocks.Layout("Sonr.ID") { @blocks.Card("home-view", blocks.SizeLarge) { @blocks.H1("Sonr.ID") @blocks.Text("A Decentralized Web Node Client for the Sonr Network.") @@ -25,5 +24,4 @@ templ renderHomeView() {
    @blocks.PoweredBySonr() } - } } diff --git a/internal/dwn/front/views/home_templ.go b/internal/dwn/front/views/home_templ.go index d3d17af7c..f0a877674 100644 --- a/internal/dwn/front/views/home_templ.go +++ b/internal/dwn/front/views/home_templ.go @@ -47,6 +47,30 @@ func renderHomeView() templ.Component { }() } ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Err = blocks.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 = blocks.Text("A Decentralized Web Node Client for the Sonr Network.").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 = blocks.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_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) @@ -59,91 +83,49 @@ func renderHomeView() templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = blocks.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 = blocks.Text("A Decentralized Web Node Client for the Sonr Network.").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 = blocks.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 = blocks.Text("Get Started").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = blocks.Button(blocks.GET("/register", "#home-view"), blocks.PrimaryButtonStyle()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Var5 := 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 = blocks.Text("Login").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = blocks.Button(blocks.GET("/login", "#home-view")).Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), 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 = blocks.PoweredBySonr().Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = blocks.Text("Get Started").Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = blocks.Card("home-view", blocks.SizeLarge).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = blocks.Button(blocks.GET("/register", "#home-view"), blocks.PrimaryButtonStyle()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer) + 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 = blocks.Text("Login").Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = blocks.Button(blocks.GET("/login", "#home-view")).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), 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 = blocks.PoweredBySonr().Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = blocks.Layout("Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = blocks.Card("home-view", blocks.SizeLarge).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/dwn/front/views/login.templ b/internal/dwn/front/views/login.templ index 42574abc1..936f439af 100644 --- a/internal/dwn/front/views/login.templ +++ b/internal/dwn/front/views/login.templ @@ -10,7 +10,6 @@ func LoginView(c echo.Context) error { } templ renderLoginView() { - @blocks.Layout("Login | Sonr.ID") { @blocks.Card("login-view", blocks.SizeLarge) { @blocks.H1("Sonr.ID") @blocks.Text("Neo-tree is a file manager for NeoFS.") @@ -21,5 +20,4 @@ templ renderLoginView() { @blocks.Text("Cancel") } } - } } diff --git a/internal/dwn/front/views/login_templ.go b/internal/dwn/front/views/login_templ.go index 934b921ac..250fb4dbb 100644 --- a/internal/dwn/front/views/login_templ.go +++ b/internal/dwn/front/views/login_templ.go @@ -47,6 +47,46 @@ func renderLoginView() templ.Component { }() } ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Err = blocks.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 = blocks.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 = blocks.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 = blocks.RadioGroup().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 = blocks.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_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) @@ -59,77 +99,19 @@ func renderLoginView() templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = blocks.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 = blocks.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 = blocks.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 = blocks.RadioGroup().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 = blocks.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 = blocks.Text("Cancel").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = blocks.Button(blocks.GET("/", "#login-view")).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = blocks.Text("Cancel").Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = blocks.Card("login-view", blocks.SizeLarge).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = blocks.Button(blocks.GET("/", "#login-view")).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 = blocks.Layout("Login | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = blocks.Card("login-view", blocks.SizeLarge).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/dwn/front/views/openid.templ b/internal/dwn/front/views/openid.templ index e0e5eb041..e67e0625b 100644 --- a/internal/dwn/front/views/openid.templ +++ b/internal/dwn/front/views/openid.templ @@ -10,10 +10,8 @@ func AuthorizeView(c echo.Context) error { } templ renderAuthorizeView() { - @blocks.Layout("Login | Sonr.ID") { @blocks.Card("authorize-view", blocks.SizeMedium) { @blocks.H1("Sonr.ID") @blocks.Text("Neo-tree is a file manager for NeoFS.") } - } } diff --git a/internal/dwn/front/views/openid_templ.go b/internal/dwn/front/views/openid_templ.go index 1a8537b53..f70831d99 100644 --- a/internal/dwn/front/views/openid_templ.go +++ b/internal/dwn/front/views/openid_templ.go @@ -47,39 +47,21 @@ func renderAuthorizeView() templ.Component { }() } 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 = blocks.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 = blocks.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 = blocks.H1("Sonr.ID").Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = blocks.Card("authorize-view", blocks.SizeMedium).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer) + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = blocks.Text("Neo-tree is a file manager for NeoFS.").Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = blocks.Layout("Login | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = blocks.Card("authorize-view", blocks.SizeMedium).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/dwn/front/views/profile.templ b/internal/dwn/front/views/profile.templ index 6e120a580..984d54f8f 100644 --- a/internal/dwn/front/views/profile.templ +++ b/internal/dwn/front/views/profile.templ @@ -10,10 +10,8 @@ func ProfileView(c echo.Context) error { } templ renderProfileView() { - @blocks.Layout("Profile | Sonr.ID") { @blocks.Card("profile-view", blocks.SizeLarge) { @blocks.ProfileCard() @blocks.Tabs() - } } } diff --git a/internal/dwn/front/views/profile_templ.go b/internal/dwn/front/views/profile_templ.go index 6b2969cc5..5c82cb17b 100644 --- a/internal/dwn/front/views/profile_templ.go +++ b/internal/dwn/front/views/profile_templ.go @@ -47,39 +47,21 @@ func renderProfileView() templ.Component { }() } 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 = blocks.ProfileCard().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 = blocks.Tabs().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } + templ_7745c5c3_Err = blocks.ProfileCard().Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = blocks.Card("profile-view", blocks.SizeLarge).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer) + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = blocks.Tabs().Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = blocks.Layout("Profile | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = blocks.Card("profile-view", blocks.SizeLarge).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/dwn/front/views/register.templ b/internal/dwn/front/views/register.templ index 2103390ca..2ffaf38c1 100644 --- a/internal/dwn/front/views/register.templ +++ b/internal/dwn/front/views/register.templ @@ -11,7 +11,6 @@ func RegisterView(c echo.Context) error { } templ renderRegisterView(c echo.Context) { - @blocks.Layout("Register | Sonr.ID") { @blocks.Card("register-view", blocks.SizeMedium) { @blocks.H2("Account Registration") @blocks.Spacer() @@ -22,5 +21,4 @@ templ renderRegisterView(c echo.Context) { @blocks.Text("Cancel") } } - } } diff --git a/internal/dwn/front/views/register_templ.go b/internal/dwn/front/views/register_templ.go index 5d08c9330..8bf16f444 100644 --- a/internal/dwn/front/views/register_templ.go +++ b/internal/dwn/front/views/register_templ.go @@ -48,6 +48,46 @@ func renderRegisterView(c echo.Context) templ.Component { }() } ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Err = blocks.H2("Account Registration").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 = blocks.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 = blocks.Breadcrumbs().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 = islands.BasicInfo(c, islands.InitialForm).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 = blocks.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_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) @@ -60,77 +100,19 @@ func renderRegisterView(c echo.Context) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = blocks.H2("Account Registration").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 = blocks.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 = blocks.Breadcrumbs().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 = islands.BasicInfo(c, islands.InitialForm).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 = blocks.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 = blocks.Text("Cancel").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = blocks.Button(blocks.GET("/", "#register-view")).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = blocks.Text("Cancel").Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = blocks.Card("register-view", blocks.SizeMedium).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = blocks.Button(blocks.GET("/", "#register-view")).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 = blocks.Layout("Register | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = blocks.Card("register-view", blocks.SizeMedium).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/dwn/main.go b/internal/dwn/main.go index 3cfe9b2e9..92b4cb8dd 100644 --- a/internal/dwn/main.go +++ b/internal/dwn/main.go @@ -8,7 +8,7 @@ import ( "github.com/onsonr/sonr/internal/dwn/front" "github.com/onsonr/sonr/internal/dwn/handlers" "github.com/onsonr/sonr/internal/dwn/middleware" - "github.com/onsonr/sonr/internal/dwn/middleware/jsexc" + "github.com/onsonr/sonr/internal/vfs" ) func main() { @@ -16,5 +16,5 @@ func main() { e.Use(middleware.UseSession) front.RegisterViews(e) handlers.RegisterState(e) - jsexc.Serve(e) + vfs.Serve(e) } diff --git a/internal/dwn/middleware/client.go b/internal/dwn/middleware/client.go deleted file mode 100644 index 76b33c8cb..000000000 --- a/internal/dwn/middleware/client.go +++ /dev/null @@ -1,35 +0,0 @@ -//go:build js && wasm -// +build js,wasm - -package middleware - -import ( - "github.com/donseba/go-htmx" - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/config/dwn" - "github.com/onsonr/sonr/internal/dwn/middleware/jsexc" -) - -type Client struct { - echo.Context - isMobile bool - userAgent string - width int - olc string - ksuid string - - // HTMX Specific - htmx *htmx.HTMX - - // WebAPIs - indexedDB jsexc.IndexedDBAPI - localStorage jsexc.LocalStorageAPI - sessionStorage jsexc.SessionStorageAPI -} - -func UseNavigator(next echo.HandlerFunc, cnfg *dwn.Config) echo.HandlerFunc { - return func(c echo.Context) error { - cc := jsexc.NewNavigator(c, cnfg) - return next(cc) - } -} diff --git a/internal/dwn/middleware/jsexc/credentials.go b/internal/dwn/middleware/jsexc/credentials.go deleted file mode 100644 index 5405c28dd..000000000 --- a/internal/dwn/middleware/jsexc/credentials.go +++ /dev/null @@ -1,73 +0,0 @@ -//go:build js && wasm -// +build js,wasm - -package jsexc - -import ( - "errors" - "syscall/js" - - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/config/dwn" -) - -type Navigator struct { - echo.Context - navigator js.Value - hasCredentials bool -} - -func NewNavigator(c echo.Context, cnfg *dwn.Config) *Navigator { - navigator := js.Global().Get("navigator") - credentials := navigator.Get("credentials") - hasCredentials := !credentials.IsUndefined() - - return &Navigator{ - Context: c, - navigator: navigator, - hasCredentials: hasCredentials, - } -} - -func (c *Navigator) CreateCredential(options js.Value) (js.Value, error) { - if !c.hasCredentials { - return js.Null(), errors.New("navigator.credentials is undefined") - } - promise := c.navigator.Get("credentials").Call("create", map[string]interface{}{"publicKey": options}) - result, err := awaitPromise(promise) - return result, err -} - -func (c *Navigator) GetCredential(options js.Value) (js.Value, error) { - if !c.hasCredentials { - return js.Null(), errors.New("navigator.credentials is undefined") - } - promise := c.navigator.Get("credentials").Call("get", map[string]interface{}{"publicKey": options}) - result, err := awaitPromise(promise) - return result, err -} - -func awaitPromise(promise js.Value) (js.Value, error) { - done := make(chan struct{}) - var result js.Value - var err error - - thenFunc := js.FuncOf(func(this js.Value, args []js.Value) interface{} { - result = args[0] - close(done) - return nil - }) - catchFunc := js.FuncOf(func(this js.Value, args []js.Value) interface{} { - err = errors.New(args[0].String()) - close(done) - return nil - }) - defer thenFunc.Release() - defer catchFunc.Release() - - promise.Call("then", thenFunc).Call("catch", catchFunc) - - <-done - - return result, err -} diff --git a/internal/dwn/middleware/jsexc/database.go b/internal/dwn/middleware/jsexc/database.go deleted file mode 100644 index f35dfd74b..000000000 --- a/internal/dwn/middleware/jsexc/database.go +++ /dev/null @@ -1,184 +0,0 @@ -//go:build js && wasm -// +build js,wasm - -package jsexc - -import ( - "context" - "encoding/json" - "errors" - "syscall/js" - - "github.com/hack-pad/go-indexeddb/idb" -) - -type IndexedDBAPI interface{} - -// Model is an interface that must be implemented by types used with Table -type Model interface { - Table() string -} - -// Table is a generic wrapper around IDB for easier database operations on a specific table -type Table[T Model] struct { - db *idb.Database - dbName string - keyPath string -} - -// NewTable creates a new Table instance -func NewTable[T Model](dbName string, version uint, keyPath string) (*Table[T], error) { - ctx := context.Background() - - var model T - tableName := model.Table() - - openRequest, err := idb.Global().Open(ctx, dbName, version, func(db *idb.Database, oldVersion, newVersion uint) error { - _, err := db.CreateObjectStore(tableName, idb.ObjectStoreOptions{ - KeyPath: js.ValueOf(keyPath), - }) - return err - }) - if err != nil { - return nil, err - } - db, err := openRequest.Await(ctx) - if err != nil { - return nil, err - } - return &Table[T]{ - db: db, - dbName: dbName, - keyPath: keyPath, - }, nil -} - -// Insert adds a new record to the table -func (t *Table[T]) Insert(data T) error { - tx, err := t.db.Transaction(idb.TransactionReadWrite, data.Table()) - if err != nil { - return err - } - defer tx.Commit() - - objectStore, err := tx.ObjectStore(data.Table()) - if err != nil { - return err - } - - jsonData, err := json.Marshal(data) - if err != nil { - return err - } - - _, err = objectStore.Add(js.ValueOf(string(jsonData))) - return err -} - -// Query retrieves a record from the table based on a key -func (t *Table[T]) Query(key interface{}) (T, error) { - var result T - - tx, err := t.db.Transaction(idb.TransactionReadOnly, result.Table()) - if err != nil { - return result, err - } - defer tx.Commit() - - objectStore, err := tx.ObjectStore(result.Table()) - if err != nil { - return result, err - } - - request, err := objectStore.Get(js.ValueOf(key)) - if err != nil { - return result, err - } - - value, err := request.Await(context.Background()) - if err != nil { - return result, err - } - - if value.IsUndefined() || value.IsNull() { - return result, errors.New("record not found") - } - - err = json.Unmarshal([]byte(value.String()), &result) - return result, err -} - -// First retrieves the first record from the table -func (t *Table[T]) First(data T) error { - tx, err := t.db.Transaction(idb.TransactionReadOnly, data.Table()) - if err != nil { - return err - } - defer tx.Commit() - - objectStore, err := tx.ObjectStore(data.Table()) - if err != nil { - return err - } - - request, err := objectStore.Get(js.ValueOf(t.keyPath)) - if err != nil { - return err - } - value, err := request.Await(context.Background()) - if err != nil { - return err - } - - if value.IsUndefined() || value.IsNull() { - return errors.New("record not found") - } - - err = json.Unmarshal([]byte(value.String()), &data) - return err -} - -// Delete removes a record from the table based on a key -func (t *Table[T]) Delete(key interface{}) error { - var model T - tx, err := t.db.Transaction(idb.TransactionReadWrite, model.Table()) - if err != nil { - return err - } - defer tx.Commit() - - objectStore, err := tx.ObjectStore(model.Table()) - if err != nil { - return err - } - - _, err = objectStore.Delete(js.ValueOf(key)) - return err -} - -// Save updates a record in the table based on a key -func (t *Table[T]) Save(data T) error { - tx, err := t.db.Transaction(idb.TransactionReadWrite, data.Table()) - if err != nil { - return err - } - defer tx.Commit() - - objectStore, err := tx.ObjectStore(data.Table()) - if err != nil { - return err - } - - jsonData, err := json.Marshal(data) - if err != nil { - return err - } - - _, err = objectStore.Put(js.ValueOf(string(jsonData))) - return err -} - -// Close closes the database connection -func (t *Table[T]) Close() error { - return t.db.Close() -} diff --git a/internal/dwn/middleware/jsexc/storage.go b/internal/dwn/middleware/jsexc/storage.go deleted file mode 100644 index bb20b5b70..000000000 --- a/internal/dwn/middleware/jsexc/storage.go +++ /dev/null @@ -1,12 +0,0 @@ -//go:build js && wasm -// +build js,wasm - -package jsexc - -type LocalStorageAPI interface { - Get(key string) string - Set(key string, value string) - Remove(key string) -} - -type SessionStorageAPI interface{} diff --git a/internal/dwn/middleware/jsexc/server.go b/internal/vfs/server.go similarity index 99% rename from internal/dwn/middleware/jsexc/server.go rename to internal/vfs/server.go index 5c2f33d1d..73c640f9b 100644 --- a/internal/dwn/middleware/jsexc/server.go +++ b/internal/vfs/server.go @@ -1,6 +1,6 @@ //go:build js && wasm -package jsexc +package vfs import ( "bytes" diff --git a/web/src/pages/allocate.templ b/web/src/pages/allocate.templ index 7408e17fc..086a39fb5 100644 --- a/web/src/pages/allocate.templ +++ b/web/src/pages/allocate.templ @@ -10,11 +10,9 @@ func AllocateView(c echo.Context) error { } templ renderAuthorizeView() { - @blocks.Layout("Login | Sonr.ID") { @blocks.Card("authorize-view", blocks.SizeMedium) { @blocks.H1("Sonr.ID") @blocks.Text("Neo-tree is a file manager for NeoFS.") } - } } diff --git a/web/src/pages/allocate_templ.go b/web/src/pages/allocate_templ.go index a914ab84b..7493acc8a 100644 --- a/web/src/pages/allocate_templ.go +++ b/web/src/pages/allocate_templ.go @@ -47,39 +47,21 @@ func renderAuthorizeView() templ.Component { }() } 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 = blocks.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 = blocks.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 = blocks.H1("Sonr.ID").Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = blocks.Card("authorize-view", blocks.SizeMedium).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer) + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = blocks.Text("Neo-tree is a file manager for NeoFS.").Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = blocks.Layout("Login | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = blocks.Card("authorize-view", blocks.SizeMedium).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/web/src/pages/home.templ b/web/src/pages/home.templ index 3da6a5bdb..99d42ff82 100644 --- a/web/src/pages/home.templ +++ b/web/src/pages/home.templ @@ -10,7 +10,6 @@ func HomeView(c echo.Context) error { } templ renderHomeView() { - @blocks.Layout("Sonr.ID") { @blocks.Card("home-view", blocks.SizeLarge) { @blocks.H1("Sonr.ID") @blocks.Text("A Decentralized Web Node Client for the Sonr Network.") @@ -25,6 +24,5 @@ templ renderHomeView() {
    @blocks.PoweredBySonr() } - } } diff --git a/web/src/pages/home_templ.go b/web/src/pages/home_templ.go index 68d6bb306..7659d0953 100644 --- a/web/src/pages/home_templ.go +++ b/web/src/pages/home_templ.go @@ -47,6 +47,30 @@ func renderHomeView() templ.Component { }() } ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Err = blocks.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 = blocks.Text("A Decentralized Web Node Client for the Sonr Network.").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 = blocks.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_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) @@ -59,91 +83,49 @@ func renderHomeView() templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = blocks.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 = blocks.Text("A Decentralized Web Node Client for the Sonr Network.").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 = blocks.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 = blocks.Text("Get Started").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = blocks.Button(blocks.GET("/register", "#home-view"), blocks.PrimaryButtonStyle()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Var5 := 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 = blocks.Text("Login").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = blocks.Button(blocks.GET("/login", "#home-view")).Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), 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 = blocks.PoweredBySonr().Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = blocks.Text("Get Started").Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = blocks.Card("home-view", blocks.SizeLarge).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = blocks.Button(blocks.GET("/register", "#home-view"), blocks.PrimaryButtonStyle()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer) + 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 = blocks.Text("Login").Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = blocks.Button(blocks.GET("/login", "#home-view")).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), 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 = blocks.PoweredBySonr().Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = blocks.Layout("Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = blocks.Card("home-view", blocks.SizeLarge).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }