Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
parent
6194bbde84
commit
8a355b1e75
|
@ -28,8 +28,7 @@
|
||||||
;; TODO(jeluard) both send and request flows should be merged
|
;; TODO(jeluard) both send and request flows should be merged
|
||||||
(views/letsubs [{:keys [to to-name whisper-identity]} [:wallet.send/transaction]
|
(views/letsubs [{:keys [to to-name whisper-identity]} [:wallet.send/transaction]
|
||||||
{:keys [amount amount-error]} [:wallet.request/transaction]
|
{:keys [amount amount-error]} [:wallet.request/transaction]
|
||||||
scroll (atom nil)
|
scroll (atom nil)]
|
||||||
amount-text-value (atom nil)]
|
|
||||||
[comp/simple-screen {:avoid-keyboard? true}
|
[comp/simple-screen {:avoid-keyboard? true}
|
||||||
[comp/toolbar (i18n/label :t/new-request)]
|
[comp/toolbar (i18n/label :t/new-request)]
|
||||||
[react/view components.styles/flex
|
[react/view components.styles/flex
|
||||||
|
@ -46,8 +45,7 @@
|
||||||
:input-options {:default-value (str (money/to-fixed (money/wei->ether amount)))
|
:input-options {:default-value (str (money/to-fixed (money/wei->ether amount)))
|
||||||
:max-length 21
|
:max-length 21
|
||||||
:on-focus (fn [] (when @scroll (utils/set-timeout #(.scrollToEnd @scroll) 100)))
|
:on-focus (fn [] (when @scroll (utils/set-timeout #(.scrollToEnd @scroll) 100)))
|
||||||
:on-change-text #(reset! amount-text-value %)
|
:on-change-text #(re-frame/dispatch [:wallet.request/set-and-validate-amount %])}}]]]
|
||||||
:on-end-editing #(re-frame/dispatch [:wallet.request/set-and-validate-amount @amount-text-value])}}]]]
|
|
||||||
[bottom-buttons/bottom-buttons styles/bottom-buttons
|
[bottom-buttons/bottom-buttons styles/bottom-buttons
|
||||||
nil ;; Force a phantom button to ensure consistency with other transaction screens which define 2 buttons
|
nil ;; Force a phantom button to ensure consistency with other transaction screens which define 2 buttons
|
||||||
[button/button {:disabled? (not (and to amount))
|
[button/button {:disabled? (not (and to amount))
|
||||||
|
|
|
@ -194,9 +194,15 @@
|
||||||
(when advanced?
|
(when advanced?
|
||||||
[advanced-cartouche transaction modal?])])
|
[advanced-cartouche transaction modal?])])
|
||||||
|
|
||||||
|
(defn update-amount-fn [timeout]
|
||||||
|
(fn [amount]
|
||||||
|
(when @timeout
|
||||||
|
(utils/clear-timeout @timeout))
|
||||||
|
(reset! timeout (utils/set-timeout #(re-frame/dispatch [:wallet.send/set-and-validate-amount amount]) 500))))
|
||||||
|
|
||||||
(defn- send-transaction-panel [{:keys [modal? transaction scroll advanced? symbol]}]
|
(defn- send-transaction-panel [{:keys [modal? transaction scroll advanced? symbol]}]
|
||||||
(let [{:keys [amount amount-error signing? to to-name sufficient-funds? in-progress? from-chat?]} transaction
|
(let [{:keys [amount amount-error signing? to to-name sufficient-funds? in-progress? from-chat?]} transaction
|
||||||
amount-text-value (atom nil)]
|
timeout (atom nil)]
|
||||||
[wallet.components/simple-screen {:avoid-keyboard? (not modal?)
|
[wallet.components/simple-screen {:avoid-keyboard? (not modal?)
|
||||||
:status-bar-type (if modal? :modal-wallet :wallet)}
|
:status-bar-type (if modal? :modal-wallet :wallet)}
|
||||||
[toolbar from-chat? (if modal? act/close-white act/back-white)
|
[toolbar from-chat? (if modal? act/close-white act/back-white)
|
||||||
|
@ -221,8 +227,7 @@
|
||||||
:input-options {:default-value (str (money/to-fixed (money/wei->ether amount)))
|
:input-options {:default-value (str (money/to-fixed (money/wei->ether amount)))
|
||||||
:max-length 21
|
:max-length 21
|
||||||
:on-focus (fn [] (when (and scroll @scroll) (utils/set-timeout #(.scrollToEnd @scroll) 100)))
|
:on-focus (fn [] (when (and scroll @scroll) (utils/set-timeout #(.scrollToEnd @scroll) 100)))
|
||||||
:on-change-text #(reset! amount-text-value %)
|
:on-change-text (update-amount-fn timeout)}}]
|
||||||
:on-end-editing #(re-frame/dispatch [:wallet.send/set-and-validate-amount @amount-text-value])}}]
|
|
||||||
[advanced-options advanced? transaction modal?]]]
|
[advanced-options advanced? transaction modal?]]]
|
||||||
(if signing?
|
(if signing?
|
||||||
[signing-buttons
|
[signing-buttons
|
||||||
|
|
Loading…
Reference in New Issue