fix keycard redundant screen (#13922)

This commit is contained in:
Parvesh Monu 2022-09-07 15:24:33 +05:30 committed by GitHub
parent 8b01a4ac6c
commit d7bbe1ceec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 54 additions and 52 deletions

View File

@ -6,6 +6,7 @@
[status-im.ui.components.react :as react] [status-im.ui.components.react :as react]
[status-im.ui.components.icons.icons :as icons] [status-im.ui.components.icons.icons :as icons]
[status-im.i18n.i18n :as i18n] [status-im.i18n.i18n :as i18n]
[status-im.utils.handlers :refer [<sub]]
[status-im.react-native.resources :as resources] [status-im.react-native.resources :as resources]
[status-im.ui.components.tooltip.views :as tooltip] [status-im.ui.components.tooltip.views :as tooltip]
[status-im.ui.components.topbar :as topbar] [status-im.ui.components.topbar :as topbar]
@ -264,56 +265,57 @@
:after :main-icon/next} :after :main-icon/next}
(i18n/label :t/confirm)]}]]])) (i18n/label :t/confirm)]}]]]))
(defview recovery-phrase-confirm-word [] (defn recovery-phrase-confirm-word []
(letsubs [word [:keycard-recovery-phrase-word] (let [word (<sub [:keycard-recovery-phrase-word])]
input-word [:keycard-recovery-phrase-input-word] (fn []
error [:keycard-recovery-phrase-confirm-error]] (let [input-word (<sub [:keycard-recovery-phrase-input-word])
(let [{:keys [idx]} word] error (<sub [:keycard-recovery-phrase-confirm-error])
[react/keyboard-avoiding-view {:style styles/container {:keys [idx]} word]
:ignore-offset true} [react/keyboard-avoiding-view {:style styles/container
[topbar/topbar :ignore-offset true}
{:navigation {:on-press #(re-frame/dispatch [::keycard.onboarding/cancel-pressed]) [topbar/topbar
:accessibility-label :cancel-keycard-setup {:navigation {:on-press #(re-frame/dispatch [::keycard.onboarding/cancel-pressed])
:label (i18n/label :t/cancel)} :accessibility-label :cancel-keycard-setup
:title (i18n/label :t/step-i-of-n {:step "3" :label (i18n/label :t/cancel)}
:number "3"})}] :title (i18n/label :t/step-i-of-n {:step "3"
[react/view {:flex 1 :number "3"})}]
:flex-direction :column [react/view {:flex 1
:justify-content :space-between :flex-direction :column
:align-items :center} :justify-content :space-between
[react/view {:flex-direction :column :align-items :center}
:align-items :center} [react/view {:flex-direction :column
[react/view {:margin-top 16} :align-items :center}
[react/text {:style {:typography :header [react/view {:margin-top 16}
:text-align :center}} [react/text {:style {:typography :header
(i18n/label :t/keycard-recovery-phrase-confirm-header)]] :text-align :center}}
[react/view {:margin-top 16 (i18n/label :t/keycard-recovery-phrase-confirm-header)]]
:align-items :center} [react/view {:margin-top 16
[react/text {:style {:typography :header :align-items :center}
:color colors/gray [react/text {:style {:typography :header
:text-align :center} :color colors/gray
:accessibility-label :word-number} :text-align :center}
:accessibility-label :word-number}
(i18n/label :t/word-n {:number (inc idx)})]]] (i18n/label :t/word-n {:number (inc idx)})]]]
[react/view {:flex 1 [react/view {:flex 1
:padding 16 :padding 16
:justify-content :center} :justify-content :center}
[quo/text-input [quo/text-input
{:on-change-text #(re-frame/dispatch [:keycard.onboarding.recovery-phrase-confirm-word.ui/input-changed %]) {:on-change-text #(re-frame/dispatch [:keycard.onboarding.recovery-phrase-confirm-word.ui/input-changed %])
:auto-focus true :auto-focus true
:on-submit-editing #(re-frame/dispatch [:keycard.onboarding.recovery-phrase-confirm-word.ui/input-submitted]) :on-submit-editing #(re-frame/dispatch [:keycard.onboarding.recovery-phrase-confirm-word.ui/input-submitted])
:placeholder (i18n/label :t/word-n {:number (inc idx)}) :placeholder (i18n/label :t/word-n {:number (inc idx)})
:auto-correct false :auto-correct false
:accessibility-label :enter-word :accessibility-label :enter-word
:monospace true}] :monospace true}]
[react/view {:margin-top 5 [react/view {:margin-top 5
:width 250} :width 250}
[tooltip/tooltip error]]] [tooltip/tooltip error]]]
[bottom-toolbar/toolbar [bottom-toolbar/toolbar
{:right {:right
[quo/button {:on-press #(re-frame/dispatch [:keycard.onboarding.recovery-phrase-confirm-word.ui/next-pressed]) [quo/button {:on-press #(re-frame/dispatch [:keycard.onboarding.recovery-phrase-confirm-word.ui/next-pressed])
:accessibility-label :next :accessibility-label :next
:disabled (empty? input-word) :disabled (empty? input-word)
:type :secondary :type :secondary
:after :main-icon/next} :after :main-icon/next}
(i18n/label :t/next)]}]]]))) (i18n/label :t/next)]}]]]))))