From ccb2b4cf98ce6bca60e66816f0e2c7e63327caf6 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Tue, 20 Sep 2016 16:29:23 +0300 Subject: [PATCH] fix #231 --- resources/status.js | 16 +++++++------- src/status_im/chat/handlers/animation.cljs | 21 +++++++++++-------- .../chat/views/command_validation.cljs | 4 ++-- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/resources/status.js b/resources/status.js index b5642359a1..4303bf1de1 100644 --- a/resources/status.js +++ b/resources/status.js @@ -97,17 +97,19 @@ function webView(url) { function validationMessage(titleText, descriptionText) { var titleStyle = { - color: "white", - fontSize: 12, - fontFamily: "sans-serif" + style: { + color: "white", + fontSize: 12 + } }; var title = status.components.text(titleStyle, titleText); var descriptionStyle = { - color: "white", - fontSize: 12, - fontFamily: "sans-serif", - opacity: 0.9 + style: { + color: "white", + fontSize: 12, + opacity: 0.9 + } }; var description = status.components.text(descriptionStyle, descriptionText); diff --git a/src/status_im/chat/handlers/animation.cljs b/src/status_im/chat/handlers/animation.cljs index 3547154f3d..6bfa1ba592 100644 --- a/src/status_im/chat/handlers/animation.cljs +++ b/src/status_im/chat/handlers/animation.cljs @@ -39,18 +39,21 @@ [{:keys [current-chat-id] :as db}] (let [path [:chats current-chat-id :command-input :command :type] type (get-in db path) + command? (= :command type) + response? (not command?) errors (get-in db [:validation-errors current-chat-id]) + validation-errors? (seq errors) suggestion? (get-in db [:has-suggestions? current-chat-id]) custom-errors (get-in db [:custom-validation-errors current-chat-id]) - validation-height (if (or (seq errors) (seq custom-errors)) - request-info-height - 0)] - (+ validation-height - (if (= :response type) - minimum-suggestion-height - (if-not suggestion? - input-height - (+ input-height suggestions-header-height)))))) + custom-errors? (seq custom-errors) + validation-errors? (or validation-errors? custom-errors?)] + (cond-> 0 + validation-errors? (+ request-info-height) + response? (+ minimum-suggestion-height) + command? (+ input-height) + (and suggestion? command?) (+ suggestions-header-height) + custom-errors? (+ suggestions-header-height) + (and command? validation-errors?) (+ suggestions-header-height)))) (register-handler :animate-show-response ;[(after #(dispatch [:command-edit-mode]))] diff --git a/src/status_im/chat/views/command_validation.cljs b/src/status_im/chat/views/command_validation.cljs index 6d7a705bd5..8b69b69bcd 100644 --- a/src/status_im/chat/views/command_validation.cljs +++ b/src/status_im/chat/views/command_validation.cljs @@ -7,8 +7,8 @@ (defn message [{:keys [title description]}] (c/list-item [c/view - [c/text st/title title] - [c/text st/description description]])) + [c/text {:style st/title} title] + [c/text {:style st/description} description]])) (defn messages-list [errors] [c/list-view {:renderRow message