bug #2205 - discover all links are disabled when empty

This commit is contained in:
Goran Jovic 2017-10-18 12:41:22 +02:00 committed by Oskar Thorén
parent 893900f3ea
commit 74e81f7faf
2 changed files with 30 additions and 27 deletions

View File

@ -17,7 +17,8 @@
[react/text {:style styles/title-text [react/text {:style styles/title-text
:font :medium} :font :medium}
(i18n/label label-kw)] (i18n/label label-kw)]
[react/touchable-highlight {:on-press action-fn} [react/touchable-highlight {:on-press action-fn
:disabled (not active?)}
[react/view {} [react/view {}
;; NOTE(oskarth): text-transform to uppercase not supported as RN style ;; NOTE(oskarth): text-transform to uppercase not supported as RN style
;; https://github.com/facebook/react-native/issues/2088 ;; https://github.com/facebook/react-native/issues/2088

View File

@ -69,35 +69,37 @@
(defview popular-hashtags-preview [{:keys [contacts current-account]}] (defview popular-hashtags-preview [{:keys [contacts current-account]}]
(letsubs [popular-tags [:get-popular-tags 10]] (letsubs [popular-tags [:get-popular-tags 10]]
[react/view styles/popular-container (let [has-content? (seq popular-tags)]
;; TODO (goranjovic) - refactor double dispatch to a single call [react/view styles/popular-container
[components/title :t/popular-tags :t/all #(do (re-frame/dispatch [:set :discover-search-tags (map :name popular-tags)]) ;; TODO (goranjovic) - refactor double dispatch to a single call
(re-frame/dispatch [:navigate-to :discover-all-hashtags])) true] [components/title :t/popular-tags :t/all #(do (re-frame/dispatch [:set :discover-search-tags (map :name popular-tags)])
(if (seq popular-tags) (re-frame/dispatch [:navigate-to :discover-all-hashtags])) has-content?]
(if has-content?
[carousel/carousel {:pageStyle styles/carousel-page-style
:gap 8
:sneak 16
:count (count popular-tags)}
(for [{:keys [name]} popular-tags]
[top-status-for-popular-hashtag {:tag name
:contacts contacts
:current-account current-account}])]
[empty-section :empty-hashtags :t/no-hashtags-discovered-title :t/no-hashtags-discovered-body])])))
(defn recent-statuses-preview [current-account discoveries]
(let [has-content? (seq discoveries)]
[react/view styles/recent-statuses-preview-container
[components/title :t/recent :t/all #(re-frame/dispatch [:navigate-to :discover-all-recent]) has-content?]
(if has-content?
[carousel/carousel {:pageStyle styles/carousel-page-style [carousel/carousel {:pageStyle styles/carousel-page-style
:gap 8 :gap 8
:sneak 16 :sneak 16
:count (count popular-tags)} :count (count discoveries)}
(for [{:keys [name]} popular-tags] (for [discovery discoveries]
[top-status-for-popular-hashtag {:tag name [react/view styles/recent-statuses-preview-content
:contacts contacts [components/discover-list-item {:message discovery
:current-account current-account}])] :show-separator? false
[empty-section :empty-hashtags :t/no-hashtags-discovered-title :t/no-hashtags-discovered-body])])) :current-account current-account}]])]
[empty-section :empty-recent :t/no-statuses-discovered :t/no-statuses-discovered-body])]))
(defn recent-statuses-preview [current-account discoveries]
[react/view styles/recent-statuses-preview-container
[components/title :t/recent :t/all #(re-frame/dispatch [:navigate-to :discover-all-recent]) true]
(if (seq discoveries)
[carousel/carousel {:pageStyle styles/carousel-page-style
:gap 8
:sneak 16
:count (count discoveries)}
(for [discovery discoveries]
[react/view styles/recent-statuses-preview-content
[components/discover-list-item {:message discovery
:show-separator? false
:current-account current-account}]])]
[empty-section :empty-recent :t/no-statuses-discovered :t/no-statuses-discovered-body])])
(def public-chats-mock-data (def public-chats-mock-data
[{:name "Status team" [{:name "Status team"