diff --git a/bin/aio b/bin/aio index 161fef0..5ee443f 100755 Binary files a/bin/aio and b/bin/aio differ diff --git a/services/serve/serve.go b/services/serve/serve.go index 345c1c4..46cfc0a 100644 --- a/services/serve/serve.go +++ b/services/serve/serve.go @@ -2,7 +2,7 @@ package serve import ( templEngine "github.com/davesavic/aio/services/templ" - view "github.com/davesavic/aio/view" + "github.com/davesavic/aio/view" "github.com/gin-gonic/gin" "net/http" ) @@ -13,8 +13,8 @@ func Run() error { r.Use(gin.Recovery()) r.Use(gin.Logger()) - r.GET("/", func(c *gin.Context) { - c.HTML(http.StatusOK, "landing", view.LandingPage()) + r.GET("/", func(ctx *gin.Context) { + ctx.HTML(http.StatusOK, "index", view.AuthorisedLayout()) }) return r.Run() diff --git a/view/button.templ b/view/button.templ deleted file mode 100644 index cd635a1..0000000 --- a/view/button.templ +++ /dev/null @@ -1,7 +0,0 @@ -package view - -templ Button(text string, action func() string) { - - {text} - -} \ No newline at end of file diff --git a/view/button_templ.go b/view/button_templ.go deleted file mode 100644 index 9d32c83..0000000 --- a/view/button_templ.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: 0.2.476 -package view - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import "context" -import "io" -import "bytes" - -func Button(text string, action func() string) templ.Component { - return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) - if !templ_7745c5c3_IsBuffer { - templ_7745c5c3_Buffer = templ.GetBuffer() - defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var3 string = text - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if !templ_7745c5c3_IsBuffer { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) - } - return templ_7745c5c3_Err - }) -} diff --git a/view/landing.templ b/view/landing.templ deleted file mode 100644 index b5d8e6f..0000000 --- a/view/landing.templ +++ /dev/null @@ -1,7 +0,0 @@ -package view - -templ LandingPage() { - @UnauthorisedLayout("Landing page") { - @UnauthorisedHeader() - } -} \ No newline at end of file diff --git a/view/landing_templ.go b/view/landing_templ.go deleted file mode 100644 index 24c7b3d..0000000 --- a/view/landing_templ.go +++ /dev/null @@ -1,50 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: 0.2.476 -package view - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import "context" -import "io" -import "bytes" - -func LandingPage() templ.Component { - return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) - if !templ_7745c5c3_IsBuffer { - templ_7745c5c3_Buffer = templ.GetBuffer() - defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) - } - 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_Var2 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) - if !templ_7745c5c3_IsBuffer { - templ_7745c5c3_Buffer = templ.GetBuffer() - defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) - } - templ_7745c5c3_Err = UnauthorisedHeader().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if !templ_7745c5c3_IsBuffer { - _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer) - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = UnauthorisedLayout("Landing page").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if !templ_7745c5c3_IsBuffer { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) - } - return templ_7745c5c3_Err - }) -} diff --git a/view/layout.templ b/view/layout.templ new file mode 100644 index 0000000..5fc184a --- /dev/null +++ b/view/layout.templ @@ -0,0 +1,157 @@ +package view + +templ AuthorisedLayout() { + + + + + + + + + +
+ + +
+
+
+

Dashboard

+
+
+
+
+ +
+
+
+
+ + +} \ No newline at end of file diff --git a/view/layout_templ.go b/view/layout_templ.go new file mode 100644 index 0000000..0aa6dc0 --- /dev/null +++ b/view/layout_templ.go @@ -0,0 +1,355 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: 0.2.476 +package view + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import "context" +import "io" +import "bytes" + +func AuthorisedLayout() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Var32 := `Dashboard` + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var32) + 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 + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} diff --git a/view/layout_unauthorised.templ b/view/layout_unauthorised.templ deleted file mode 100644 index 2fb2e8b..0000000 --- a/view/layout_unauthorised.templ +++ /dev/null @@ -1,16 +0,0 @@ -package view - -templ UnauthorisedLayout(title string) { - - - - - - - {title} - - - { children... } - - -} \ No newline at end of file diff --git a/view/layout_unauthorised_templ.go b/view/layout_unauthorised_templ.go deleted file mode 100644 index f324d0a..0000000 --- a/view/layout_unauthorised_templ.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: 0.2.476 -package view - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import "context" -import "io" -import "bytes" - -func UnauthorisedLayout(title string) templ.Component { - return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) - if !templ_7745c5c3_IsBuffer { - templ_7745c5c3_Buffer = templ.GetBuffer() - defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var4 string = title - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if !templ_7745c5c3_IsBuffer { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) - } - return templ_7745c5c3_Err - }) -} diff --git a/view/link.templ b/view/link.templ deleted file mode 100644 index da48f26..0000000 --- a/view/link.templ +++ /dev/null @@ -1,14 +0,0 @@ -package view - -type LinkVariant string - -const ( - LinkVariantPrimary LinkVariant = "primary" - LinkVariantSecondary LinkVariant = "secondary" -) - -templ Link(href string, text string, variant LinkVariant) { - - {text} - -} \ No newline at end of file diff --git a/view/link_templ.go b/view/link_templ.go deleted file mode 100644 index 723c854..0000000 --- a/view/link_templ.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: 0.2.476 -package view - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import "context" -import "io" -import "bytes" - -type LinkVariant string - -const ( - LinkVariantPrimary LinkVariant = "primary" - LinkVariantSecondary LinkVariant = "secondary" -) - -func Link(href string, text string, variant LinkVariant) templ.Component { - return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) - if !templ_7745c5c3_IsBuffer { - templ_7745c5c3_Buffer = templ.GetBuffer() - defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var3 string = text - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if !templ_7745c5c3_IsBuffer { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) - } - return templ_7745c5c3_Err - }) -} diff --git a/view/unauthorised_header.templ b/view/unauthorised_header.templ deleted file mode 100644 index 7eb4f47..0000000 --- a/view/unauthorised_header.templ +++ /dev/null @@ -1,65 +0,0 @@ -package view - -templ UnauthorisedHeader() { -
- - - -
-} \ No newline at end of file diff --git a/view/unauthorised_header_templ.go b/view/unauthorised_header_templ.go deleted file mode 100644 index 1e4bb5c..0000000 --- a/view/unauthorised_header_templ.go +++ /dev/null @@ -1,196 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: 0.2.476 -package view - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import "context" -import "io" -import "bytes" - -func UnauthorisedHeader() templ.Component { - return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) - if !templ_7745c5c3_IsBuffer { - templ_7745c5c3_Buffer = templ.GetBuffer() - defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if !templ_7745c5c3_IsBuffer { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) - } - return templ_7745c5c3_Err - }) -}