aboutsummaryrefslogtreecommitdiff
path: root/src/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/tubo/subs.cljs17
-rw-r--r--src/frontend/tubo/util.cljs18
2 files changed, 22 insertions, 13 deletions
diff --git a/src/frontend/tubo/subs.cljs b/src/frontend/tubo/subs.cljs
index b2f6ead..a4f84f2 100644
--- a/src/frontend/tubo/subs.cljs
+++ b/src/frontend/tubo/subs.cljs
@@ -1,7 +1,8 @@
(ns tubo.subs
(:require
[reagent.core :as r]
- [re-frame.core :as rf]))
+ [re-frame.core :as rf]
+ [tubo.util :as util]))
(defonce !is-window-visible
(let [a (r/atom true)]
@@ -100,24 +101,14 @@
(fn [_]
(rf/subscribe [:service-id]))
(fn [id _]
- (case id
- 0 "#cc0000"
- 1 "#ff7700"
- 2 "#333333"
- 3 "#F2690D"
- 4 "#629aa9")))
+ (util/get-service-color id)))
(rf/reg-sub
:service-name
(fn [_]
(rf/subscribe [:service-id]))
(fn [id _]
- (case id
- 0 "YouTube"
- 1 "SoundCloud"
- 2 "media.ccc.de"
- 3 "PeerTube"
- 4 "Bandcamp")))
+ (util/get-service-name id)))
(rf/reg-sub
:services
diff --git a/src/frontend/tubo/util.cljs b/src/frontend/tubo/util.cljs
index ea42ab6..7244106 100644
--- a/src/frontend/tubo/util.cljs
+++ b/src/frontend/tubo/util.cljs
@@ -2,6 +2,24 @@
(:require
["timeago.js" :as timeago]))
+(defn get-service-color
+ [id]
+ (case id
+ 0 "#cc0000"
+ 1 "#ff7700"
+ 2 "#333333"
+ 3 "#F2690D"
+ 4 "#629aa9"))
+
+(defn get-service-name
+ [id]
+ (case id
+ 0 "YouTube"
+ 1 "SoundCloud"
+ 2 "media.ccc.de"
+ 3 "PeerTube"
+ 4 "Bandcamp"))
+
(defn format-date-string
[date]
(-> date