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}
[view {:style st/tag-container}
[text {:style st/tag-title} [text {:style st/tag-title}
(str " #" tag)]]) (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])
@ -41,11 +41,7 @@
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}
:handler (fn [] (nav-pop navigator))}
:title "Add Participants"
:content (title-content @tag)
:action {:image {:source {:uri "icon_search"} :action {:image {:source {:uri "icon_search"}
:style st/icon-search} :style st/icon-search}
:handler (fn [] :handler (fn []

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

@ -158,6 +158,11 @@
{: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"
@ -165,7 +170,7 @@
: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