2016-05-19 18:31:56 +02:00
|
|
|
(ns status-im.chats-list.screen
|
2016-05-11 16:06:37 +03:00
|
|
|
(:require [re-frame.core :refer [subscribe dispatch]]
|
2016-05-19 18:31:56 +02:00
|
|
|
[status-im.components.react :refer [list-view
|
2016-05-20 22:12:08 +03:00
|
|
|
list-item
|
|
|
|
view
|
|
|
|
text
|
|
|
|
image
|
|
|
|
touchable-highlight]]
|
2016-05-19 18:31:56 +02:00
|
|
|
[status-im.utils.listview :refer [to-datasource]]
|
2016-03-29 23:45:31 +03:00
|
|
|
[reagent.core :as r]
|
2016-05-19 18:31:56 +02:00
|
|
|
[status-im.chats-list.views.chat-list-item :refer [chat-list-item]]
|
|
|
|
[status-im.components.action-button :refer [action-button
|
2016-05-20 22:12:08 +03:00
|
|
|
action-button-item]]
|
2016-05-19 18:31:56 +02:00
|
|
|
[status-im.components.drawer.view :refer [drawer-view open-drawer]]
|
2016-05-23 13:50:46 +03:00
|
|
|
[status-im.components.styles :refer [color-blue
|
|
|
|
toolbar-background2]]
|
2016-05-19 18:31:56 +02:00
|
|
|
[status-im.components.toolbar :refer [toolbar]]
|
|
|
|
[status-im.components.icons.ionicons :refer [icon]]
|
2016-05-25 18:57:06 +03:00
|
|
|
[status-im.i18n :refer [label]]
|
2016-05-19 18:31:56 +02:00
|
|
|
[status-im.chats-list.styles :as st]))
|
2016-03-29 23:45:31 +03:00
|
|
|
|
2016-05-04 15:13:31 +03:00
|
|
|
(defn chats-list-toolbar []
|
2016-05-11 14:58:03 +03:00
|
|
|
[toolbar {:nav-action {:image {:source {:uri :icon_hamburger}
|
2016-05-11 16:06:37 +03:00
|
|
|
:style st/hamburger-icon}
|
2016-05-16 13:40:43 +03:00
|
|
|
:handler open-drawer}
|
2016-05-25 18:57:06 +03:00
|
|
|
:title (label :t/chats)
|
2016-05-23 13:50:46 +03:00
|
|
|
:background-color toolbar-background2
|
2016-05-20 15:37:24 +03:00
|
|
|
;; TODO implement search
|
2016-05-11 14:58:03 +03:00
|
|
|
:action {:image {:source {:uri :icon_search}
|
|
|
|
:style st/search-icon}
|
2016-05-04 15:13:31 +03:00
|
|
|
:handler (fn [])}}])
|
2016-03-29 23:45:31 +03:00
|
|
|
|
2016-05-11 14:47:40 +03:00
|
|
|
(defn chats-list []
|
2016-05-11 16:06:37 +03:00
|
|
|
(let [chats (subscribe [:get :chats])]
|
2016-03-29 23:45:31 +03:00
|
|
|
(fn []
|
2016-05-16 13:40:43 +03:00
|
|
|
[drawer-view
|
|
|
|
[view st/chats-container
|
|
|
|
[chats-list-toolbar]
|
2016-05-30 11:49:16 +03:00
|
|
|
[list-view {:dataSource (to-datasource @chats)
|
2016-05-16 13:40:43 +03:00
|
|
|
:renderRow (fn [row _ _]
|
|
|
|
(list-item [chat-list-item row]))
|
|
|
|
:style st/list-container}]
|
2016-05-17 17:03:21 +03:00
|
|
|
[action-button {:buttonColor color-blue
|
2016-05-23 15:13:52 +03:00
|
|
|
:offsetY 16
|
2016-05-17 17:03:21 +03:00
|
|
|
:offsetX 16}
|
2016-05-16 13:40:43 +03:00
|
|
|
[action-button-item
|
2016-05-25 18:57:06 +03:00
|
|
|
{:title (label :t/new-chat)
|
2016-05-16 13:40:43 +03:00
|
|
|
:buttonColor :#9b59b6
|
|
|
|
:onPress #(dispatch [:navigate-to :contact-list])}
|
|
|
|
[icon {:name :android-create
|
|
|
|
:style st/create-icon}]]
|
|
|
|
[action-button-item
|
2016-05-25 18:57:06 +03:00
|
|
|
{:title (label :t/new-group-chat)
|
2016-05-16 13:40:43 +03:00
|
|
|
:buttonColor :#1abc9c
|
|
|
|
:onPress #(dispatch [:show-group-new])}
|
|
|
|
[icon {:name :person-stalker
|
2016-05-23 15:13:52 +03:00
|
|
|
:style st/person-stalker-icon}]]]]])))
|