diff --git a/src/modules/album/album.go b/src/modules/album/album.go
index 99c0f73..fade5d1 100644
--- a/src/modules/album/album.go
+++ b/src/modules/album/album.go
@@ -15,6 +15,7 @@ type ClientSong struct {
Title string `json:"title"`
Artist string `json:"artist"`
AlbumId string `json:"albumId"`
+ Album string `json:"album"`
SongId string `json:"songId"`
}
@@ -30,21 +31,10 @@ func allAlbumsPage(c echo.Context) error {
// if there's a search query, do that
searchQuery := c.QueryParam("s")
isHtmxRequest := c.Request().Header.Get("HX-Request") == "true"
-
- // get the first 10 albums
token, server := utils.Credentials(c)
- var (
- albums []utils.Album
- err error
- )
- if searchQuery != "" {
- // search for the requested albums
- albums, err = searchAlbums(token, searchQuery, server, 0, 20)
- } else {
- // get 10 random albums
- albums, err = loadAlbums(token, server, 0, 30)
- }
+ // if searchQuery is empty, this will get the first 30 albums
+ albums, err := searchAlbums(token, searchQuery, server, 0, 30)
if err != nil {
return err
@@ -105,6 +95,7 @@ func albumPage(c echo.Context) error {
Title: song.Title,
Artist: song.Artist,
AlbumId: album.ID,
+ Album: album.Name,
SongId: song.ID,
}
}
diff --git a/src/modules/album/album.service.go b/src/modules/album/album.service.go
index 1a0f9ea..040645e 100644
--- a/src/modules/album/album.service.go
+++ b/src/modules/album/album.service.go
@@ -33,28 +33,6 @@ func searchAlbums(token, query, server string, start, end int) ([]utils.Album, e
return albums, nil
}
-func loadAlbums(token, server string, start, end int) ([]utils.Album, error) {
- var albums []utils.Album
- var error utils.NavError
-
- client := resty.New()
- response, err := client.R().
- SetHeader("x-nd-authorization", fmt.Sprintf("Bearer %s", token)).
- SetResult(&albums).
- SetError(&error).
- Get(fmt.Sprintf("%s/api/album?_start=%d&_end=%d&_sort=name&_order=ASC", server, start, end))
-
- if err != nil {
- return nil, err
- }
-
- if !response.IsSuccess() {
- return nil, errors.New(error.Error)
- }
-
- return albums, nil
-}
-
func loadAlbum(token, server, albumId string) (*utils.Album, error) {
var album utils.Album
var error utils.NavError
diff --git a/src/utils/utils.templ b/src/utils/utils.templ
index 727ea32..eadfa55 100644
--- a/src/utils/utils.templ
+++ b/src/utils/utils.templ
@@ -33,10 +33,16 @@ templ MusicPlayer() {
class="fixed bottom-0 left-0 w-screen border-t border-sky-500 grid grid-cols-[3rem_auto_3rem_3rem] gap-2 p-1 bg-white"
x-data="player"
>
-
+
-
+
@skipForwardIcon(24)
+ @fullMusicPlayer()
")
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = fullMusicPlayer().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
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func fullMusicPlayer() templ.Component {
+ return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+ return templ_7745c5c3_CtxErr
+ }
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Var3 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var3 == nil {
+ templ_7745c5c3_Var3 = templ.NopComponent
+ }
+ ctx = templ.ClearChildren(ctx)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -116,21 +169,21 @@ func playIcon(size int) templ.Component {
}()
}
ctx = templ.InitializeContext(ctx)
- templ_7745c5c3_Var3 := templ.GetChildren(ctx)
- if templ_7745c5c3_Var3 == nil {
- templ_7745c5c3_Var3 = templ.NopComponent
+ templ_7745c5c3_Var4 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var4 == nil {
+ templ_7745c5c3_Var4 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func caretDoubleDownIcon(size int) templ.Component {
+ return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+ return templ_7745c5c3_CtxErr
+ }
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Var19 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var19 == nil {
+ templ_7745c5c3_Var19 = templ.NopComponent
+ }
+ ctx = templ.ClearChildren(ctx)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
var _ = templruntime.GeneratedTemplate