Fix new chat icon

Former-commit-id: fc5bb416af
This commit is contained in:
virvar 2016-05-23 13:50:46 +03:00
parent 585baa9d71
commit 5142ffc4c3
6 changed files with 22 additions and 24 deletions

View File

@ -2,6 +2,7 @@
(:require [re-frame.core :refer [register-handler enrich after debug dispatch]] (:require [re-frame.core :refer [register-handler enrich after debug dispatch]]
[status-im.models.commands :as commands] [status-im.models.commands :as commands]
[clojure.string :as str] [clojure.string :as str]
[status-im.components.styles :refer [default-chat-color]]
[status-im.chat.suggestions :as suggestions] [status-im.chat.suggestions :as suggestions]
[status-im.protocol.api :as api] [status-im.protocol.api :as api]
[status-im.models.messages :as messages] [status-im.models.messages :as messages]
@ -304,6 +305,7 @@
(let [name (get-in contacts [contcat-id :name]) (let [name (get-in contacts [contcat-id :name])
chat {:chat-id contcat-id chat {:chat-id contcat-id
:name name :name name
:color default-chat-color
:group-chat false :group-chat false
:is-active true :is-active true
:timestamp (.getTime (js/Date.)) :timestamp (.getTime (js/Date.))

View File

@ -10,9 +10,10 @@
[reagent.core :as r] [reagent.core :as r]
[status-im.chats-list.views.chat-list-item :refer [chat-list-item]] [status-im.chats-list.views.chat-list-item :refer [chat-list-item]]
[status-im.components.action-button :refer [action-button [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.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.toolbar :refer [toolbar]]
[status-im.components.icons.ionicons :refer [icon]] [status-im.components.icons.ionicons :refer [icon]]
[status-im.chats-list.styles :as st])) [status-im.chats-list.styles :as st]))
@ -23,6 +24,7 @@
:style st/hamburger-icon} :style st/hamburger-icon}
:handler open-drawer} :handler open-drawer}
:title "Chats" :title "Chats"
:background-color toolbar-background2
;; TODO implement search ;; TODO implement search
:action {:image {:source {:uri :icon_search} :action {:image {:source {:uri :icon_search}
:style st/search-icon} :style st/search-icon}

View File

@ -8,7 +8,7 @@
[status-im.components.chat-icon.styles :as st] [status-im.components.chat-icon.styles :as st]
[status-im.components.styles :refer [color-purple]])) [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) [view (:default-chat-icon styles)
[text {:style (:default-chat-icon-text styles)} [text {:style (:default-chat-icon-text styles)}
(first name)]]) (first name)]])
@ -23,17 +23,17 @@
[view (:online-dot-left styles)] [view (:online-dot-left styles)]
[view (:online-dot-right 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]] [photo-path [:chat-photo chat-id]]
[view (:container styles) [view (:container styles)
(if (and photo-path (not (empty? photo-path))) (if (and photo-path (not (empty? photo-path)))
[chat-icon photo-path styles] [chat-icon photo-path styles]
[default-chat-icon name color styles]) [default-chat-icon name styles])
(when (not group-chat) (when (not group-chat)
[contact-online online styles])]) [contact-online online styles])])
(defn chat-icon-view-chat-list [chat-id group-chat name color online] (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 {: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
@ -43,7 +43,7 @@
:default-chat-icon-text st/default-chat-icon-text}]) :default-chat-icon-text st/default-chat-icon-text}])
(defn chat-icon-view-action [chat-id group-chat name color online] (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 {:container st/container
:online-view st/online-view :online-view st/online-view
:online-dot-left st/online-dot-left :online-dot-left st/online-dot-left
@ -53,7 +53,7 @@
:default-chat-icon-text st/default-chat-icon-text}]) :default-chat-icon-text st/default-chat-icon-text}])
(defn chat-icon-view-menu-item [chat-id group-chat name color online] (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 {:container st/container-menu-item
:online-view st/online-view-menu-item :online-view st/online-view-menu-item
:online-dot-left st/online-dot-left-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 (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}])
(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] (defn profile-icon-view [photo-path name color online]
(let [styles {:container st/container-profile (let [styles {:container st/container-profile
:online-view st/online-view-profile :online-view st/online-view-profile
@ -83,20 +73,20 @@
[view (:container styles) [view (:container styles)
(if (and photo-path (not (empty? photo-path))) (if (and photo-path (not (empty? photo-path)))
[chat-icon photo-path styles] [chat-icon photo-path styles]
[default-chat-icon name color styles]) [default-chat-icon name styles])
[contact-online online styles]])) [contact-online online styles]]))
(defview profile-icon [] (defview profile-icon []
[contact [:contact]] [contact [:contact]]
(let [ ;; TODO stub data (let [;; TODO stub data
online true online true
color color-purple] color color-purple]
[profile-icon-view (:photo-path contact) (:name contact) color online])) [profile-icon-view (:photo-path contact) (:name contact) color online]))
(defview my-profile-icon [] (defview my-profile-icon []
[name [:get :username] [name [:get :username]
photo-path [:get :photo-path]] photo-path [:get :photo-path]]
(let [ ;; TODO stub data (let [;; TODO stub data
online true online true
color color-purple] color color-purple]
[profile-icon-view photo-path name color online])) [profile-icon-view photo-path name color online]))

View File

@ -26,3 +26,4 @@
(def separator-color "#0000001f") (def separator-color "#0000001f")
(def toolbar-background1 color-white) (def toolbar-background1 color-white)
(def toolbar-background2 color-light-gray) (def toolbar-background2 color-light-gray)
(def default-chat-color color-purple)

View File

@ -1,6 +1,7 @@
(ns status-im.new-group.handlers (ns status-im.new-group.handlers
(:require [status-im.protocol.api :as api] (:require [status-im.protocol.api :as api]
[re-frame.core :refer [register-handler after dispatch debug enrich]] [re-frame.core :refer [register-handler after dispatch debug enrich]]
[status-im.components.styles :refer [default-chat-color]]
[status-im.models.chats :as chats] [status-im.models.chats :as chats]
[clojure.string :as s])) [clojure.string :as s]))
@ -37,6 +38,7 @@
(group-name-from-contacts db))] (group-name-from-contacts db))]
(assoc db :new-chat {:chat-id new-group-id (assoc db :new-chat {:chat-id new-group-id
:name chat-name :name chat-name
:color default-chat-color
:group-chat true :group-chat true
:is-active true :is-active true
:timestamp (.getTime (js/Date.)) :timestamp (.getTime (js/Date.))

View File

@ -1,5 +1,6 @@
(ns status-im.persistence.realm (ns status-im.persistence.realm
(:require [cljs.reader :refer [read-string]] (:require [cljs.reader :refer [read-string]]
[status-im.components.styles :refer [default-chat-color]]
[status-im.utils.logging :as log] [status-im.utils.logging :as log]
[status-im.utils.types :refer [to-string]]) [status-im.utils.types :refer [to-string]])
(:refer-clojure :exclude [exists?])) (:refer-clojure :exclude [exists?]))
@ -44,7 +45,7 @@
:properties {:chat-id "string" :properties {:chat-id "string"
:name "string" :name "string"
:color {:type "string" :color {:type "string"
:default "#a187d5"} :default default-chat-color}
:group-chat {:type "bool" :group-chat {:type "bool"
:indexed true} :indexed true}
:is-active "bool" :is-active "bool"