mirror of
https://github.com/heyarne/airsonic-ui.git
synced 2026-05-07 02:33:39 +02:00
Merge incomplete podcast support
commit 4ac35d6530f7770e7b80307321c72541a55e2c8e
Author: Arne Schlüter <arne@schlueter.is>
Date: Mon Oct 8 21:09:04 2018 +0200
Stub out podcast detail view
commit 60742a22e93bfe6f432e06d56d3e4da671184559
Author: Arne Schlüter <arne@schlueter.is>
Date: Tue Sep 18 23:02:39 2018 +0200
Simplify api helpers; closes #16
commit 8bbc79ebf4dbbe3dbfa08cb4c7c1edd341d507eb
Author: Arne Schlüter <arne@schlueter.is>
Date: Tue Sep 18 19:39:17 2018 +0200
Adjust `stream-url` to work with podcast episodes
commit 991ba5b65230a7429c160ca1b7968ecbb8595e0b
Author: Arne Schlüter <arne@schlueter.is>
Date: Tue Sep 18 19:14:08 2018 +0200
Fix breadcrumbs for podcasts
commit 37c3a894eded2fe37f9af031d3132c7175702266
Author: Arne Schlüter <arne@schlueter.is>
Date: Tue Sep 18 15:11:54 2018 +0200
Stub out overview for podcasts
This commit is contained in:
parent
38eea1c8c9
commit
fa485bbf42
19 changed files with 350 additions and 133 deletions
83
src/cljs/airsonic_ui/components/podcast/views.cljs
Normal file
83
src/cljs/airsonic_ui/components/podcast/views.cljs
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
(ns airsonic-ui.components.podcast.views
|
||||
(:require [re-frame.core :refer [subscribe]]
|
||||
[airsonic-ui.helpers :refer [muted-dispatch]]
|
||||
[airsonic-ui.routes :as routes :refer [url-for]]
|
||||
[airsonic-ui.components.podcast.subs :as subs]
|
||||
[airsonic-ui.views.cover :refer [cover card]]
|
||||
[airsonic-ui.views.icon :refer [icon]]
|
||||
[airsonic-ui.components.debug.views :refer [debug]]))
|
||||
|
||||
;; TODO: Implement detail pages for podcasts
|
||||
;; TODO: Implement CRUD frontend for podcasts
|
||||
;; TODO: Error handling for channels and episodes
|
||||
|
||||
(defn channel-card
|
||||
"Displays the cover of a podcast and links to the podcasts detail page"
|
||||
[channel]
|
||||
[card channel
|
||||
:url-fn #(url-for ::routes/podcast.detail {:id (:id channel)})
|
||||
:content [:div.title.is-5
|
||||
[:a {:href (url-for ::routes/podcast.detail {:id (:id channel)})
|
||||
:title (:title channel)} (:title channel)]]])
|
||||
(defn- channel-overview [channels]
|
||||
[:div.columns.is-multiline.is-mobile
|
||||
(for [[idx channel] (map-indexed vector channels)]
|
||||
^{:key idx}
|
||||
[:div.column.is-one-fifth-desktop.is-one-quarter-tablet.is-half-mobile
|
||||
[channel-card channel]])])
|
||||
|
||||
(defn- episode-actions [episode]
|
||||
(case (:status episode)
|
||||
"completed"
|
||||
[[:td>a {:title "Play next"
|
||||
:href "#"
|
||||
:on-click (muted-dispatch [:audio-player/enqueue-next episode])}
|
||||
[icon :plus]]
|
||||
[:td>a {:title "Play last"
|
||||
:href "#"
|
||||
:on-click (muted-dispatch [:audio-player/enqueue-last episode])}
|
||||
[icon :caret-right]]]
|
||||
"skipped" ;; FIXME: Show download button
|
||||
[[:td] [:td]]))
|
||||
|
||||
(defn- episode-list [episodes]
|
||||
[:table.table.is-striped.is-hoverable.is-fullwidth>tbody
|
||||
(for [[idx episode] (map-indexed vector episodes)]
|
||||
^{:key idx}
|
||||
(into
|
||||
[:tr
|
||||
[:td.grow [:span
|
||||
[:a {:href (url-for ::routes/podcast.detail {:id (:channelId episode)})}
|
||||
(:artist episode)]
|
||||
" - "
|
||||
[:a {:title (:title episode)
|
||||
:href "#"
|
||||
:on-click (muted-dispatch [:audio-player/play-all episodes idx])}
|
||||
(:title episode)]]]]
|
||||
(episode-actions episode)))])
|
||||
|
||||
(defn detail
|
||||
"Detail page for a single channel"
|
||||
[_]
|
||||
;; NOTE: This isn't especially pretty, but it works. The detail page can only
|
||||
;; ever be displayed for the podcast the current route points to
|
||||
(let [channel @(subscribe [::subs/podcast.detail-from-route])]
|
||||
[:div
|
||||
[:section.section>div.hero-body
|
||||
[:div.container>article.media
|
||||
[:div.media-left [cover channel 128]]
|
||||
[:div.media-content
|
||||
[:h2.title (:title channel)]
|
||||
[:p (:description channel)]]]]
|
||||
[:section.section>div.container [episode-list (:episode channel)]]]))
|
||||
|
||||
(defn overview
|
||||
"All channels and most recently published shows"
|
||||
[_]
|
||||
(let [channels @(subscribe [::subs/podcast.channels])
|
||||
episodes @(subscribe [::subs/podcast.all-episodes-by :created])]
|
||||
[:section.section>div.container
|
||||
[:h1.title "Subscriptions"]
|
||||
[channel-overview channels]
|
||||
[:h1.title "Latest Episodes"]
|
||||
[episode-list episodes]]))
|
||||
Loading…
Add table
Add a link
Reference in a new issue