2016-05-11 14:47:40 +03:00
|
|
|
(ns syng-im.chats-list.screen
|
2016-05-11 16:06:37 +03:00
|
|
|
(:require [re-frame.core :refer [subscribe dispatch]]
|
2016-05-13 18:56:52 +03:00
|
|
|
[syng-im.components.react :refer [list-view
|
|
|
|
list-item
|
|
|
|
view
|
2016-03-29 23:45:31 +03:00
|
|
|
text
|
|
|
|
image
|
2016-05-11 16:06:37 +03:00
|
|
|
touchable-highlight]]
|
2016-05-13 19:03:14 +03:00
|
|
|
[syng-im.utils.listview :refer [to-datasource]]
|
2016-03-29 23:45:31 +03:00
|
|
|
[reagent.core :as r]
|
2016-05-11 14:47:40 +03:00
|
|
|
[syng-im.chats-list.views.chat-list-item :refer [chat-list-item]]
|
2016-04-01 18:05:55 +03:00
|
|
|
[syng-im.components.action-button :refer [action-button
|
|
|
|
action-button-item]]
|
2016-05-16 14:38:07 +03:00
|
|
|
[syng-im.components.drawer.view :refer [drawer-view open-drawer]]
|
2016-05-11 16:06:37 +03:00
|
|
|
[syng-im.components.styles :refer [color-blue]]
|
2016-05-04 15:13:31 +03:00
|
|
|
[syng-im.components.toolbar :refer [toolbar]]
|
2016-05-11 14:58:03 +03:00
|
|
|
[syng-im.components.icons.ionicons :refer [icon]]
|
|
|
|
[syng-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-04 15:13:31 +03:00
|
|
|
:title "Chats"
|
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]
|
|
|
|
[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}
|
|
|
|
[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}]]]]])))
|