From 27ddb24f7b704ff2216ec7f966d586d8bb78fbc1 Mon Sep 17 00:00:00 2001 From: alwx Date: Fri, 10 Feb 2017 14:03:48 +0300 Subject: [PATCH] Magic suggestions area (#772) --- src/status_im/chat/subs.cljs | 3 --- src/status_im/chat/views/response.cljs | 24 +++++++++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/status_im/chat/subs.cljs b/src/status_im/chat/subs.cljs index 45fbd2881f..310f2e3707 100644 --- a/src/status_im/chat/subs.cljs +++ b/src/status_im/chat/subs.cljs @@ -239,14 +239,11 @@ (register-sub :input-margin (fn [] (let [kb-height (subscribe [:get :keyboard-height]) - focused (subscribe [:get :focused]) - mode (subscribe [:kb-mode]) kb-max (subscribe [:get :keyboard-max-height]) show-emoji? (subscribe [:chat-ui-props :show-emoji?])] (reaction (cond @show-emoji? (or @kb-max c/emoji-container-height) ios? @kb-height - (and @focused (= :pan @mode) (pos? @kb-height)) 20 :else 0))))) (register-sub :max-layout-height diff --git a/src/status_im/chat/views/response.cljs b/src/status_im/chat/views/response.cljs index d55e397235..3715238f6b 100644 --- a/src/status_im/chat/views/response.cljs +++ b/src/status_im/chat/views/response.cljs @@ -151,10 +151,20 @@ (when (seq suggestions) suggestions)) (defn response-view [] - (let [response-height (anim/create-value c/input-height)] - [container response-height - [request-info response-height] - [suggestions-web-view] - [response-suggestions-view] - [cv/validation-messages] - [placeholder]])) + (let [response-height (anim/create-value c/input-height) + command (subscribe [:get-chat-command]) + suggestions (subscribe [:get-content-suggestions]) + errors (subscribe [:validation-errors]) + custom-errors (subscribe [:custom-validation-errors])] + (fn [] + (when (or (:fullscreen @command) + (= :response (:type @command)) + (seq @suggestions) + (seq @errors) + (seq @custom-errors)) + [container response-height + [request-info response-height] + [suggestions-web-view] + [response-suggestions-view] + [cv/validation-messages] + [placeholder]]))))