diff --git a/src/status_im/chat/commands/input.cljs b/src/status_im/chat/commands/input.cljs index f691c49a38..13d614d667 100644 --- a/src/status_im/chat/commands/input.cljs +++ b/src/status_im/chat/commands/input.cljs @@ -118,6 +118,7 @@ (assoc command-props :input-params input-params :current-param-position (current-param-position input-text text-selection) + :cursor-in-the-end? (= (count input-text) text-selection) :command-completion (command-completion input-params params))))))) (defn parse-parameters @@ -146,8 +147,7 @@ input-text (cond-> (str command chat.constants/spacing-char (join-command-args new-params)) (and (not last-param?) - (or (= 0 param-count) - (= param-index (dec param-count)))) + (= param-index param-count)) (str chat.constants/spacing-char))] {:db (-> db (chat/set-chat-ui-props {:validation-messages nil}) @@ -170,3 +170,8 @@ [{:keys [db] :as cofx} command-message-id] (let [current-chat-id (:current-chat-id db)] {:db (assoc-in db [:chats current-chat-id :metadata :responding-to-command] command-message-id)})) + +(fx/defn clean-custom-params + [{:keys [db] :as cofx}] + (let [current-chat-id (:current-chat-id db)] + {:db (assoc-in db [:chats current-chat-id :custom-params] nil)})) diff --git a/src/status_im/chat/commands/sending.cljs b/src/status_im/chat/commands/sending.cljs index ab749495f3..7b1505b870 100644 --- a/src/status_im/chat/commands/sending.cljs +++ b/src/status_im/chat/commands/sending.cljs @@ -39,6 +39,7 @@ (fx/merge cofx #(protocol/on-send type command-message %) (commands.input/set-command-reference nil) + (commands.input/clean-custom-params) (chat.message/send-message command-message))))))) (fx/defn send @@ -48,4 +49,5 @@ (fx/merge cofx #(protocol/on-send type (commands/enrich-command-message-for-events db command-message) %) (commands.input/set-command-reference nil) - (chat.message/send-message command-message)))) + (commands.input/clean-custom-params) + (chat.message/send-message command-message)))) \ No newline at end of file diff --git a/src/status_im/chat/subs.cljs b/src/status_im/chat/subs.cljs index 02a442bb9c..a4ba494482 100644 --- a/src/status_im/chat/subs.cljs +++ b/src/status_im/chat/subs.cljs @@ -233,8 +233,8 @@ :chats/input-placeholder :<- [:chats/current-chat] :<- [:chats/selected-chat-command] - (fn [[{:keys [input-text]} {:keys [params current-param-position]}]] - (when (string/ends-with? (or input-text "") chat.constants/spacing-char) + (fn [[{:keys [input-text]} {:keys [params current-param-position cursor-in-the-end?]}]] + (when (and cursor-in-the-end? (string/ends-with? (or input-text "") chat.constants/spacing-char)) (get-in params [current-param-position :placeholder])))) (re-frame/reg-sub diff --git a/src/status_im/ui/screens/chat/input/parameter_box.cljs b/src/status_im/ui/screens/chat/input/parameter_box.cljs index 9390fb86af..f5e3a940de 100644 --- a/src/status_im/ui/screens/chat/input/parameter_box.cljs +++ b/src/status_im/ui/screens/chat/input/parameter_box.cljs @@ -7,7 +7,7 @@ (defview parameter-box-container [] (letsubs [parameter-box [:chats/parameter-box]] (when parameter-box - [react/view style/root + [react/view [parameter-box]]))) (defview parameter-box-view [] diff --git a/src/status_im/ui/screens/chat/styles/animations.cljs b/src/status_im/ui/screens/chat/styles/animations.cljs index 9f70aee389..03e8cf6d52 100644 --- a/src/status_im/ui/screens/chat/styles/animations.cljs +++ b/src/status_im/ui/screens/chat/styles/animations.cljs @@ -19,6 +19,10 @@ :bottom bottom :position :absolute :elevation 2 + :shadow-offset {:width 0 :height 1} + :shadow-radius 12 + :shadow-opacity 0.12 + :shadow-color colors/white :max-height max-height}) (def header-container diff --git a/test/cljs/status_im/test/chat/commands/input.cljs b/test/cljs/status_im/test/chat/commands/input.cljs index 741a13357c..7801ec30c6 100644 --- a/test/cljs/status_im/test/chat/commands/input.cljs +++ b/test/cljs/status_im/test/chat/commands/input.cljs @@ -60,7 +60,7 @@ [:db :chats "test" :input-text]))) (is (= "/test-command first-value second-value \"last value\"" (get-in (input/set-command-parameter (create-cofx "/test-command first-value second-value") - false 2 "last value") + true 2 "last value") [:db :chats "test" :input-text])))))) (deftest parse-parameters-test