diff --git a/src/status_im/components/chat_icon/screen.cljs b/src/status_im/components/chat_icon/screen.cljs index 8b89575422..3b6437c193 100644 --- a/src/status_im/components/chat_icon/screen.cljs +++ b/src/status_im/components/chat_icon/screen.cljs @@ -63,8 +63,7 @@ :default-chat-icon (st/default-chat-icon-menu-item color) :default-chat-icon-text st/default-chat-icon-text}]) -(defview contact-icon-view [identity styles] - [contact [:contact-by-identity identity]] +(defn contact-icon-view [contact styles] (let [photo-path (:photo-path contact) ;; TODO stub data online true] @@ -74,8 +73,8 @@ [default-chat-icon (:name contact) styles]) [contact-online online styles]])) -(defn contact-icon-contacts-tab [identity] - [contact-icon-view identity +(defn contact-icon-contacts-tab [contact] + [contact-icon-view contact {:container st/container-chat-list :online-view st/online-view :online-dot-left st/online-dot-left diff --git a/src/status_im/contacts/screen.cljs b/src/status_im/contacts/screen.cljs index 406d85de1d..df87dc87da 100644 --- a/src/status_im/contacts/screen.cljs +++ b/src/status_im/contacts/screen.cljs @@ -60,7 +60,7 @@ [text {:style st/show-all-text} (label :show-all)]]]]) (defn contact-list [] - (let [contacts (subscribe [:get-contacts]) + (let [contacts (subscribe [:all-contacts]) show-toolbar-shadow? (r/atom false)] (fn [] [drawer-view diff --git a/src/status_im/contacts/subs.cljs b/src/status_im/contacts/subs.cljs index 3f5764c9b5..e44c89b36a 100644 --- a/src/status_im/contacts/subs.cljs +++ b/src/status_im/contacts/subs.cljs @@ -7,10 +7,14 @@ (let [contacts (reaction (:contacts @db))] (reaction (vals @contacts))))) +(defn sort-contacts [contacts] + (sort-by :name #(compare (clojure.string/lower-case %1) + (clojure.string/lower-case %2)) (vals contacts))) + (register-sub :all-contacts (fn [db _] (let [contacts (reaction (:contacts @db))] - (reaction (sort-by :name (vals @contacts)))))) + (reaction (sort-contacts @contacts))))) (defn get-contact-letter [contact] (when-let [letter (first (:name contact))] @@ -20,7 +24,7 @@ (fn [db _] (let [contacts (reaction (:contacts @db))] (reaction - (let [ordered (sort-by :name (vals @contacts))] + (let [ordered (sort-contacts @contacts)] (map (fn [prev cur] (let [prev-letter (get-contact-letter prev) cur-letter (get-contact-letter cur)] diff --git a/src/status_im/contacts/views/contact_inner.cljs b/src/status_im/contacts/views/contact_inner.cljs index 2a5eb95257..8b44f601c8 100644 --- a/src/status_im/contacts/views/contact_inner.cljs +++ b/src/status_im/contacts/views/contact_inner.cljs @@ -11,9 +11,9 @@ [text {:style st/letter-text} letter])]) -(defn contact-photo [{:keys [whisper-identity]}] +(defn contact-photo [contact] [view st/contact-photo-container - [contact-icon-contacts-tab whisper-identity]]) + [contact-icon-contacts-tab contact]]) (defn contact-inner-view [{:keys [name letter] :as contact}] [view st/contact-container