diff --git a/cmd/motrd/proxy.go b/cmd/motrd/proxy.go
index d3490c5ee..e9b4cba1d 100644
--- a/cmd/motrd/proxy.go
+++ b/cmd/motrd/proxy.go
@@ -26,7 +26,6 @@ func NewProxyCmd() *cobra.Command {
}
e.GET("/", pages.Home)
- e.GET("/config", nebula.GetConfig)
e.GET("/allocate", pages.Profile)
if err := e.Start(":1323"); err != http.ErrServerClosed {
diff --git a/pkg/nebula/assets/config.pkl b/pkg/nebula/assets/config.pkl
index dc25bae59..3d0a285ad 100644
--- a/pkg/nebula/assets/config.pkl
+++ b/pkg/nebula/assets/config.pkl
@@ -1,2 +1,30 @@
-import "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 = "560";
+ height = "560;
+ };
+};
+
+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.";
+};
diff --git a/pkg/nebula/components/sections/hero.templ b/pkg/nebula/components/sections/hero.templ
index dd9139c6f..96318b195 100644
--- a/pkg/nebula/components/sections/hero.templ
+++ b/pkg/nebula/components/sections/hero.templ
@@ -1,19 +1,8 @@
package sections
-type Hero struct {
- TitleFirst string
- TitleEmphasis string
- TitleSecond string
- Subtitle string
+import "github.com/onsonr/sonr/pkg/nebula/models"
- PrimaryButtonText string
- PrimaryButtonLink string
-
- SecondaryButtonText string
- SecondaryButtonLink string
-}
-
-templ SectionHero(hero Hero) {
+templ SectionHero(hero *models.Hero) {
@@ -36,29 +25,29 @@ templ SectionHero(hero Hero) {
- @heroImage()
+ @heroImage(hero)
@stats()
}
-templ heroImage() {
+templ heroImage(hero *models.Hero) {
0K
Assets packed with power beyond your imagination.
0K
Assets packed with power beyond your imagination.
0M+
Assets packed with power beyond your imagination.
")
diff --git a/pkg/nebula/models/Footer.pkl.go b/pkg/nebula/models/Footer.pkl.go
new file mode 100644
index 000000000..aa9aba0aa
--- /dev/null
+++ b/pkg/nebula/models/Footer.pkl.go
@@ -0,0 +1,12 @@
+// Code generated from Pkl module `models`. DO NOT EDIT.
+package models
+
+type Footer struct {
+ Logo *Image `pkl:"logo"`
+
+ SocialLinks []*SocialLink `pkl:"socialLinks"`
+
+ CompanyLinks []*Link `pkl:"companyLinks"`
+
+ ResourcesLinks []*Link `pkl:"resourcesLinks"`
+}
diff --git a/pkg/nebula/models/Image.pkl.go b/pkg/nebula/models/Image.pkl.go
index e694c93a5..9bacfa74f 100644
--- a/pkg/nebula/models/Image.pkl.go
+++ b/pkg/nebula/models/Image.pkl.go
@@ -4,7 +4,7 @@ package models
type Image struct {
Src string `pkl:"src"`
- Width int `pkl:"width"`
+ Width string `pkl:"width"`
- Height int `pkl:"height"`
+ Height string `pkl:"height"`
}
diff --git a/pkg/nebula/models/Models.pkl.go b/pkg/nebula/models/Models.pkl.go
index c896a12be..03d42f033 100644
--- a/pkg/nebula/models/Models.pkl.go
+++ b/pkg/nebula/models/Models.pkl.go
@@ -8,6 +8,7 @@ import (
)
type Models struct {
+ Hero *Hero `pkl:"hero"`
}
// LoadFromPath loads the pkl module at the given path and evaluates it into a Models
@@ -26,22 +27,6 @@ func LoadFromPath(ctx context.Context, path string) (ret *Models, err error) {
return ret, err
}
-// LoadFromURL loads the pkl module at the given URL and evaluates it into a Models
-func LoadFromURL(ctx context.Context, url string) (ret *Models, err error) {
- evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions)
- if err != nil {
- return nil, err
- }
- defer func() {
- cerr := evaluator.Close()
- if err == nil {
- err = cerr
- }
- }()
- ret, err = Load(ctx, evaluator, pkl.UriSource(url))
- return ret, err
-}
-
// Load loads the pkl module at the given source and evaluates it with the given evaluator into a Models
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Models, error) {
var ret Models
diff --git a/pkg/nebula/models/common.go b/pkg/nebula/models/common.go
index 2640e7f93..a0d1042d6 100644
--- a/pkg/nebula/models/common.go
+++ b/pkg/nebula/models/common.go
@@ -1 +1,36 @@
package models
+
+import (
+ "context"
+ "errors"
+
+ "github.com/apple/pkl-go/pkl"
+)
+
+var models *Models
+
+func LoadFromString(ctx context.Context, s string) (err error) {
+ evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions)
+ if err != nil {
+ return err
+ }
+ defer func() {
+ cerr := evaluator.Close()
+ if err == nil {
+ err = cerr
+ }
+ }()
+ ret, err := Load(ctx, evaluator, pkl.TextSource(s))
+ if err != nil {
+ return err
+ }
+ models = ret
+ return nil
+}
+
+func GetModels() (*Models, error) {
+ if models == nil {
+ return nil, errors.New("models not initialized")
+ }
+ return models, nil
+}
diff --git a/pkg/nebula/models/init.pkl.go b/pkg/nebula/models/init.pkl.go
index 97233e92d..9d4349aac 100644
--- a/pkg/nebula/models/init.pkl.go
+++ b/pkg/nebula/models/init.pkl.go
@@ -5,10 +5,11 @@ import "github.com/apple/pkl-go/pkl"
func init() {
pkl.RegisterMapping("models", Models{})
+ pkl.RegisterMapping("models#Hero", Hero{})
+ pkl.RegisterMapping("models#Button", Button{})
pkl.RegisterMapping("models#Image", Image{})
+ pkl.RegisterMapping("models#Stat", Stat{})
pkl.RegisterMapping("models#Link", Link{})
pkl.RegisterMapping("models#SocialLink", SocialLink{})
- pkl.RegisterMapping("models#Button", Button{})
- pkl.RegisterMapping("models#Stat", Stat{})
- pkl.RegisterMapping("models#Hero", Hero{})
+ pkl.RegisterMapping("models#Footer", Footer{})
}
diff --git a/pkg/nebula/models/marketing.go b/pkg/nebula/models/marketing.go
deleted file mode 100644
index 2640e7f93..000000000
--- a/pkg/nebula/models/marketing.go
+++ /dev/null
@@ -1 +0,0 @@
-package models
diff --git a/pkg/nebula/nebula.go b/pkg/nebula/nebula.go
index 055980c95..518eac2db 100644
--- a/pkg/nebula/nebula.go
+++ b/pkg/nebula/nebula.go
@@ -1,18 +1,21 @@
package nebula
import (
+ "context"
"embed"
"io/fs"
"net/http"
"github.com/labstack/echo/v4"
+
+ "github.com/onsonr/sonr/pkg/nebula/models"
)
//go:embed assets
var embeddedFiles embed.FS
//go:embed assets/config.pkl
-var config []byte
+var config string
func getHTTPFS() (http.FileSystem, error) {
fsys, err := fs.Sub(embeddedFiles, "assets")
@@ -24,6 +27,10 @@ func getHTTPFS() (http.FileSystem, error) {
// UseAssets is a middleware that serves static files from the embedded assets
func UseAssets(e *echo.Echo) error {
+ err := models.LoadFromString(context.Background(), config)
+ if err != nil {
+ return err
+ }
fsys, err := getHTTPFS()
if err != nil {
return err
@@ -33,8 +40,3 @@ func UseAssets(e *echo.Echo) error {
e.GET("/assets/*", echo.WrapHandler(http.StripPrefix("/assets/", assets)))
return nil
}
-
-// GetConfig is a middleware that serves the config file
-func GetConfig(e echo.Context) error {
- return e.Blob(http.StatusOK, "application/octet-stream", config)
-}
diff --git a/pkg/nebula/pages/home.templ b/pkg/nebula/pages/home.templ
index f5817f642..48af4afe6 100644
--- a/pkg/nebula/pages/home.templ
+++ b/pkg/nebula/pages/home.templ
@@ -4,23 +4,18 @@ import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/blocks"
"github.com/onsonr/sonr/pkg/nebula/components/sections"
+ "github.com/onsonr/sonr/pkg/nebula/models"
)
func Home(c echo.Context) error {
- hero := sections.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.",
- PrimaryButtonText: "Get Started",
- PrimaryButtonLink: "/register",
- SecondaryButtonText: "Learn More",
- SecondaryButtonLink: "/about",
+ mdls, err := models.GetModels()
+ if err != nil {
+ return err
}
- return echoResponse(c, homeView(hero))
+ return echoResponse(c, homeView(mdls.Hero))
}
-templ homeView(hero sections.Hero) {
+templ homeView(hero *models.Hero) {
@blocks.LayoutNoBody("Sonr.ID", true) {
@sections.HeaderMarketingNav()
@sections.SectionHero(hero)
diff --git a/pkg/nebula/pages/home_templ.go b/pkg/nebula/pages/home_templ.go
index 7cc378b56..410c9e28a 100644
--- a/pkg/nebula/pages/home_templ.go
+++ b/pkg/nebula/pages/home_templ.go
@@ -12,23 +12,18 @@ import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/blocks"
"github.com/onsonr/sonr/pkg/nebula/components/sections"
+ "github.com/onsonr/sonr/pkg/nebula/models"
)
func Home(c echo.Context) error {
- hero := sections.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.",
- PrimaryButtonText: "Get Started",
- PrimaryButtonLink: "/register",
- SecondaryButtonText: "Learn More",
- SecondaryButtonLink: "/about",
+ mdls, err := models.GetModels()
+ if err != nil {
+ return err
}
- return echoResponse(c, homeView(hero))
+ return echoResponse(c, homeView(mdls.Hero))
}
-func homeView(hero sections.Hero) templ.Component {
+func homeView(hero *models.Hero) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
diff --git a/pkl/uiux.pkl b/pkl/uiux.pkl
index 81d0fa619..b84fcdfa8 100644
--- a/pkl/uiux.pkl
+++ b/pkl/uiux.pkl
@@ -6,8 +6,8 @@ import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
class Image {
src: String
- width: Int
- height: Int
+ width: String
+ height: String
}
class Link {
@@ -25,9 +25,13 @@ class Button {
href: String
}
-class Stat {
- value: String
- label: String
+class Stats {
+ firstValue: String
+ firstLabel: String
+ secondValue: String
+ secondLabel: String
+ thirdValue: String
+ thirdLabel: String
}
class Hero {
@@ -38,7 +42,17 @@ class Hero {
primaryButton: Button
secondaryButton: Button
image: Image
- stats: List
}
+class Footer {
+ logo: Image
+ mediumLink: SocialLink
+ twitterLink: SocialLink
+ discordLink: SocialLink
+ githubLink: SocialLink
+ companyLinks: List
+ resourcesLinks: List
+}
+hero : Hero
+stats : Stats