parent
69b1aaebe1
commit
30894b3780
|
@ -41,10 +41,16 @@
|
|||
(defn get-minimum-height
|
||||
[{:keys [current-chat-id] :as db}]
|
||||
(let [path [:chats current-chat-id :command-input :command :type]
|
||||
type (get-in db path)]
|
||||
(if (= :response type)
|
||||
minimum-suggestion-height
|
||||
input-height)))
|
||||
type (get-in db path)
|
||||
errors (get-in db [:validation-errors 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
|
||||
input-height))))
|
||||
|
||||
(register-handler :animate-show-response
|
||||
;[(after #(dispatch [:command-edit-mode]))]
|
||||
|
|
|
@ -183,5 +183,6 @@
|
|||
|
||||
|
||||
(register-handler ::set-validation-error
|
||||
(after #(dispatch [:fix-response-height]))
|
||||
(fn [db [_ chat-id error]]
|
||||
(assoc-in db [:validation-errors chat-id] [error])))
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
(ns status-im.chat.styles.command-validation
|
||||
(:require [status-im.components.styles :as st]))
|
||||
(:require [status-im.components.styles :as st]
|
||||
[status-im.chat.constants :as constants]))
|
||||
|
||||
(def messages-container
|
||||
{:background-color :red
|
||||
:height 61
|
||||
:height constants/request-info-height
|
||||
:padding-left 16
|
||||
:padding-top 14})
|
||||
|
||||
|
|
|
@ -20,12 +20,11 @@
|
|||
[validation-messages [:validation-errors]
|
||||
custom-errors [:custom-validation-errors]
|
||||
command? [:command?]]
|
||||
(when (and command?
|
||||
(or (seq validation-messages)
|
||||
(seq custom-errors)))
|
||||
[c/scroll-view
|
||||
(cond (seq custom-errors)
|
||||
(vec (concat [c/view] custom-errors))
|
||||
[c/view
|
||||
(cond (seq custom-errors)
|
||||
(vec (concat [c/view] custom-errors))
|
||||
|
||||
(seq validation-messages)
|
||||
[messages-list validation-messages])]))
|
||||
(seq validation-messages)
|
||||
[messages-list validation-messages]
|
||||
|
||||
:else nil)])
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
[status-im.chat.views.command :as command]
|
||||
[status-im.chat.styles.message-input :as st]
|
||||
[status-im.chat.styles.plain-message :as st-message]
|
||||
[status-im.chat.styles.response :as st-response]
|
||||
[status-im.chat.views.command-validation :as cv]))
|
||||
[status-im.chat.styles.response :as st-response]))
|
||||
|
||||
(defn send-button [{:keys [on-press accessibility-label]}]
|
||||
[touchable-highlight {:on-press on-press
|
||||
|
@ -56,7 +55,6 @@
|
|||
input-command [:get-chat-command-content]
|
||||
valid-plain-message? [:valid-plain-message?]]
|
||||
[view st/input-container
|
||||
[cv/validation-messages]
|
||||
[view st/input-view
|
||||
[plain-message/commands-button]
|
||||
[message-input-container
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
[status-im.chat.styles.dragdown :as ddst]
|
||||
[status-im.components.animation :as anim]
|
||||
[status-im.chat.suggestions-responder :as resp]
|
||||
[status-im.chat.constants :as c]))
|
||||
[status-im.chat.constants :as c]
|
||||
[status-im.chat.views.command-validation :as cv]))
|
||||
|
||||
(defn drag-icon []
|
||||
[view st/drag-container
|
||||
|
@ -83,8 +84,7 @@
|
|||
|
||||
(defview placeholder []
|
||||
[suggestions [:get-content-suggestions]]
|
||||
(when (seq suggestions)
|
||||
[view st/input-placeholder]))
|
||||
[view st/input-placeholder])
|
||||
|
||||
(defview response-suggestions-view []
|
||||
[suggestions [:get-content-suggestions]]
|
||||
|
@ -95,4 +95,5 @@
|
|||
[container response-height
|
||||
[request-info response-height]
|
||||
[response-suggestions-view]
|
||||
[cv/validation-messages]
|
||||
[placeholder]]))
|
||||
|
|
|
@ -11,4 +11,4 @@
|
|||
(defn register-handler
|
||||
([name handler] (register-handler name nil handler))
|
||||
([name middleware handler]
|
||||
(re-core/register-handler name [debug middleware] handler)))
|
||||
(re-core/register-handler name [#_debug middleware] handler)))
|
||||
|
|
Loading…
Reference in New Issue