[#10988] Add entry point to start new chat from search results
Fixes #10988 Allow public key and filter public chats Make toolbar width 100 Clear new identity from search QA issues fix Signed-off-by: Gheorghe Pinzaru <feross95@gmail.com>
This commit is contained in:
parent
56364ea70c
commit
8652f899e0
Binary file not shown.
After Width: | Height: | Size: 546 B |
Binary file not shown.
After Width: | Height: | Size: 909 B |
|
@ -6,6 +6,7 @@
|
|||
:or {size :default}}]
|
||||
(merge {:align-items :center
|
||||
:padding-horizontal 8
|
||||
:width "100%"
|
||||
:flex-direction :row
|
||||
:justify-content :space-between}
|
||||
(when center?
|
||||
|
|
|
@ -67,10 +67,10 @@
|
|||
new-identity
|
||||
@resolve-last-id])}})))))))
|
||||
|
||||
(handlers/register-handler-fx
|
||||
::new-chat-focus
|
||||
(fn [{:keys [db]}]
|
||||
{:db (dissoc db :contacts/new-identity)}))
|
||||
(fx/defn clear-new-identity
|
||||
{:events [::clear-new-identity ::new-chat-focus]}
|
||||
[{:keys [db]}]
|
||||
{:db (dissoc db :contacts/new-identity)})
|
||||
|
||||
(defn- get-validation-label [value]
|
||||
(case value
|
||||
|
|
|
@ -13,7 +13,11 @@
|
|||
[status-im.ui.components.colors :as colors]
|
||||
[status-im.ui.screens.add-new.new-public-chat.view :as new-public-chat]
|
||||
[quo.core :as quo]
|
||||
[status-im.ui.screens.add-new.new-chat.events :as new-chat]
|
||||
[status-im.ui.components.search-input.view :as search-input]
|
||||
[status-im.ui.screens.add-new.new-public-chat.db :as db]
|
||||
[status-im.utils.debounce :as debounce]
|
||||
[status-im.utils.utils :as utils]
|
||||
[cljs-bean.core :as bean]
|
||||
[status-im.ui.components.topbar :as topbar])
|
||||
(:require-macros [status-im.utils.views :as views]))
|
||||
|
@ -90,13 +94,42 @@
|
|||
{:search-active? search-active?
|
||||
:search-filter search-filter
|
||||
:on-cancel #(re-frame/dispatch [:search/home-filter-changed nil])
|
||||
:on-blur #(when-not (seq chats)
|
||||
(re-frame/dispatch [:search/home-filter-changed nil]))
|
||||
:on-blur (fn []
|
||||
(when-not (seq chats)
|
||||
(re-frame/dispatch [:search/home-filter-changed nil]))
|
||||
(re-frame/dispatch [::new-chat/clear-new-identity]))
|
||||
:on-focus (fn [search-filter]
|
||||
(when-not search-filter
|
||||
(re-frame/dispatch [:search/home-filter-changed ""])))
|
||||
(re-frame/dispatch [:search/home-filter-changed ""])
|
||||
(re-frame/dispatch [::new-chat/clear-new-identity])))
|
||||
:on-change (fn [text]
|
||||
(re-frame/dispatch [:search/home-filter-changed text]))}]])
|
||||
(re-frame/dispatch [:search/home-filter-changed text])
|
||||
(re-frame/dispatch [:set-in [:contacts/new-identity :state] :searching])
|
||||
(debounce/debounce-and-dispatch [:new-chat/set-new-identity text] 300))}]])
|
||||
|
||||
(defn start-suggestion [search-value]
|
||||
(let [{:keys [state ens-name public-key]}
|
||||
@(re-frame/subscribe [:contacts/new-identity])
|
||||
valid-private? (= state :valid)
|
||||
valid-public? (db/valid-topic? search-value)]
|
||||
(when (or valid-public? valid-private?)
|
||||
[react/view
|
||||
[quo/list-header (i18n/label :t/search-no-chat-found)]
|
||||
(when valid-private?
|
||||
[quo/list-item {:theme :accent
|
||||
:icon :main-icons/private-chat
|
||||
:title (or ens-name (utils/get-shortened-address public-key))
|
||||
:subtitle (i18n/label :t/join-new-private-chat)
|
||||
:on-press (fn []
|
||||
(debounce/dispatch-and-chill [:contact.ui/contact-code-submitted false] 3000))}])
|
||||
(when valid-public?
|
||||
[quo/list-item {:theme :accent
|
||||
:icon :main-icons/public-chat
|
||||
:title (str "#" search-value)
|
||||
:subtitle (i18n/label :t/join-new-public-chat)
|
||||
:on-press (fn []
|
||||
(re-frame/dispatch [:chat.ui/start-public-chat search-value])
|
||||
(re-frame/dispatch [:set :public-group-topic nil]))}])])))
|
||||
|
||||
(views/defview chats-list []
|
||||
(views/letsubs [loading? [:chats/loading?]
|
||||
|
@ -111,15 +144,17 @@
|
|||
(not @search-active?))
|
||||
[welcome-blank-page]
|
||||
[list/flat-list
|
||||
{:key-fn :chat-id
|
||||
:keyboard-should-persist-taps :always
|
||||
:data chats
|
||||
:render-fn (fn [home-item] [inner-item/home-list-item home-item])
|
||||
:header (when (or (seq chats) @search-active?)
|
||||
[search-input-wrapper search-filter chats])
|
||||
:footer (if (and (not hide-home-tooltip?) (not @search-active?))
|
||||
[home-tooltip-view]
|
||||
[react/view {:height 68}])}]))))
|
||||
{:key-fn :chat-id
|
||||
:keyboard-should-persist-taps :always
|
||||
:data chats
|
||||
:render-fn (fn [home-item] [inner-item/home-list-item home-item])
|
||||
:header (when (or (seq chats) @search-active?)
|
||||
[search-input-wrapper search-filter chats])
|
||||
:empty-component (when @search-active?
|
||||
[start-suggestion search-filter])
|
||||
:footer (if (and (not hide-home-tooltip?) (not @search-active?))
|
||||
[home-tooltip-view]
|
||||
[react/view {:height 68}])}]))))
|
||||
|
||||
(views/defview plus-button []
|
||||
(views/letsubs [logging-in? [:multiaccounts/login]]
|
||||
|
|
|
@ -816,6 +816,9 @@
|
|||
"public-chats": "Public chats",
|
||||
"public-group-status": "Public",
|
||||
"public-group-topic": "Topic",
|
||||
"join-new-public-chat": "Join a public chat",
|
||||
"join-new-private-chat": "Start a new private chat",
|
||||
"search-no-chat-found": "No search results. Do you mean",
|
||||
"public-key": "Public key",
|
||||
"puk-and-pairing-codes-displayed": "PUK and pairing codes displayed",
|
||||
"puk-code": "PUK code",
|
||||
|
|
Loading…
Reference in New Issue