parent
3f2c598b2b
commit
c20e7a2424
|
@ -63,8 +63,7 @@
|
||||||
:default-chat-icon (st/default-chat-icon-menu-item color)
|
:default-chat-icon (st/default-chat-icon-menu-item color)
|
||||||
:default-chat-icon-text st/default-chat-icon-text}])
|
:default-chat-icon-text st/default-chat-icon-text}])
|
||||||
|
|
||||||
(defview contact-icon-view [identity styles]
|
(defn contact-icon-view [contact styles]
|
||||||
[contact [:contact-by-identity identity]]
|
|
||||||
(let [photo-path (:photo-path contact)
|
(let [photo-path (:photo-path contact)
|
||||||
;; TODO stub data
|
;; TODO stub data
|
||||||
online true]
|
online true]
|
||||||
|
@ -74,8 +73,8 @@
|
||||||
[default-chat-icon (:name contact) styles])
|
[default-chat-icon (:name contact) styles])
|
||||||
[contact-online online styles]]))
|
[contact-online online styles]]))
|
||||||
|
|
||||||
(defn contact-icon-contacts-tab [identity]
|
(defn contact-icon-contacts-tab [contact]
|
||||||
[contact-icon-view identity
|
[contact-icon-view contact
|
||||||
{:container st/container-chat-list
|
{:container st/container-chat-list
|
||||||
:online-view st/online-view
|
:online-view st/online-view
|
||||||
:online-dot-left st/online-dot-left
|
:online-dot-left st/online-dot-left
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
[text {:style st/show-all-text} (label :show-all)]]]])
|
[text {:style st/show-all-text} (label :show-all)]]]])
|
||||||
|
|
||||||
(defn contact-list []
|
(defn contact-list []
|
||||||
(let [contacts (subscribe [:get-contacts])
|
(let [contacts (subscribe [:all-contacts])
|
||||||
show-toolbar-shadow? (r/atom false)]
|
show-toolbar-shadow? (r/atom false)]
|
||||||
(fn []
|
(fn []
|
||||||
[drawer-view
|
[drawer-view
|
||||||
|
|
|
@ -7,10 +7,14 @@
|
||||||
(let [contacts (reaction (:contacts @db))]
|
(let [contacts (reaction (:contacts @db))]
|
||||||
(reaction (vals @contacts)))))
|
(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
|
(register-sub :all-contacts
|
||||||
(fn [db _]
|
(fn [db _]
|
||||||
(let [contacts (reaction (:contacts @db))]
|
(let [contacts (reaction (:contacts @db))]
|
||||||
(reaction (sort-by :name (vals @contacts))))))
|
(reaction (sort-contacts @contacts)))))
|
||||||
|
|
||||||
(defn get-contact-letter [contact]
|
(defn get-contact-letter [contact]
|
||||||
(when-let [letter (first (:name contact))]
|
(when-let [letter (first (:name contact))]
|
||||||
|
@ -20,7 +24,7 @@
|
||||||
(fn [db _]
|
(fn [db _]
|
||||||
(let [contacts (reaction (:contacts @db))]
|
(let [contacts (reaction (:contacts @db))]
|
||||||
(reaction
|
(reaction
|
||||||
(let [ordered (sort-by :name (vals @contacts))]
|
(let [ordered (sort-contacts @contacts)]
|
||||||
(map (fn [prev cur]
|
(map (fn [prev cur]
|
||||||
(let [prev-letter (get-contact-letter prev)
|
(let [prev-letter (get-contact-letter prev)
|
||||||
cur-letter (get-contact-letter cur)]
|
cur-letter (get-contact-letter cur)]
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
[text {:style st/letter-text}
|
[text {:style st/letter-text}
|
||||||
letter])])
|
letter])])
|
||||||
|
|
||||||
(defn contact-photo [{:keys [whisper-identity]}]
|
(defn contact-photo [contact]
|
||||||
[view st/contact-photo-container
|
[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}]
|
(defn contact-inner-view [{:keys [name letter] :as contact}]
|
||||||
[view st/contact-container
|
[view st/contact-container
|
||||||
|
|
Loading…
Reference in New Issue