Merge branch 'feature/#123' into feature/command-suggestions-animation
This commit is contained in:
commit
463c824e57
|
@ -1,15 +1,15 @@
|
||||||
(ns status-im.chat.styles.message
|
(ns status-im.chat.styles.message
|
||||||
(:require [status-im.components.styles :refer [font
|
(:require [status-im.components.styles :refer [font
|
||||||
color-light-blue-transparent
|
color-light-blue-transparent
|
||||||
color-white
|
color-white
|
||||||
color-black
|
color-black
|
||||||
color-blue
|
color-blue
|
||||||
selected-message-color
|
selected-message-color
|
||||||
online-color
|
online-color
|
||||||
text1-color
|
text1-color
|
||||||
text2-color]]
|
text2-color]]
|
||||||
[status-im.constants :refer [text-content-type
|
[status-im.constants :refer [text-content-type
|
||||||
content-type-command]]))
|
content-type-command]]))
|
||||||
|
|
||||||
(def style-message-text
|
(def style-message-text
|
||||||
{:fontSize 14
|
{:fontSize 14
|
||||||
|
@ -154,13 +154,12 @@
|
||||||
:transform [{:scale scale}]})
|
:transform [{:scale scale}]})
|
||||||
|
|
||||||
(def command-image-view
|
(def command-image-view
|
||||||
{:position :absolute
|
{:position :absolute
|
||||||
:top 0
|
:top 0
|
||||||
:right 0
|
:right 0
|
||||||
:width 24
|
:width 24
|
||||||
:height 24
|
:height 24
|
||||||
:borderRadius 50
|
:alignItems :center})
|
||||||
:alignItems :center})
|
|
||||||
|
|
||||||
(def command-request-image
|
(def command-request-image
|
||||||
{:position :absolute
|
{:position :absolute
|
||||||
|
@ -195,9 +194,9 @@
|
||||||
|
|
||||||
(def command-image
|
(def command-image
|
||||||
{:margin-top 5
|
{:margin-top 5
|
||||||
:width 12
|
:width 12
|
||||||
:height 13
|
:height 13
|
||||||
:tintColor :#a9a9a9cc})
|
:tint-color :#a9a9a9cc})
|
||||||
|
|
||||||
(def command-text
|
(def command-text
|
||||||
(merge style-message-text
|
(merge style-message-text
|
||||||
|
|
|
@ -56,26 +56,22 @@
|
||||||
[view st/track-mark]
|
[view st/track-mark]
|
||||||
[text {:style st/track-duration-text} "03:39"]]])
|
[text {:style st/track-duration-text} "03:39"]]])
|
||||||
|
|
||||||
(defn message-content-command [content preview]
|
(defview message-content-command [content preview]
|
||||||
(let [commands-atom (subscribe [:get-commands-and-responses])]
|
[commands [:get-commands-and-responses]]
|
||||||
(fn [content preview]
|
(let [{:keys [command content]} (parse-command-msg-content commands content)
|
||||||
(let [commands @commands-atom
|
{:keys [name icon type]} command]
|
||||||
{:keys [command content]}
|
[view st/content-command-view
|
||||||
(parse-command-msg-content commands content)]
|
[view st/command-container
|
||||||
[view st/content-command-view
|
[view (st/command-view command)
|
||||||
[view st/command-container
|
[text {:style st/command-name}
|
||||||
[view (st/command-view command)
|
(str (if (= :command type) "!" "") name)]]]
|
||||||
[text {:style st/command-name}
|
(when icon
|
||||||
(str "!" (:name command))]]]
|
[view st/command-image-view
|
||||||
;; todo doesn't reflect design
|
[image {:source {:uri icon}
|
||||||
(when-let [icon (:icon command)]
|
:style st/command-image}]])
|
||||||
[view st/command-image-view
|
(if preview
|
||||||
[image {:source {:uri icon}
|
preview
|
||||||
:style st/command-image}]])
|
[text {:style st/command-text} content])]))
|
||||||
(if preview
|
|
||||||
preview
|
|
||||||
[text {:style st/command-text}
|
|
||||||
content])]))))
|
|
||||||
|
|
||||||
(defn set-chat-command [msg-id command]
|
(defn set-chat-command [msg-id command]
|
||||||
(dispatch [:set-response-chat-command msg-id (keyword (:name command))]))
|
(dispatch [:set-response-chat-command msg-id (keyword (:name command))]))
|
||||||
|
|
|
@ -61,11 +61,16 @@
|
||||||
(get-hash-by-file file))]
|
(get-hash-by-file file))]
|
||||||
(assoc db ::valid-hash valid?)))
|
(assoc db ::valid-hash valid?)))
|
||||||
|
|
||||||
|
(defn mark-as [as coll]
|
||||||
|
(->> coll
|
||||||
|
(map (fn [[k v]] [k (assoc v :type as)]))
|
||||||
|
(into {})))
|
||||||
|
|
||||||
(defn add-commands
|
(defn add-commands
|
||||||
[db [id _ {:keys [commands responses]}]]
|
[db [id _ {:keys [commands responses]}]]
|
||||||
(-> db
|
(-> db
|
||||||
(update-in [:chats id :commands] merge commands)
|
(update-in [:chats id :commands] merge (mark-as :command commands))
|
||||||
(update-in [:chats id :responses] merge responses)))
|
(update-in [:chats id :responses] merge (mark-as :response responses))))
|
||||||
|
|
||||||
(defn save-commands-js!
|
(defn save-commands-js!
|
||||||
[_ [id file]]
|
[_ [id file]]
|
||||||
|
|
Loading…
Reference in New Issue