mirror of
https://github.com/eduardolat/pgbackweb.git
synced 2026-01-25 05:58:29 -06:00
Add about page to dashboard router
This commit is contained in:
75
internal/view/web/dashboard/about/index.go
Normal file
75
internal/view/web/dashboard/about/index.go
Normal file
@@ -0,0 +1,75 @@
|
||||
package about
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/eduardolat/pgbackweb/internal/util/echoutil"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/layout"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/maragudk/gomponents"
|
||||
"github.com/maragudk/gomponents/html"
|
||||
)
|
||||
|
||||
func (h *handlers) indexPageHandler(c echo.Context) error {
|
||||
return echoutil.RenderGomponent(c, http.StatusOK, indexPage())
|
||||
}
|
||||
|
||||
func indexPage() gomponents.Node {
|
||||
content := []gomponents.Node{
|
||||
component.H1Text("About PG Back Web"),
|
||||
html.Div(
|
||||
html.Class("max-w-[600px] mt-1"),
|
||||
component.PText(`
|
||||
PG Back Web was born in July 2024 out of a need for a simple and
|
||||
user-friendly backup solution for self-hosted PostgreSQL databases.
|
||||
After searching extensively for an easy-to-use backup tool and not
|
||||
finding one, I decided to create my own. Its mission is to provide a
|
||||
straightforward web interface that makes managing PostgreSQL backups
|
||||
effortless and efficient.
|
||||
`),
|
||||
|
||||
html.Table(
|
||||
html.Class("table border mt-4"),
|
||||
html.Tr(
|
||||
html.Td(component.SpanText("License")),
|
||||
html.Td(
|
||||
html.A(
|
||||
html.Class("link"),
|
||||
html.Href("https://github.com/eduardolat/pgbackweb/blob/main/LICENSE"),
|
||||
html.Target("_blank"),
|
||||
component.SpanText("MIT"),
|
||||
),
|
||||
),
|
||||
),
|
||||
html.Tr(
|
||||
html.Td(component.SpanText("About the author")),
|
||||
html.Td(
|
||||
html.A(
|
||||
html.Class("link"),
|
||||
html.Href("https://eduardo.lat"),
|
||||
html.Target("_blank"),
|
||||
component.SpanText("https://eduardo.lat"),
|
||||
),
|
||||
),
|
||||
),
|
||||
html.Tr(
|
||||
html.Td(component.SpanText("Repository")),
|
||||
html.Td(
|
||||
html.A(
|
||||
html.Class("link"),
|
||||
html.Href("https://github.com/eduardolat/pgbackweb"),
|
||||
html.Target("_blank"),
|
||||
component.SpanText("https://github.com/eduardolat/pgbackweb"),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
}
|
||||
|
||||
return layout.Dashboard(layout.DashboardParams{
|
||||
Title: "About",
|
||||
Body: content,
|
||||
})
|
||||
}
|
||||
23
internal/view/web/dashboard/about/router.go
Normal file
23
internal/view/web/dashboard/about/router.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package about
|
||||
|
||||
import (
|
||||
"github.com/eduardolat/pgbackweb/internal/service"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/middleware"
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
type handlers struct {
|
||||
servs *service.Service
|
||||
}
|
||||
|
||||
func newHandlers(servs *service.Service) *handlers {
|
||||
return &handlers{servs: servs}
|
||||
}
|
||||
|
||||
func MountRouter(
|
||||
parent *echo.Group, mids *middleware.Middleware, servs *service.Service,
|
||||
) {
|
||||
h := newHandlers(servs)
|
||||
|
||||
parent.GET("", h.indexPageHandler)
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package dashboard
|
||||
import (
|
||||
"github.com/eduardolat/pgbackweb/internal/service"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/middleware"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/dashboard/about"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/dashboard/databases"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/dashboard/profile"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/dashboard/summary"
|
||||
@@ -15,4 +16,5 @@ func MountRouter(
|
||||
summary.MountRouter(parent.Group(""), mids, servs)
|
||||
databases.MountRouter(parent.Group("/databases"), mids, servs)
|
||||
profile.MountRouter(parent.Group("/profile"), mids, servs)
|
||||
about.MountRouter(parent.Group("/about"), mids, servs)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user