From fc5bb416af26496701f4132ef055d463b63ee9d6 Mon Sep 17 00:00:00 2001 From: virvar Date: Mon, 23 May 2016 13:50:46 +0300 Subject: [PATCH] Fix new chat icon --- src/status_im/chat/handlers.cljs | 2 ++ src/status_im/chats_list/screen.cljs | 6 ++-- .../components/chat_icon/screen.cljs | 32 +++++++------------ src/status_im/components/styles.cljs | 1 + src/status_im/new_group/handlers.cljs | 2 ++ src/status_im/persistence/realm.cljs | 3 +- 6 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/status_im/chat/handlers.cljs b/src/status_im/chat/handlers.cljs index 45bcc38329..124357de30 100644 --- a/src/status_im/chat/handlers.cljs +++ b/src/status_im/chat/handlers.cljs @@ -2,6 +2,7 @@ (:require [re-frame.core :refer [register-handler enrich after debug dispatch]] [status-im.models.commands :as commands] [clojure.string :as str] + [status-im.components.styles :refer [default-chat-color]] [status-im.chat.suggestions :as suggestions] [status-im.protocol.api :as api] [status-im.models.messages :as messages] @@ -304,6 +305,7 @@ (let [name (get-in contacts [contcat-id :name]) chat {:chat-id contcat-id :name name + :color default-chat-color :group-chat false :is-active true :timestamp (.getTime (js/Date.)) diff --git a/src/status_im/chats_list/screen.cljs b/src/status_im/chats_list/screen.cljs index d1c3d603bc..700ee209b2 100644 --- a/src/status_im/chats_list/screen.cljs +++ b/src/status_im/chats_list/screen.cljs @@ -10,9 +10,10 @@ [reagent.core :as r] [status-im.chats-list.views.chat-list-item :refer [chat-list-item]] [status-im.components.action-button :refer [action-button - action-button-item]] + action-button-item]] [status-im.components.drawer.view :refer [drawer-view open-drawer]] - [status-im.components.styles :refer [color-blue]] + [status-im.components.styles :refer [color-blue + toolbar-background2]] [status-im.components.toolbar :refer [toolbar]] [status-im.components.icons.ionicons :refer [icon]] [status-im.chats-list.styles :as st])) @@ -23,6 +24,7 @@ :style st/hamburger-icon} :handler open-drawer} :title "Chats" + :background-color toolbar-background2 ;; TODO implement search :action {:image {:source {:uri :icon_search} :style st/search-icon} diff --git a/src/status_im/components/chat_icon/screen.cljs b/src/status_im/components/chat_icon/screen.cljs index e3aae00a05..e44d334e33 100644 --- a/src/status_im/components/chat_icon/screen.cljs +++ b/src/status_im/components/chat_icon/screen.cljs @@ -8,7 +8,7 @@ [status-im.components.chat-icon.styles :as st] [status-im.components.styles :refer [color-purple]])) -(defn default-chat-icon [name color styles] +(defn default-chat-icon [name styles] [view (:default-chat-icon styles) [text {:style (:default-chat-icon-text styles)} (first name)]]) @@ -23,17 +23,17 @@ [view (:online-dot-left styles)] [view (:online-dot-right styles)]])) -(defview chat-icon-view [chat-id group-chat name color online styles] +(defview chat-icon-view [chat-id group-chat name online styles] [photo-path [:chat-photo chat-id]] [view (:container styles) (if (and photo-path (not (empty? photo-path))) [chat-icon photo-path styles] - [default-chat-icon name color styles]) + [default-chat-icon name styles]) (when (not group-chat) [contact-online online styles])]) (defn chat-icon-view-chat-list [chat-id group-chat name color online] - [chat-icon-view chat-id group-chat name color online + [chat-icon-view chat-id group-chat name online {:container st/container-chat-list :online-view st/online-view :online-dot-left st/online-dot-left @@ -43,7 +43,7 @@ :default-chat-icon-text st/default-chat-icon-text}]) (defn chat-icon-view-action [chat-id group-chat name color online] - [chat-icon-view chat-id group-chat name color online + [chat-icon-view chat-id group-chat name online {:container st/container :online-view st/online-view :online-dot-left st/online-dot-left @@ -53,7 +53,7 @@ :default-chat-icon-text st/default-chat-icon-text}]) (defn chat-icon-view-menu-item [chat-id group-chat name color online] - [chat-icon-view chat-id group-chat name color online + [chat-icon-view chat-id group-chat name online {:container st/container-menu-item :online-view st/online-view-menu-item :online-dot-left st/online-dot-left-menu-item @@ -62,16 +62,6 @@ :default-chat-icon (st/default-chat-icon-menu-item color) :default-chat-icon-text st/default-chat-icon-text}]) -(defn chat-icon-view-profile [chat-id group-chat name color online] - [chat-icon-view chat-id group-chat name color online - {:container st/container-profile - :online-view st/online-view-profile - :online-dot-left st/online-dot-left-profile - :online-dot-right st/online-dot-right-profile - :chat-icon st/chat-icon-profile - :default-chat-icon (st/default-chat-icon-profile color) - :default-chat-icon-text st/default-chat-icon-text}]) - (defn profile-icon-view [photo-path name color online] (let [styles {:container st/container-profile :online-view st/online-view-profile @@ -83,20 +73,20 @@ [view (:container styles) (if (and photo-path (not (empty? photo-path))) [chat-icon photo-path styles] - [default-chat-icon name color styles]) + [default-chat-icon name styles]) [contact-online online styles]])) (defview profile-icon [] [contact [:contact]] - (let [ ;; TODO stub data + (let [;; TODO stub data online true - color color-purple] + color color-purple] [profile-icon-view (:photo-path contact) (:name contact) color online])) (defview my-profile-icon [] [name [:get :username] photo-path [:get :photo-path]] - (let [ ;; TODO stub data + (let [;; TODO stub data online true - color color-purple] + color color-purple] [profile-icon-view photo-path name color online])) diff --git a/src/status_im/components/styles.cljs b/src/status_im/components/styles.cljs index 421224dc92..6ccb836e02 100644 --- a/src/status_im/components/styles.cljs +++ b/src/status_im/components/styles.cljs @@ -26,3 +26,4 @@ (def separator-color "#0000001f") (def toolbar-background1 color-white) (def toolbar-background2 color-light-gray) +(def default-chat-color color-purple) diff --git a/src/status_im/new_group/handlers.cljs b/src/status_im/new_group/handlers.cljs index 7c890399fd..4d934d1e23 100644 --- a/src/status_im/new_group/handlers.cljs +++ b/src/status_im/new_group/handlers.cljs @@ -1,6 +1,7 @@ (ns status-im.new-group.handlers (:require [status-im.protocol.api :as api] [re-frame.core :refer [register-handler after dispatch debug enrich]] + [status-im.components.styles :refer [default-chat-color]] [status-im.models.chats :as chats] [clojure.string :as s])) @@ -37,6 +38,7 @@ (group-name-from-contacts db))] (assoc db :new-chat {:chat-id new-group-id :name chat-name + :color default-chat-color :group-chat true :is-active true :timestamp (.getTime (js/Date.)) diff --git a/src/status_im/persistence/realm.cljs b/src/status_im/persistence/realm.cljs index 242f98bb9c..a7d564f143 100644 --- a/src/status_im/persistence/realm.cljs +++ b/src/status_im/persistence/realm.cljs @@ -1,5 +1,6 @@ (ns status-im.persistence.realm (:require [cljs.reader :refer [read-string]] + [status-im.components.styles :refer [default-chat-color]] [status-im.utils.logging :as log] [status-im.utils.types :refer [to-string]]) (:refer-clojure :exclude [exists?])) @@ -44,7 +45,7 @@ :properties {:chat-id "string" :name "string" :color {:type "string" - :default "#a187d5"} + :default default-chat-color} :group-chat {:type "bool" :indexed true} :is-active "bool"