mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
feature/1125 offload sync service worker (#1144)
- **feat: provide access to block time** - **refactor: move block expiry calculation to helper function** - **feat: register decentralized web node HTMX views** - **feat: Reorganize methods in layout.templ file alphabetically** - **feat: add support for layout variants** - **feat: update Allocate RPC to use GET request with path parameters** - **feat: add gRPC Gateway endpoint for Allocate** - **refactor: rename SyncCurrent to Sync** - **feat: improve code organization by making vault assembly private** - **feat: add a new method for syncing DID documents**
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/onsonr/sonr/internal/dwn/gen"
|
||||
)
|
||||
|
||||
// BuildFile builds the index.html file for the vault
|
||||
func BuildFile(cnfg *gen.Config) (files.Node, error) {
|
||||
w := bytes.NewBuffer(nil)
|
||||
err := IndexFile().Render(context.Background(), w)
|
||||
|
||||
@@ -2,7 +2,6 @@ package state
|
||||
|
||||
var (
|
||||
serviceWorkerInstall = templ.NewOnceHandle()
|
||||
serviceWorkerReady = templ.NewOnceHandle()
|
||||
)
|
||||
|
||||
templ RegisterServiceWorker() {
|
||||
|
||||
@@ -1,29 +1,27 @@
|
||||
package styles
|
||||
|
||||
// Icon is a component that renders an icon
|
||||
type Icon interface {
|
||||
Render() templ.Component
|
||||
}
|
||||
|
||||
// Variant is a component that has attributes
|
||||
type Variant interface {
|
||||
Attributes() templ.Attributes
|
||||
}
|
||||
|
||||
templ Spacer() {
|
||||
<br/>
|
||||
}
|
||||
|
||||
templ Rows() {
|
||||
<div class="flex flex-row w-full gap-2 md:gap-4">
|
||||
{ children... }
|
||||
</div>
|
||||
}
|
||||
// ╭───────────────────────────────────────────────────────────╮
|
||||
// │ General Layout Components │
|
||||
// ╰───────────────────────────────────────────────────────────╯
|
||||
|
||||
// Columns is a component that renders a flex container with a gap of 3 and a max width of 100%
|
||||
templ Columns() {
|
||||
<div class="flex flex-col h-full w-full gap-3 md:gap-6 md:flex-row">
|
||||
{ children... }
|
||||
</div>
|
||||
}
|
||||
|
||||
// Layout is a component that renders the general layout of the application
|
||||
templ Layout(title string, remote bool) {
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
@@ -51,6 +49,7 @@ templ Layout(title string, remote bool) {
|
||||
</html>
|
||||
}
|
||||
|
||||
// LayoutNoBody is a component that renders the general layout of the application without the body tag
|
||||
templ LayoutNoBody(title string, remote bool) {
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
@@ -80,6 +79,7 @@ templ LayoutNoBody(title string, remote bool) {
|
||||
</html>
|
||||
}
|
||||
|
||||
// OpenModal is a component that renders a modal with a title and description
|
||||
templ OpenModal(title, description string) {
|
||||
<div
|
||||
x-data="{ modalOpen: true }"
|
||||
@@ -126,3 +126,15 @@ templ OpenModal(title, description string) {
|
||||
</template>
|
||||
</div>
|
||||
}
|
||||
|
||||
// Rows is a component that renders a flex container with a gap of 2 and a max width of 100%
|
||||
templ Rows() {
|
||||
<div class="flex flex-row w-full gap-2 md:gap-4">
|
||||
{ children... }
|
||||
</div>
|
||||
}
|
||||
|
||||
// Spacer is a component that renders a <br/> tag
|
||||
templ Spacer() {
|
||||
<br/>
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"github.com/onsonr/sonr/pkg/workers/handlers"
|
||||
)
|
||||
|
||||
// RegisterWebNodeAPI registers the Decentralized Web Node API routes.
|
||||
func RegisterWebNodeAPI(e *echo.Echo) {
|
||||
g1 := e.Group("api")
|
||||
g1.GET("/register/:subject/start", handlers.Auth.RegisterSubjectStart)
|
||||
@@ -22,6 +23,7 @@ func RegisterWebNodeAPI(e *echo.Echo) {
|
||||
g1.POST("/:origin/grant/:subject", handlers.OpenID.GrantAuthorization)
|
||||
}
|
||||
|
||||
// RegisterWebNodeViews registers the Decentralized Web Node HTMX views.
|
||||
func RegisterWebNodeViews(e *echo.Echo) {
|
||||
e.File("/", "index.html")
|
||||
e.GET("/#", authentication.CurrentViewRoute)
|
||||
|
||||
Reference in New Issue
Block a user