parent
c2ee61c1db
commit
9ac1056d73
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.9 KiB |
|
@ -10,6 +10,7 @@
|
||||||
(def color-black "#000000de")
|
(def color-black "#000000de")
|
||||||
(def color-purple "#a187d5")
|
(def color-purple "#a187d5")
|
||||||
(def color-gray "#838c93de")
|
(def color-gray "#838c93de")
|
||||||
|
(def color-gray2 "#8f838c93")
|
||||||
(def color-white :white)
|
(def color-white :white)
|
||||||
(def color-light-blue "#bbc4cb")
|
(def color-light-blue "#bbc4cb")
|
||||||
(def color-light-blue-transparent "#bbc4cb32")
|
(def color-light-blue-transparent "#bbc4cb32")
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
linear-gradient
|
linear-gradient
|
||||||
scroll-view
|
scroll-view
|
||||||
list-view
|
list-view
|
||||||
list-item]]
|
list-item] :as react]
|
||||||
[status-im.components.action-button :refer [action-button
|
[status-im.components.action-button :refer [action-button
|
||||||
action-button-item]]
|
action-button-item]]
|
||||||
[status-im.contacts.views.contact :refer [contact-extended-view]]
|
[status-im.contacts.views.contact :refer [contact-extended-view]]
|
||||||
|
@ -21,7 +21,6 @@
|
||||||
create-icon
|
create-icon
|
||||||
toolbar-background2]]
|
toolbar-background2]]
|
||||||
[status-im.contacts.styles :as st]
|
[status-im.contacts.styles :as st]
|
||||||
[status-im.utils.listview :as lw]
|
|
||||||
[status-im.i18n :refer [label]]))
|
[status-im.i18n :refer [label]]))
|
||||||
|
|
||||||
(defn contact-list-toolbar []
|
(defn contact-list-toolbar []
|
||||||
|
@ -35,7 +34,9 @@
|
||||||
:style icon-search}
|
:style icon-search}
|
||||||
:handler (fn [])}}])
|
:handler (fn [])}}])
|
||||||
|
|
||||||
(defn contact-group [contacts title group top?]
|
(def contacts-limit 10)
|
||||||
|
|
||||||
|
(defn contact-group [contacts contacts-count title group top?]
|
||||||
[view st/contact-group
|
[view st/contact-group
|
||||||
[view st/contact-group-header
|
[view st/contact-group-header
|
||||||
(when-not top?
|
(when-not top?
|
||||||
|
@ -43,22 +44,23 @@
|
||||||
:colors st/contact-group-header-gradient-top-colors}])
|
:colors st/contact-group-header-gradient-top-colors}])
|
||||||
[view st/contact-group-header-inner
|
[view st/contact-group-header-inner
|
||||||
[text {:style st/contact-group-text} title]
|
[text {:style st/contact-group-text} title]
|
||||||
[text {:style st/contact-group-size-text} (str (count contacts))]]
|
[text {:style st/contact-group-size-text} (str contacts-count)]]
|
||||||
[linear-gradient {:style st/contact-group-header-gradient-bottom
|
[linear-gradient {:style st/contact-group-header-gradient-bottom
|
||||||
:colors st/contact-group-header-gradient-bottom-colors}]]
|
:colors st/contact-group-header-gradient-bottom-colors}]]
|
||||||
;; todo what if there is no contacts, should we show some information
|
;; todo what if there is no contacts, should we show some information
|
||||||
;; about this?
|
;; about this?
|
||||||
(when contacts
|
|
||||||
[view {:flexDirection :column}
|
[view {:flexDirection :column}
|
||||||
(for [contact (take 4 contacts)]
|
(for [contact contacts]
|
||||||
;; TODO not imlemented: contact more button handler
|
;; TODO not imlemented: contact more button handler
|
||||||
^{:key contact} [contact-extended-view contact nil nil])])
|
^{:key contact} [contact-extended-view contact nil nil])]
|
||||||
|
(when (= contacts-limit (count contacts))
|
||||||
[view st/show-all
|
[view st/show-all
|
||||||
[touchable-highlight {:on-press #(dispatch [:show-group-contacts group])}
|
[touchable-highlight {:on-press #(dispatch [:show-group-contacts group])}
|
||||||
[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 [:all-contacts])
|
(let [contacts (subscribe [:get-contacts-with-limit contacts-limit])
|
||||||
|
contcats-count (subscribe [:contacts-count])
|
||||||
show-toolbar-shadow? (r/atom false)]
|
show-toolbar-shadow? (r/atom false)]
|
||||||
(fn []
|
(fn []
|
||||||
[drawer-view
|
[drawer-view
|
||||||
|
@ -68,13 +70,25 @@
|
||||||
(when @show-toolbar-shadow?
|
(when @show-toolbar-shadow?
|
||||||
[linear-gradient {:style st/contact-group-header-gradient-bottom
|
[linear-gradient {:style st/contact-group-header-gradient-bottom
|
||||||
:colors st/contact-group-header-gradient-bottom-colors}])]
|
:colors st/contact-group-header-gradient-bottom-colors}])]
|
||||||
|
(if (pos? @contcats-count)
|
||||||
[scroll-view {:style st/contact-groups
|
[scroll-view {:style st/contact-groups
|
||||||
:onScroll (fn [e]
|
:onScroll (fn [e]
|
||||||
(let [offset (.. e -nativeEvent -contentOffset -y)]
|
(let [offset (.. e -nativeEvent -contentOffset -y)]
|
||||||
(reset! show-toolbar-shadow? (<= st/contact-group-header-height offset))))}
|
(reset! show-toolbar-shadow? (<= st/contact-group-header-height offset))))}
|
||||||
;; TODO not implemented: dapps and persons separation
|
;; TODO not implemented: dapps and persons separation
|
||||||
[contact-group @contacts (label :contacs-group-dapps) :dapps true]
|
[contact-group
|
||||||
[contact-group @contacts (label :contacs-group-people) :people false]]
|
@contacts
|
||||||
|
@contcats-count
|
||||||
|
(label :t/contacs-group-dapps)
|
||||||
|
:dapps true]
|
||||||
|
[contact-group
|
||||||
|
@contacts
|
||||||
|
@contcats-count
|
||||||
|
(label :t/contacs-group-people)
|
||||||
|
:people false]]
|
||||||
|
[view st/empty-contact-groups
|
||||||
|
[react/icon :group_big st/empty-contacts-icon]
|
||||||
|
[text {:style st/empty-contacts-text} (label :t/no-contacts)]])
|
||||||
[action-button {:buttonColor color-blue
|
[action-button {:buttonColor color-blue
|
||||||
:offsetY 16
|
:offsetY 16
|
||||||
:offsetX 16}
|
:offsetX 16}
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
text5-color
|
text5-color
|
||||||
color-white
|
color-white
|
||||||
toolbar-background2
|
toolbar-background2
|
||||||
online-color]]))
|
online-color
|
||||||
|
color-gray2]]))
|
||||||
|
|
||||||
(def contacts-list-container
|
(def contacts-list-container
|
||||||
{:flex 1
|
{:flex 1
|
||||||
|
@ -22,6 +23,20 @@
|
||||||
{:flex 1
|
{:flex 1
|
||||||
:backgroundColor toolbar-background2})
|
:backgroundColor toolbar-background2})
|
||||||
|
|
||||||
|
(def empty-contact-groups
|
||||||
|
(merge contact-groups
|
||||||
|
{:align-items :center
|
||||||
|
:padding-top 150}))
|
||||||
|
|
||||||
|
(def empty-contacts-icon
|
||||||
|
{:height 62
|
||||||
|
:width 62})
|
||||||
|
|
||||||
|
(def empty-contacts-text
|
||||||
|
{:margin-top 12
|
||||||
|
:font-size 16
|
||||||
|
:color color-gray2})
|
||||||
|
|
||||||
(def contacts-list
|
(def contacts-list
|
||||||
{:backgroundColor :white})
|
{:backgroundColor :white})
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(ns status-im.contacts.subs
|
(ns status-im.contacts.subs
|
||||||
(:require-macros [reagent.ratom :refer [reaction]])
|
(:require-macros [reagent.ratom :refer [reaction]])
|
||||||
(:require [re-frame.core :refer [register-sub]]))
|
(:require [re-frame.core :refer [register-sub subscribe]]))
|
||||||
|
|
||||||
(register-sub :get-contacts
|
(register-sub :get-contacts
|
||||||
(fn [db _]
|
(fn [db _]
|
||||||
|
@ -16,6 +16,16 @@
|
||||||
(let [contacts (reaction (:contacts @db))]
|
(let [contacts (reaction (:contacts @db))]
|
||||||
(reaction (sort-contacts @contacts)))))
|
(reaction (sort-contacts @contacts)))))
|
||||||
|
|
||||||
|
(register-sub :get-contacts-with-limit
|
||||||
|
(fn [_ [_ limit]]
|
||||||
|
(let [contacts (subscribe [:all-contacts])]
|
||||||
|
(reaction (take limit @contacts)))))
|
||||||
|
|
||||||
|
(register-sub :contacts-count
|
||||||
|
(fn [_ _]
|
||||||
|
(let [contacts (subscribe [:all-contacts])]
|
||||||
|
(reaction (count @contacts)))))
|
||||||
|
|
||||||
(defn get-contact-letter [contact]
|
(defn get-contact-letter [contact]
|
||||||
(when-let [letter (first (:name contact))]
|
(when-let [letter (first (:name contact))]
|
||||||
(clojure.string/upper-case letter)))
|
(clojure.string/upper-case letter)))
|
||||||
|
@ -25,13 +35,14 @@
|
||||||
(let [contacts (reaction (:contacts @db))]
|
(let [contacts (reaction (:contacts @db))]
|
||||||
(reaction
|
(reaction
|
||||||
(let [ordered (sort-contacts @contacts)]
|
(let [ordered (sort-contacts @contacts)]
|
||||||
(map (fn [prev cur]
|
(reduce (fn [prev cur]
|
||||||
(let [prev-letter (get-contact-letter prev)
|
(let [prev-letter (get-contact-letter (last prev))
|
||||||
cur-letter (get-contact-letter cur)]
|
cur-letter (get-contact-letter cur)]
|
||||||
|
(conj prev
|
||||||
(if (not= prev-letter cur-letter)
|
(if (not= prev-letter cur-letter)
|
||||||
(assoc cur :letter cur-letter)
|
(assoc cur :letter cur-letter)
|
||||||
cur)))
|
cur))))
|
||||||
(cons nil ordered) ordered))))))
|
[] ordered))))))
|
||||||
|
|
||||||
(defn contacts-by-chat [fn db chat-id]
|
(defn contacts-by-chat [fn db chat-id]
|
||||||
(let [chat (reaction (get-in @db [:chats chat-id]))
|
(let [chat (reaction (get-in @db [:chats chat-id]))
|
||||||
|
|
|
@ -8,8 +8,7 @@
|
||||||
(defn letter-view [letter]
|
(defn letter-view [letter]
|
||||||
[view st/letter-container
|
[view st/letter-container
|
||||||
(when letter
|
(when letter
|
||||||
[text {:style st/letter-text}
|
[text {:style st/letter-text} letter])])
|
||||||
letter])])
|
|
||||||
|
|
||||||
(defn on-press [chat whisper-identity]
|
(defn on-press [chat whisper-identity]
|
||||||
(if chat
|
(if chat
|
||||||
|
@ -24,12 +23,6 @@
|
||||||
[letter-view letter]
|
[letter-view letter]
|
||||||
[contact-inner-view contact]]])
|
[contact-inner-view contact]]])
|
||||||
|
|
||||||
(defview contact-simple-view [{:keys [whisper-identity] :as contact}]
|
|
||||||
[chat [:get-chat whisper-identity]]
|
|
||||||
[touchable-highlight
|
|
||||||
{:onPress (on-press chat whisper-identity)}
|
|
||||||
[view {} [contact-inner-view contact]]])
|
|
||||||
|
|
||||||
(defview contact-extended-view [{:keys [whisper-identity] :as contact} info more-click-handler]
|
(defview contact-extended-view [{:keys [whisper-identity] :as contact} info more-click-handler]
|
||||||
[chat [:get-chat whisper-identity]]
|
[chat [:get-chat whisper-identity]]
|
||||||
[touchable-highlight
|
[touchable-highlight
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
(:require [status-im.components.styles :refer [font
|
(:require [status-im.components.styles :refer [font
|
||||||
title-font
|
title-font
|
||||||
color-white
|
color-white
|
||||||
|
color-gray2
|
||||||
chat-background
|
chat-background
|
||||||
online-color
|
online-color
|
||||||
selected-message-color
|
selected-message-color
|
||||||
|
@ -49,7 +50,7 @@
|
||||||
:elevation 0})
|
:elevation 0})
|
||||||
|
|
||||||
(def discovery-subtitle
|
(def discovery-subtitle
|
||||||
{:color "#8f838c93"
|
{:color color-gray2
|
||||||
:fontFamily "sans-serif-medium"
|
:fontFamily "sans-serif-medium"
|
||||||
:fontSize 14})
|
:fontSize 14})
|
||||||
|
|
||||||
|
|
|
@ -73,8 +73,9 @@
|
||||||
:no-name "Noname"
|
:no-name "Noname"
|
||||||
:new-contact "New Contact"
|
:new-contact "New Contact"
|
||||||
:show-all "SHOW ALL"
|
:show-all "SHOW ALL"
|
||||||
:contacs-group-dapps "DApps"
|
:contacs-group-dapps "Dapps"
|
||||||
:contacs-group-people "People"
|
:contacs-group-people "People"
|
||||||
|
:no-contacts "No contacts yet"
|
||||||
|
|
||||||
;group-settings
|
;group-settings
|
||||||
:remove "Remove"
|
:remove "Remove"
|
||||||
|
|
Loading…
Reference in New Issue