From 897ee3dcd672dd64c339155e2c009b5767a0b474 Mon Sep 17 00:00:00 2001 From: Adrian Tiberius Date: Thu, 12 May 2016 23:46:17 +0300 Subject: [PATCH] fixed discovery tag navigation --- .../components/discovery/discovery.cljs | 3 +- .../discovery/discovery_popular.cljs | 4 +- .../discovery/discovery_popular_list.cljs | 4 +- .../components/discovery/discovery_tag.cljs | 38 +++---- .../components/discovery/handlers.cljs | 4 +- src/syng_im/components/discovery/styles.cljs | 101 +++++++++--------- 6 files changed, 77 insertions(+), 77 deletions(-) diff --git a/src/syng_im/components/discovery/discovery.cljs b/src/syng_im/components/discovery/discovery.cljs index 8d6ea4ad4d..3cc2e65373 100644 --- a/src/syng_im/components/discovery/discovery.cljs +++ b/src/syng_im/components/discovery/discovery.cljs @@ -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]] diff --git a/src/syng_im/components/discovery/discovery_popular.cljs b/src/syng_im/components/discovery/discovery_popular.cljs index df33467899..a829a7ae12 100644 --- a/src/syng_im/components/discovery/discovery_popular.cljs +++ b/src/syng_im/components/discovery/discovery_popular.cljs @@ -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"]))) \ No newline at end of file diff --git a/src/syng_im/components/discovery/discovery_popular_list.cljs b/src/syng_im/components/discovery/discovery_popular_list.cljs index 0291a1bb82..428e647d8f 100644 --- a/src/syng_im/components/discovery/discovery_popular_list.cljs +++ b/src/syng_im/components/discovery/discovery_popular_list.cljs @@ -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} diff --git a/src/syng_im/components/discovery/discovery_tag.cljs b/src/syng_im/components/discovery/discovery_tag.cljs index f8a7fa88a8..cf6d76ffa7 100644 --- a/src/syng_im/components/discovery/discovery_tag.cljs +++ b/src/syng_im/components/discovery/discovery_tag.cljs @@ -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} - [text {:style st/tag-title} - (str " #" tag)]]) + [view {:style st/tag-container} + [text {:style st/tag-title} + (str " #" tag)]]]) (defn discovery-tag [{:keys [tag navigator]}] (let [tag (subscribe [:get-current-tag]) @@ -39,21 +39,17 @@ (fn [] (let [items @discoveries 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) - :action {:image {:source {:uri "icon_search"} - :style st/icon-search} - :handler (fn [] - ())}}] + [view {:style st/discovery-tag-container} + [toolbar {:navigator navigator + :custom-content [title-content @tag] + :action {:image {:source {:uri "icon_search"} + :style st/icon-search} + :handler (fn [] + ())}}] - [list-view {:dataSource datasource - :enableEmptySections true - :renderRow render-row - :renderSeparator render-separator - :style st/recent-list}] - ])))) \ No newline at end of file + [list-view {:dataSource datasource + :enableEmptySections true + :renderRow render-row + :renderSeparator render-separator + :style st/recent-list}] + ])))) \ No newline at end of file diff --git a/src/syng_im/components/discovery/handlers.cljs b/src/syng_im/components/discovery/handlers.cljs index 44d24c99d9..0139316849 100644 --- a/src/syng_im/components/discovery/handlers.cljs +++ b/src/syng_im/components/discovery/handlers.cljs @@ -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))) \ No newline at end of file diff --git a/src/syng_im/components/discovery/styles.cljs b/src/syng_im/components/discovery/styles.cljs index 0044f86c94..465d3a25ba 100644 --- a/src/syng_im/components/discovery/styles.cljs +++ b/src/syng_im/components/discovery/styles.cljs @@ -39,14 +39,14 @@ (def discovery-title {:color "#000000de" - :alignSelf "center" + :alignSelf "center" :textAlign "center" :fontFamily "sans-serif" :fontSize 16}) (def discovery-toolbar {:backgroundColor "#eef2f5" - :elevation 0}) + :elevation 0}) (def discovery-subtitle {:color "#8f838c93" @@ -71,86 +71,86 @@ ;; discovery_populat_list.cljs (def tag-name - {:color "#7099e6" - :fontFamily "sans-serif-medium" - :fontSize 14 - :paddingRight 5 - :paddingBottom 2 - :alignItems "center" + {:color "#7099e6" + :fontFamily "sans-serif-medium" + :fontSize 14 + :paddingRight 5 + :paddingBottom 2 + :alignItems "center" :justifyContent "center"}) (def tag-name-container - {:flexDirection "column" + {:flexDirection "column" :backgroundColor "#eef2f5" - :borderRadius 5 - :padding 4}) + :borderRadius 5 + :padding 4}) (def tag-count - {:color "#838c93" - :fontFamily "sans-serif" - :fontSize 12 - :paddingRight 5 - :paddingBottom 2 - :alignItems "center" + {:color "#838c93" + :fontFamily "sans-serif" + :fontSize 12 + :paddingRight 5 + :paddingBottom 2 + :alignItems "center" :justifyContent "center"}) (def tag-count-container - {:flex 0.2 + {:flex 0.2 :flexDirection "column" - :alignItems "flex-end" - :paddingTop 10 - :paddingRight 9}) + :alignItems "flex-end" + :paddingTop 10 + :paddingRight 9}) (def popular-list-container - {:flex 1 + {:flex 1 :backgroundColor "white" - :paddingLeft 10 - :paddingTop 16}) + :paddingLeft 10 + :paddingTop 16}) (def popular-list {:backgroundColor "white" - :paddingTop 13}) + :paddingTop 13}) ;; discover_popular_list_item.cjls (def popular-list-item {:flexDirection "row" - :paddingTop 10 + :paddingTop 10 :paddingBottom 10}) (def popular-list-item-status - {:color "black" + {:color "black" :fontFamily "sans-serif" :lineHeight 22 - :fontSize 14}) + :fontSize 14}) (def popular-list-item-name - {:color "black" + {:color "black" :fontFamily "sans-serif-medium" - :fontSize 14 + :fontSize 14 :lineHeight 24}) (def popular-list-item-name-container - {:flex 0.8 + {:flex 0.8 :flexDirection "column"}) (def popular-list-item-avatar-container - {:flex 0.2 + {:flex 0.2 :flexDirection "column" - :alignItems "center" - :paddingTop 5}) + :alignItems "center" + :paddingTop 5}) (def popular-list-item-avatar - {:resizeMode "contain" + {:resizeMode "contain" :borderRadius 150 - :width 40 - :height 40}) + :width 40 + :height 40}) ;; discovery_recent (def recent-list {:backgroundColor "white" - :paddingLeft 15}) + :paddingLeft 15}) ;; discovery_tag @@ -158,22 +158,27 @@ {:flex 1 :backgroundColor "#eef2f5"}) +(def tag-title-container + {:flex 1 + :alignItems "center" + :justifyContent "center"}) + (def tag-title - {:color "#7099e6" - :fontFamily "sans-serif-medium" - :fontSize 14 - :paddingRight 5 + {:color "#7099e6" + :fontFamily "sans-serif-medium" + :fontSize 14 + :paddingRight 5 :paddingBottom 2}) -(def tag-title-container +(def tag-container {:backgroundColor "#eef2f5" - :flexWrap :wrap - :borderRadius 5 - :padding 4}) + :flexWrap :wrap + :borderRadius 5 + :padding 4}) (def icon-back - {:width 8 - :height 14}) + {:width 8 + :height 14}) (def icon-search {:width 17