Fixes for discover search input field (#478)
This commit is contained in:
parent
4c876587ed
commit
7c1319e966
|
@ -104,7 +104,7 @@
|
|||
:ref #(reset! main-swiper %)
|
||||
:on-momentum-scroll-end (on-scroll-end swiped?)})
|
||||
[chats-list]
|
||||
[discovery]
|
||||
[discovery (= @view-id :discovery)]
|
||||
[contact-list]]
|
||||
[tabs {:selected-view-id @view-id
|
||||
:prev-view-id @prev-view-id
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
[text {:style st/toolbar-title-text
|
||||
:font :toolbar-title}
|
||||
title]])
|
||||
[view (st/toolbar-actions-container (count actions) (or custom-content custom-action))
|
||||
[view (st/toolbar-actions-container (count actions) custom-action)
|
||||
(if actions
|
||||
(for [{action-image :image
|
||||
action-handler :handler} actions]
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
(defmethod nav/preload-data! :discovery
|
||||
[db _]
|
||||
(dispatch [:set :discovery-show-search? false])
|
||||
(-> db
|
||||
(assoc :tags (discoveries/get-all-tags))
|
||||
(assoc :discoveries (->> (discoveries/get-all :desc)
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
[status-im.discovery.views.popular-list :refer [discovery-popular-list]]
|
||||
[status-im.discovery.views.discovery-list-item :refer [discovery-list-item]]
|
||||
[status-im.contacts.styles :as contacts-styles]
|
||||
[status-im.utils.platform :refer [platform-specific]]))
|
||||
[status-im.utils.platform :refer [platform-specific]]
|
||||
[reagent.core :as r]))
|
||||
|
||||
(defn get-hashtags [status]
|
||||
(let [hashtags (map #(str/lower-case (str/replace % #"#" "")) (re-seq #"[^ !?,;:.]+" status))]
|
||||
|
@ -27,9 +28,11 @@
|
|||
[view st/discovery-toolbar-content
|
||||
(if show-search?
|
||||
[text-input {:style st/discovery-search-input
|
||||
:autoFocus true
|
||||
:auto-focus true
|
||||
:placeholder (label :t/search-tags)
|
||||
:onSubmitEditing (fn [e]
|
||||
:on-blur (fn [e]
|
||||
(dispatch [:set :discovery-show-search? false]))
|
||||
:on-submit-editing (fn [e]
|
||||
(let [search (aget e "nativeEvent" "text")
|
||||
hashtags (get-hashtags search)]
|
||||
(dispatch [:set :discovery-search-tags hashtags])
|
||||
|
@ -40,7 +43,7 @@
|
|||
(label :t/discovery)]])])
|
||||
|
||||
(defn toogle-search [current-value]
|
||||
(dispatch [:set ::show-search? (not current-value)]))
|
||||
(dispatch [:set :discovery-show-search? (not current-value)]))
|
||||
|
||||
(defn discovery-toolbar [show-search?]
|
||||
[toolbar
|
||||
|
@ -83,18 +86,18 @@
|
|||
[view st/recent-list
|
||||
(let [discoveries (map-indexed vector discoveries)]
|
||||
(for [[i {:keys [message-id] :as message}] discoveries]
|
||||
^{:key (str "message-" message-id)}
|
||||
^{:key (str "message-recent-" message-id)}
|
||||
[discovery-list-item {:message message
|
||||
:show-separator? (not= (inc i) (count discoveries))
|
||||
:current-account current-account}]))]]))
|
||||
|
||||
(defview discovery []
|
||||
[show-search? [:get ::show-search?]
|
||||
(defview discovery [current-view?]
|
||||
[show-search? [:get :discovery-show-search?]
|
||||
contacts [:get :contacts]
|
||||
current-account [:get-current-account]
|
||||
discoveries [:get-recent-discoveries]]
|
||||
[view st/discovery-container
|
||||
[discovery-toolbar show-search?]
|
||||
[discovery-toolbar (and current-view? show-search?)]
|
||||
(if discoveries
|
||||
[scroll-view st/scroll-view-container
|
||||
[discovery-popular {:contacts contacts
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
{:flex 1
|
||||
:align-self "stretch"
|
||||
:margin-left 18
|
||||
:line-height 42
|
||||
:font-size 14
|
||||
:color "#7099e6"})
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
(:total discoveries)]]]
|
||||
(let [discoveries (map-indexed vector (:discoveries discoveries))]
|
||||
(for [[i {:keys [message-id] :as discovery}] discoveries]
|
||||
^{:key (str "message-" message-id)}
|
||||
^{:key (str "message-popular-" message-id)}
|
||||
[discovery-list-item {:message discovery
|
||||
:show-separator? (not= (inc i) (count discoveries))
|
||||
:current-account current-account}]))])
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
:new-group-chat "New group chat"
|
||||
|
||||
;discover
|
||||
:discovery "Discovery"
|
||||
:discovery "Discover"
|
||||
:none "None"
|
||||
:search-tags "Type your search tags here"
|
||||
:popular-tags "Popular tags"
|
||||
|
|
Loading…
Reference in New Issue