Discover tag search screen: Fix margins and some nice to haves

This commit is contained in:
Oskar Thorén 2017-10-24 13:35:55 +02:00
parent 429ec89c62
commit 2e57d476a8
2 changed files with 15 additions and 27 deletions

View File

@ -1,8 +1,6 @@
(ns status-im.ui.screens.discover.search-results.views (ns status-im.ui.screens.discover.search-results.views
(:require-macros [status-im.utils.views :refer [defview letsubs]]) (:require-macros [status-im.utils.views :refer [defview letsubs]])
(:require [status-im.utils.listview :refer [to-datasource]] (:require [status-im.components.react :as react]
[status-im.components.status-bar :as status-bar]
[status-im.components.react :as react]
[status-im.components.icons.vector-icons :as vi] [status-im.components.icons.vector-icons :as vi]
[status-im.components.toolbar.view :refer [toolbar]] [status-im.components.toolbar.view :refer [toolbar]]
[status-im.ui.screens.discover.components.views :as components] [status-im.ui.screens.discover.components.views :as components]
@ -11,36 +9,29 @@
[status-im.ui.screens.contacts.styles :as contacts-styles] [status-im.ui.screens.contacts.styles :as contacts-styles]
[status-im.components.toolbar-new.view :as toolbar])) [status-im.components.toolbar-new.view :as toolbar]))
(defn render-separator [_ row-id _] ;; TOOD(oskarth): Refactor this, very similar to discover-all-hashtags view
(react/list-item [react/view {:style styles/row-separator
:key row-id}]))
(defview discover-search-results [] (defview discover-search-results []
(letsubs [{:keys [discoveries total]} [:get-popular-discoveries 250] (letsubs [{:keys [discoveries total]} [:get-popular-discoveries 250]
tags [:get :discover-search-tags] tags [:get :discover-search-tags]
contacts [:get-contacts] contacts [:get-contacts]
current-account [:get-current-account]] current-account [:get-current-account]]
(let [datasource (to-datasource discoveries)]
[react/view styles/discover-tag-container [react/view styles/discover-tag-container
[status-bar/status-bar]
[toolbar/toolbar2 {} [toolbar/toolbar2 {}
toolbar/default-nav-back toolbar/default-nav-back
[react/view {:flex-direction :row [toolbar/content-title (str "#" (first tags) " " total)]]
:justify-content :flex-start}
[react/text {} (str "#" (first tags) " " total)]]]
(if (empty? discoveries) (if (empty? discoveries)
[react/view styles/empty-view [react/view styles/empty-view
[vi/icon :icons/group-big {:style contacts-styles/empty-contacts-icon}] [vi/icon :icons/group-big {:style contacts-styles/empty-contacts-icon}]
[react/text {:style contacts-styles/empty-contacts-text} [react/text {:style contacts-styles/empty-contacts-text}
(i18n/label :t/no-statuses-found)]] (i18n/label :t/no-statuses-found)]]
;TODO (goranjovic) replace this with status-im.components.list.views [react/scroll-view styles/list-container
;as per https://github.com/status-im/status-react/issues/1840 [react/view styles/status-list-outer
[react/list-view {:dataSource datasource [react/view styles/status-list-inner
:renderRow (fn [row _ _] (let [discoveries (map-indexed vector discoveries)]
(react/list-item [components/discover-list-item (for [[i {:keys [message-id] :as message}] discoveries]
{:message row ^{:key (str "message-hashtag-" message-id)}
:current-account current-account [components/discover-list-item-full
:contacts contacts}])) {:message message
:renderSeparator render-separator :show-separator? (not= (inc i) (count discoveries))
:style styles/status-list-inner}])]))) :contacts contacts
:current-account current-account}]))]]])]))

View File

@ -241,10 +241,6 @@
{:border-bottom-color styles/color-light-gray5 {:border-bottom-color styles/color-light-gray5
:border-bottom-width 1}) :border-bottom-width 1})
(def discover-tag-container
{:flex 1
:background-color styles/color-light-gray})
(def tag-title-container (def tag-title-container
{:height 68 {:height 68
:margin-left 16 :margin-left 16
@ -468,4 +464,5 @@
;; TODO(goranjovic): Using the same style in dapp-details screen - reconcile later ;; TODO(goranjovic): Using the same style in dapp-details screen - reconcile later
(def dapp-details-container all-dapps-container) (def dapp-details-container all-dapps-container)
(def discover-tag-container all-dapps-container)