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}
(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 []
[show-actions? [:chat-ui-props :show-actions?]
show-chat-overlay? [:show-chat-overlay?]
accounts [:get :accounts]
show-chat-overlay? [:show-chat-overlay?]
creating? [:get :creating-account?]]
[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?)
:custom-content [toolbar-content-view]
:custom-action [toolbar-action]}]
@ -176,7 +181,6 @@
show-actions? [:chat-ui-props :show-actions?]
show-bottom-info? [:chat-ui-props :show-bottom-info?]
show-emoji? [:chat-ui-props :show-emoji?]
show-chat-overlay? [:show-chat-overlay?]
layout-height [:get :layout-height]
input-text [:chat :input-text]]
{:component-did-mount #(dispatch [:check-autorun])
@ -188,8 +192,7 @@
(dispatch [:set-layout-height height]))))}
[chat-toolbar]
[messages-view group-chat]
(when show-chat-overlay?
[view {:style st/result-box-overlay}])
[overlay-view]
[input/container {:text-empty? (str/blank? input-text)}]
(when show-actions?
[actions-view])

View File

@ -125,10 +125,14 @@
(register-sub
:show-chat-overlay?
(fn [db _]
(let [show-parameter-box? (subscribe [:show-parameter-box?])
result-box (subscribe [:chat-ui-props :result-box])]
(reaction (or @show-parameter-box?
@result-box)))))
(let [{:keys [current-chat-id]} @db
show-parameter-box? (subscribe [:show-parameter-box?])
result-box (subscribe [:chat-ui-props :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
:command-completion