diff --git a/src/syng_im/android/core.cljs b/src/syng_im/android/core.cljs index a8cf5785f9..329d9081e8 100644 --- a/src/syng_im/android/core.cljs +++ b/src/syng_im/android/core.cljs @@ -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] diff --git a/src/syng_im/components/chat.cljs b/src/syng_im/chat/screen.cljs similarity index 96% rename from src/syng_im/components/chat.cljs rename to src/syng_im/chat/screen.cljs index 9607463a93..579cd44da0 100644 --- a/src/syng_im/components/chat.cljs +++ b/src/syng_im/chat/screen.cljs @@ -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 diff --git a/src/syng_im/components/chat_styles.cljs b/src/syng_im/chat/styles/chat.cljs similarity index 99% rename from src/syng_im/components/chat_styles.cljs rename to src/syng_im/chat/styles/chat.cljs index f66e57ed89..9ebf92eadb 100644 --- a/src/syng_im/components/chat_styles.cljs +++ b/src/syng_im/chat/styles/chat.cljs @@ -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 diff --git a/src/syng_im/components/chat/chat_message_styles.cljs b/src/syng_im/chat/styles/message.cljs similarity index 95% rename from src/syng_im/components/chat/chat_message_styles.cljs rename to src/syng_im/chat/styles/message.cljs index c336fbb8d5..356419841b 100644 --- a/src/syng_im/components/chat/chat_message_styles.cljs +++ b/src/syng_im/chat/styles/message.cljs @@ -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}) diff --git a/src/syng_im/components/chat/chat_message.cljs b/src/syng_im/chat/views/message.cljs similarity index 98% rename from src/syng_im/components/chat/chat_message.cljs rename to src/syng_im/chat/views/message.cljs index cbf794972b..a65cd07825 100644 --- a/src/syng_im/components/chat/chat_message.cljs +++ b/src/syng_im/chat/views/message.cljs @@ -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] diff --git a/src/syng_im/components/chat/chat_message_new.cljs b/src/syng_im/chat/views/new_message.cljs similarity index 94% rename from src/syng_im/components/chat/chat_message_new.cljs rename to src/syng_im/chat/views/new_message.cljs index 545d0052b7..75c28662e0 100644 --- a/src/syng_im/components/chat/chat_message_new.cljs +++ b/src/syng_im/chat/views/new_message.cljs @@ -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]) diff --git a/src/syng_im/participants/styles.cljs b/src/syng_im/participants/styles.cljs new file mode 100644 index 0000000000..482436f30a --- /dev/null +++ b/src/syng_im/participants/styles.cljs @@ -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}) diff --git a/src/syng_im/components/chats/new_participant_contact.cljs b/src/syng_im/participants/views/contact.cljs similarity index 50% rename from src/syng_im/components/chats/new_participant_contact.cljs rename to src/syng_im/participants/views/contact.cljs index 97985c6468..0309fee299 100644 --- a/src/syng_im/components/chats/new_participant_contact.cljs +++ b/src/syng_im/participants/views/contact.cljs @@ -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?])) diff --git a/src/syng_im/components/chat/new_participants.cljs b/src/syng_im/participants/views/new.cljs similarity index 59% rename from src/syng_im/components/chat/new_participants.cljs rename to src/syng_im/participants/views/new.cljs index 91beecf10a..f5073a7879 100644 --- a/src/syng_im/components/chat/new_participants.cljs +++ b/src/syng_im/participants/views/new.cljs @@ -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}]])))) diff --git a/src/syng_im/components/chat/remove_participants.cljs b/src/syng_im/participants/views/remove.cljs similarity index 66% rename from src/syng_im/components/chat/remove_participants.cljs rename to src/syng_im/participants/views/remove.cljs index d9c5053c2d..d475406c8a 100644 --- a/src/syng_im/components/chat/remove_participants.cljs +++ b/src/syng_im/participants/views/remove.cljs @@ -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}]]))))