parent
e4e30b85e4
commit
cc850f3d7c
|
@ -16,7 +16,7 @@
|
||||||
(for [command staged-commands]
|
(for [command staged-commands]
|
||||||
^{:key command} [staged-command-view command])])
|
^{:key command} [staged-command-view command])])
|
||||||
|
|
||||||
(defn get-options [{:keys [type placeholder]}]
|
(defn get-options [{:keys [type placeholder]} command-type]
|
||||||
(let [options (case (keyword type)
|
(let [options (case (keyword type)
|
||||||
:phone {:input-options {:keyboardType :phone-pad}
|
:phone {:input-options {:keyboardType :phone-pad}
|
||||||
:validator valid-mobile-number?}
|
:validator valid-mobile-number?}
|
||||||
|
@ -24,13 +24,18 @@
|
||||||
:number {:input-options {:keyboardType :numeric}}
|
:number {:input-options {:keyboardType :numeric}}
|
||||||
;; todo maybe nil is fine for now :)
|
;; todo maybe nil is fine for now :)
|
||||||
nil #_(throw (js/Error. "Uknown command type")))]
|
nil #_(throw (js/Error. "Uknown command type")))]
|
||||||
(assoc-in options [:input-options :placeholder] "")))
|
(if (= :response command-type)
|
||||||
|
(if placeholder
|
||||||
|
(assoc-in options [:input-options :placeholder] placeholder)
|
||||||
|
options)
|
||||||
|
(assoc-in options [:input-options :placeholder] ""))))
|
||||||
|
|
||||||
(defview show-input []
|
(defview show-input []
|
||||||
[parameter [:get-command-parameter]
|
[parameter [:get-command-parameter]
|
||||||
command? [:command?]]
|
command? [:command?]
|
||||||
|
type [:command-type]]
|
||||||
[plain-message-input-view
|
[plain-message-input-view
|
||||||
(when command? (get-options parameter))])
|
(when command? (get-options parameter type))])
|
||||||
|
|
||||||
(defview chat-message-new []
|
(defview chat-message-new []
|
||||||
[staged-commands [:get-chat-staged-commands]]
|
[staged-commands [:get-chat-staged-commands]]
|
||||||
|
|
Loading…
Reference in New Issue