1
0
Fork 0
mirror of https://github.com/heyarne/airsonic-ui.git synced 2026-05-07 10:43:39 +02:00

Add tabs for newest and starred tracks

This commit is contained in:
Arne Schlüter 2018-08-28 18:12:11 +02:00
commit 2545ff3579
5 changed files with 40 additions and 20 deletions

View file

@ -0,0 +1,21 @@
(ns airsonic-ui.components.library.views
(:require [airsonic-ui.routes :as routes :refer [url-for]]
[airsonic-ui.views.album :as album]))
(defn tabs [items active-item]
[:div.tabs
[:ul (for [[idx [route label]] (map-indexed vector items)]
(do
(println route label active-item)
^{:key idx} [:li (when (= route active-item)
{:class-name "is-active"})
[:a {:href (apply url-for route)} label]]))]])
(defn main [route {:keys [album-list]}]
[:div
[:h2.title "Your library"]
(let [items [[[::routes/library {:criteria "recent"} nil] "Recently played"]
[[::routes/library {:criteria "newest"} nil] "Newest additions"]
[[::routes/library {:criteria "starred"} nil] "Starred"]]]
[tabs items route])
[album/listing (:album album-list)]])