Andrey Shovkoplyas 2017-04-20 15:56:30 +03:00 committed by Roman Volosovskyi
parent 6b524cf50d
commit 6da18d3fca
2 changed files with 16 additions and 9 deletions

View File

@ -108,13 +108,18 @@
[text {:style st/add-contact-text} [text {:style st/add-contact-text}
(label :t/add-to-contacts)]]])) (label :t/add-to-contacts)]]]))
(defview overlay-view []
[show-chat-overlay? [:show-chat-overlay?]]
(when show-chat-overlay?
[view {:style st/result-box-overlay}]))
(defview chat-toolbar [] (defview chat-toolbar []
[show-actions? [:chat-ui-props :show-actions?] [show-actions? [:chat-ui-props :show-actions?]
show-chat-overlay? [:show-chat-overlay?]
accounts [:get :accounts] accounts [:get :accounts]
show-chat-overlay? [:show-chat-overlay?]
creating? [:get :creating-account?]] creating? [:get :creating-account?]]
[view (when show-chat-overlay? {:style {:zIndex 0}}) [view (when show-chat-overlay? {:style {:zIndex 0}})
[status-bar {:type (if show-chat-overlay? :overlay :default)}] [status-bar]
[toolbar {:hide-nav? (or (empty? accounts) show-actions? creating?) [toolbar {:hide-nav? (or (empty? accounts) show-actions? creating?)
:custom-content [toolbar-content-view] :custom-content [toolbar-content-view]
:custom-action [toolbar-action]}] :custom-action [toolbar-action]}]
@ -176,7 +181,6 @@
show-actions? [:chat-ui-props :show-actions?] show-actions? [:chat-ui-props :show-actions?]
show-bottom-info? [:chat-ui-props :show-bottom-info?] show-bottom-info? [:chat-ui-props :show-bottom-info?]
show-emoji? [:chat-ui-props :show-emoji?] show-emoji? [:chat-ui-props :show-emoji?]
show-chat-overlay? [:show-chat-overlay?]
layout-height [:get :layout-height] layout-height [:get :layout-height]
input-text [:chat :input-text]] input-text [:chat :input-text]]
{:component-did-mount #(dispatch [:check-autorun]) {:component-did-mount #(dispatch [:check-autorun])
@ -188,8 +192,7 @@
(dispatch [:set-layout-height height]))))} (dispatch [:set-layout-height height]))))}
[chat-toolbar] [chat-toolbar]
[messages-view group-chat] [messages-view group-chat]
(when show-chat-overlay? [overlay-view]
[view {:style st/result-box-overlay}])
[input/container {:text-empty? (str/blank? input-text)}] [input/container {:text-empty? (str/blank? input-text)}]
(when show-actions? (when show-actions?
[actions-view]) [actions-view])

View File

@ -125,10 +125,14 @@
(register-sub (register-sub
:show-chat-overlay? :show-chat-overlay?
(fn [db _] (fn [db _]
(let [show-parameter-box? (subscribe [:show-parameter-box?]) (let [{:keys [current-chat-id]} @db
result-box (subscribe [:chat-ui-props :result-box])] show-parameter-box? (subscribe [:show-parameter-box?])
(reaction (or @show-parameter-box? result-box (subscribe [:chat-ui-props :result-box])
@result-box))))) max-height (subscribe [:get-max-container-area-height])
result-box-height (subscribe [:get-in [:chat-animations current-chat-id :result-box :height]])
parameter-box-height (subscribe [:get-in [:chat-animations current-chat-id :parameter-box :height]])]
(reaction (or (and @show-parameter-box? (or (= @parameter-box-height :max) (< (- @max-height @parameter-box-height) 20)))
(and @result-box (or (= @result-box-height :max) (< (- @max-height @result-box-height) 20))))))))
(register-sub (register-sub
:command-completion :command-completion