From e7b47adf3af05ba03d2b6a2bba514503e0d49d68 Mon Sep 17 00:00:00 2001 From: Araozu Date: Sun, 8 Dec 2024 19:05:40 -0500 Subject: [PATCH] feat: add minimal artist page --- src/modules/artist/artist.go | 31 +++++++++++++++++++++++++++++++ src/modules/artist/artist.templ | 11 +++++++++++ src/routes.go | 2 ++ 3 files changed, 44 insertions(+) create mode 100644 src/modules/artist/artist.go create mode 100644 src/modules/artist/artist.templ diff --git a/src/modules/artist/artist.go b/src/modules/artist/artist.go new file mode 100644 index 0000000..bbdcdb6 --- /dev/null +++ b/src/modules/artist/artist.go @@ -0,0 +1,31 @@ +package artist + +import ( + "acide/src/utils" + "log" + "net/http" + + "github.com/labstack/echo" +) + +func Setup(g *echo.Group) { + log.Print("Setting up the artist module") + g.Use(utils.Authed) + + // g.GET("/", allArtistPage) + g.GET("/:id", artistPage) +} + +func artistPage(c echo.Context) error { + // token, server := utils.Credentials(c) + isHtmxRequest := c.Request().Header.Get("HX-Request") == "true" + // artistId := c.Param("id") + + // load artist info + + if isHtmxRequest { + return utils.RenderTempl(c, http.StatusOK, artistTempl()) + } else { + return utils.RenderTempl(c, http.StatusOK, artistTempl()) + } +} diff --git a/src/modules/artist/artist.templ b/src/modules/artist/artist.templ new file mode 100644 index 0000000..ebfd041 --- /dev/null +++ b/src/modules/artist/artist.templ @@ -0,0 +1,11 @@ +package artist + +import "acide/src/utils" + +templ artistTempl() { + @utils.SkeletonTempl() { +
+ Artist page :D +
+ } +} diff --git a/src/routes.go b/src/routes.go index ac12db8..485213e 100644 --- a/src/routes.go +++ b/src/routes.go @@ -2,6 +2,7 @@ package src import ( "acide/src/modules/album" + "acide/src/modules/artist" "acide/src/modules/auth" "acide/src/modules/covers" "acide/src/modules/index" @@ -31,6 +32,7 @@ func (s *Server) RegisterRoutes() http.Handler { auth.SetupRoutes(e.Group("/auth")) covers.Setup(e.Group("/covers")) album.Setup(e.Group("/album")) + artist.Setup(e.Group("/artist")) return e }