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

View File

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

View File

@ -26,12 +26,12 @@
:key rowID}])]
elem))
(defn discovery-popular-list [tag count navigator]
(defn discovery-popular-list [tag count]
(let [discoveries (subscribe [:get-discoveries-by-tag tag 3])]
[view {:style st/popular-list-container}
[view st/row
[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}
(str " #" (name tag))]]]
[view {:style st/tag-count-container}

View File

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

View File

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

View File

@ -158,6 +158,11 @@
{:flex 1
:backgroundColor "#eef2f5"})
(def tag-title-container
{:flex 1
:alignItems "center"
:justifyContent "center"})
(def tag-title
{:color "#7099e6"
:fontFamily "sans-serif-medium"
@ -165,7 +170,7 @@
:paddingRight 5
:paddingBottom 2})
(def tag-title-container
(def tag-container
{:backgroundColor "#eef2f5"
:flexWrap :wrap
:borderRadius 5