mirror of
https://github.com/status-im/status-react.git
synced 2025-01-11 03:26:31 +00:00
[#3006]: No more search features
Signed-off-by: alwxndr <alwxndr@gmail.com>
This commit is contained in:
parent
d0dff14ea6
commit
ce524507da
@ -1,3 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
|
||||||
<path fill="" d="M9.92798871,13.8799812 L9.92798871,13.8799812 C12.1106139,13.8799812 13.8799812,12.1106139 13.8799812,9.92798871 C13.8799812,7.74536354 12.1106139,5.97599624 9.92798871,5.97599624 C7.74536354,5.97599624 5.97599624,7.74536354 5.97599624,9.92798871 C5.97599624,12.1106139 7.74536354,13.8799812 9.92798871,13.8799812 L9.92798871,13.8799812 Z M19.7118864,18.3146461 C20.0959479,18.6987076 20.0971983,19.3201438 19.7086711,19.7086711 L19.7086711,19.7086711 C19.3228338,20.0945083 18.6917146,20.0889549 18.3146461,19.7118864 L12.719254,14.1164944 C12.3351926,13.7324329 12.3339421,13.1109966 12.7224694,12.7224694 L12.7224694,12.7224694 C13.1083067,12.3366321 13.7394259,12.3421856 14.1164944,12.719254 L19.7118864,18.3146461 Z M9.92798871,15.8559774 L9.92798871,15.8559774 C6.65405095,15.8559774 4,13.2019265 4,9.92798871 C4,6.65405095 6.65405095,4 9.92798871,4 C13.2019265,4 15.8559774,6.65405095 15.8559774,9.92798871 C15.8559774,13.2019265 13.2019265,15.8559774 9.92798871,15.8559774 L9.92798871,15.8559774 Z"/>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 1.1 KiB |
@ -47,15 +47,6 @@
|
|||||||
:handler #(do (re-frame/dispatch [:remove-chat chat-id])
|
:handler #(do (re-frame/dispatch [:remove-chat chat-id])
|
||||||
(re-frame/dispatch [:navigation-replace :home]))})
|
(re-frame/dispatch [:navigation-replace :home]))})
|
||||||
|
|
||||||
(def item-search
|
|
||||||
{:title (i18n/label :t/search-chat)
|
|
||||||
:subtitle (i18n/label :t/not-implemented)
|
|
||||||
:icon :search_gray_copy
|
|
||||||
:icon-style {:width 17
|
|
||||||
:height 17}
|
|
||||||
;; TODO not implemented: action Search chat
|
|
||||||
:handler nil})
|
|
||||||
|
|
||||||
(def item-notifications
|
(def item-notifications
|
||||||
{:title (i18n/label :t/notifications-title)
|
{:title (i18n/label :t/notifications-title)
|
||||||
:subtitle (i18n/label :t/not-implemented)
|
:subtitle (i18n/label :t/not-implemented)
|
||||||
@ -76,14 +67,12 @@
|
|||||||
|
|
||||||
(defn group-chat-items [members public?]
|
(defn group-chat-items [members public?]
|
||||||
(into (if public? [] [(item-members members)])
|
(into (if public? [] [(item-members members)])
|
||||||
[item-search
|
[item-notifications
|
||||||
item-notifications
|
|
||||||
item-settings]))
|
item-settings]))
|
||||||
|
|
||||||
(defn user-chat-items [chat-id]
|
(defn user-chat-items [chat-id]
|
||||||
[(item-user chat-id)
|
[(item-user chat-id)
|
||||||
(item-delete chat-id)
|
(item-delete chat-id)
|
||||||
item-search
|
|
||||||
item-notifications])
|
item-notifications])
|
||||||
|
|
||||||
(defn overlay [{:keys [on-click-outside]} items]
|
(defn overlay [{:keys [on-click-outside]} items]
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
(defview choose-contact-view [{title :title
|
(defview choose-contact-view [{title :title
|
||||||
arg-index :index
|
arg-index :index
|
||||||
bot-db-key :bot-db-key}]
|
bot-db-key :bot-db-key}]
|
||||||
[contacts [:contacts-filtered :people-in-current-chat]]
|
[contacts [:people-in-current-chat]]
|
||||||
[react/view {:flex 1}
|
[react/view {:flex 1}
|
||||||
[react/text {:style {:font-size 14
|
[react/text {:style {:font-size 14
|
||||||
:color "rgb(147, 155, 161)"
|
:color "rgb(147, 155, 161)"
|
||||||
|
@ -62,7 +62,6 @@
|
|||||||
:icons/public (slurp/slurp-svg "./resources/icons/public.svg")
|
:icons/public (slurp/slurp-svg "./resources/icons/public.svg")
|
||||||
:icons/public-chat (slurp/slurp-svg "./resources/icons/public_chat.svg")
|
:icons/public-chat (slurp/slurp-svg "./resources/icons/public_chat.svg")
|
||||||
:icons/qr (slurp/slurp-svg "./resources/icons/QR.svg")
|
:icons/qr (slurp/slurp-svg "./resources/icons/QR.svg")
|
||||||
:icons/search (slurp/slurp-svg "./resources/icons/search.svg")
|
|
||||||
:icons/smile (slurp/slurp-svg "./resources/icons/smile.svg")
|
:icons/smile (slurp/slurp-svg "./resources/icons/smile.svg")
|
||||||
:icons/commands-list (slurp/slurp-svg "./resources/icons/commands_list.svg")
|
:icons/commands-list (slurp/slurp-svg "./resources/icons/commands_list.svg")
|
||||||
:icons/back (slurp/slurp-svg "./resources/icons/back.svg")
|
:icons/back (slurp/slurp-svg "./resources/icons/back.svg")
|
||||||
|
@ -95,10 +95,6 @@
|
|||||||
(def flex
|
(def flex
|
||||||
{:flex 1})
|
{:flex 1})
|
||||||
|
|
||||||
(def icon-search
|
|
||||||
{:width 24
|
|
||||||
:height 24})
|
|
||||||
|
|
||||||
(def create-icon
|
(def create-icon
|
||||||
{:fontSize 20
|
{:fontSize 20
|
||||||
:height 22
|
:height 22
|
||||||
|
@ -9,14 +9,6 @@
|
|||||||
{:icon :icons/options
|
{:icon :icons/options
|
||||||
:options options})
|
:options options})
|
||||||
|
|
||||||
(defn search [handler]
|
|
||||||
{:icon :icons/search
|
|
||||||
:handler handler})
|
|
||||||
|
|
||||||
(def search-icon
|
|
||||||
{:icon :icons/search
|
|
||||||
:icon-opts {:container-style {:opacity 0.4}}})
|
|
||||||
|
|
||||||
(defn back [handler]
|
(defn back [handler]
|
||||||
{:icon :icons/back
|
{:icon :icons/back
|
||||||
:handler handler
|
:handler handler
|
||||||
|
@ -64,27 +64,6 @@
|
|||||||
:align-items :center
|
:align-items :center
|
||||||
:justify-content :center})
|
:justify-content :center})
|
||||||
|
|
||||||
(def toolbar-with-search
|
|
||||||
{:background-color toolbar-background1})
|
|
||||||
|
|
||||||
(defstyle toolbar-with-search-content
|
|
||||||
{:flex 1
|
|
||||||
:android {:padding-left 18}
|
|
||||||
:ios {:align-items :center}})
|
|
||||||
|
|
||||||
(defstyle toolbar-search-input
|
|
||||||
{:line-height 24
|
|
||||||
:height 24
|
|
||||||
:font-size 17
|
|
||||||
:padding-top 0
|
|
||||||
:padding-left 0
|
|
||||||
:padding-bottom 0
|
|
||||||
:text-align-vertical :center
|
|
||||||
:color styles/color-black
|
|
||||||
:ios {:padding-left 8
|
|
||||||
:padding-top 2
|
|
||||||
:letter-spacing -0.2}})
|
|
||||||
|
|
||||||
(def action-default
|
(def action-default
|
||||||
{:width 24
|
{:width 24
|
||||||
:height 24})
|
:height 24})
|
||||||
|
@ -129,67 +129,4 @@
|
|||||||
(defn simple-toolbar
|
(defn simple-toolbar
|
||||||
"A simple toolbar composed of a nav-back item and a single line title."
|
"A simple toolbar composed of a nav-back item and a single line title."
|
||||||
([] (simple-toolbar nil))
|
([] (simple-toolbar nil))
|
||||||
([title] (simple-toolbar nil title))
|
([title] (toolbar nil default-nav-back [content-title title])))
|
||||||
([m title] (simple-toolbar m default-nav-back title))
|
|
||||||
([m nav-back title]
|
|
||||||
(toolbar m nav-back [content-title title])))
|
|
||||||
|
|
||||||
(def search-text-input (reagent/atom nil))
|
|
||||||
|
|
||||||
(defn- toolbar-search-submit [on-search-submit]
|
|
||||||
(let [text @(re-frame/subscribe [:get-in [:toolbar-search :text]])]
|
|
||||||
(on-search-submit text)
|
|
||||||
(re-frame/dispatch [:set-in [:toolbar-search :text] nil])))
|
|
||||||
|
|
||||||
(defn- toolbar-with-search-content [{:keys [show-search?
|
|
||||||
search-placeholder
|
|
||||||
title
|
|
||||||
custom-title
|
|
||||||
on-search-submit]}]
|
|
||||||
[react/view styles/toolbar-with-search-content
|
|
||||||
(if show-search?
|
|
||||||
[react/text-input
|
|
||||||
{:style styles/toolbar-search-input
|
|
||||||
:ref #(reset! search-text-input %)
|
|
||||||
:auto-focus true
|
|
||||||
:placeholder search-placeholder
|
|
||||||
:placeholder-text-color colors/gray
|
|
||||||
:on-change-text #(re-frame/dispatch [:set-in [:toolbar-search :text] %])
|
|
||||||
:on-submit-editing (when on-search-submit
|
|
||||||
#(toolbar-search-submit on-search-submit))}]
|
|
||||||
(or custom-title
|
|
||||||
[react/view
|
|
||||||
[react/text {:style styles/toolbar-title-text
|
|
||||||
:font :toolbar-title}
|
|
||||||
title]]))])
|
|
||||||
|
|
||||||
(defn- toggle-search-fn [text]
|
|
||||||
(re-frame/dispatch [:set-in [:toolbar-search :show] text])
|
|
||||||
(re-frame/dispatch [:set-in [:toolbar-search :text] ""]))
|
|
||||||
|
|
||||||
(defn- search-actions [show-search? search-text search-key actions]
|
|
||||||
(if show-search?
|
|
||||||
(if (pos? (count search-text))
|
|
||||||
[(actions/close #(do
|
|
||||||
(.clear @search-text-input)
|
|
||||||
(re-frame/dispatch [:set-in [:toolbar-search :text] ""])))]
|
|
||||||
[actions/search-icon])
|
|
||||||
(into [(actions/search #(toggle-search-fn search-key))] actions)))
|
|
||||||
|
|
||||||
|
|
||||||
(defn toolbar-with-search [{:keys [show-search?
|
|
||||||
search-text
|
|
||||||
search-key
|
|
||||||
nav-action
|
|
||||||
style
|
|
||||||
modal?]
|
|
||||||
:as opts}]
|
|
||||||
;; TODO(jeluard) refactor to components? Drop modal? and nav-action support
|
|
||||||
[toolbar {:modal? modal?
|
|
||||||
:style style}
|
|
||||||
[nav-button
|
|
||||||
(if show-search?
|
|
||||||
(actions/back #(toggle-search-fn nil))
|
|
||||||
(or nav-action (if modal? actions/default-close actions/default-back)))]
|
|
||||||
[toolbar-with-search-content opts]
|
|
||||||
[actions (search-actions show-search? search-text search-key (:actions opts))]])
|
|
@ -43,7 +43,7 @@
|
|||||||
:on-press #()}]])
|
:on-press #()}]])
|
||||||
|
|
||||||
(defview add-new []
|
(defview add-new []
|
||||||
(letsubs [contacts [:all-added-group-contacts-filtered]
|
(letsubs [contacts [:all-added-group-contacts]
|
||||||
params [:get :contacts/click-params]]
|
params [:get :contacts/click-params]]
|
||||||
[react/view {:flex 1}
|
[react/view {:flex 1}
|
||||||
[status-bar/status-bar]
|
[status-bar/status-bar]
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
[status-im.ui.screens.contacts.views :as contact-options]
|
[status-im.ui.screens.contacts.views :as contact-options]
|
||||||
[status-im.i18n :as i18n]))
|
[status-im.i18n :as i18n]))
|
||||||
|
|
||||||
|
;; TODO(alwx): this namespace is not used; should it be removed?
|
||||||
|
|
||||||
(defn render-row [group edit?]
|
(defn render-row [group edit?]
|
||||||
(fn [row _ _]
|
(fn [row _ _]
|
||||||
[contact-view/contact-view {:contact row
|
[contact-view/contact-view {:contact row
|
||||||
@ -26,22 +28,8 @@
|
|||||||
(i18n/label :t/contacts)
|
(i18n/label :t/contacts)
|
||||||
(or (:name group) (i18n/label :t/contacts-group-new-chat)))]])
|
(or (:name group) (i18n/label :t/contacts-group-new-chat)))]])
|
||||||
|
|
||||||
(defview contact-list-toolbar [group]
|
|
||||||
(letsubs [show-search [:get-in [:toolbar-search :show]]
|
|
||||||
search-text [:get-in [:toolbar-search :text]]]
|
|
||||||
(toolbar/toolbar-with-search
|
|
||||||
{:show-search? (= show-search :contact-list)
|
|
||||||
:search-text search-text
|
|
||||||
:search-key :contact-list
|
|
||||||
:title (if-not group
|
|
||||||
(i18n/label :t/contacts)
|
|
||||||
(or (:name group) (i18n/label :t/contacts-group-new-chat)))
|
|
||||||
:search-placeholder (i18n/label :t/search-contacts)
|
|
||||||
:actions [(act/opts [{:text (i18n/label :t/edit)
|
|
||||||
:value #(re-frame/dispatch [:set-in [:contacts/list-ui-props :edit?] true])}])]})))
|
|
||||||
|
|
||||||
(defview contacts-list-view [group edit?]
|
(defview contacts-list-view [group edit?]
|
||||||
(letsubs [contacts [:all-added-group-contacts-filtered (:group-id group)]]
|
(letsubs [contacts [:all-added-group-contacts (:group-id group)]]
|
||||||
[list/flat-list {:style styles/contacts-list
|
[list/flat-list {:style styles/contacts-list
|
||||||
:data contacts
|
:data contacts
|
||||||
:render-fn (render-row group edit?)
|
:render-fn (render-row group edit?)
|
||||||
@ -58,5 +46,7 @@
|
|||||||
[status-bar/status-bar]
|
[status-bar/status-bar]
|
||||||
(if edit?
|
(if edit?
|
||||||
[contact-list-toolbar-edit group]
|
[contact-list-toolbar-edit group]
|
||||||
[contact-list-toolbar group])]
|
[toolbar/simple-toolbar (if-not group
|
||||||
|
(i18n/label :t/contacts)
|
||||||
|
(or (:name group) (i18n/label :t/contacts-group-new-chat)))])]
|
||||||
[contacts-list-view group edit?]]))
|
[contacts-list-view group edit?]]))
|
||||||
|
@ -9,21 +9,10 @@
|
|||||||
[status-im.ui.components.list.views :as list]
|
[status-im.ui.components.list.views :as list]
|
||||||
[status-im.ui.components.react :as react]
|
[status-im.ui.components.react :as react]
|
||||||
[status-im.ui.components.status-bar.view :refer [status-bar]]
|
[status-im.ui.components.status-bar.view :refer [status-bar]]
|
||||||
[status-im.ui.components.toolbar.view :refer [toolbar-with-search]]
|
[status-im.ui.components.toolbar.view :as toolbar]
|
||||||
[status-im.ui.screens.contacts.styles :as st]
|
[status-im.ui.screens.contacts.styles :as st]
|
||||||
[status-im.i18n :as i18n]))
|
[status-im.i18n :as i18n]))
|
||||||
|
|
||||||
(defview contact-list-modal-toolbar []
|
|
||||||
(letsubs [show-search [:get-in [:toolbar-search :show]]
|
|
||||||
search-text [:get-in [:toolbar-search :text]]]
|
|
||||||
(toolbar-with-search
|
|
||||||
{:modal? true
|
|
||||||
:show-search? (= show-search :contact-list)
|
|
||||||
:search-text search-text
|
|
||||||
:search-key :contact-list
|
|
||||||
:title (i18n/label :t/contacts)
|
|
||||||
:search-placeholder (i18n/label :t/search-contacts)})))
|
|
||||||
|
|
||||||
(defn actions-view [action click-handler]
|
(defn actions-view [action click-handler]
|
||||||
[react/view actions-list
|
[react/view actions-list
|
||||||
[action-button
|
[action-button
|
||||||
@ -53,13 +42,13 @@
|
|||||||
|
|
||||||
|
|
||||||
(defview contact-list-modal []
|
(defview contact-list-modal []
|
||||||
(letsubs [contacts [:contacts-filtered :all-added-people-contacts]
|
(letsubs [contacts [:all-added-people-contacts]
|
||||||
click-handler [:get :contacts/click-handler]
|
click-handler [:get :contacts/click-handler]
|
||||||
action [:get :contacts/click-action]
|
action [:get :contacts/click-action]
|
||||||
params [:get :contacts/click-params]]
|
params [:get :contacts/click-params]]
|
||||||
[react/view {:flex 1}
|
[react/view {:flex 1}
|
||||||
[status-bar {:type :modal-white}]
|
[status-bar {:type :modal-white}]
|
||||||
[contact-list-modal-toolbar]
|
[toolbar/simple-toolbar (i18n/label :t/contacts)]
|
||||||
[list/flat-list {:style st/contacts-list-modal
|
[list/flat-list {:style st/contacts-list-modal
|
||||||
:data contacts
|
:data contacts
|
||||||
:render-fn (render-row click-handler action params)
|
:render-fn (render-row click-handler action params)
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
(defmethod nav/preload-data! :contact-list
|
(defmethod nav/preload-data! :contact-list
|
||||||
[db [_ _ click-handler]]
|
[db [_ _ click-handler]]
|
||||||
(-> db
|
(-> db
|
||||||
(assoc-in [:toolbar-search :show] nil)
|
|
||||||
(assoc-in [:contacts/list-ui-props :edit?] false)
|
(assoc-in [:contacts/list-ui-props :edit?] false)
|
||||||
(assoc-in [:contacts/ui-props :edit?] false)
|
(assoc-in [:contacts/ui-props :edit?] false)
|
||||||
(assoc :contacts/click-handler click-handler)))
|
(assoc :contacts/click-handler click-handler)))
|
||||||
|
@ -93,13 +93,3 @@
|
|||||||
|
|
||||||
(def qr-input
|
(def qr-input
|
||||||
{:margin-right 42})
|
{:margin-right 42})
|
||||||
|
|
||||||
(def search-container
|
|
||||||
{:flex 1
|
|
||||||
:background-color common/color-white})
|
|
||||||
|
|
||||||
(def search-empty-view
|
|
||||||
{:flex 1
|
|
||||||
:background-color common/color-white
|
|
||||||
:align-items :center
|
|
||||||
:justify-content :center})
|
|
||||||
|
@ -98,52 +98,6 @@
|
|||||||
(->> (remove :pending? (vals groups))
|
(->> (remove :pending? (vals groups))
|
||||||
(sort-by :order >))))
|
(sort-by :order >))))
|
||||||
|
|
||||||
(defn search-filter [text item]
|
|
||||||
(let [name (-> (or (:name item) "")
|
|
||||||
(string/lower-case))
|
|
||||||
text (string/lower-case text)]
|
|
||||||
(not= (string/index-of name text) nil)))
|
|
||||||
|
|
||||||
(defn search-filter-reaction [contacts text]
|
|
||||||
(if text
|
|
||||||
(filter #(search-filter text %) contacts)
|
|
||||||
contacts))
|
|
||||||
|
|
||||||
(reg-sub :all-added-group-contacts-filtered
|
|
||||||
(fn [[_ group-id] _]
|
|
||||||
[(if group-id
|
|
||||||
(subscribe [:all-added-group-contacts group-id])
|
|
||||||
(subscribe [:all-added-contacts]))
|
|
||||||
(subscribe [:get-in [:toolbar-search :text]])])
|
|
||||||
(fn [[contacts text] _]
|
|
||||||
(search-filter-reaction contacts text)))
|
|
||||||
|
|
||||||
(reg-sub :contact-group-contacts
|
|
||||||
:<- [:get-contact-group]
|
|
||||||
(fn [group]
|
|
||||||
(:contacts group)))
|
|
||||||
|
|
||||||
(reg-sub :all-not-added-contact-group-contacts
|
|
||||||
(fn [_ _]
|
|
||||||
[(subscribe [:all-added-contacts])
|
|
||||||
(subscribe [:contact-group-contacts])])
|
|
||||||
(fn [[contacts group-contacts]]
|
|
||||||
(filter-not-group-contacts group-contacts contacts)))
|
|
||||||
|
|
||||||
(reg-sub :all-group-not-added-contacts-filtered
|
|
||||||
(fn [_ _]
|
|
||||||
[(subscribe [:all-not-added-contact-group-contacts])
|
|
||||||
(subscribe [:get-in [:toolbar-search :text]])])
|
|
||||||
(fn [[contacts text] _]
|
|
||||||
(search-filter-reaction contacts text)))
|
|
||||||
|
|
||||||
(reg-sub :contacts-filtered
|
|
||||||
(fn [[_ subscription-id] _]
|
|
||||||
[(subscribe [subscription-id])
|
|
||||||
(subscribe [:get-in [:toolbar-search :text]])])
|
|
||||||
(fn [[contacts text]]
|
|
||||||
(search-filter-reaction contacts text)))
|
|
||||||
|
|
||||||
(reg-sub :contact
|
(reg-sub :contact
|
||||||
(fn [db]
|
(fn [db]
|
||||||
(let [identity (:contacts/identity db)]
|
(let [identity (:contacts/identity db)]
|
||||||
|
@ -67,7 +67,6 @@
|
|||||||
(spec/def ::webview-bridge (spec/nilable any?))
|
(spec/def ::webview-bridge (spec/nilable any?))
|
||||||
(spec/def ::status-module-initialized? (spec/nilable boolean?))
|
(spec/def ::status-module-initialized? (spec/nilable boolean?))
|
||||||
(spec/def ::status-node-started? (spec/nilable boolean?))
|
(spec/def ::status-node-started? (spec/nilable boolean?))
|
||||||
(spec/def ::toolbar-search (spec/nilable map?))
|
|
||||||
;;height of native keyboard if shown
|
;;height of native keyboard if shown
|
||||||
(spec/def ::keyboard-height (spec/nilable number?))
|
(spec/def ::keyboard-height (spec/nilable number?))
|
||||||
(spec/def ::keyboard-max-height (spec/nilable number?))
|
(spec/def ::keyboard-max-height (spec/nilable number?))
|
||||||
@ -173,7 +172,6 @@
|
|||||||
::webview-bridge
|
::webview-bridge
|
||||||
::status-module-initialized?
|
::status-module-initialized?
|
||||||
::status-node-started?
|
::status-node-started?
|
||||||
::toolbar-search
|
|
||||||
::keyboard-height
|
::keyboard-height
|
||||||
::keyboard-max-height
|
::keyboard-max-height
|
||||||
::orientation
|
::orientation
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
(ns status-im.ui.screens.discover.events
|
(ns status-im.ui.screens.discover.events
|
||||||
(:require [re-frame.core :as re-frame]
|
(:require [re-frame.core :as re-frame]
|
||||||
[status-im.protocol.core :as protocol]
|
[status-im.protocol.core :as protocol]
|
||||||
[status-im.ui.screens.discover.navigation]
|
|
||||||
[status-im.utils.handlers :as handlers]
|
[status-im.utils.handlers :as handlers]
|
||||||
[clojure.string :as string]
|
[clojure.string :as string]
|
||||||
[status-im.utils.utils :as utils]))
|
[status-im.utils.utils :as utils]))
|
||||||
@ -115,19 +114,6 @@
|
|||||||
:identities (handlers/identities contacts)}
|
:identities (handlers/identities contacts)}
|
||||||
:dispatch [:status-received message]}))))
|
:dispatch [:status-received message]}))))
|
||||||
|
|
||||||
(handlers/register-handler-fx
|
|
||||||
:init-discoveries
|
|
||||||
[(re-frame/inject-cofx :data-store/discoveries)]
|
|
||||||
(fn [{:keys [data-store/discoveries db] {:keys [request-discoveries-timer]} :db} _]
|
|
||||||
(when request-discoveries-timer
|
|
||||||
(utils/clear-interval request-discoveries-timer))
|
|
||||||
{:db (assoc db
|
|
||||||
:discoveries discoveries
|
|
||||||
:request-discoveries-timer
|
|
||||||
(utils/set-interval #(re-frame/dispatch [:request-discoveries])
|
|
||||||
(* request-discoveries-interval-s 1000)))
|
|
||||||
:dispatch [:request-discoveries]}))
|
|
||||||
|
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
:request-discoveries
|
:request-discoveries
|
||||||
[(re-frame/inject-cofx :random-id)]
|
[(re-frame/inject-cofx :random-id)]
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
(ns status-im.ui.screens.discover.navigation
|
|
||||||
(:require [status-im.ui.screens.navigation :as navigation]
|
|
||||||
[status-im.data-store.discover :as discoveries]))
|
|
||||||
|
|
||||||
(defmethod navigation/preload-data! :discover
|
|
||||||
[db _]
|
|
||||||
(assoc-in db [:toolbar-search :show] nil))
|
|
@ -269,10 +269,6 @@
|
|||||||
{:width 8
|
{:width 8
|
||||||
:height 14})
|
:height 14})
|
||||||
|
|
||||||
(def icon-search
|
|
||||||
{:width 17
|
|
||||||
:height 17})
|
|
||||||
|
|
||||||
(def discover-container
|
(def discover-container
|
||||||
{:flex 1
|
{:flex 1
|
||||||
:background-color styles/color-light-gray})
|
:background-color styles/color-light-gray})
|
||||||
@ -280,10 +276,6 @@
|
|||||||
(def list-container
|
(def list-container
|
||||||
{:flex 1})
|
{:flex 1})
|
||||||
|
|
||||||
(def search-icon
|
|
||||||
{:width 17
|
|
||||||
:height 17})
|
|
||||||
|
|
||||||
(defn title-action-text [active?]
|
(defn title-action-text [active?]
|
||||||
{:color (if active?
|
{:color (if active?
|
||||||
styles/color-blue
|
styles/color-blue
|
||||||
|
@ -30,17 +30,6 @@
|
|||||||
(let [hashtags (map #(string/lower-case (string/replace % #"#" "")) (re-seq #"[^ !?,;:.]+" status))]
|
(let [hashtags (map #(string/lower-case (string/replace % #"#" "")) (re-seq #"[^ !?,;:.]+" status))]
|
||||||
(or hashtags [])))
|
(or hashtags [])))
|
||||||
|
|
||||||
(defn toolbar-view [show-search? search-text]
|
|
||||||
[toolbar/toolbar-with-search
|
|
||||||
{:show-search? show-search?
|
|
||||||
:search-text search-text
|
|
||||||
:search-key :discover
|
|
||||||
:title (i18n/label :t/discover)
|
|
||||||
:search-placeholder (i18n/label :t/search-tags)
|
|
||||||
:on-search-submit (fn [text]
|
|
||||||
(when-not (string/blank? text)
|
|
||||||
(re-frame/dispatch [:discover/search-tags-results-view text])))}])
|
|
||||||
|
|
||||||
(defn top-status-for-popular-hashtag [{:keys [popular-hashtag current-account contacts]}]
|
(defn top-status-for-popular-hashtag [{:keys [popular-hashtag current-account contacts]}]
|
||||||
(let [{:keys [tag discovery total]} popular-hashtag]
|
(let [{:keys [tag discovery total]} popular-hashtag]
|
||||||
[react/view styles/popular-list-container
|
[react/view styles/popular-list-container
|
||||||
@ -140,16 +129,13 @@
|
|||||||
:render-fn render-public-chats-item}]])
|
:render-fn render-public-chats-item}]])
|
||||||
|
|
||||||
(defview discover [current-view?]
|
(defview discover [current-view?]
|
||||||
(letsubs [show-search [:get-in [:toolbar-search :show]]
|
(letsubs [contacts [:get-contacts]
|
||||||
search-text [:get-in [:toolbar-search :text]]
|
|
||||||
contacts [:get-contacts]
|
|
||||||
current-account [:get-current-account]
|
current-account [:get-current-account]
|
||||||
discoveries [:discover/recent-discoveries]
|
discoveries [:discover/recent-discoveries]
|
||||||
all-dapps [:discover/all-dapps]
|
all-dapps [:discover/all-dapps]
|
||||||
popular-hashtags [:discover/popular-hashtags-preview]]
|
popular-hashtags [:discover/popular-hashtags-preview]]
|
||||||
[react/view styles/discover-container
|
[react/view styles/discover-container
|
||||||
[toolbar-view (and current-view?
|
[toolbar/simple-toolbar (i18n/label :t/discover)]
|
||||||
(= show-search :discover)) search-text]
|
|
||||||
[react/scroll-view styles/list-container
|
[react/scroll-view styles/list-container
|
||||||
[recent-statuses-preview {:contacts contacts
|
[recent-statuses-preview {:contacts contacts
|
||||||
:current-account current-account
|
:current-account current-account
|
||||||
|
@ -291,7 +291,6 @@
|
|||||||
[:load-contact-groups]
|
[:load-contact-groups]
|
||||||
[:initialize-debugging {:address address}]
|
[:initialize-debugging {:address address}]
|
||||||
[:send-account-update-if-needed]
|
[:send-account-update-if-needed]
|
||||||
[:init-discoveries]
|
|
||||||
[:update-wallet]
|
[:update-wallet]
|
||||||
[:update-transactions]
|
[:update-transactions]
|
||||||
[:get-fcm-token]]
|
[:get-fcm-token]]
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
[status-im.ui.components.react :as react]
|
[status-im.ui.components.react :as react]
|
||||||
[status-im.ui.components.sticky-button :refer [sticky-button]]
|
[status-im.ui.components.sticky-button :refer [sticky-button]]
|
||||||
[status-im.ui.components.status-bar.view :refer [status-bar]]
|
[status-im.ui.components.status-bar.view :refer [status-bar]]
|
||||||
[status-im.ui.components.toolbar.view :refer [toolbar-with-search]]
|
[status-im.ui.components.toolbar.view :as toolbar]
|
||||||
[status-im.ui.screens.group.styles :as styles]
|
[status-im.ui.screens.group.styles :as styles]
|
||||||
[status-im.ui.screens.contacts.styles :as contacts.styles]
|
[status-im.ui.screens.contacts.styles :as contacts.styles]
|
||||||
[status-im.i18n :as i18n]
|
[status-im.i18n :as i18n]
|
||||||
@ -28,26 +28,19 @@
|
|||||||
(defn group-toggle-participant [{:keys [whisper-identity] :as contact}]
|
(defn group-toggle-participant [{:keys [whisper-identity] :as contact}]
|
||||||
[toogle-contact-view contact :is-participant-selected? on-toggle-participant])
|
[toogle-contact-view contact :is-participant-selected? on-toggle-participant])
|
||||||
|
|
||||||
(defn title-with-count [title count-value]
|
(defn toggle-list-toolbar [title contacts-count]
|
||||||
[react/view styles/toolbar-title-with-count
|
[toolbar/toolbar {}
|
||||||
[react/text {:style styles/toolbar-title-with-count-text
|
toolbar/default-nav-back
|
||||||
:font :toolbar-title}
|
[react/view styles/toolbar-container
|
||||||
title]
|
[react/view styles/toolbar-title-with-count
|
||||||
(when (pos? count-value)
|
[react/text {:style styles/toolbar-title-with-count-text
|
||||||
[react/view styles/toolbar-title-with-count-container
|
:font :toolbar-title}
|
||||||
[react/text {:style styles/toolbar-title-with-count-text-count
|
title]
|
||||||
:font :toolbar-title}
|
(when (pos? contacts-count)
|
||||||
count-value]])])
|
[react/view styles/toolbar-title-with-count-container
|
||||||
|
[react/text {:style styles/toolbar-title-with-count-text-count
|
||||||
(defview toggle-list-toolbar [title contacts-count]
|
:font :toolbar-title}
|
||||||
(letsubs [show-search [:get-in [:toolbar-search :show]]
|
contacts-count]])]]])
|
||||||
search-text [:get-in [:toolbar-search :text]]]
|
|
||||||
(toolbar-with-search
|
|
||||||
{:show-search? (= show-search :contact-group-list)
|
|
||||||
:search-text search-text
|
|
||||||
:search-key :contact-group-list
|
|
||||||
:custom-title (title-with-count title contacts-count)
|
|
||||||
:search-placeholder (i18n/label :t/search-contacts)})))
|
|
||||||
|
|
||||||
(defn toggle-list [contacts render-function]
|
(defn toggle-list [contacts render-function]
|
||||||
[react/view {:flex 1}
|
[react/view {:flex 1}
|
||||||
@ -59,7 +52,7 @@
|
|||||||
:keyboardShouldPersistTaps :always}]])
|
:keyboardShouldPersistTaps :always}]])
|
||||||
|
|
||||||
(defview contact-toggle-list []
|
(defview contact-toggle-list []
|
||||||
(letsubs [contacts [:all-added-group-contacts-filtered]
|
(letsubs [contacts [:all-added-contacts]
|
||||||
selected-contacts-count [:selected-contacts-count]
|
selected-contacts-count [:selected-contacts-count]
|
||||||
group-type [:get-group-type]]
|
group-type [:get-group-type]]
|
||||||
[react/keyboard-avoiding-view {:style styles/group-container}
|
[react/keyboard-avoiding-view {:style styles/group-container}
|
||||||
@ -74,7 +67,7 @@
|
|||||||
[sticky-button (i18n/label :t/next) #(re-frame/dispatch [:navigate-to :new-group])])]))
|
[sticky-button (i18n/label :t/next) #(re-frame/dispatch [:navigate-to :new-group])])]))
|
||||||
|
|
||||||
(defview add-contacts-toggle-list []
|
(defview add-contacts-toggle-list []
|
||||||
(letsubs [contacts [:all-group-not-added-contacts-filtered]
|
(letsubs [contacts [:all-group-not-added-contacts]
|
||||||
group [:get-contact-group]
|
group [:get-contact-group]
|
||||||
selected-contacts-count [:selected-contacts-count]]
|
selected-contacts-count [:selected-contacts-count]]
|
||||||
[react/keyboard-avoiding-view {:style styles/group-container}
|
[react/keyboard-avoiding-view {:style styles/group-container}
|
||||||
@ -87,7 +80,7 @@
|
|||||||
(re-frame/dispatch [:navigate-back]))])]))
|
(re-frame/dispatch [:navigate-back]))])]))
|
||||||
|
|
||||||
(defview add-participants-toggle-list []
|
(defview add-participants-toggle-list []
|
||||||
(letsubs [contacts [:contacts-filtered :all-new-contacts]
|
(letsubs [contacts [:all-new-contacts]
|
||||||
chat-name [:chat :name]
|
chat-name [:chat :name]
|
||||||
selected-contacts-count [:selected-participants-count]]
|
selected-contacts-count [:selected-participants-count]]
|
||||||
[react/keyboard-avoiding-view {:style styles/group-container}
|
[react/keyboard-avoiding-view {:style styles/group-container}
|
||||||
|
@ -5,20 +5,10 @@
|
|||||||
[status-im.ui.components.list.views :as list]
|
[status-im.ui.components.list.views :as list]
|
||||||
[status-im.ui.components.react :as react]
|
[status-im.ui.components.react :as react]
|
||||||
[status-im.ui.components.status-bar.view :refer [status-bar]]
|
[status-im.ui.components.status-bar.view :refer [status-bar]]
|
||||||
[status-im.ui.components.toolbar.view :refer [toolbar-with-search]]
|
[status-im.ui.components.toolbar.view :as toolbar]
|
||||||
[status-im.ui.screens.group.styles :as styles]
|
[status-im.ui.screens.group.styles :as styles]
|
||||||
[status-im.i18n :as i18n]))
|
[status-im.i18n :as i18n]))
|
||||||
|
|
||||||
(defview contact-list-toolbar [title]
|
|
||||||
(letsubs [show-search [:get-in [:toolbar-search :show]]
|
|
||||||
search-text [:get-in [:toolbar-search :text]]]
|
|
||||||
(toolbar-with-search
|
|
||||||
{:show-search? (= show-search :contact-list)
|
|
||||||
:search-text search-text
|
|
||||||
:search-key :contact-list
|
|
||||||
:title title
|
|
||||||
:search-placeholder (i18n/label :t/search-contacts)})))
|
|
||||||
|
|
||||||
(defn contacts-list [contacts extended? extend-options]
|
(defn contacts-list [contacts extended? extend-options]
|
||||||
[react/view {:flex 1}
|
[react/view {:flex 1}
|
||||||
[list/flat-list {:data contacts
|
[list/flat-list {:data contacts
|
||||||
@ -46,20 +36,20 @@
|
|||||||
|
|
||||||
(defview edit-chat-group-contact-list []
|
(defview edit-chat-group-contact-list []
|
||||||
(letsubs [chat-name [:chat :name]
|
(letsubs [chat-name [:chat :name]
|
||||||
contacts [:contacts-filtered :current-chat-contacts]
|
contacts [:current-chat-contacts]
|
||||||
current-pk [:get :current-public-key]
|
current-pk [:get :current-public-key]
|
||||||
group-admin [:chat :group-admin]]
|
group-admin [:chat :group-admin]]
|
||||||
(let [admin? (= current-pk group-admin)]
|
(let [admin? (= current-pk group-admin)]
|
||||||
[react/view styles/group-container
|
[react/view styles/group-container
|
||||||
[status-bar]
|
[status-bar]
|
||||||
[contact-list-toolbar chat-name]
|
[toolbar/simple-toolbar chat-name]
|
||||||
[contacts-list
|
[contacts-list
|
||||||
contacts
|
contacts
|
||||||
admin?
|
admin?
|
||||||
chat-extended-options]])))
|
chat-extended-options]])))
|
||||||
|
|
||||||
(defview contacts-list-view [group-id]
|
(defview contacts-list-view [group-id]
|
||||||
(letsubs [contacts [:all-added-group-contacts-filtered group-id]]
|
(letsubs [contacts [:all-added-group-contacts group-id]]
|
||||||
[contacts-list
|
[contacts-list
|
||||||
contacts
|
contacts
|
||||||
true
|
true
|
||||||
@ -69,5 +59,5 @@
|
|||||||
(letsubs [group [:get-contact-group]]
|
(letsubs [group [:get-contact-group]]
|
||||||
[react/view styles/group-container
|
[react/view styles/group-container
|
||||||
[status-bar]
|
[status-bar]
|
||||||
[contact-list-toolbar (:name group)]
|
[toolbar/simple-toolbar (:name group)]
|
||||||
[contacts-list-view (:group-id group)]]))
|
[contacts-list-view (:group-id group)]]))
|
||||||
|
@ -1,36 +1,18 @@
|
|||||||
(ns status-im.ui.screens.group.navigation
|
(ns status-im.ui.screens.group.navigation
|
||||||
(:require [status-im.ui.screens.navigation :as nav]))
|
(:require [status-im.ui.screens.navigation :as nav]))
|
||||||
|
|
||||||
(defn clear-toolbar-search [db]
|
|
||||||
(-> db
|
|
||||||
(assoc-in [:toolbar-search :show] nil)
|
|
||||||
(assoc-in [:toolbar-search :text] "")))
|
|
||||||
|
|
||||||
(defmethod nav/preload-data! :add-contacts-toggle-list
|
(defmethod nav/preload-data! :add-contacts-toggle-list
|
||||||
[db _]
|
[db _]
|
||||||
(->
|
(assoc db :group/selected-contacts #{}))
|
||||||
(assoc db :group/selected-contacts #{})
|
|
||||||
(clear-toolbar-search)))
|
|
||||||
|
|
||||||
|
|
||||||
(defmethod nav/preload-data! :add-participants-toggle-list
|
(defmethod nav/preload-data! :add-participants-toggle-list
|
||||||
[db _]
|
[db _]
|
||||||
(->
|
(assoc db :selected-participants #{}))
|
||||||
(assoc db :selected-participants #{})
|
|
||||||
(clear-toolbar-search)))
|
|
||||||
|
|
||||||
(defmethod nav/preload-data! :new-public-chat
|
(defmethod nav/preload-data! :new-public-chat
|
||||||
[db]
|
[db]
|
||||||
(dissoc db :public-group-topic))
|
(dissoc db :public-group-topic))
|
||||||
|
|
||||||
(defmethod nav/preload-data! :group-contacts
|
|
||||||
[db [_ _ {:keys [show-search?]}]]
|
|
||||||
(-> db
|
|
||||||
(update :toolbar-search
|
|
||||||
assoc
|
|
||||||
:show (when show-search? :contact-list)
|
|
||||||
:text "")))
|
|
||||||
|
|
||||||
(defmethod nav/preload-data! :reorder-groups
|
(defmethod nav/preload-data! :reorder-groups
|
||||||
[db [_ _]]
|
[db [_ _]]
|
||||||
(assoc db :group/groups-order (->> (vals (:group/contact-groups db))
|
(assoc db :group/groups-order (->> (vals (:group/contact-groups db))
|
||||||
|
@ -60,7 +60,6 @@
|
|||||||
:justify-content :center
|
:justify-content :center
|
||||||
:ios {:background-color "#628fe333"
|
:ios {:background-color "#628fe333"
|
||||||
:border-radius 50}})
|
:border-radius 50}})
|
||||||
|
|
||||||
(def add-icon
|
(def add-icon
|
||||||
{:align-items :center
|
{:align-items :center
|
||||||
:width 24
|
:width 24
|
||||||
@ -163,6 +162,11 @@
|
|||||||
:ios {:margin-left 16
|
:ios {:margin-left 16
|
||||||
:opacity 0.5}})
|
:opacity 0.5}})
|
||||||
|
|
||||||
|
(defstyle toolbar-container
|
||||||
|
{:flex 1
|
||||||
|
:android {:padding-left 18}
|
||||||
|
:ios {:align-items :center}})
|
||||||
|
|
||||||
(def toolbar-title-with-count-text
|
(def toolbar-title-with-count-text
|
||||||
{:color common/text1-color
|
{:color common/text1-color
|
||||||
:letter-spacing -0.2
|
:letter-spacing -0.2
|
||||||
|
@ -33,14 +33,11 @@
|
|||||||
(:signed-up? current-account)))
|
(:signed-up? current-account)))
|
||||||
|
|
||||||
(reg-sub :tabs-hidden?
|
(reg-sub :tabs-hidden?
|
||||||
:<- [:get-in [:toolbar-search :show]]
|
|
||||||
:<- [:get-in [:chat-list-ui-props :edit?]]
|
:<- [:get-in [:chat-list-ui-props :edit?]]
|
||||||
:<- [:get-in [:contacts/ui-props :edit?]]
|
:<- [:get-in [:contacts/ui-props :edit?]]
|
||||||
:<- [:get :view-id]
|
:<- [:get :view-id]
|
||||||
(fn [[search-mode? chats-edit-mode? contacts-edit-mode? view-id]]
|
(fn [[chats-edit-mode? contacts-edit-mode? view-id]]
|
||||||
(or search-mode?
|
(and (= view-id :contact-list) contacts-edit-mode?)))
|
||||||
(and (= view-id :home) chats-edit-mode?)
|
|
||||||
(and (= view-id :contact-list) contacts-edit-mode?))))
|
|
||||||
|
|
||||||
(reg-sub :network
|
(reg-sub :network
|
||||||
(fn [db]
|
(fn [db]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user