Fix new chat icon

This commit is contained in:
virvar 2016-05-23 13:50:46 +03:00
parent c3496957ff
commit fc5bb416af
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]]
[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.))

View File

@ -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}

View File

@ -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]))

View File

@ -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)

View File

@ -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.))

View File

@ -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"