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.components.react :refer [navigator app-registry]]
[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.new-group :refer [new-group]]
[syng-im.components.chat.new-participants :refer [new-participants]]
[syng-im.components.chat.remove-participants :refer [remove-participants]]
[syng-im.participants.views.new :refer [new-participants]]
[syng-im.participants.views.remove :refer [remove-participants]]
[syng-im.utils.logging :as log]
[syng-im.utils.utils :refer [toast]]
[syng-im.navigation :as nav]
@ -34,7 +34,7 @@
(defn app-root []
(let [signed-up (subscribe [:signed-up])
view-id (subscribe [:view-id])]
view-id (subscribe [:view-id])]
(fn []
(case (if @signed-up @view-id :chat)
:add-participants [new-participants]

View File

@ -1,4 +1,4 @@
(ns syng-im.components.chat
(ns syng-im.chat.screen
(:require [clojure.string :as s]
[re-frame.core :refer [subscribe dispatch dispatch-sync]]
[syng-im.components.react :refer [view
@ -11,15 +11,15 @@
list-view
list-item
android?]]
[syng-im.components.chat-styles :as st]
[syng-im.chat.styles.chat :as st]
[syng-im.utils.logging :as log]
[syng-im.resources :as res]
[syng-im.constants :refer [content-type-status]]
[syng-im.utils.listview :refer [to-datasource
to-datasource2]]
[syng-im.components.invertible-scroll-view :refer [invertible-scroll-view]]
[syng-im.components.chat.chat-message :refer [chat-message]]
[syng-im.components.chat.chat-message-new :refer [chat-message-new]]))
[syng-im.chat.views.message :refer [chat-message]]
[syng-im.chat.views.new-message :refer [chat-message-new]]))
(defn contacts-by-identity [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
title-font
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
color-light-blue-transparent
color-white
@ -312,18 +312,3 @@
(def new-message-container
{:backgroundColor color-white
: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]
[re-frame.core :refer [subscribe dispatch]]
[syng-im.components.react :refer [view
text
image
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
parse-command-request]]
[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
[re-frame.core :refer [subscribe]]
[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.money :refer [money-input-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]
[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
(:require [syng-im.resources :as res]
[re-frame.core :refer [subscribe dispatch dispatch-sync]]
(ns syng-im.participants.views.contact
(:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
[syng-im.components.react :refer [view]]
[syng-im.components.contact-list.contact-inner :refer [contact-inner-view]]
[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)]
(fn []
[view {:style {:flexDirection "row"
:marginTop 5
:marginBottom 5
:paddingLeft 15
:paddingRight 15
:height 75}}
(fn [{:keys [whisper-identity] :as contact}]
[view st/participant-container
[item-checkbox {:onToggle (fn [checked?]
(reset! checked checked?)
(dispatch [:select-new-participant whisper-identity checked?]))

View File

@ -1,27 +1,27 @@
(ns syng-im.components.chat.new-participants
(ns syng-im.participants.views.new
(:require [re-frame.core :refer [subscribe dispatch]]
[syng-im.resources :as res]
[syng-im.components.react :refer [view]]
[syng-im.components.realm :refer [list-view]]
[syng-im.components.toolbar :refer [toolbar]]
[syng-im.utils.listview :refer [to-realm-datasource]]
[syng-im.components.chats.new-participant-contact
:refer [new-participant-contact]]
[syng-im.participants.views.contact
:refer [participant-contact]]
[reagent.core :as r]
[syng-im.components.chat.chat-message-styles :as st]))
[syng-im.participants.styles :as st]))
(defn new-participants-toolbar [navigator]
[toolbar
{:navigator navigator
:title "Add Participants"
:action {:image {:source res/v ;; {:uri "icon_search"}
:action {:image {:source res/v ;; {:uri "icon_search"}
:style st/new-participant-image}
:handler #(dispatch [:add-new-participants navigator])}}])
(defn new-participants-row [navigator]
(fn [row _ _]
(r/as-element
[new-participant-contact (js->clj row :keywordize-keys true) navigator])))
(defn new-participants-row
[row _ _]
(r/as-element
[participant-contact (js->clj row :keywordize-keys true)]))
(defn new-participants [{:keys [navigator]}]
(let [contacts (subscribe [:all-new-contacts])]
@ -29,7 +29,7 @@
(let [contacts-ds (to-realm-datasource @contacts)]
[view st/participants-container
[new-participants-toolbar navigator]
[list-view {:dataSource contacts-ds
[list-view {:dataSource contacts-ds
:enableEmptySections true
:renderRow (new-participants-row navigator)
:style st/participants-list}]]))))
:renderRow new-participants-row
: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]]
[syng-im.resources :as res]
[syng-im.components.react :refer [view text-input text image
@ -6,10 +6,10 @@
[syng-im.components.realm :refer [list-view]]
[syng-im.components.toolbar :refer [toolbar]]
[syng-im.utils.listview :refer [to-realm-datasource]]
[syng-im.components.chats.new-participant-contact
:refer [new-participant-contact]]
[syng-im.participants.views.contact
:refer [participant-contact]]
[reagent.core :as r]
[syng-im.components.chat.chat-message-styles :as st]))
[syng-im.participants.styles :as st]))
(defn remove-participants-toolbar [navigator]
[toolbar
@ -19,10 +19,10 @@
:image {:source res/trash-icon ;; {:uri "icon_search"}
:style st/remove-participants-image}}}])
(defn remove-participants-row [navigator]
(fn [row _ _]
(r/as-element
[new-participant-contact (js->clj row :keywordize-keys true) navigator])))
(defn remove-participants-row
[row _ _]
(r/as-element
[participant-contact (js->clj row :keywordize-keys true)]))
(defn remove-participants [{:keys [navigator]}]
(let [contacts (subscribe [:current-chat-contacts])]
@ -30,7 +30,7 @@
(let [contacts-ds (to-realm-datasource @contacts)]
[view st/participants-container
[remove-participants-toolbar navigator]
[list-view {:dataSource contacts-ds
[list-view {:dataSource contacts-ds
:enableEmptySections true
:renderRow (remove-participants-row navigator)
:style st/participants-list}]]))))
:renderRow remove-participants-row
:style st/participants-list}]]))))