Compare commits

...
15 Commits
63 changed files with 1011 additions and 588 deletions
+1 -1
View File
@@ -2,6 +2,6 @@
name = "cz_conventional_commits"
tag_format = "v$version"
version_scheme = "semver"
version = "0.5.2"
version = "0.5.6"
update_changelog_on_bump = true
major_version_zero = true
+1 -1
View File
@@ -37,7 +37,7 @@ jobs:
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: pkljar
source-dir: pkl
source-dir: deploy/config
destination-dir: .
upload_nebula_cdn:
+1 -4
View File
@@ -55,7 +55,7 @@ release:
github:
owner: onsonr
name: sonr
name_template: '{{.Now.Format "2006.01.02"}}'
name_template: "Release {{.Version}}"
draft: false
replace_existing_draft: true
replace_existing_artifacts: true
@@ -63,7 +63,6 @@ release:
- glob: ./CHANGELOG*
- glob: ./README*
- glob: ./LICENSE*
- glob: ./pkl/*
brews:
- name: sonr
@@ -137,5 +136,3 @@ announce:
telegram:
enabled: true
chat_id: -1002222617755
message_template: "__*New Sonr Release*__ *{{.Tag}}* is out"
parse_mode: MarkdownV2
+28
View File
@@ -1,3 +1,31 @@
## v0.5.6 (2024-10-03)
### Feat
- add hway and sonr processes to dev environment
## v0.5.5 (2024-10-03)
### Feat
- add rudimentary DidController table
- update home section with new features
- introduce Home model and refactor views
- **nebula**: create Home model for home page
### Refactor
- reorganize pkl files for better separation of concerns
- rename msg_server_test.go to rpc_test.go
## v0.5.4 (2024-10-02)
## v0.5.3 (2024-10-02)
### Fix
- remove unnecessary telegram message template
## v0.5.2 (2024-10-02)
### Feat
+5 -6
View File
@@ -94,7 +94,7 @@ endif
install: go.sum
go install -mod=readonly $(BUILD_FLAGS) ./cmd/sonrd
go install -mod=readonly $(BUILD_FLAGS) ./cmd/motr
go install -mod=readonly $(BUILD_FLAGS) ./cmd/hway
########################################
### Tools & dependencies
@@ -307,7 +307,6 @@ motr:
templ:
@echo "(templ) Generating templ files"
go install github.com/a-h/templ/cmd/templ@latest
templ generate
nebula:
@@ -316,10 +315,10 @@ nebula:
pkl:
@echo "(pkl) Building PKL"
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/dwn.pkl
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/orm.pkl
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/txns.pkl
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/uiux.pkl
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./deploy/config/DWN.pkl
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./deploy/config/ORM.pkl
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./deploy/config/Txns.pkl
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./deploy/config/UIUX.pkl
start-caddy:
@echo "(start-caddy) Starting caddy"
-1
View File
@@ -29,7 +29,6 @@ func New() *Server {
s.GET("/login", pages.Login)
s.GET("/register", pages.Register)
s.GET("/profile", pages.Profile)
s.GET("/allocate", pages.Profile)
return s
}
+86 -36
View File
@@ -5,10 +5,21 @@ module models
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
// ╭───────────────────────────────────────────────────────────╮
// │ General Components
// │ General State
// ╰───────────────────────────────────────────────────────────╯
typealias FormState = "initial" | "error" | "success" | "warning"
typealias InputType = "text" | "password" | "email" | "credential" | "file"
class Button {
text: String
href: String
}
abstract class Form {
title: String
description: String
inputs: List<Input>
}
class Image {
src: String
@@ -16,6 +27,16 @@ class Image {
height: String
}
class Input {
label: String
type: InputType
placeholder: String
value: String?
error: String?
help: String?
required: Boolean?
}
class Link {
text: String
href: String
@@ -26,34 +47,32 @@ class SocialLink {
icon: String
}
class Button {
text: String
href: String
// ╭───────────────────────────────────────────────────────────╮
// │ Data Models │
// ╰───────────────────────────────────────────────────────────╯
class Feature {
title: String
description: String
icon: String
image: Image
}
class Input {
class Highlight {
title: String
description: String
image: Image
}
class Stat {
value: String
label: String
type: String
placeholder: String
value: String?
error: String?
help: String?
required: Boolean
}
// ╭───────────────────────────────────────────────────────────╮
// │ Homepage Components
// │ Homepage View Model
// ╰───────────────────────────────────────────────────────────╯
class Stats {
firstValue: String
firstLabel: String
secondValue: String
secondLabel: String
thirdValue: String
thirdLabel: String
}
class Hero {
titleFirst: String
titleEmphasis: String
@@ -62,6 +81,39 @@ class Hero {
primaryButton: Button
secondaryButton: Button
image: Image
stats: Listing<Stat>
}
class Highlights {
heading: String
subheading: String
highlights: Listing<Highlight>
}
class Features {
title: String
description: String
image: Image
}
class Bento {
title: String
description: String
primaryButton: Button
secondaryButton: Button
}
class Lowlights {
title: String
description: String
image: Image
}
class CallToAction {
title: String
description: String
primaryButton: Button
secondaryButton: Button
}
class Footer {
@@ -70,21 +122,19 @@ class Footer {
twitterLink: SocialLink
discordLink: SocialLink
githubLink: SocialLink
companyLinks: List<Link>
resourcesLinks: List<Link>
companyLinks: Listing<Link>
resourcesLinks: Listing<Link>
}
hero : Hero
stats : Stats
// ╭───────────────────────────────────────────────────────────╮
// │ Registration Components │
// ╰───────────────────────────────────────────────────────────╯
class RegistrationForm {
title: String
description: String
state: FormState
inputs: List<Input>
class Home {
hero: Hero
highlights: Listing<Highlight>
features: Listing<Features>
bento: Bento
lowlights: Listing<Lowlights>
callToAction: CallToAction
footer: Footer
}
home : Home
+35
View File
@@ -0,0 +1,35 @@
version: "0.6"
processes:
ipfs:
namespace: testnet
command: "sh scripts/setup_ipfs.sh"
background: true
availability:
restart: on_failure
max_restarts: 0
sonr:
namespace: testnet
command: "devbox run start:testnet"
restart: on_failure
max_restarts: 1
depends:
- ipfs
hway:
namespace: testnet
command: "devbox run start:hway"
restart: on_failure
max_restarts: 1
depends:
- ipfs
- sonr
tunnel:
namespace: public
command: "cloudflared tunnel run --token $TUNNEL_TOKEN"
restart: on_failure
max_restarts: 1
depends:
- caddy
+3 -2
View File
@@ -13,13 +13,14 @@ processes:
namespace: testnet
command: "devbox run start:testnet"
restart: on_failure
env:
max_restarts: 1
depends:
- ipfs
motr:
hway:
namespace: testnet
command: "devbox run start:motr"
command: "hway start"
restart: on_failure
max_restarts: 1
depends:
+19 -60
View File
@@ -4,14 +4,16 @@
"go@1.22",
"air@latest",
"bun@latest",
"gum@latest",
"ipfs@latest",
"skate@latest",
"templ@latest",
"cloudflared@latest",
"process-compose@latest"
],
"env": {
"GOPATH": "$HOME/go",
"PATH": "$HOME/go/bin:$PATH",
"PATH": "./build:$HOME/go/bin:$PATH",
"CHAIN_ID": "sonr-testnet-1",
"DENOM": "usnr",
"KEYRING": "test",
@@ -28,65 +30,22 @@
},
"shell": {
"scripts": {
"dev": [
"air"
],
"build:docker": [
"make local-image"
],
"build:hway": [
"make nebula",
"make hway"
],
"build:nebula": [
"make nebula"
],
"build:sonrd": [
"make motr",
"make build"
],
"build": [
"make motr",
"make build",
"make hway"
],
"gen:proto": [
"make proto-gen"
],
"gen:pkl": [
"make pkl"
],
"gen:templ": [
"make templ"
],
"start:hway": [
"make templ",
"make hway",
"make start-hway"
],
"start:testnet": [
"make templ",
"make install",
"make sh-testnet"
],
"start": [
"process-compose up -d"
],
"stop": [
"process-compose down"
],
"test:e2e": [
"make templ",
"make test-e2e"
],
"test:unit": [
"make templ",
"make test-unit"
],
"test": [
"make templ",
"make test"
]
"dev": ["air"],
"build:docker": ["make local-image"],
"build:hway": ["make nebula", "make hway"],
"build:nebula": ["make nebula"],
"build:sonrd": ["make motr", "make build"],
"build": ["make motr", "make build", "make hway"],
"gen:proto": ["make proto-gen"],
"gen:pkl": ["make pkl"],
"gen:templ": ["make templ"],
"start:hway": ["make templ", "make hway", "make start-hway"],
"start:testnet": ["make templ", "make install", "make sh-testnet"],
"start": ["process-compose up -d"],
"stop": ["process-compose down"],
"test:e2e": ["make templ", "make test-e2e"],
"test:unit": ["make templ", "make test-unit"],
"test": ["make templ", "make test"]
}
}
}
+96
View File
@@ -193,6 +193,54 @@
}
}
},
"gum@latest": {
"last_modified": "2024-09-10T15:01:03Z",
"resolved": "github:NixOS/nixpkgs/5ed627539ac84809c78b2dd6d26a5cebeb5ae269#gum",
"source": "devbox-search",
"version": "0.14.5",
"systems": {
"aarch64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/n1gqffrwdzr3vpsmwmwx3hmw814c1k6g-gum-0.14.5",
"default": true
}
],
"store_path": "/nix/store/n1gqffrwdzr3vpsmwmwx3hmw814c1k6g-gum-0.14.5"
},
"aarch64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/ggp10jr3l6higs0gqibp6ypjlf7yakpc-gum-0.14.5",
"default": true
}
],
"store_path": "/nix/store/ggp10jr3l6higs0gqibp6ypjlf7yakpc-gum-0.14.5"
},
"x86_64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/jq8shghha81s1wg67fcjrfnf4hbliimn-gum-0.14.5",
"default": true
}
],
"store_path": "/nix/store/jq8shghha81s1wg67fcjrfnf4hbliimn-gum-0.14.5"
},
"x86_64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/f199acwir08z47f3d5kf1fhmhajmd1ig-gum-0.14.5",
"default": true
}
],
"store_path": "/nix/store/f199acwir08z47f3d5kf1fhmhajmd1ig-gum-0.14.5"
}
}
},
"ipfs@latest": {
"last_modified": "2023-02-24T09:01:09Z",
"resolved": "github:NixOS/nixpkgs/7d0ed7f2e5aea07ab22ccb338d27fbe347ed2f11#ipfs",
@@ -294,6 +342,54 @@
"store_path": "/nix/store/6zbyhj72wh0645lj6b9c392aqqg11a84-skate-1.0.0"
}
}
},
"templ@latest": {
"last_modified": "2024-09-10T15:01:03Z",
"resolved": "github:NixOS/nixpkgs/5ed627539ac84809c78b2dd6d26a5cebeb5ae269#templ",
"source": "devbox-search",
"version": "0.2.778",
"systems": {
"aarch64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/n3yqslisz9v81k4w4vhci1v2bl1sqf9s-templ-0.2.778",
"default": true
}
],
"store_path": "/nix/store/n3yqslisz9v81k4w4vhci1v2bl1sqf9s-templ-0.2.778"
},
"aarch64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/i4xjiw0vc25qpr3g01q0x401351w28hr-templ-0.2.778",
"default": true
}
],
"store_path": "/nix/store/i4xjiw0vc25qpr3g01q0x401351w28hr-templ-0.2.778"
},
"x86_64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/77w522agb5fgsr36jkifcccr9x4xwkf9-templ-0.2.778",
"default": true
}
],
"store_path": "/nix/store/77w522agb5fgsr36jkifcccr9x4xwkf9-templ-0.2.778"
},
"x86_64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/1g5ji5930j03cycpcjy12z6lr24l9c65-templ-0.2.778",
"default": true
}
],
"store_path": "/nix/store/1g5ji5930j03cycpcjy12z6lr24l9c65-templ-0.2.778"
}
}
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
package home
templ MarketingFooter() {
templ Footer() {
<!-- Site footer -->
<footer>
<div class="max-w-5xl mx-auto px-4 sm:px-6">
+1 -1
View File
@@ -8,7 +8,7 @@ package home
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
func MarketingFooter() templ.Component {
func Footer() 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 -1
View File
@@ -1,6 +1,6 @@
package home
templ MarketingHeader() {
templ Header() {
<!-- Site header -->
<header class="absolute top-2 md:top-6 w-full z-30">
<div class="px-4 sm:px-6">
+1 -1
View File
@@ -8,7 +8,7 @@ package home
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
func MarketingHeader() templ.Component {
func Header() 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 {
+6 -7
View File
@@ -1,6 +1,9 @@
package home
import "github.com/onsonr/sonr/pkg/nebula/models"
import (
"github.com/onsonr/sonr/pkg/nebula/components/ui"
"github.com/onsonr/sonr/pkg/nebula/models"
)
templ SectionHero(hero *models.Hero) {
<!-- Hero -->
@@ -24,12 +27,8 @@ templ SectionHero(hero *models.Hero) {
{ hero.Subtitle }
</p>
<div class="max-w-xs mx-auto sm:max-w-none sm:inline-flex sm:justify-center space-y-4 sm:space-y-0 sm:space-x-4">
<div>
<div class="btn cursor-pointer text-zinc-100 bg-zinc-900 hover:bg-zinc-800 w-full shadow" hx-swap="afterend" hx-get={ hero.PrimaryButton.Href }>{ hero.PrimaryButton.Text }</div>
</div>
<div>
<div class="btn cursor-pointer text-zinc-600 bg-white hover:text-zinc-900 w-full shadow" hx-swap="afterend" hx-get={ hero.SecondaryButton.Href }>{ hero.SecondaryButton.Text }</div>
</div>
@ui.PrimaryButton(hero.PrimaryButton.Href, hero.PrimaryButton.Text)
@ui.SecondaryButton(hero.SecondaryButton.Href, hero.SecondaryButton.Text)
</div>
</div>
</div>
+30 -67
View File
@@ -8,7 +8,10 @@ package home
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "github.com/onsonr/sonr/pkg/nebula/models"
import (
"github.com/onsonr/sonr/pkg/nebula/components/ui"
"github.com/onsonr/sonr/pkg/nebula/models"
)
func SectionHero(hero *models.Hero) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
@@ -38,7 +41,7 @@ func SectionHero(hero *models.Hero) templ.Component {
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(hero.TitleFirst)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 14, Col: 24}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 17, Col: 24}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
@@ -51,7 +54,7 @@ func SectionHero(hero *models.Hero) templ.Component {
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(hero.TitleEmphasis)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 16, Col: 28}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 19, Col: 28}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
@@ -64,7 +67,7 @@ func SectionHero(hero *models.Hero) templ.Component {
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(hero.TitleSecond)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 21, Col: 25}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 24, Col: 25}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
@@ -77,65 +80,25 @@ func SectionHero(hero *models.Hero) templ.Component {
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Subtitle)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 24, Col: 22}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 27, Col: 22}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</p><div class=\"max-w-xs mx-auto sm:max-w-none sm:inline-flex sm:justify-center space-y-4 sm:space-y-0 sm:space-x-4\"><div><div class=\"btn cursor-pointer text-zinc-100 bg-zinc-900 hover:bg-zinc-800 w-full shadow\" hx-swap=\"afterend\" hx-get=\"")
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</p><div class=\"max-w-xs mx-auto sm:max-w-none sm:inline-flex sm:justify-center space-y-4 sm:space-y-0 sm:space-x-4\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(hero.PrimaryButton.Href)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 28, Col: 149}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
templ_7745c5c3_Err = ui.PrimaryButton(hero.PrimaryButton.Href, hero.PrimaryButton.Text).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
templ_7745c5c3_Err = ui.SecondaryButton(hero.SecondaryButton.Href, hero.SecondaryButton.Text).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(hero.PrimaryButton.Text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 28, Col: 177}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div><div><div class=\"btn cursor-pointer text-zinc-600 bg-white hover:text-zinc-900 w-full shadow\" hx-swap=\"afterend\" hx-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(hero.SecondaryButton.Href)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 31, Col: 150}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
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_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(hero.SecondaryButton.Text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 31, Col: 180}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div></div></div></div>")
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -171,21 +134,21 @@ func heroImage(hero *models.Hero) templ.Component {
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var10 := templ.GetChildren(ctx)
if templ_7745c5c3_Var10 == nil {
templ_7745c5c3_Var10 = templ.NopComponent
templ_7745c5c3_Var6 := templ.GetChildren(ctx)
if templ_7745c5c3_Var6 == nil {
templ_7745c5c3_Var6 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!-- Image --><div class=\"max-w-5xl mx-auto px-4 sm:px-6 flex justify-center pb-12 md:pb-20 relative before:absolute before:-top-12 before:w-96 before:h-96 before:bg-zinc-900 before:opacity-[.15] before:rounded-full before:blur-3xl before:-z-10 from-zinc-100 to-white\"><img class=\"rounded-lg\" src=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Image.Src)
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Image.Src)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 48, Col: 23}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 47, Col: 23}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -193,12 +156,12 @@ func heroImage(hero *models.Hero) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Image.Width)
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Image.Width)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 49, Col: 27}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 48, Col: 27}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -206,12 +169,12 @@ func heroImage(hero *models.Hero) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Image.Height)
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Image.Height)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 50, Col: 29}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 49, Col: 29}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -239,9 +202,9 @@ func stats() templ.Component {
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var14 := templ.GetChildren(ctx)
if templ_7745c5c3_Var14 == nil {
templ_7745c5c3_Var14 = templ.NopComponent
templ_7745c5c3_Var10 := templ.GetChildren(ctx)
if templ_7745c5c3_Var10 == nil {
templ_7745c5c3_Var10 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!-- Stats --><div class=\"max-w-4xl mx-auto px-4 sm:px-6 justify-center items-center\"><div class=\"max-w-sm mx-auto grid gap-12 sm:grid-cols-2 md:grid-cols-4 md:-mx-5 md:gap-0 items-end md:max-w-none\"><!-- 1st item --><div class=\"relative text-center md:px-5 after:hidden md:after:block after:absolute after:right-0 after:top-1/2 after:-translate-y-1/2 after:w-px after:h-8 after:border-l after:border-zinc-300 after:border-dashed last:after:hidden\"><h4 class=\"font-inter-tight text-2xl md:text-3xl font-bold tabular-nums mb-2\"><span x-data=\"counter(476)\" x-text=\"counterValue\">0</span>K</h4><p class=\"text-sm text-zinc-500\">Assets packed with power beyond your imagination.</p></div><!-- 2nd item --><div class=\"relative text-center md:px-5 after:hidden md:after:block after:absolute after:right-0 after:top-1/2 after:-translate-y-1/2 after:w-px after:h-8 after:border-l after:border-zinc-300 after:border-dashed last:after:hidden\"><h4 class=\"font-inter-tight text-2xl md:text-3xl font-bold tabular-nums mb-2\"><span x-data=\"counter(1.44)\" x-text=\"counterValue\">0</span>K</h4><p class=\"text-sm text-zinc-500\">Assets packed with power beyond your imagination.</p></div><!-- 3rd item --><div class=\"relative text-center md:px-5 after:hidden md:after:block after:absolute after:right-0 after:top-1/2 after:-translate-y-1/2 after:w-px after:h-8 after:border-l after:border-zinc-300 after:border-dashed last:after:hidden\"><h4 class=\"font-inter-tight text-2xl md:text-3xl font-bold tabular-nums mb-2\"><span x-data=\"counter(1.5)\" x-text=\"counterValue\">0</span>M+</h4><p class=\"text-sm text-zinc-500\">Assets packed with power beyond your imagination.</p></div><!-- 4th item --><div class=\"relative text-center md:px-5 after:hidden md:after:block after:absolute after:right-0 after:top-1/2 after:-translate-y-1/2 after:w-px after:h-8 after:border-l after:border-zinc-300 after:border-dashed last:after:hidden\"><h4 class=\"font-inter-tight text-2xl md:text-3xl font-bold tabular-nums mb-2\"><span x-data=\"counter(750)\" x-text=\"counterValue\">0</span>K</h4><p class=\"text-sm text-zinc-500\">Assets packed with power beyond your imagination.</p></div></div>")
@@ -144,14 +144,6 @@ templ Highlights() {
height="360"
alt="Feature 01"
/>
<img
class="absolute top-0 left-full mix-blend-exclusion -translate-x-[70%] -mr-20 max-md:w-[45%]"
src="https://cdn.sonr.id/img/secure-keys.svg"
width="224"
height="224"
alt="Illustration"
aria-hidden="true"
/>
</div>
</div>
<!-- Item 2 -->
@@ -173,14 +165,6 @@ templ Highlights() {
height="360"
alt="Feature 02"
/>
<img
class="absolute top-0 left-full mix-blend-exclusion -translate-x-[70%] -mr-20 max-md:w-[45%]"
src="https://cdn.sonr.id/img/secure-keys.svg"
width="224"
height="224"
alt="Illustration"
aria-hidden="true"
/>
</div>
</div>
<!-- Item 3 -->
@@ -202,14 +186,6 @@ templ Highlights() {
height="360"
alt="Feature 03"
/>
<img
class="absolute top-0 left-full mix-blend-exclusion -translate-x-[70%] -mr-20 max-md:w-[45%]"
src="https://cdn.sonr.id/img/secure-keys.svg"
width="224"
height="224"
alt="Illustration"
aria-hidden="true"
/>
</div>
</div>
<!-- Item 4 -->
@@ -231,14 +207,6 @@ templ Highlights() {
height="360"
alt="Feature 04"
/>
<img
class="absolute top-0 left-full mix-blend-exclusion -translate-x-[70%] -mr-20 max-md:w-[45%]"
src="https://cdn.sonr.id/img/secure-keys.svg"
width="224"
height="224"
alt="Illustration"
aria-hidden="true"
/>
</div>
</div>
</div>
File diff suppressed because one or more lines are too long
+4 -4
View File
@@ -5,15 +5,15 @@ import (
"github.com/onsonr/sonr/pkg/nebula/models"
)
templ View(hero *models.Hero) {
templ View(home *models.Home) {
@blocks.LayoutNoBody("Sonr.ID", true) {
@MarketingHeader()
@SectionHero(hero)
@Header()
@SectionHero(home.Hero)
@Highlights()
@Features()
@Bento()
@Lowlights()
@CallToAction()
@MarketingFooter()
@Footer()
}
}
+4 -4
View File
@@ -13,7 +13,7 @@ import (
"github.com/onsonr/sonr/pkg/nebula/models"
)
func View(hero *models.Hero) templ.Component {
func View(home *models.Home) 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 {
@@ -46,7 +46,7 @@ func View(hero *models.Hero) templ.Component {
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = MarketingHeader().Render(ctx, templ_7745c5c3_Buffer)
templ_7745c5c3_Err = Header().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -54,7 +54,7 @@ func View(hero *models.Hero) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = SectionHero(hero).Render(ctx, templ_7745c5c3_Buffer)
templ_7745c5c3_Err = SectionHero(home.Hero).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -102,7 +102,7 @@ func View(hero *models.Hero) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = MarketingFooter().Render(ctx, templ_7745c5c3_Buffer)
templ_7745c5c3_Err = Footer().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
+1 -2
View File
@@ -3,7 +3,6 @@ package register
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/blocks"
"github.com/onsonr/sonr/pkg/nebula/models/formstate"
)
templ Modal(c echo.Context) {
@@ -47,7 +46,7 @@ templ Modal(c echo.Context) {
<p>Enter your account information below to create your account.</p>
</div>
@blocks.Breadcrumbs()
@basicInfoForm(formstate.Initial)
@basicInfoForm()
@blocks.Spacer()
<div class="flex flex-col-reverse sm:flex-row sm:justify-between sm:space-x-2">
<button @click="modalOpen=false" type="button" class="inline-flex items-center justify-center h-10 px-4 py-2 text-sm font-medium transition-colors border rounded-md focus:outline-none focus:ring-2 focus:ring-neutral-100 focus:ring-offset-2">Cancel</button>
@@ -11,7 +11,6 @@ import templruntime "github.com/a-h/templ/runtime"
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/blocks"
"github.com/onsonr/sonr/pkg/nebula/models/formstate"
)
func Modal(c echo.Context) templ.Component {
@@ -43,7 +42,7 @@ func Modal(c echo.Context) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = basicInfoForm(formstate.Initial).Render(ctx, templ_7745c5c3_Buffer)
templ_7745c5c3_Err = basicInfoForm().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
+8 -28
View File
@@ -1,31 +1,11 @@
package register
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/blocks"
"github.com/onsonr/sonr/pkg/nebula/models/formstate"
)
templ View(c echo.Context) {
@blocks.Layout("Sonr.ID", true) {
@blocks.Card("register-view", blocks.SizeMedium) {
@blocks.Spacer()
@blocks.Breadcrumbs()
@basicInfoForm(formstate.Initial)
@blocks.Spacer()
}
}
}
templ basicInfoForm(state formstate.FormState) {
switch (state) {
default:
<div class="border rounded-lg shadow-sm bg-card text-zinc-900">
<div class="flex flex-col space-y-1.5 p-6"></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-zinc-300 ring-offset-background placeholder:text-zinc-400 focus:border-zinc-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-zinc-300 ring-offset-background placeholder:text-zinc-400 focus:border-zinc-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 basicInfoForm() {
<div class="border rounded-lg shadow-sm bg-card text-zinc-900">
<div class="flex flex-col space-y-1.5 p-6"></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-zinc-300 ring-offset-background placeholder:text-zinc-400 focus:border-zinc-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-zinc-300 ring-offset-background placeholder:text-zinc-400 focus:border-zinc-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>
}
+2 -100
View File
@@ -8,13 +8,7 @@ package register
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/blocks"
"github.com/onsonr/sonr/pkg/nebula/models/formstate"
)
func View(c echo.Context) templ.Component {
func basicInfoForm() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
@@ -35,67 +29,7 @@ func View(c echo.Context) templ.Component {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var3 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = 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 = basicInfoForm(formstate.Initial).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
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = blocks.Card("register-view", blocks.SizeMedium).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("Sonr.ID", true).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"border rounded-lg shadow-sm bg-card text-zinc-900\"><div class=\"flex flex-col space-y-1.5 p-6\"></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-zinc-300 ring-offset-background placeholder:text-zinc-400 focus:border-zinc-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-zinc-300 ring-offset-background placeholder:text-zinc-400 focus:border-zinc-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
}
@@ -103,36 +37,4 @@ func View(c echo.Context) templ.Component {
})
}
func basicInfoForm(state formstate.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-zinc-900\"><div class=\"flex flex-col space-y-1.5 p-6\"></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-zinc-300 ring-offset-background placeholder:text-zinc-400 focus:border-zinc-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-zinc-300 ring-offset-background placeholder:text-zinc-400 focus:border-zinc-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
+13
View File
@@ -0,0 +1,13 @@
package ui
templ PrimaryButton(href string, text string) {
<div>
<div class="btn cursor-pointer text-zinc-100 bg-zinc-900 hover:bg-zinc-800 w-full shadow" hx-swap="afterend" hx-get={ href }>{ text }</div>
</div>
}
templ SecondaryButton(href string, text string) {
<div>
<div class="btn cursor-pointer text-zinc-600 bg-white hover:text-zinc-900 w-full shadow" hx-swap="afterend" hx-get={ href }>{ text }</div>
</div>
}
+121
View File
@@ -0,0 +1,121 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
package ui
//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 PrimaryButton(href string, text 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div><div class=\"btn cursor-pointer text-zinc-100 bg-zinc-900 hover:bg-zinc-800 w-full shadow\" hx-swap=\"afterend\" hx-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(href)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/ui/button.templ`, Line: 5, Col: 124}
}
_, 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
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/ui/button.templ`, Line: 5, Col: 133}
}
_, 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("</div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
func SecondaryButton(href string, text 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
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)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div><div class=\"btn cursor-pointer text-zinc-600 bg-white hover:text-zinc-900 w-full shadow\" hx-swap=\"afterend\" hx-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(href)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/ui/button.templ`, Line: 11, Col: 123}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
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_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/ui/button.templ`, Line: 11, Col: 132}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate
+12
View File
@@ -0,0 +1,12 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Bento struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
PrimaryButton *Button `pkl:"primaryButton"`
SecondaryButton *Button `pkl:"secondaryButton"`
}
+12
View File
@@ -0,0 +1,12 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type CallToAction struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
PrimaryButton *Button `pkl:"primaryButton"`
SecondaryButton *Button `pkl:"secondaryButton"`
}
+12
View File
@@ -0,0 +1,12 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Feature struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
Icon string `pkl:"icon"`
Image *Image `pkl:"image"`
}
+10
View File
@@ -0,0 +1,10 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Features struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
Image *Image `pkl:"image"`
}
+10
View File
@@ -0,0 +1,10 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Form interface {
GetTitle() string
GetDescription() string
GetInputs() []*Input
}
+2
View File
@@ -15,4 +15,6 @@ type Hero struct {
SecondaryButton *Button `pkl:"secondaryButton"`
Image *Image `pkl:"image"`
Stats []*Stat `pkl:"stats"`
}
+10
View File
@@ -0,0 +1,10 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Highlight struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
Image *Image `pkl:"image"`
}
+10
View File
@@ -0,0 +1,10 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Highlights struct {
Heading string `pkl:"heading"`
Subheading string `pkl:"subheading"`
Highlights []*Highlight `pkl:"highlights"`
}
+18
View File
@@ -0,0 +1,18 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Home struct {
Hero *Hero `pkl:"hero"`
Highlights []*Highlight `pkl:"highlights"`
Features []*Features `pkl:"features"`
Bento *Bento `pkl:"bento"`
Lowlights []*Lowlights `pkl:"lowlights"`
CallToAction *CallToAction `pkl:"callToAction"`
Footer *Footer `pkl:"footer"`
}
+4 -2
View File
@@ -1,10 +1,12 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
import "github.com/onsonr/sonr/pkg/nebula/models/inputtype"
type Input struct {
Label string `pkl:"label"`
Type string `pkl:"type"`
Type inputtype.InputType `pkl:"type"`
Placeholder string `pkl:"placeholder"`
@@ -14,5 +16,5 @@ type Input struct {
Help *string `pkl:"help"`
Required bool `pkl:"required"`
Required *bool `pkl:"required"`
}
+10
View File
@@ -0,0 +1,10 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Lowlights struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
Image *Image `pkl:"image"`
}
+1 -3
View File
@@ -8,9 +8,7 @@ import (
)
type Models struct {
Hero *Hero `pkl:"hero"`
Stats *Stats `pkl:"stats"`
Home *Home `pkl:"home"`
}
// LoadFromPath loads the pkl module at the given path and evaluates it into a Models
+28
View File
@@ -0,0 +1,28 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type RegisterFormData interface {
Form
}
var _ RegisterFormData = (*RegisterFormDataImpl)(nil)
type RegisterFormDataImpl struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
Inputs []*Input `pkl:"inputs"`
}
func (rcv *RegisterFormDataImpl) GetTitle() string {
return rcv.Title
}
func (rcv *RegisterFormDataImpl) GetDescription() string {
return rcv.Description
}
func (rcv *RegisterFormDataImpl) GetInputs() []*Input {
return rcv.Inputs
}
-14
View File
@@ -1,14 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
import "github.com/onsonr/sonr/pkg/nebula/models/formstate"
type RegistrationForm struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
State formstate.FormState `pkl:"state"`
Inputs []*Input `pkl:"inputs"`
}
@@ -1,40 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package formstate
import (
"encoding"
"fmt"
)
type FormState string
const (
Initial FormState = "initial"
Error FormState = "error"
Success FormState = "success"
Warning FormState = "warning"
)
// String returns the string representation of FormState
func (rcv FormState) String() string {
return string(rcv)
}
var _ encoding.BinaryUnmarshaler = new(FormState)
// UnmarshalBinary implements encoding.BinaryUnmarshaler for FormState.
func (rcv *FormState) UnmarshalBinary(data []byte) error {
switch str := string(data); str {
case "initial":
*rcv = Initial
case "error":
*rcv = Error
case "success":
*rcv = Success
case "warning":
*rcv = Warning
default:
return fmt.Errorf(`illegal: "%s" is not a valid FormState`, str)
}
return nil
}
+12 -5
View File
@@ -5,13 +5,20 @@ import "github.com/apple/pkl-go/pkl"
func init() {
pkl.RegisterMapping("models", Models{})
pkl.RegisterMapping("models#Home", Home{})
pkl.RegisterMapping("models#Hero", Hero{})
pkl.RegisterMapping("models#Button", Button{})
pkl.RegisterMapping("models#Image", Image{})
pkl.RegisterMapping("models#Stats", Stats{})
pkl.RegisterMapping("models#Link", Link{})
pkl.RegisterMapping("models#SocialLink", SocialLink{})
pkl.RegisterMapping("models#Input", Input{})
pkl.RegisterMapping("models#Stat", Stat{})
pkl.RegisterMapping("models#Highlight", Highlight{})
pkl.RegisterMapping("models#Features", Features{})
pkl.RegisterMapping("models#Bento", Bento{})
pkl.RegisterMapping("models#Lowlights", Lowlights{})
pkl.RegisterMapping("models#CallToAction", CallToAction{})
pkl.RegisterMapping("models#Footer", Footer{})
pkl.RegisterMapping("models#RegistrationForm", RegistrationForm{})
pkl.RegisterMapping("models#SocialLink", SocialLink{})
pkl.RegisterMapping("models#Link", Link{})
pkl.RegisterMapping("models#Input", Input{})
pkl.RegisterMapping("models#Feature", Feature{})
pkl.RegisterMapping("models#Highlights", Highlights{})
}
@@ -0,0 +1,43 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package inputtype
import (
"encoding"
"fmt"
)
type InputType string
const (
Text InputType = "text"
Password InputType = "password"
Email InputType = "email"
Credential InputType = "credential"
File InputType = "file"
)
// String returns the string representation of InputType
func (rcv InputType) String() string {
return string(rcv)
}
var _ encoding.BinaryUnmarshaler = new(InputType)
// UnmarshalBinary implements encoding.BinaryUnmarshaler for InputType.
func (rcv *InputType) UnmarshalBinary(data []byte) error {
switch str := string(data); str {
case "text":
*rcv = Text
case "password":
*rcv = Password
case "email":
*rcv = Email
case "credential":
*rcv = Credential
case "file":
*rcv = File
default:
return fmt.Errorf(`illegal: "%s" is not a valid InputType`, str)
}
return nil
}
+230 -27
View File
@@ -1,30 +1,233 @@
amends "https://pkl.sh/uiux.pkl";
amends "https://pkl.sh/UIUX.pkl";
hero = new Hero {
titleFirst = "Simplified";
titleEmphasis = "self-custody";
titleSecond = "for everyone";
subtitle = "Sonr is a modern re-imagination of online user identity, empowering users to take ownership of their digital footprint and unlocking a new era of self-sovereignty.";
primaryButton = new Button {
text = "Get Started";
href = "/register";
};
secondaryButton = new Button {
text = "Learn More";
href = "/about";
};
image = new Image {
src = "https://cdn.sonr.id/img/hero-clipped.svg";
width = "500";
height = "500";
};
};
home = new Home {
stats = new Stats {
firstValue = "476K";
firstLabel = "Assets packed with power beyond your imagination.";
secondValue = "1.44K";
secondLabel = "Assets packed with power beyond your imagination.";
thirdValue = "1.5M+";
thirdLabel = "Assets packed with power beyond your imagination.";
// Hero
hero = new Hero {
titleFirst = "Simplified";
titleEmphasis = "self-custody";
titleSecond = "for everyone";
subtitle = "Sonr is a modern re-imagination of online user identity, empowering users to take ownership of their digital footprint and unlocking a new era of self-sovereignty.";
primaryButton = new Button {
text = "Get Started";
href = "/register";
};
secondaryButton = new Button {
text = "Learn More";
href = "/about";
};
image = new Image {
src = "https://cdn.sonr.id/img/hero-clipped.svg";
width = "500";
height = "500";
};
stats {
new Stat {
value = "476K";
label = "Assets packed with power beyond your imagination.";
};
new Stat {
value = "1.44K";
label = "Assets packed with power beyond your imagination.";
};
new Stat {
value = "1.5M+";
label = "Assets packed with power beyond your imagination.";
}
};
};
// Highlights
highlights {
new Highlight {
title = "Simplified";
description = "Sonr is a modern re-imagination of online user identity, empowering users to take ownership of their digital footprint and unlocking a new era of self-sovereignty.";
image = new Image {
src = "https://cdn.sonr.id/img/highlight-1.svg";
width = "500";
height = "500";
};
};
new Highlight {
title = "Simplified";
description = "Sonr is a modern re-imagination of online user identity, empowering users to take ownership of their digital footprint and unlocking a new era of self-sovereignty.";
image = new Image {
src = "https://cdn.sonr.id/img/highlight-2.svg";
width = "500";
height = "500";
};
};
};
// Features
features {
new Features {
title = "Simplified";
description = "Sonr is a modern re-imagination of online user identity, empowering users to take ownership of their digital footprint and unlocking a new era of self-sovereignty.";
image = new Image {
src = "https://cdn.sonr.id/img/feature-1.svg";
width = "500";
height = "500";
};
};
new Features {
title = "Simplified";
description = "Sonr is a modern re-imagination of online user identity, empowering users to take ownership of their digital footprint and unlocking a new era of self-sovereignty.";
image = new Image {
src = "https://cdn.sonr.id/img/feature-2.svg";
width = "500";
height = "500";
};
};
new Features {
title = "Simplified";
description = "Sonr is a modern re-imagination of online user identity, empowering users to take ownership of their digital footprint and unlocking a new era of self-sovereignty.";
image = new Image {
src = "https://cdn.sonr.id/img/feature-3.svg";
width = "500";
height = "500";
};
};
};
// Bento
bento = new Bento {
title = "Simplified";
description = "Sonr is a modern re-imagination of online user identity, empowering users to take ownership of their digital footprint and unlocking a new era of self-sovereignty.";
primaryButton = new Button {
text = "Get Started";
href = "/register";
};
secondaryButton = new Button {
text = "Learn More";
href = "/about";
};
};
// Lowlights
lowlights {
new Lowlights {
title = "Simplified";
description = "Sonr is a modern re-imagination of online user identity, empowering users to take ownership of their digital footprint and unlocking a new era of self-sovereignty.";
image = new Image {
src = "https://cdn.sonr.id/img/lowlight-1.svg";
width = "500";
height = "500";
};
};
new Lowlights {
title = "Simplified";
description = "Sonr is a modern re-imagination of online user identity, empowering users to take ownership of their digital footprint and unlocking a new era of self-sovereignty.";
image = new Image {
src = "https://cdn.sonr.id/img/lowlight-2.svg";
width = "500";
height = "500";
};
};
};
// Call to Action
callToAction = new CallToAction {
title = "Simplified";
description = "Sonr is a modern re-imagination of online user identity, empowering users to take ownership of their digital footprint and unlocking a new era of self-sovereignty.";
primaryButton = new Button {
text = "Get Started";
href = "/register";
};
secondaryButton = new Button {
text = "Learn More";
href = "/about";
};
};
// Footer
footer = new Footer {
logo = new Image {
src = "https://cdn.sonr.id/img/logo.svg";
width = "500";
height = "500";
};
mediumLink = new SocialLink {
link = new Link {
text = "Medium";
href = "https://medium.com/sonr-io";
};
icon = "https://cdn.sonr.id/img/medium.svg";
};
twitterLink = new SocialLink {
link = new Link {
text = "Twitter";
href = "https://twitter.com/sonr";
};
icon = "https://cdn.sonr.id/img/twitter.svg";
};
discordLink = new SocialLink {
link = new Link {
text = "Discord";
href = "https://discord.com/invite/sonr";
};
icon = "https://cdn.sonr.id/img/discord.svg";
};
githubLink = new SocialLink {
link = new Link {
text = "GitHub";
href = "https://github.com/sonr-io";
};
icon = "https://cdn.sonr.id/img/github.svg";
};
companyLinks {
new Link {
text = "About";
href = "https://sonr.io/about";
};
new Link {
text = "Careers";
href = "https://sonr.io/careers";
};
new Link {
text = "Partners";
href = "https://sonr.io/partners";
};
new Link {
text = "Investors";
href = "https://sonr.io/investors";
};
new Link {
text = "Newsroom";
href = "https://sonr.io/newsroom";
};
new Link {
text = "Blog";
href = "https://sonr.io/blog";
};
};
resourcesLinks {
new Link {
text = "Docs";
href = "https://docs.sonr.io";
};
new Link {
text = "Whitepaper";
href = "https://sonr.io/whitepaper";
};
new Link {
text = "FAQ";
href = "https://sonr.io/faq";
};
new Link {
text = "Terms of Service";
href = "https://sonr.io/terms";
};
new Link {
text = "Privacy Policy";
href = "https://sonr.io/privacy";
};
};
}
};
-11
View File
@@ -1,11 +0,0 @@
package pages
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/grant"
)
func Authorize(c echo.Context) error {
return echoResponse(c, grant.View(c))
}
-15
View File
@@ -1,15 +0,0 @@
package pages
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/home"
"github.com/onsonr/sonr/pkg/nebula/models"
)
func Home(c echo.Context) error {
mdls, err := models.GetModels()
if err != nil {
return err
}
return echoResponse(c, home.View(mdls.Hero))
}
-11
View File
@@ -1,11 +0,0 @@
package pages
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/login"
)
func Login(c echo.Context) error {
return echoResponse(c, login.Modal(c))
}
+60
View File
@@ -0,0 +1,60 @@
package pages
import (
"bytes"
"github.com/a-h/templ"
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/grant"
"github.com/onsonr/sonr/pkg/nebula/components/home"
"github.com/onsonr/sonr/pkg/nebula/components/login"
"github.com/onsonr/sonr/pkg/nebula/components/profile"
"github.com/onsonr/sonr/pkg/nebula/components/register"
"github.com/onsonr/sonr/pkg/nebula/models"
)
func Authorize(c echo.Context) error {
return echoResponse(c, grant.View(c))
}
func Home(c echo.Context) error {
mdls, err := models.GetModels()
if err != nil {
return err
}
return echoResponse(c, home.View(mdls.Home))
}
func Login(c echo.Context) error {
return echoResponse(c, login.Modal(c))
}
func Profile(c echo.Context) error {
return echoResponse(c, profile.View(c))
}
func Register(c echo.Context) error {
return echoResponse(c, register.Modal(c))
}
// ╭───────────────────────────────────────────────────────────╮
// │ Helper Methods │
// ╰───────────────────────────────────────────────────────────╯
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
err := cmp.Render(c.Request().Context(), buf)
if err != nil {
return err
}
// Set the content type
c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML)
// Write the buffered content to the response
_, err = c.Response().Write(buf.Bytes())
return err
}
-11
View File
@@ -1,11 +0,0 @@
package pages
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/profile"
)
func Profile(c echo.Context) error {
return echoResponse(c, profile.View(c))
}
-11
View File
@@ -1,11 +0,0 @@
package pages
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/register"
)
func Register(c echo.Context) error {
return echoResponse(c, register.Modal(c))
}
-25
View File
@@ -1,25 +0,0 @@
package pages
import (
"bytes"
"github.com/a-h/templ"
"github.com/labstack/echo/v4"
)
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
err := cmp.Render(c.Request().Context(), buf)
if err != nil {
return err
}
// Set the content type
c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML)
// Write the buffered content to the response
_, err = c.Response().Write(buf.Bytes())
return err
}
+27
View File
@@ -0,0 +1,27 @@
package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/onsonr/crypto/mpc"
"github.com/onsonr/sonr/x/did/types"
)
func (k Keeper) NewController(ctx sdk.Context) (uint64, types.ControllerI, error) {
shares, err := mpc.GenerateKeyshares()
if err != nil {
return 0, nil, err
}
controller, err := types.NewController(shares)
if err != nil {
return 0, nil, err
}
entry, err := controller.GetTableEntry()
if err != nil {
return 0, nil, err
}
num, err := k.OrmDB.ControllerTable().InsertReturningNumber(ctx, entry)
if err != nil {
return 0, nil, err
}
return num, controller, nil
}
-46
View File
@@ -1,22 +1,16 @@
package keeper
import (
"crypto/sha256"
"fmt"
"cosmossdk.io/collections"
storetypes "cosmossdk.io/core/store"
"cosmossdk.io/log"
"cosmossdk.io/orm/model/ormdb"
nftkeeper "cosmossdk.io/x/nft/keeper"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
stakkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
"github.com/onsonr/crypto/mpc"
"gopkg.in/macaroon.v2"
apiv1 "github.com/onsonr/sonr/api/did/v1"
"github.com/onsonr/sonr/x/did/types"
@@ -91,43 +85,3 @@ func NewKeeper(
k.Schema = schema
return k
}
func (k Keeper) NewController(ctx sdk.Context) (uint64, types.ControllerI, error) {
shares, err := mpc.GenerateKeyshares()
if err != nil {
return 0, nil, err
}
controller, err := types.NewController(shares)
if err != nil {
return 0, nil, err
}
entry, err := controller.GetTableEntry()
if err != nil {
return 0, nil, err
}
num, err := k.OrmDB.ControllerTable().InsertReturningNumber(ctx, entry)
if err != nil {
return 0, nil, err
}
return num, controller, nil
}
// IssueMacaroon creates a macaroon with the specified parameters.
func (k Keeper) IssueMacaroon(ctx sdk.Context, sharedMPCPubKey, location, id string, blockExpiry uint64) (*macaroon.Macaroon, error) {
// Derive the root key by hashing the shared MPC public key
rootKey := sha256.Sum256([]byte(sharedMPCPubKey))
// Create the macaroon
m, err := macaroon.New(rootKey[:], []byte(id), location, macaroon.LatestVersion)
if err != nil {
return nil, err
}
// Add the block expiry caveat
caveat := fmt.Sprintf("block-expiry=%d", blockExpiry)
err = m.AddFirstPartyCaveat([]byte(caveat))
if err != nil {
return nil, err
}
return m, nil
}
+29
View File
@@ -0,0 +1,29 @@
package keeper
import (
"crypto/sha256"
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
"gopkg.in/macaroon.v2"
)
// IssueMacaroon creates a macaroon with the specified parameters.
func (k Keeper) IssueMacaroon(ctx sdk.Context, sharedMPCPubKey, location, id string, blockExpiry uint64) (*macaroon.Macaroon, error) {
// Derive the root key by hashing the shared MPC public key
rootKey := sha256.Sum256([]byte(sharedMPCPubKey))
// Create the macaroon
m, err := macaroon.New(rootKey[:], []byte(id), location, macaroon.LatestVersion)
if err != nil {
return nil, err
}
// Add the block expiry caveat
caveat := fmt.Sprintf("block-expiry=%d", blockExpiry)
err = m.AddFirstPartyCaveat([]byte(caveat))
if err != nil {
return nil, err
}
return m, nil
}
+1 -5
View File
@@ -8,6 +8,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ipfs/boxo/path"
"github.com/ipfs/kubo/client/rpc"
"github.com/onsonr/sonr/x/vault/types"
)
@@ -74,8 +75,3 @@ func (k Keeper) HasPathInIPFS(ctx sdk.Context, cid string) (bool, error) {
}
return true, nil
}
// validateSubjectOrigin checks if the subject and origin are valid
func (k Keeper) validateSubjectOrigin(ctx sdk.Context, subject string, origin string) error {
return nil
}