diff --git a/src/cljs/airsonic_ui/subs.cljs b/src/cljs/airsonic_ui/subs.cljs index a83f1f0..1aca53d 100644 --- a/src/cljs/airsonic_ui/subs.cljs +++ b/src/cljs/airsonic_ui/subs.cljs @@ -9,6 +9,11 @@ (fn [db] (select-keys (:credentials db) [:u :p]))) +(re-frame/reg-sub + ::user + (fn [{:keys [credentials]}] + {:name (:u credentials)})) + (re-frame/reg-sub ::server (fn [db] diff --git a/src/cljs/airsonic_ui/views.cljs b/src/cljs/airsonic_ui/views.cljs index fef34f4..12dbd30 100644 --- a/src/cljs/airsonic_ui/views.cljs +++ b/src/cljs/airsonic_ui/views.cljs @@ -28,21 +28,29 @@ [:h2.title "Recently played"] [album/listing (:album content)]]) +(defn sidebar [user] + [:aside.menu.section + [:p.menu-label (str "User: " (:name user))] + [:ul.menu-list + [:li [:a "Settings"]] + [:li [:a {:on-click #(dispatch [::events/initialize-db]) :href "#"} "Logout"]]]]) + ;; putting everything together (defn app [route params query] - (let [login @(subscribe [::subs/login]) + (let [user @(subscribe [::subs/user]) content @(subscribe [::subs/current-content])] [:div - [:section.section>div.container - [:div.level - [:div.level-left [:span (str "Currently logged in as " (:u login))]] - [:div.level-right [:a {:on-click #(dispatch [::events/initialize-db]) :href "#"} "Logout"]]] - [breadcrumbs content] - (case route - ::routes/main [most-recent content] - ::routes/artist-view [artist-detail content] - ::routes/album-view [album-detail content])] + [:div.columns + [:div.column.is-2.sidebar + [sidebar]] + [:div.column + [:section.section + [breadcrumbs content] + (case route + ::routes/main [most-recent content] + ::routes/artist-view [artist-detail content] + ::routes/album-view [album-detail content])]]] [bottom-bar]])) (defn main-panel [] diff --git a/src/cljs/airsonic_ui/views/bottom_bar.cljs b/src/cljs/airsonic_ui/views/bottom_bar.cljs index e26a619..facab81 100644 --- a/src/cljs/airsonic_ui/views/bottom_bar.cljs +++ b/src/cljs/airsonic_ui/views/bottom_bar.cljs @@ -21,11 +21,11 @@ [:p.control>button.button.is-light {:on-click #(dispatch [event])} label]) buttons))]) -(def logo-url "https://airsonic.github.io/airsonic-ui/assets/images/logo/airsonic-dark-350x100.png") + (def logo-url "https://airsonic.github.io/airsonic-ui/assets/images/logo/airsonic-light-350x100.png") (defn bottom-bar [] (let [currently-playing @(subscribe [::subs/currently-playing])] - [:nav.navbar.is-fixed-bottom + [:nav.navbar.is-fixed-bottom.playback-area [:div.navbar-brand [:div.navbar-item [:img {:src logo-url}]]] @@ -38,4 +38,4 @@ [:div.media-content [current-song-info currently-playing]]] [:div.level-right [playback-controls]]] ;; not playing anything - [:span "Currently no song selected"])]])) + [:p.idle-notification "Currently no song selected"])]])) diff --git a/src/sass/app.sass b/src/sass/app.sass index b9bbd35..9b4e964 100644 --- a/src/sass/app.sass +++ b/src/sass/app.sass @@ -1,5 +1,19 @@ @import "../../node_modules/bulma/bulma" +// navi on the left side +.sidebar + background: $dark + a + color: $light + +// bottom bar +.playback-area + background: $dark + color: $light + + .navbar-menu + align-items: center + .progress.is-tiny height: 0.25rem