From 9c1aa2939e05a0a10e3f9e7f67169bb43b20761f Mon Sep 17 00:00:00 2001 From: James Tombleson Date: Sat, 13 Jul 2024 10:38:54 -0700 Subject: [PATCH] refactor --- internal/views/home/about.templ | 8 ++--- internal/views/home/index.templ | 45 ++++++++++++--------------- internal/views/sources/add.templ | 19 ++++++----- internal/views/sources/listAll.templ | 8 ++--- internal/views/users/login copy.templ | 4 +-- internal/views/users/logout.templ | 4 +-- internal/views/users/profile.templ | 7 +++-- internal/views/users/signup.templ | 4 +-- 8 files changed, 49 insertions(+), 50 deletions(-) diff --git a/internal/views/home/about.templ b/internal/views/home/about.templ index 306ee41..b580198 100644 --- a/internal/views/home/about.templ +++ b/internal/views/home/about.templ @@ -1,15 +1,15 @@ package home import "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout" +import "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma" templ About() { @layout.WithTemplate(){ -

About this project

- -
+ @bulma.Title("About this project") + @bulma.Block() { Newsbot started a small project to send out notifications to discord servers. I wanted to be able to keep the small communitiy aware of new posts about a game we all played. That feature still exists because I think that keeping a communitiy aware and engaged is important and not everyone follows the same news. -
+ } } } \ No newline at end of file diff --git a/internal/views/home/index.templ b/internal/views/home/index.templ index 8ecaa65..c614456 100644 --- a/internal/views/home/index.templ +++ b/internal/views/home/index.templ @@ -1,32 +1,27 @@ package home -import "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout" -import "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma" +import ( + b "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma" + bl "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/layout" + "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout" +) templ Index() { @layout.WithTemplate() { - @bulma.Hero("Welcome to Newsbot!", "Your new home for your news.") - -
-

- News bot is a self hostable solution to aggregating your news. - You can run `Newsbot` as an API or interact with it with this site. -

-
- - -
-

Why Newsbot

- I started to build this tool to help me avoid sitting on the big platform websites. - I wanted a tool that would work for me, not them. - - This tool started as a notification system that would let me redirect RSS posts over to Discord servers. - It still has those roots but now its starting to scale up to a full Aggregation platform. - -
-

- This project is a passion project of mine as I -

- + @bl.Hero("Welcome to Newsbot!", "Your new home for your news.") + @b.Block() { + News bot is a self hostable solution to aggregating your news. + You can run `Newsbot` as an API or interact with it with this site. + } + @b.H2("Why Newsbot", false) + @b.Block() { + I started to build this tool to help me avoid sitting on the big platform websites. + I wanted a tool that would work for me, not them. + This tool started as a notification system that would let me redirect RSS posts over to Discord servers. + It still has those roots but now its starting to scale up to a full Aggregation platform. + } + @b.Block() { + This project is a passion project of mine as I + } } } diff --git a/internal/views/sources/add.templ b/internal/views/sources/add.templ index 7a7d546..cf49057 100644 --- a/internal/views/sources/add.templ +++ b/internal/views/sources/add.templ @@ -2,25 +2,28 @@ package sources import ( "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma" - "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/form" + bf "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/form" + bl "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/layout" "git.jamestombleson.com/jtom38/newsbot-portal/internal/models" "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout" ) var ( - p = form.NewParam{ + p = bf.NewParam{ HxPost: "/sources/add", } ) templ Add(model models.AddSourcePayloadModel) { @layout.WithTemplate() { - @bulma.H2("New Source", false) -

At this time only direct RSS links are allowed to be provided.

- @form.New(p) { - @form.TextInput("", "name", form.InputTypeText, "Name of the site") - @form.TextInput("", "url", form.InputTypeText, "RSS URL") - @form.Submit("Submit", bulma.ColorPrimary) + @bl.Hero("New Source", "") + @bulma.Block() { + At this time only direct RSS links are allowed to be provided. + } + @bf.New(p) { + @bf.TextInput("name", bf.InputTypeText, "Name of the site") + @bf.TextInput("url", bf.InputTypeText, "RSS URL") + @bf.Submit("Submit", bulma.ColorPrimary) } } } diff --git a/internal/views/sources/listAll.templ b/internal/views/sources/listAll.templ index 2c3786e..24f0fbd 100644 --- a/internal/views/sources/listAll.templ +++ b/internal/views/sources/listAll.templ @@ -2,7 +2,7 @@ package sources import ( "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma" - templhtml "git.jamestombleson.com/jtom38/newsbot-portal/components/templ-html" + bh "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/html" "git.jamestombleson.com/jtom38/newsbot-portal/internal/models" "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout" ) @@ -10,10 +10,10 @@ import ( templ ListAll(model models.ListAllSourcesViewModel) { @layout.WithTemplate() { @bulma.Button() { - @templhtml.ALink("/sources/add", "New Source") + @bh.ALink("/sources/add", "New Source") } - @templhtml.Br() - @templhtml.Br() + @bh.Br() + @bh.Br() for _, item := range model.Items { @bulma.ButtonColor(bulma.ColorPrimary) { @bulma.ANewTab(item.Url, item.DisplayName) diff --git a/internal/views/users/login copy.templ b/internal/views/users/login copy.templ index 2f47cf2..6aca252 100644 --- a/internal/views/users/login copy.templ +++ b/internal/views/users/login copy.templ @@ -17,13 +17,13 @@ templ LoginNew() { @form.Field() { @form.Label("Username") @form.Control() { - @form.TextInput("", "username", "text", "email address") + @form.TextInput("username", "text", "email address") } } @form.Field() { @form.Label("Password") @form.Control() { - @form.TextInput("", "password", form.InputTypePassword, "") + @form.TextInput("password", form.InputTypePassword, "") } } @form.Submit("Submit", "is-primary") diff --git a/internal/views/users/logout.templ b/internal/views/users/logout.templ index 7f43639..a0a45ef 100644 --- a/internal/views/users/logout.templ +++ b/internal/views/users/logout.templ @@ -1,10 +1,10 @@ package users import "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout" -import "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma" +import bl "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/layout" templ Logout() { @layout.WithTemplate(){ - @bulma.Hero("You are out of here!", "Please login again when you are ready.") + @bl.Hero("You are out of here!", "Please login again when you are ready.") } } \ No newline at end of file diff --git a/internal/views/users/profile.templ b/internal/views/users/profile.templ index 7a0962c..fea8a29 100644 --- a/internal/views/users/profile.templ +++ b/internal/views/users/profile.templ @@ -2,17 +2,18 @@ package users import ( "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma" - templhtml "git.jamestombleson.com/jtom38/newsbot-portal/components/templ-html" + bh "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/html" + bl "git.jamestombleson.com/jtom38/newsbot-portal/components/bulma/layout" "git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout" ) templ Profile() { @layout.WithTemplate() { - @bulma.Hero("Profile", "Here you can update your profile 😀") + @bl.Hero("Profile", "Here you can update your profile 😀") @bulma.H2("Sessions", false) @bulma.Button() { - @templhtml.ALink("/users/forcelogout", "Terminate all active sessions") + @bh.ALink("/users/forcelogout", "Terminate all active sessions") } @bulma.Subitle("This will force you to login again as the application will give you a new session value.") } diff --git a/internal/views/users/signup.templ b/internal/views/users/signup.templ index ba46e98..f915538 100644 --- a/internal/views/users/signup.templ +++ b/internal/views/users/signup.templ @@ -11,13 +11,13 @@ templ SignUp() { @form.Field(){ @form.Label("Username") @form.Control() { - @form.TextInput("", "username", form.InputTypeText, "username or email address") + @form.TextInput("username", form.InputTypeText, "username or email address") } } @form.Field() { @form.Label("Password") @form.Control() { - @form.TextInput("", "password", form.InputTypePassword, "Nice strong password, like Ox!") + @form.TextInput("password", form.InputTypePassword, "Nice strong password, like Ox!") } } @form.Submit("Submit", "")