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}
[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}]
]))))
[list-view {:dataSource datasource
:enableEmptySections true
:renderRow render-row
:renderSeparator render-separator
:style st/recent-list}]
]))))

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

@ -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