Former-commit-id: ac4548f63b
This commit is contained in:
Roman Volosovskyi 2016-05-16 13:40:43 +03:00
parent 4d9b81edf5
commit b893cce7bb
2 changed files with 26 additions and 24 deletions

View File

@ -11,6 +11,7 @@
[syng-im.chats-list.views.chat-list-item :refer [chat-list-item]] [syng-im.chats-list.views.chat-list-item :refer [chat-list-item]]
[syng-im.components.action-button :refer [action-button [syng-im.components.action-button :refer [action-button
action-button-item]] action-button-item]]
[syng-im.components.drawer :refer [drawer-view open-drawer]]
[syng-im.components.styles :refer [color-blue]] [syng-im.components.styles :refer [color-blue]]
[syng-im.components.toolbar :refer [toolbar]] [syng-im.components.toolbar :refer [toolbar]]
[syng-im.components.icons.ionicons :refer [icon]] [syng-im.components.icons.ionicons :refer [icon]]
@ -20,7 +21,7 @@
(defn chats-list-toolbar [] (defn chats-list-toolbar []
[toolbar {:nav-action {:image {:source {:uri :icon_hamburger} [toolbar {:nav-action {:image {:source {:uri :icon_hamburger}
:style st/hamburger-icon} :style st/hamburger-icon}
:handler (fn [])} :handler open-drawer}
:title "Chats" :title "Chats"
:action {:image {:source {:uri :icon_search} :action {:image {:source {:uri :icon_search}
:style st/search-icon} :style st/search-icon}
@ -29,22 +30,23 @@
(defn chats-list [] (defn chats-list []
(let [chats (subscribe [:get :chats])] (let [chats (subscribe [:get :chats])]
(fn [] (fn []
[view st/chats-container [drawer-view
[chats-list-toolbar] [view st/chats-container
[list-view {:dataSource (to-datasource (vals @chats)) [chats-list-toolbar]
:renderRow (fn [row _ _] [list-view {:dataSource (to-datasource (vals @chats))
(list-item [chat-list-item row])) :renderRow (fn [row _ _]
:style st/list-container}] (list-item [chat-list-item row]))
[action-button {:buttonColor color-blue} :style st/list-container}]
[action-button-item [action-button {:buttonColor color-blue}
{:title "New Chat" [action-button-item
:buttonColor :#9b59b6 {:title "New Chat"
:onPress #(dispatch [:navigate-to :contact-list])} :buttonColor :#9b59b6
[icon {:name :android-create :onPress #(dispatch [:navigate-to :contact-list])}
:style st/create-icon}]] [icon {:name :android-create
[action-button-item :style st/create-icon}]]
{:title "New Group Chat" [action-button-item
:buttonColor :#1abc9c {:title "New Group Chat"
:onPress #(dispatch [:show-group-new])} :buttonColor :#1abc9c
[icon {:name :person-stalker :onPress #(dispatch [:show-group-new])}
:style st/person-stalker-icon}]]]]))) [icon {:name :person-stalker
:style st/person-stalker-icon}]]]]])))

View File

@ -35,9 +35,9 @@
[text {:style st/menu-item-text} [text {:style st/menu-item-text}
name]]) name]])
(defn drawer-menu [navigator] (defn drawer-menu []
(let [username (subscribe [:get :username])] (let [username (subscribe [:get :username])]
(fn [navigator] (fn []
[view st/drawer-menu [view st/drawer-menu
[view st/user-photo-container [view st/user-photo-container
[user-photo {}]] [user-photo {}]]
@ -72,10 +72,10 @@
[text {:style st/switch-users-text} [text {:style st/switch-users-text}
"Switch users"]]]]))) "Switch users"]]]])))
(defn drawer-view [{:keys [navigator]} items] (defn drawer-view [items]
[drawer-layout-android {:drawerWidth 260 [drawer-layout-android {:drawerWidth 260
:drawerPosition js/React.DrawerLayoutAndroid.positions.Left :drawerPosition js/React.DrawerLayoutAndroid.positions.Left
:render-navigation-view #(r/as-element [drawer-menu navigator]) :render-navigation-view #(r/as-element [drawer-menu])
:ref (fn [drawer] :ref (fn [drawer]
(reset! drawer-atom drawer))} (reset! drawer-atom drawer))}
items]) items])