fixed discovery tag navigation

This commit is contained in:
Adrian Tiberius 2016-05-12 23:46:17 +03:00
parent 1fd3f86e23
commit 897ee3dcd6
6 changed files with 77 additions and 77 deletions

View File

@ -61,7 +61,6 @@
:style {:width 16 :style {:width 16
:height 12}} :height 12}}
:handler create-fake-discovery} :handler create-fake-discovery}
:title "Add Participants"
:custom-content [title-content @showSearch] :custom-content [title-content @showSearch]
:action {:image {:source {:uri "icon_search"} :action {:image {:source {:uri "icon_search"}
:style {:width 17 :style {:width 17
@ -73,7 +72,7 @@
[scroll-view {:style {}} [scroll-view {:style {}}
[view {:style st/section-spacing} [view {:style st/section-spacing}
[text {:style st/discovery-subtitle} "Popular tags"]] [text {:style st/discovery-subtitle} "Popular tags"]]
[discovery-popular navigator] [discovery-popular]
[view {:style st/section-spacing} [view {:style st/section-spacing}
[text {:style st/discovery-subtitle} "Recent"]] [text {:style st/discovery-subtitle} "Recent"]]
[discovery-recent]] [discovery-recent]]

View File

@ -12,12 +12,12 @@
(defn page-width [] (defn page-width []
(.-width (.get (.. js/React -Dimensions) "window"))) (.-width (.get (.. js/React -Dimensions) "window")))
(defn discovery-popular [navigator] (defn discovery-popular []
(let [popular-tags (subscribe [:get-popular-tags 3])] (let [popular-tags (subscribe [:get-popular-tags 3])]
(log/debug "Got popular tags: " @popular-tags) (log/debug "Got popular tags: " @popular-tags)
(if (> (count @popular-tags) 0) (if (> (count @popular-tags) 0)
[carousel {:pageStyle st/carousel-page-style [carousel {:pageStyle st/carousel-page-style
:sneak 20} :sneak 20}
(for [tag @popular-tags] (for [tag @popular-tags]
(discovery-popular-list (.-name tag) (.-count tag) navigator))] (discovery-popular-list (.-name tag) (.-count tag)))]
[text "None"]))) [text "None"])))

View File

@ -26,12 +26,12 @@
:key rowID}])] :key rowID}])]
elem)) elem))
(defn discovery-popular-list [tag count navigator] (defn discovery-popular-list [tag count]
(let [discoveries (subscribe [:get-discoveries-by-tag tag 3])] (let [discoveries (subscribe [:get-discoveries-by-tag tag 3])]
[view {:style st/popular-list-container} [view {:style st/popular-list-container}
[view st/row [view st/row
[view st/tag-name-container [view st/tag-name-container
[touchable-highlight {:onPress #(dispatch [:show-discovery-tag tag navigator :push])} [touchable-highlight {:onPress #(dispatch [:show-discovery-tag tag])}
[text {:style st/tag-name} [text {:style st/tag-name}
(str " #" (name tag))]]] (str " #" (name tag))]]]
[view {:style st/tag-count-container} [view {:style st/tag-count-container}

View File

@ -19,8 +19,7 @@
(if row (if row
(let [elem (discovery-popular-list-item row)] (let [elem (discovery-popular-list-item row)]
elem) elem)
(r/as-element [text "null"]) (r/as-element [text "null"])))
))
(defn render-separator [sectionID, rowID, adjacentRowHighlighted] (defn render-separator [sectionID, rowID, adjacentRowHighlighted]
(let [elem (r/as-element [view {:style st/row-separator (let [elem (r/as-element [view {:style st/row-separator
@ -29,8 +28,9 @@
(defn title-content [tag] (defn title-content [tag]
[view {:style st/tag-title-container} [view {:style st/tag-title-container}
[text {:style st/tag-title} [view {:style st/tag-container}
(str " #" tag)]]) [text {:style st/tag-title}
(str " #" tag)]]])
(defn discovery-tag [{:keys [tag navigator]}] (defn discovery-tag [{:keys [tag navigator]}]
(let [tag (subscribe [:get-current-tag]) (let [tag (subscribe [:get-current-tag])
@ -39,21 +39,17 @@
(fn [] (fn []
(let [items @discoveries (let [items @discoveries
datasource (to-realm-datasource items)] datasource (to-realm-datasource items)]
[view {:style st/discovery-tag-container} [view {:style st/discovery-tag-container}
[toolbar {:navigator navigator [toolbar {:navigator navigator
:nav-action {:image {:source {:uri "icon_back"} :custom-content [title-content @tag]
:style st/icon-back} :action {:image {:source {:uri "icon_search"}
:handler (fn [] (nav-pop navigator))} :style st/icon-search}
:title "Add Participants" :handler (fn []
:content (title-content @tag) ())}}]
:action {:image {:source {:uri "icon_search"}
:style st/icon-search}
:handler (fn []
())}}]
[list-view {:dataSource datasource [list-view {:dataSource datasource
:enableEmptySections true :enableEmptySections true
:renderRow render-row :renderRow render-row
:renderSeparator render-separator :renderSeparator render-separator
:style st/recent-list}] :style st/recent-list}]
])))) ]))))

View File

@ -37,8 +37,8 @@
db))) db)))
(register-handler :show-discovery-tag (register-handler :show-discovery-tag
(fn [db [action tag navigator nav-type]] (fn [db [action tag]]
(log/debug action "setting current tag: " tag) (log/debug action "setting current tag: " tag)
(let [db (set-current-tag db tag)] (let [db (set-current-tag db tag)]
(dispatch [:navigate-to navigator {:view-id :discovery-tag} nav-type]) (dispatch [:navigate-to :discovery-tag])
db))) db)))

View File

@ -39,14 +39,14 @@
(def discovery-title (def discovery-title
{:color "#000000de" {:color "#000000de"
:alignSelf "center" :alignSelf "center"
:textAlign "center" :textAlign "center"
:fontFamily "sans-serif" :fontFamily "sans-serif"
:fontSize 16}) :fontSize 16})
(def discovery-toolbar (def discovery-toolbar
{:backgroundColor "#eef2f5" {:backgroundColor "#eef2f5"
:elevation 0}) :elevation 0})
(def discovery-subtitle (def discovery-subtitle
{:color "#8f838c93" {:color "#8f838c93"
@ -71,86 +71,86 @@
;; discovery_populat_list.cljs ;; discovery_populat_list.cljs
(def tag-name (def tag-name
{:color "#7099e6" {:color "#7099e6"
:fontFamily "sans-serif-medium" :fontFamily "sans-serif-medium"
:fontSize 14 :fontSize 14
:paddingRight 5 :paddingRight 5
:paddingBottom 2 :paddingBottom 2
:alignItems "center" :alignItems "center"
:justifyContent "center"}) :justifyContent "center"})
(def tag-name-container (def tag-name-container
{:flexDirection "column" {:flexDirection "column"
:backgroundColor "#eef2f5" :backgroundColor "#eef2f5"
:borderRadius 5 :borderRadius 5
:padding 4}) :padding 4})
(def tag-count (def tag-count
{:color "#838c93" {:color "#838c93"
:fontFamily "sans-serif" :fontFamily "sans-serif"
:fontSize 12 :fontSize 12
:paddingRight 5 :paddingRight 5
:paddingBottom 2 :paddingBottom 2
:alignItems "center" :alignItems "center"
:justifyContent "center"}) :justifyContent "center"})
(def tag-count-container (def tag-count-container
{:flex 0.2 {:flex 0.2
:flexDirection "column" :flexDirection "column"
:alignItems "flex-end" :alignItems "flex-end"
:paddingTop 10 :paddingTop 10
:paddingRight 9}) :paddingRight 9})
(def popular-list-container (def popular-list-container
{:flex 1 {:flex 1
:backgroundColor "white" :backgroundColor "white"
:paddingLeft 10 :paddingLeft 10
:paddingTop 16}) :paddingTop 16})
(def popular-list (def popular-list
{:backgroundColor "white" {:backgroundColor "white"
:paddingTop 13}) :paddingTop 13})
;; discover_popular_list_item.cjls ;; discover_popular_list_item.cjls
(def popular-list-item (def popular-list-item
{:flexDirection "row" {:flexDirection "row"
:paddingTop 10 :paddingTop 10
:paddingBottom 10}) :paddingBottom 10})
(def popular-list-item-status (def popular-list-item-status
{:color "black" {:color "black"
:fontFamily "sans-serif" :fontFamily "sans-serif"
:lineHeight 22 :lineHeight 22
:fontSize 14}) :fontSize 14})
(def popular-list-item-name (def popular-list-item-name
{:color "black" {:color "black"
:fontFamily "sans-serif-medium" :fontFamily "sans-serif-medium"
:fontSize 14 :fontSize 14
:lineHeight 24}) :lineHeight 24})
(def popular-list-item-name-container (def popular-list-item-name-container
{:flex 0.8 {:flex 0.8
:flexDirection "column"}) :flexDirection "column"})
(def popular-list-item-avatar-container (def popular-list-item-avatar-container
{:flex 0.2 {:flex 0.2
:flexDirection "column" :flexDirection "column"
:alignItems "center" :alignItems "center"
:paddingTop 5}) :paddingTop 5})
(def popular-list-item-avatar (def popular-list-item-avatar
{:resizeMode "contain" {:resizeMode "contain"
:borderRadius 150 :borderRadius 150
:width 40 :width 40
:height 40}) :height 40})
;; discovery_recent ;; discovery_recent
(def recent-list (def recent-list
{:backgroundColor "white" {:backgroundColor "white"
:paddingLeft 15}) :paddingLeft 15})
;; discovery_tag ;; discovery_tag
@ -158,22 +158,27 @@
{:flex 1 {:flex 1
:backgroundColor "#eef2f5"}) :backgroundColor "#eef2f5"})
(def tag-title-container
{:flex 1
:alignItems "center"
:justifyContent "center"})
(def tag-title (def tag-title
{:color "#7099e6" {:color "#7099e6"
:fontFamily "sans-serif-medium" :fontFamily "sans-serif-medium"
:fontSize 14 :fontSize 14
:paddingRight 5 :paddingRight 5
:paddingBottom 2}) :paddingBottom 2})
(def tag-title-container (def tag-container
{:backgroundColor "#eef2f5" {:backgroundColor "#eef2f5"
:flexWrap :wrap :flexWrap :wrap
:borderRadius 5 :borderRadius 5
:padding 4}) :padding 4})
(def icon-back (def icon-back
{:width 8 {:width 8
:height 14}) :height 14})
(def icon-search (def icon-search
{:width 17 {:width 17