chat's views & styles

Former-commit-id: 6932f1c103
This commit is contained in:
Roman Volosovskyi 2016-05-09 18:17:40 +03:00
parent 7a791627d3
commit 0c1ec9a56e
10 changed files with 69 additions and 65 deletions

View File

@ -8,11 +8,11 @@
[syng-im.subs] [syng-im.subs]
[syng-im.components.react :refer [navigator app-registry]] [syng-im.components.react :refer [navigator app-registry]]
[syng-im.components.contact-list.contact-list :refer [contact-list]] [syng-im.components.contact-list.contact-list :refer [contact-list]]
[syng-im.components.chat :refer [chat]] [syng-im.chat.screen :refer [chat]]
[syng-im.components.chats.chats-list :refer [chats-list]] [syng-im.components.chats.chats-list :refer [chats-list]]
[syng-im.components.chats.new-group :refer [new-group]] [syng-im.components.chats.new-group :refer [new-group]]
[syng-im.components.chat.new-participants :refer [new-participants]] [syng-im.participants.views.new :refer [new-participants]]
[syng-im.components.chat.remove-participants :refer [remove-participants]] [syng-im.participants.views.remove :refer [remove-participants]]
[syng-im.utils.logging :as log] [syng-im.utils.logging :as log]
[syng-im.utils.utils :refer [toast]] [syng-im.utils.utils :refer [toast]]
[syng-im.navigation :as nav] [syng-im.navigation :as nav]

View File

@ -1,4 +1,4 @@
(ns syng-im.components.chat (ns syng-im.chat.screen
(:require [clojure.string :as s] (:require [clojure.string :as s]
[re-frame.core :refer [subscribe dispatch dispatch-sync]] [re-frame.core :refer [subscribe dispatch dispatch-sync]]
[syng-im.components.react :refer [view [syng-im.components.react :refer [view
@ -11,15 +11,15 @@
list-view list-view
list-item list-item
android?]] android?]]
[syng-im.components.chat-styles :as st] [syng-im.chat.styles.chat :as st]
[syng-im.utils.logging :as log] [syng-im.utils.logging :as log]
[syng-im.resources :as res] [syng-im.resources :as res]
[syng-im.constants :refer [content-type-status]] [syng-im.constants :refer [content-type-status]]
[syng-im.utils.listview :refer [to-datasource [syng-im.utils.listview :refer [to-datasource
to-datasource2]] to-datasource2]]
[syng-im.components.invertible-scroll-view :refer [invertible-scroll-view]] [syng-im.components.invertible-scroll-view :refer [invertible-scroll-view]]
[syng-im.components.chat.chat-message :refer [chat-message]] [syng-im.chat.views.message :refer [chat-message]]
[syng-im.components.chat.chat-message-new :refer [chat-message-new]])) [syng-im.chat.views.new-message :refer [chat-message-new]]))
(defn contacts-by-identity [contacts] (defn contacts-by-identity [contacts]
(->> contacts (->> contacts

View File

@ -1,4 +1,4 @@
(ns syng-im.components.chat-styles (ns syng-im.chat.styles.chat
(:require [syng-im.components.styles :refer [font (:require [syng-im.components.styles :refer [font
title-font title-font
color-white color-white

View File

@ -1,4 +1,4 @@
(ns syng-im.components.chat.chat-message-styles (ns syng-im.chat.styles.message
(:require [syng-im.components.styles :refer [font (:require [syng-im.components.styles :refer [font
color-light-blue-transparent color-light-blue-transparent
color-white color-white
@ -312,18 +312,3 @@
(def new-message-container (def new-message-container
{:backgroundColor color-white {:backgroundColor color-white
:elevation 4}) :elevation 4})
(def participants-container
{:flex 1
:backgroundColor :white})
(def participants-list
{:backgroundColor :white})
(def new-participant-image
{:width 20
:height 18})
(def remove-participants-image
{:width 22
:height 30})

View File

@ -1,11 +1,11 @@
(ns syng-im.components.chat.chat-message (ns syng-im.chat.views.message
(:require [clojure.string :as s] (:require [clojure.string :as s]
[re-frame.core :refer [subscribe dispatch]] [re-frame.core :refer [subscribe dispatch]]
[syng-im.components.react :refer [view [syng-im.components.react :refer [view
text text
image image
touchable-highlight]] touchable-highlight]]
[syng-im.components.chat.chat-message-styles :as st] [syng-im.chat.styles.message :as st]
[syng-im.models.commands :refer [parse-command-msg-content [syng-im.models.commands :refer [parse-command-msg-content
parse-command-request]] parse-command-request]]
[syng-im.resources :as res] [syng-im.resources :as res]

View File

@ -1,4 +1,4 @@
(ns syng-im.components.chat.chat-message-new (ns syng-im.chat.views.new-message
(:require (:require
[re-frame.core :refer [subscribe]] [re-frame.core :refer [subscribe]]
[syng-im.components.react :refer [view]] [syng-im.components.react :refer [view]]
@ -9,7 +9,7 @@
[syng-im.components.chat.input.confirmation-code :refer [confirmation-code-input-view]] [syng-im.components.chat.input.confirmation-code :refer [confirmation-code-input-view]]
[syng-im.components.chat.input.money :refer [money-input-view]] [syng-im.components.chat.input.money :refer [money-input-view]]
[syng-im.components.chat.input.simple-command-staged :refer [simple-command-staged-view]] [syng-im.components.chat.input.simple-command-staged :refer [simple-command-staged-view]]
[syng-im.components.chat.chat-message-styles :as st])) [syng-im.chat.styles.message :as st]))
(defn staged-command-view [stage-command] (defn staged-command-view [stage-command]
[simple-command-staged-view stage-command]) [simple-command-staged-view stage-command])

View File

@ -0,0 +1,24 @@
(ns syng-im.participants.styles)
(def participants-container
{:flex 1
:backgroundColor :white})
(def participants-list
{:backgroundColor :white})
(def new-participant-image
{:width 20
:height 18})
(def remove-participants-image
{:width 22
:height 30})
(def participant-container
{:flexDirection :row
:marginTop 5
:marginBottom 5
:paddingLeft 15
:paddingRight 15
:height 75})

View File

@ -1,21 +1,16 @@
(ns syng-im.components.chats.new-participant-contact (ns syng-im.participants.views.contact
(:require [syng-im.resources :as res] (:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
[re-frame.core :refer [subscribe dispatch dispatch-sync]]
[syng-im.components.react :refer [view]] [syng-im.components.react :refer [view]]
[syng-im.components.contact-list.contact-inner :refer [contact-inner-view]] [syng-im.components.contact-list.contact-inner :refer [contact-inner-view]]
[syng-im.components.item-checkbox :refer [item-checkbox]] [syng-im.components.item-checkbox :refer [item-checkbox]]
[syng-im.utils.logging :as log] [reagent.core :as r]
[reagent.core :as r])) [syng-im.participants.styles :as st]))
(defn new-participant-contact [{:keys [whisper-identity] :as contact} navigator] (defn participant-contact [{:keys [whisper-identity] :as contact}]
;; todo must be moved to handlers
(let [checked (r/atom false)] (let [checked (r/atom false)]
(fn [] (fn [{:keys [whisper-identity] :as contact}]
[view {:style {:flexDirection "row" [view st/participant-container
:marginTop 5
:marginBottom 5
:paddingLeft 15
:paddingRight 15
:height 75}}
[item-checkbox {:onToggle (fn [checked?] [item-checkbox {:onToggle (fn [checked?]
(reset! checked checked?) (reset! checked checked?)
(dispatch [:select-new-participant whisper-identity checked?])) (dispatch [:select-new-participant whisper-identity checked?]))

View File

@ -1,14 +1,14 @@
(ns syng-im.components.chat.new-participants (ns syng-im.participants.views.new
(:require [re-frame.core :refer [subscribe dispatch]] (:require [re-frame.core :refer [subscribe dispatch]]
[syng-im.resources :as res] [syng-im.resources :as res]
[syng-im.components.react :refer [view]] [syng-im.components.react :refer [view]]
[syng-im.components.realm :refer [list-view]] [syng-im.components.realm :refer [list-view]]
[syng-im.components.toolbar :refer [toolbar]] [syng-im.components.toolbar :refer [toolbar]]
[syng-im.utils.listview :refer [to-realm-datasource]] [syng-im.utils.listview :refer [to-realm-datasource]]
[syng-im.components.chats.new-participant-contact [syng-im.participants.views.contact
:refer [new-participant-contact]] :refer [participant-contact]]
[reagent.core :as r] [reagent.core :as r]
[syng-im.components.chat.chat-message-styles :as st])) [syng-im.participants.styles :as st]))
(defn new-participants-toolbar [navigator] (defn new-participants-toolbar [navigator]
[toolbar [toolbar
@ -18,10 +18,10 @@
:style st/new-participant-image} :style st/new-participant-image}
:handler #(dispatch [:add-new-participants navigator])}}]) :handler #(dispatch [:add-new-participants navigator])}}])
(defn new-participants-row [navigator] (defn new-participants-row
(fn [row _ _] [row _ _]
(r/as-element (r/as-element
[new-participant-contact (js->clj row :keywordize-keys true) navigator]))) [participant-contact (js->clj row :keywordize-keys true)]))
(defn new-participants [{:keys [navigator]}] (defn new-participants [{:keys [navigator]}]
(let [contacts (subscribe [:all-new-contacts])] (let [contacts (subscribe [:all-new-contacts])]
@ -31,5 +31,5 @@
[new-participants-toolbar navigator] [new-participants-toolbar navigator]
[list-view {:dataSource contacts-ds [list-view {:dataSource contacts-ds
:enableEmptySections true :enableEmptySections true
:renderRow (new-participants-row navigator) :renderRow new-participants-row
:style st/participants-list}]])))) :style st/participants-list}]]))))

View File

@ -1,4 +1,4 @@
(ns syng-im.components.chat.remove-participants (ns syng-im.participants.views.remove
(:require [re-frame.core :refer [subscribe dispatch]] (:require [re-frame.core :refer [subscribe dispatch]]
[syng-im.resources :as res] [syng-im.resources :as res]
[syng-im.components.react :refer [view text-input text image [syng-im.components.react :refer [view text-input text image
@ -6,10 +6,10 @@
[syng-im.components.realm :refer [list-view]] [syng-im.components.realm :refer [list-view]]
[syng-im.components.toolbar :refer [toolbar]] [syng-im.components.toolbar :refer [toolbar]]
[syng-im.utils.listview :refer [to-realm-datasource]] [syng-im.utils.listview :refer [to-realm-datasource]]
[syng-im.components.chats.new-participant-contact [syng-im.participants.views.contact
:refer [new-participant-contact]] :refer [participant-contact]]
[reagent.core :as r] [reagent.core :as r]
[syng-im.components.chat.chat-message-styles :as st])) [syng-im.participants.styles :as st]))
(defn remove-participants-toolbar [navigator] (defn remove-participants-toolbar [navigator]
[toolbar [toolbar
@ -19,10 +19,10 @@
:image {:source res/trash-icon ;; {:uri "icon_search"} :image {:source res/trash-icon ;; {:uri "icon_search"}
:style st/remove-participants-image}}}]) :style st/remove-participants-image}}}])
(defn remove-participants-row [navigator] (defn remove-participants-row
(fn [row _ _] [row _ _]
(r/as-element (r/as-element
[new-participant-contact (js->clj row :keywordize-keys true) navigator]))) [participant-contact (js->clj row :keywordize-keys true)]))
(defn remove-participants [{:keys [navigator]}] (defn remove-participants [{:keys [navigator]}]
(let [contacts (subscribe [:current-chat-contacts])] (let [contacts (subscribe [:current-chat-contacts])]
@ -32,5 +32,5 @@
[remove-participants-toolbar navigator] [remove-participants-toolbar navigator]
[list-view {:dataSource contacts-ds [list-view {:dataSource contacts-ds
:enableEmptySections true :enableEmptySections true
:renderRow (remove-participants-row navigator) :renderRow remove-participants-row
:style st/participants-list}]])))) :style st/participants-list}]]))))