fixed address line on login and refreshed discover toolbar

This commit is contained in:
Andrey Shovkoplyas 2017-03-15 20:35:33 +03:00 committed by Roman Volosovskyi
parent 07f1877c63
commit 810fe76c7c
3 changed files with 14 additions and 6 deletions

View File

@ -34,7 +34,6 @@
:label-color "#ffffff80" :label-color "#ffffff80"
:line-color :white :line-color :white
:input-style st/input-style :input-style st/input-style
:wrapper-style (merge button-input st/address-input-wrapper)
:on-change-text #(dispatch [:set-in [:login :address] %])}]]) :on-change-text #(dispatch [:set-in [:login :address] %])}]])
(defview password-input [error] (defview password-input [error]

View File

@ -68,6 +68,11 @@
(def search-text-input (r/atom nil)) (def search-text-input (r/atom nil))
(defn- toolbar-search-submit [on-search-submit]
(let [text @(subscribe [:get-in [:toolbar-search :text]])]
(on-search-submit text)
(dispatch [:set-in [:toolbar-search :text] nil])))
(defn- toolbar-with-search-content [{:keys [show-search? (defn- toolbar-with-search-content [{:keys [show-search?
search-placeholder search-placeholder
title title
@ -80,7 +85,9 @@
:ref #(reset! search-text-input %) :ref #(reset! search-text-input %)
:auto-focus true :auto-focus true
:placeholder search-placeholder :placeholder search-placeholder
:on-change-text #(dispatch [:set-in [:toolbar-search :text] %])}] :on-change-text #(dispatch [:set-in [:toolbar-search :text] %])
:on-submit-editing (when on-search-submit
#(toolbar-search-submit on-search-submit))}]
(or custom-title (or custom-title
[view [view
[text {:style st/toolbar-title-text [text {:style st/toolbar-title-text

View File

@ -8,8 +8,8 @@
text text
text-input text-input
icon]] icon]]
[status-im.components.toolbar.view :refer [toolbar-with-search]] [status-im.components.toolbar-new.view :refer [toolbar-with-search]]
[status-im.components.toolbar.actions :as act] [status-im.components.toolbar-new.actions :as act]
[status-im.components.drawer.view :refer [open-drawer]] [status-im.components.drawer.view :refer [open-drawer]]
[status-im.components.carousel.carousel :refer [carousel]] [status-im.components.carousel.carousel :refer [carousel]]
[status-im.discover.views.popular-list :refer [discover-popular-list]] [status-im.discover.views.popular-list :refer [discover-popular-list]]
@ -23,9 +23,10 @@
(let [hashtags (map #(str/lower-case (str/replace % #"#" "")) (re-seq #"[^ !?,;:.]+" status))] (let [hashtags (map #(str/lower-case (str/replace % #"#" "")) (re-seq #"[^ !?,;:.]+" status))]
(or hashtags []))) (or hashtags [])))
(defn toolbar-view [show-search?] (defn toolbar-view [show-search? search-text]
[toolbar-with-search [toolbar-with-search
{:show-search? show-search? {:show-search? show-search?
:search-text search-text
:search-key :discover :search-key :discover
:title (label :t/discover) :title (label :t/discover)
:search-placeholder (label :t/search-tags) :search-placeholder (label :t/search-tags)
@ -74,12 +75,13 @@
(defview discover [current-view?] (defview discover [current-view?]
[show-search [:get-in [:toolbar-search :show]] [show-search [:get-in [:toolbar-search :show]]
search-text [:get-in [:toolbar-search :text]]
contacts [:get :contacts] contacts [:get :contacts]
current-account [:get-current-account] current-account [:get-current-account]
discoveries [:get-recent-discoveries]] discoveries [:get-recent-discoveries]]
[view st/discover-container [view st/discover-container
[toolbar-view (and current-view? [toolbar-view (and current-view?
(= show-search :discover))] (= show-search :discover)) search-text]
(if discoveries (if discoveries
[scroll-view {:style (get-in platform-specific [:component-styles :main-tab-list])} [scroll-view {:style (get-in platform-specific [:component-styles :main-tab-list])}
[discover-popular {:contacts contacts [discover-popular {:contacts contacts