mirror of
https://github.com/status-im/status-react.git
synced 2025-01-28 19:56:10 +00:00
Fix group chat
This commit is contained in:
parent
1059c47826
commit
69b0dbdb8d
@ -224,12 +224,11 @@
|
|||||||
:dataSource (to-datasource messages)}]))
|
:dataSource (to-datasource messages)}]))
|
||||||
|
|
||||||
(defview chat []
|
(defview chat []
|
||||||
[is-active [:chat :is-active]
|
[group-chat [:chat :group-chat]
|
||||||
group-chat [:chat :group-chat]
|
|
||||||
show-actions-atom [:show-actions]]
|
show-actions-atom [:show-actions]]
|
||||||
[view st/chat-view
|
[view st/chat-view
|
||||||
[chat-toolbar]
|
[chat-toolbar]
|
||||||
[messages-view group-chat]
|
[messages-view group-chat]
|
||||||
(when group-chat [typing-all])
|
(when group-chat [typing-all])
|
||||||
(when is-active [chat-message-new])
|
[chat-message-new]
|
||||||
(when show-actions-atom [actions-view])])
|
(when show-actions-atom [actions-view])])
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
(ns syng-im.group-settings.group-settings
|
(ns syng-im.group-settings.group-settings
|
||||||
|
(:require-macros [syng-im.utils.views :refer [defview]])
|
||||||
(:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
(:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
||||||
[syng-im.resources :as res]
|
[syng-im.resources :as res]
|
||||||
[syng-im.components.react :refer [view
|
[syng-im.components.react :refer [view
|
||||||
@ -38,7 +39,8 @@
|
|||||||
[text {:style st/modal-remove-text}
|
[text {:style st/modal-remove-text}
|
||||||
"Remove"]]]]])
|
"Remove"]]]]])
|
||||||
|
|
||||||
(defn chat-members [members]
|
(defview chat-members []
|
||||||
|
[members [:current-chat-contacts]]
|
||||||
[view st/chat-members-container
|
[view st/chat-members-container
|
||||||
(for [member members]
|
(for [member members]
|
||||||
^{:key member} [member-view member])])
|
^{:key member} [member-view member])])
|
||||||
@ -87,10 +89,9 @@
|
|||||||
[text {:style st/modal-color-picker-save-btn-text}
|
[text {:style st/modal-color-picker-save-btn-text}
|
||||||
"Save"]]]]])))
|
"Save"]]]]])))
|
||||||
|
|
||||||
(defn chat-color-icon []
|
(defview chat-color-icon []
|
||||||
(let [chat-color (subscribe [:get-current-chat-color])]
|
[chat-color [:get-current-chat-color]]
|
||||||
(fn []
|
[view {:style (st/chat-color-icon chat-color)}])
|
||||||
[view {:style (st/chat-color-icon @chat-color)}])))
|
|
||||||
|
|
||||||
(defn settings-view []
|
(defn settings-view []
|
||||||
;; TODO implement settings handlers
|
;; TODO implement settings handlers
|
||||||
@ -121,48 +122,44 @@
|
|||||||
(for [setting settings]
|
(for [setting settings]
|
||||||
^{:key setting} [setting-view setting])]))
|
^{:key setting} [setting-view setting])]))
|
||||||
|
|
||||||
(defn chat-icon []
|
(defview chat-icon []
|
||||||
(let [chat-name (subscribe [:get-current-chat-name])
|
[chat-name [:get-current-chat-name]
|
||||||
chat-color (subscribe [:get-current-chat-color])]
|
chat-color [:get-current-chat-color]]
|
||||||
(fn []
|
[view (st/chat-icon chat-color)
|
||||||
[view (st/chat-icon @chat-color)
|
[text {:style st/chat-icon-text} (nth chat-name 0)]])
|
||||||
[text {:style st/chat-icon-text} (nth @chat-name 0)]])))
|
|
||||||
|
|
||||||
(defn new-group-toolbar []
|
(defn new-group-toolbar []
|
||||||
[toolbar {:title "Chat settings"
|
[toolbar {:title "Chat settings"
|
||||||
:custom-action [chat-icon]}])
|
:custom-action [chat-icon]}])
|
||||||
|
|
||||||
(defn group-settings []
|
(defview group-settings []
|
||||||
(let [chat-name (subscribe [:get-current-chat-name])
|
[chat-name [:get-current-chat-name]
|
||||||
members (subscribe [:current-chat-contacts])
|
selected-member [:selected-group-chat-member]
|
||||||
selected-member (subscribe [:selected-group-chat-member])
|
show-color-picker [:group-settings-show-color-picker]]
|
||||||
show-color-picker (subscribe [:group-settings-show-color-picker])]
|
[view st/group-settings
|
||||||
(fn []
|
[new-group-toolbar]
|
||||||
[view st/group-settings
|
[scroll-view st/body
|
||||||
[new-group-toolbar]
|
[text {:style st/chat-name-text}
|
||||||
[scroll-view st/body
|
"Chat name"]
|
||||||
[text {:style st/chat-name-text}
|
[view st/chat-name-value-container
|
||||||
"Chat name"]
|
[text {:style st/chat-name-value}
|
||||||
[view st/chat-name-value-container
|
chat-name]
|
||||||
[text {:style st/chat-name-value}
|
[touchable-highlight {:style st/chat-name-btn-edit-container
|
||||||
@chat-name]
|
:on-press show-chat-name-edit}
|
||||||
[touchable-highlight {:style st/chat-name-btn-edit-container
|
[text {:style st/chat-name-btn-edit-text}
|
||||||
:on-press show-chat-name-edit}
|
"Edit"]]]
|
||||||
[text {:style st/chat-name-btn-edit-text}
|
[text {:style st/members-text}
|
||||||
"Edit"]]]
|
"Members"]
|
||||||
[text {:style st/members-text}
|
[touchable-highlight {:on-press #(dispatch [:show-add-participants])}
|
||||||
"Members"]
|
[view st/add-members-container
|
||||||
[touchable-highlight {:on-press (fn []
|
[icon :add-gray st/add-members-icon]
|
||||||
(dispatch [:show-add-participants]))}
|
[text {:style st/add-members-text}
|
||||||
[view st/add-members-container
|
"Add members"]]]
|
||||||
[icon :add-gray st/add-members-icon]
|
[chat-members]
|
||||||
[text {:style st/add-members-text}
|
[text {:style st/settings-text}
|
||||||
"Add members"]]]
|
"Settings"]
|
||||||
[chat-members (vals (js->clj @members :keywordize-keys true))]
|
[settings-view]]
|
||||||
[text {:style st/settings-text}
|
(when show-color-picker
|
||||||
"Settings"]
|
[chat-color-picker])
|
||||||
[settings-view]]
|
(when selected-member
|
||||||
(when @show-color-picker
|
[member-menu selected-member])])
|
||||||
[chat-color-picker])
|
|
||||||
(when @selected-member
|
|
||||||
[member-menu @selected-member])])))
|
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
(push-view db :contact-list)))
|
(push-view db :contact-list)))
|
||||||
|
|
||||||
(defn clear-new-participants [db]
|
(defn clear-new-participants [db]
|
||||||
(assoc-in db :new-participants #{}))
|
(assoc db :new-participants #{}))
|
||||||
|
|
||||||
(register-handler :show-remove-participants
|
(register-handler :show-remove-participants
|
||||||
(fn [db _]
|
(fn [db _]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user