virvar 49a9ae3ba1 Merge remote-tracking branch 'origin/develop' into real-data. Fix contacts synchronization.
# Conflicts:
#	.re-natal
#	android/app/build.gradle
#	android/app/src/main/java/com/statusim/MainActivity.java
#	android/settings.gradle
#	src/status_im/chat/handlers.cljs
#	src/status_im/chat/screen.cljs
#	src/status_im/chats_list/views/chat_list_item.cljs
#	src/status_im/db.cljs
#	src/status_im/group_settings/screen.cljs


Former-commit-id: dcc607022f4e62e4c544495220c3130c5c30b026
2016-05-24 11:08:54 +03:00

59 lines
2.7 KiB
Clojure

(ns status-im.chats-list.screen
(:require [re-frame.core :refer [subscribe dispatch]]
[status-im.components.react :refer [list-view
list-item
view
text
image
touchable-highlight]]
[status-im.utils.listview :refer [to-datasource]]
[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]]
[status-im.components.drawer.view :refer [drawer-view open-drawer]]
[status-im.components.styles :refer [color-blue
toolbar-background2]]
[status-im.components.toolbar :refer [toolbar]]
[status-im.components.main-tabs :refer [main-tabs]]
[status-im.components.icons.ionicons :refer [icon]]
[status-im.chats-list.styles :as st]))
(defn chats-list-toolbar []
[toolbar {:nav-action {:image {:source {:uri :icon_hamburger}
: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}
:handler (fn [])}}])
(defn chats-list []
(let [chats (subscribe [:get :chats])]
(fn []
[drawer-view
[view st/chats-container
[chats-list-toolbar]
[list-view {:dataSource (to-datasource (vals @chats))
:renderRow (fn [row _ _]
(list-item [chat-list-item row]))
:style st/list-container}]
[action-button {:buttonColor color-blue
:offsetY 72
:offsetX 16}
[action-button-item
{:title "New Chat"
:buttonColor :#9b59b6
:onPress #(dispatch [:navigate-to :contact-list])}
[icon {:name :android-create
:style st/create-icon}]]
[action-button-item
{:title "New Group Chat"
:buttonColor :#1abc9c
:onPress #(dispatch [:show-group-new])}
[icon {:name :person-stalker
:style st/person-stalker-icon}]]]
[main-tabs]]])))