From f75ff0d3be5b544c2546fe0d18a2e2f76a4ee2e3 Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Thu, 3 Oct 2024 01:01:49 -0400 Subject: [PATCH] refactor: reorganize pkl files for better separation of concerns --- .github/workflows/publish-assets.yml | 2 +- .goreleaser.yaml | 3 +- Makefile | 9 +- pkl/dwn.pkl => deploy/config/DWN.pkl | 0 pkl/orm.pkl => deploy/config/ORM.pkl | 0 pkl/txns.pkl => deploy/config/Txns.pkl | 0 pkl/uiux.pkl => deploy/config/UIUX.pkl | 81 ++++---- devbox.json | 1 + pkg/nebula/components/home/hero.templ | 13 +- pkg/nebula/components/register/view.templ | 12 -- pkg/nebula/components/ui/button.templ | 13 ++ pkg/nebula/models/Feature.pkl.go | 12 ++ pkg/nebula/models/Form.pkl.go | 10 + pkg/nebula/models/Highlights.pkl.go | 6 +- pkg/nebula/models/Home.pkl.go | 12 ++ pkg/nebula/models/Input.pkl.go | 6 +- pkg/nebula/models/RegisterFormData.pkl.go | 28 +++ pkg/nebula/models/formstate/FormState.pkl.go | 40 ---- pkg/nebula/models/init.pkl.go | 10 +- pkg/nebula/models/inputtype/InputType.pkl.go | 43 ++++ pkg/nebula/nebula.pkl | 198 ++++++++++++++++++- pkg/nebula/pages/grant.go | 11 -- pkg/nebula/pages/home.go | 16 -- pkg/nebula/pages/login.go | 11 -- pkg/nebula/pages/pages.go | 36 ++++ pkg/nebula/pages/profile.go | 11 -- pkg/nebula/pages/register.go | 11 -- 27 files changed, 415 insertions(+), 180 deletions(-) rename pkl/dwn.pkl => deploy/config/DWN.pkl (100%) rename pkl/orm.pkl => deploy/config/ORM.pkl (100%) rename pkl/txns.pkl => deploy/config/Txns.pkl (100%) rename pkl/uiux.pkl => deploy/config/UIUX.pkl (65%) create mode 100644 pkg/nebula/components/ui/button.templ create mode 100644 pkg/nebula/models/Feature.pkl.go create mode 100644 pkg/nebula/models/Form.pkl.go create mode 100644 pkg/nebula/models/RegisterFormData.pkl.go delete mode 100644 pkg/nebula/models/formstate/FormState.pkl.go create mode 100644 pkg/nebula/models/inputtype/InputType.pkl.go delete mode 100644 pkg/nebula/pages/grant.go delete mode 100644 pkg/nebula/pages/home.go delete mode 100644 pkg/nebula/pages/login.go create mode 100644 pkg/nebula/pages/pages.go delete mode 100644 pkg/nebula/pages/profile.go delete mode 100644 pkg/nebula/pages/register.go diff --git a/.github/workflows/publish-assets.yml b/.github/workflows/publish-assets.yml index 0f1c633a7..0c3c16f03 100644 --- a/.github/workflows/publish-assets.yml +++ b/.github/workflows/publish-assets.yml @@ -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: diff --git a/.goreleaser.yaml b/.goreleaser.yaml index b74849c83..e51e3f7de 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -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 diff --git a/Makefile b/Makefile index d96e23e1c..3eb6b51b3 100644 --- a/Makefile +++ b/Makefile @@ -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" diff --git a/pkl/dwn.pkl b/deploy/config/DWN.pkl similarity index 100% rename from pkl/dwn.pkl rename to deploy/config/DWN.pkl diff --git a/pkl/orm.pkl b/deploy/config/ORM.pkl similarity index 100% rename from pkl/orm.pkl rename to deploy/config/ORM.pkl diff --git a/pkl/txns.pkl b/deploy/config/Txns.pkl similarity index 100% rename from pkl/txns.pkl rename to deploy/config/Txns.pkl diff --git a/pkl/uiux.pkl b/deploy/config/UIUX.pkl similarity index 65% rename from pkl/uiux.pkl rename to deploy/config/UIUX.pkl index 1ae9db528..a7add44df 100644 --- a/pkl/uiux.pkl +++ b/deploy/config/UIUX.pkl @@ -8,7 +8,18 @@ import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl" // │ 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 +} 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,25 +47,17 @@ class SocialLink { icon: String } -class Button { - text: String - href: String -} - -class Input { - label: String - type: String - placeholder: String - value: String? - error: String? - help: String? - required: Boolean -} - // ╭───────────────────────────────────────────────────────────╮ // │ Data Models │ // ╰───────────────────────────────────────────────────────────╯ +class Feature { + title: String + description: String + icon: String + image: Image +} + class Highlight { title: String description: String @@ -72,9 +85,9 @@ class Hero { } class Highlights { - title: String - description: String - image: Image + heading: String + subheading: String + highlights: Listing } class Features { @@ -115,29 +128,13 @@ class Footer { class Home { hero: Hero + highlights: Listing + features: Listing + bento: Bento + lowlights: Listing + callToAction: CallToAction + footer: Footer } - -// ╭───────────────────────────────────────────────────────────╮ -// │ Registration View Model │ -// ╰───────────────────────────────────────────────────────────╯ - -class RegistrationForm { - title: String - description: String - state: FormState - inputs: List -} - -// ╭───────────────────────────────────────────────────────────╮ -// │ Login View Model │ -// ╰───────────────────────────────────────────────────────────╯ - - - -// ╭───────────────────────────────────────────────────────────╮ -// │ FINAL INPUTS │ -// ╰───────────────────────────────────────────────────────────╯ - -// Pages home : Home + diff --git a/devbox.json b/devbox.json index ab4cee8a6..c744e18b6 100644 --- a/devbox.json +++ b/devbox.json @@ -6,6 +6,7 @@ "bun@latest", "ipfs@latest", "skate@latest", + "templ@latest", "cloudflared@latest", "process-compose@latest" ], diff --git a/pkg/nebula/components/home/hero.templ b/pkg/nebula/components/home/hero.templ index 2dd9bf19d..b261c5667 100644 --- a/pkg/nebula/components/home/hero.templ +++ b/pkg/nebula/components/home/hero.templ @@ -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) { @@ -24,12 +27,8 @@ templ SectionHero(hero *models.Hero) { { hero.Subtitle }

-
-
{ hero.PrimaryButton.Text }
-
-
-
{ hero.SecondaryButton.Text }
-
+ @ui.PrimaryButton(hero.PrimaryButton.Href, hero.PrimaryButton.Text) + @ui.SecondaryButton(hero.SecondaryButton.Href, hero.SecondaryButton.Text)
diff --git a/pkg/nebula/components/register/view.templ b/pkg/nebula/components/register/view.templ index b162d5879..cb19f58b3 100644 --- a/pkg/nebula/components/register/view.templ +++ b/pkg/nebula/components/register/view.templ @@ -1,22 +1,10 @@ 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: diff --git a/pkg/nebula/components/ui/button.templ b/pkg/nebula/components/ui/button.templ new file mode 100644 index 000000000..3d488ea97 --- /dev/null +++ b/pkg/nebula/components/ui/button.templ @@ -0,0 +1,13 @@ +package ui + +templ PrimaryButton(href string, text string) { +
+
{ text }
+
+} + +templ SecondaryButton(href string, text string) { +
+
{ text }
+
+} diff --git a/pkg/nebula/models/Feature.pkl.go b/pkg/nebula/models/Feature.pkl.go new file mode 100644 index 000000000..e8239992d --- /dev/null +++ b/pkg/nebula/models/Feature.pkl.go @@ -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"` +} diff --git a/pkg/nebula/models/Form.pkl.go b/pkg/nebula/models/Form.pkl.go new file mode 100644 index 000000000..497fee014 --- /dev/null +++ b/pkg/nebula/models/Form.pkl.go @@ -0,0 +1,10 @@ +// Code generated from Pkl module `models`. DO NOT EDIT. +package models + +type Form interface { + GetTitle() string + + GetDescription() string + + GetInputs() []*Input +} diff --git a/pkg/nebula/models/Highlights.pkl.go b/pkg/nebula/models/Highlights.pkl.go index 9a45560c3..3f6e2e538 100644 --- a/pkg/nebula/models/Highlights.pkl.go +++ b/pkg/nebula/models/Highlights.pkl.go @@ -2,9 +2,9 @@ package models type Highlights struct { - Title string `pkl:"title"` + Heading string `pkl:"heading"` - Description string `pkl:"description"` + Subheading string `pkl:"subheading"` - Image *Image `pkl:"image"` + Highlights []*Highlight `pkl:"highlights"` } diff --git a/pkg/nebula/models/Home.pkl.go b/pkg/nebula/models/Home.pkl.go index 9842d8afc..f49a5e3a6 100644 --- a/pkg/nebula/models/Home.pkl.go +++ b/pkg/nebula/models/Home.pkl.go @@ -3,4 +3,16 @@ 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"` } diff --git a/pkg/nebula/models/Input.pkl.go b/pkg/nebula/models/Input.pkl.go index f1a336ad6..919852c02 100644 --- a/pkg/nebula/models/Input.pkl.go +++ b/pkg/nebula/models/Input.pkl.go @@ -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"` } diff --git a/pkg/nebula/models/RegisterFormData.pkl.go b/pkg/nebula/models/RegisterFormData.pkl.go new file mode 100644 index 000000000..e4b0d698e --- /dev/null +++ b/pkg/nebula/models/RegisterFormData.pkl.go @@ -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 +} diff --git a/pkg/nebula/models/formstate/FormState.pkl.go b/pkg/nebula/models/formstate/FormState.pkl.go deleted file mode 100644 index 68199f2c1..000000000 --- a/pkg/nebula/models/formstate/FormState.pkl.go +++ /dev/null @@ -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 -} diff --git a/pkg/nebula/models/init.pkl.go b/pkg/nebula/models/init.pkl.go index 2f8a9eaf7..f2f078551 100644 --- a/pkg/nebula/models/init.pkl.go +++ b/pkg/nebula/models/init.pkl.go @@ -10,15 +10,15 @@ func init() { 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#Input", Input{}) pkl.RegisterMapping("models#Highlight", Highlight{}) - pkl.RegisterMapping("models#Highlights", Highlights{}) 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{}) } diff --git a/pkg/nebula/models/inputtype/InputType.pkl.go b/pkg/nebula/models/inputtype/InputType.pkl.go new file mode 100644 index 000000000..f234b3b7f --- /dev/null +++ b/pkg/nebula/models/inputtype/InputType.pkl.go @@ -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 +} diff --git a/pkg/nebula/nebula.pkl b/pkg/nebula/nebula.pkl index 1a3868671..6371412fc 100644 --- a/pkg/nebula/nebula.pkl +++ b/pkg/nebula/nebula.pkl @@ -1,6 +1,8 @@ -amends "https://pkl.sh/uiux.pkl"; +amends "https://pkl.sh/UIUX.pkl"; home = new Home { + + // Hero hero = new Hero { titleFirst = "Simplified"; titleEmphasis = "self-custody"; @@ -34,4 +36,198 @@ home = new Home { } }; }; + + // 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"; + }; + }; + } }; diff --git a/pkg/nebula/pages/grant.go b/pkg/nebula/pages/grant.go deleted file mode 100644 index 96beb6b6e..000000000 --- a/pkg/nebula/pages/grant.go +++ /dev/null @@ -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)) -} diff --git a/pkg/nebula/pages/home.go b/pkg/nebula/pages/home.go deleted file mode 100644 index fa112f367..000000000 --- a/pkg/nebula/pages/home.go +++ /dev/null @@ -1,16 +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.Home)) -} diff --git a/pkg/nebula/pages/login.go b/pkg/nebula/pages/login.go deleted file mode 100644 index 0541968d3..000000000 --- a/pkg/nebula/pages/login.go +++ /dev/null @@ -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)) -} diff --git a/pkg/nebula/pages/pages.go b/pkg/nebula/pages/pages.go new file mode 100644 index 000000000..a5826b630 --- /dev/null +++ b/pkg/nebula/pages/pages.go @@ -0,0 +1,36 @@ +package pages + +import ( + "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)) +} diff --git a/pkg/nebula/pages/profile.go b/pkg/nebula/pages/profile.go deleted file mode 100644 index af7cbdeaa..000000000 --- a/pkg/nebula/pages/profile.go +++ /dev/null @@ -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)) -} diff --git a/pkg/nebula/pages/register.go b/pkg/nebula/pages/register.go deleted file mode 100644 index 78b0e0a98..000000000 --- a/pkg/nebula/pages/register.go +++ /dev/null @@ -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)) -}