better view

This commit is contained in:
Yann Esposito (Yogsototh) 2015-08-29 10:11:57 +02:00
parent 599c214ec4
commit 258d82025d
2 changed files with 25 additions and 16 deletions

View file

@ -23,17 +23,18 @@
"display user screen name as message header section"
(if (:reshared message)
[:div {:style {:text-decoration "underline"
:font-weight "bold"}}
:font-weight "bold"
:margin 0
:padding 0}}
;;double display with original author if RT
[:div {:class "retweeted_holder"}
[:p {:style {:cursor "pointer"}
:on-click #(open (str "http://www.twitter.com/" (:user-screen_name message)))
:class "user_name"}
[:i {:class "fa fa-retweet retweeted-icon"}]
[account-username (str " " (:user-name message) " ")]]]
[:span {:style {:cursor "pointer"}
:on-click #(open (str "http://www.twitter.com/" (:user-screen_name message)))
:class "user_name"}
[:i {:class "fa fa-retweet retweeted-icon"}]
[account-username (str " " (:user-name message) " ")]]
[:div {:class "username_holder "}
[:p {:style {:cursor "pointer"}
[:span {:style {:cursor "pointer"}
:on-click #(open
(str "http://www.twitter.com/"
(get-in message [:retweeted_status
@ -144,16 +145,16 @@
:class "text"}
original-text]))
(defn message [message & params]
(defn message [message height & params]
"Message component"
(when message
[:div {:style {:height "120px"
[:div {:style {:height (str height "vh")
:width "100%"
:background "rgba(255,255,255,0.8)"
:color "rgba(0,0,0,0.5)"
:font-size "0.5em"
:overflow "hidden"
:border "solid 1px rgba(0,0,0,0.3)"
:background "rgba(0,0,0,0.1)"
:margin "0.5%"
}}
[user-pic {:message message}]
[user-name message params]

View file

@ -94,12 +94,16 @@
tweets (:messages state)
max-sec (reduce max 0 (map :pub_date_epoch_ms tweets))
tweets-by-sec (clojure.set/index (set tweets) [:pub_date_epoch_ms])
max-nb (reduce #(max %1 (count %2)) 0 (vals tweets-by-sec))
vh-height (/ 40 max-nb)
tw-width (* 5 vh-height)
]
[:div {:style {:text-align "left"
:line-height "2em"
; :opacity (rx @ease)
:position "relative"
:overflow "hidden"
:height "50vh"
:border "solid 1px red"
:font-family "Futura, sans-serif"}
:node/on-attached (fn [node callback]
(animation/start-easing! ease 1.0 0.0 20000 animation/linear callback))
@ -108,12 +112,16 @@
(let [nb (/ (- max-sec (:pub_date_epoch_ms tweet-sec)) 1000)]
[:div {:style {:position "absolute"
:bottom "0"
:left (rx (str (* (- (* 10 @ease) nb) 23) "%"))
:width "22%"
:left (rx (str (* (- (* 10 @ease) nb) tw-width) "vh"))
:width (str tw-width "vh")
}
}
(for [tweet (get tweets-by-sec tweet-sec)]
[message tweet])]))])))
[message tweet vh-height ])
[:div {:style {:font-size ".5em"}} (clojure.string/replace (.toISOString (js/Date. (:pub_date_epoch_ms tweet-sec)))
#".*T" "")]
]))])))
(defn view-volume [state]
[:div