Merge pull request #250 from status-im/bug/#231
Fix styles for validation messages in chat
Former-commit-id: c0fae5b4b7
This commit is contained in:
commit
a694034d20
|
@ -97,17 +97,19 @@ function webView(url) {
|
||||||
|
|
||||||
function validationMessage(titleText, descriptionText) {
|
function validationMessage(titleText, descriptionText) {
|
||||||
var titleStyle = {
|
var titleStyle = {
|
||||||
|
style: {
|
||||||
color: "white",
|
color: "white",
|
||||||
fontSize: 12,
|
fontSize: 12
|
||||||
fontFamily: "sans-serif"
|
}
|
||||||
};
|
};
|
||||||
var title = status.components.text(titleStyle, titleText);
|
var title = status.components.text(titleStyle, titleText);
|
||||||
|
|
||||||
var descriptionStyle = {
|
var descriptionStyle = {
|
||||||
|
style: {
|
||||||
color: "white",
|
color: "white",
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontFamily: "sans-serif",
|
|
||||||
opacity: 0.9
|
opacity: 0.9
|
||||||
|
}
|
||||||
};
|
};
|
||||||
var description = status.components.text(descriptionStyle, descriptionText);
|
var description = status.components.text(descriptionStyle, descriptionText);
|
||||||
|
|
||||||
|
|
|
@ -39,18 +39,21 @@
|
||||||
[{:keys [current-chat-id] :as db}]
|
[{:keys [current-chat-id] :as db}]
|
||||||
(let [path [:chats current-chat-id :command-input :command :type]
|
(let [path [:chats current-chat-id :command-input :command :type]
|
||||||
type (get-in db path)
|
type (get-in db path)
|
||||||
|
command? (= :command type)
|
||||||
|
response? (not command?)
|
||||||
errors (get-in db [:validation-errors current-chat-id])
|
errors (get-in db [:validation-errors current-chat-id])
|
||||||
|
validation-errors? (seq errors)
|
||||||
suggestion? (get-in db [:has-suggestions? current-chat-id])
|
suggestion? (get-in db [:has-suggestions? current-chat-id])
|
||||||
custom-errors (get-in db [:custom-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))
|
custom-errors? (seq custom-errors)
|
||||||
request-info-height
|
validation-errors? (or validation-errors? custom-errors?)]
|
||||||
0)]
|
(cond-> 0
|
||||||
(+ validation-height
|
validation-errors? (+ request-info-height)
|
||||||
(if (= :response type)
|
response? (+ minimum-suggestion-height)
|
||||||
minimum-suggestion-height
|
command? (+ input-height)
|
||||||
(if-not suggestion?
|
(and suggestion? command?) (+ suggestions-header-height)
|
||||||
input-height
|
custom-errors? (+ suggestions-header-height)
|
||||||
(+ input-height suggestions-header-height))))))
|
(and command? validation-errors?) (+ suggestions-header-height))))
|
||||||
|
|
||||||
(register-handler :animate-show-response
|
(register-handler :animate-show-response
|
||||||
;[(after #(dispatch [:command-edit-mode]))]
|
;[(after #(dispatch [:command-edit-mode]))]
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
(defn message [{:keys [title description]}]
|
(defn message [{:keys [title description]}]
|
||||||
(c/list-item
|
(c/list-item
|
||||||
[c/view
|
[c/view
|
||||||
[c/text st/title title]
|
[c/text {:style st/title} title]
|
||||||
[c/text st/description description]]))
|
[c/text {:style st/description} description]]))
|
||||||
|
|
||||||
(defn messages-list [errors]
|
(defn messages-list [errors]
|
||||||
[c/list-view {:renderRow message
|
[c/list-view {:renderRow message
|
||||||
|
|
Loading…
Reference in New Issue