-
Notifications
You must be signed in to change notification settings - Fork 985
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wallet: generate new keypair UI (#18045)
* feat: new keypair flow ui
- Loading branch information
1 parent
a141bff
commit 8b41c66
Showing
6 changed files
with
206 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/status_im2/contexts/wallet/create_account/backup_recovery_phrase/style.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
(ns status-im2.contexts.wallet.create-account.backup-recovery-phrase.style | ||
(:require | ||
[quo.foundations.colors :as colors] | ||
[quo.theme :as quo.theme] | ||
[react-native.platform :as platform])) | ||
|
||
(def header-container | ||
{:margin-horizontal 20 | ||
:margin-vertical 12}) | ||
|
||
(defn seed-phrase-container | ||
[theme] | ||
{:margin-horizontal 20 | ||
:padding-horizontal 12 | ||
:border-width 1 | ||
:border-color (colors/theme-colors colors/neutral-10 colors/neutral-80 theme) | ||
:border-radius 16 | ||
:background-color (colors/theme-colors colors/white colors/neutral-80-opa-40 theme) | ||
:flex-direction :row}) | ||
|
||
(def word-item | ||
{:align-items :center | ||
:flex-direction :row}) | ||
|
||
(defn separator | ||
[theme] | ||
{:margin-vertical 12 | ||
:margin-horizontal 12 | ||
:border-width (when platform/ios? 1) | ||
:border-right-width (when platform/android? 1) | ||
:border-color (colors/theme-colors colors/neutral-10 colors/neutral-80 theme) | ||
:border-style :dashed}) | ||
|
||
(def step-item | ||
{:flex-direction :row | ||
:margin-vertical 8 | ||
:align-items :center}) | ||
|
||
(def blur-container | ||
{:position :absolute | ||
:left 0 | ||
:right 0 | ||
:top 0 | ||
:bottom 0 | ||
:border-radius 16 | ||
:overflow :hidden}) | ||
|
||
(defn blur | ||
[theme] | ||
{:style {:flex 1} | ||
:blur-radius 20 | ||
:blur-type (quo.theme/theme-value :light :dark theme) | ||
:blur-amount 20}) | ||
|
||
(def slide-button | ||
{:position :absolute | ||
:bottom 12 | ||
:left 0 | ||
:right 0}) | ||
|
||
(defn description-text | ||
[theme] | ||
{:margin-horizontal 40 | ||
:text-align :center | ||
:color (colors/theme-colors colors/neutral-80-opa-70 colors/white-opa-70 theme)}) |
95 changes: 95 additions & 0 deletions
95
src/status_im2/contexts/wallet/create_account/backup_recovery_phrase/view.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
(ns status-im2.contexts.wallet.create-account.backup-recovery-phrase.view | ||
(:require | ||
[quo.core :as quo] | ||
[quo.theme :as quo.theme] | ||
[react-native.blur :as blur] | ||
[react-native.core :as rn] | ||
[reagent.core :as reagent] | ||
[status-im2.contexts.wallet.common.temp :as temp] | ||
[status-im2.contexts.wallet.create-account.backup-recovery-phrase.style :as style] | ||
[utils.i18n :as i18n] | ||
[utils.re-frame :as rf])) | ||
|
||
(defn- word-item | ||
[item index _ increment] | ||
[rn/view {:style style/word-item} | ||
[quo/counter {:type :grey} (+ index increment)] | ||
[quo/text {:style {:margin-left 4}} item]]) | ||
|
||
(defn- words-column | ||
[words first-half?] | ||
[rn/flat-list | ||
{:style {:padding-vertical 8} | ||
:data (if first-half? (subvec words 0 6) (subvec words 6)) | ||
:separator [rn/view {:style {:height 12}}] | ||
:render-fn word-item | ||
:render-data (if first-half? 1 7) | ||
:scroll-enabled false}]) | ||
|
||
(defn- step-item | ||
[item index _ checked?] | ||
[rn/view {:style style/step-item} | ||
[quo/selectors | ||
{:type :checkbox | ||
:on-change #(swap! checked? assoc (keyword (str index)) %)}] | ||
[quo/text {:style {:margin-left 12}} (i18n/label item)]]) | ||
|
||
(defn- view-internal | ||
[{:keys [theme]}] | ||
(let [step-labels [:t/backup-step-1 :t/backup-step-2 :t/backup-step-3 | ||
:t/backup-step-4] | ||
checked? (reagent/atom | ||
{:0 false | ||
:1 false | ||
:2 false | ||
:3 false}) | ||
revealed? (reagent/atom false) | ||
{:keys [customization-color]} (rf/sub [:profile/profile])] | ||
(fn [] | ||
[rn/view {:style {:flex 1}} | ||
[quo/page-nav | ||
{:icon-name :i/close | ||
:on-press #(rf/dispatch [:navigate-back]) | ||
:accessibility-label :top-bar}] | ||
[quo/text-combinations | ||
{:container-style style/header-container | ||
:title (i18n/label :t/backup-recovery-phrase) | ||
:description (i18n/label :t/backup-recovery-phrase-description)}] | ||
[rn/view {:style (style/seed-phrase-container theme)} | ||
[words-column temp/secret-phrase true] | ||
[rn/view {:style (style/separator theme)}] | ||
[words-column temp/secret-phrase false] | ||
(when-not @revealed? | ||
[rn/view {:style style/blur-container} | ||
[blur/view (style/blur theme)]])] | ||
(when-not @revealed? | ||
[rn/view | ||
{:style {:padding-horizontal 20 | ||
:padding-top 20}} | ||
[quo/text | ||
{:weight :semi-bold | ||
:style {:margin-bottom 8}} (i18n/label :t/how-to-backup)] | ||
[rn/flat-list | ||
{:data step-labels | ||
:render-fn step-item | ||
:render-data checked? | ||
:scroll-enabled false}]]) | ||
(if @revealed? | ||
[rn/view {:style style/slide-button} | ||
[quo/bottom-actions | ||
{:button-one-label (i18n/label :t/i-have-written) | ||
:button-one-props {:disabled? (some false? (vals @checked?)) | ||
:customization-color customization-color | ||
:on-press #(js/alert "To be implemented")}}] | ||
[quo/text | ||
{:size :paragraph-2 | ||
:style (style/description-text theme)} | ||
(i18n/label :t/next-you-will)]] | ||
[quo/bottom-actions | ||
{:button-one-label (i18n/label :t/reveal-phrase) | ||
:button-one-props {:disabled? (some false? (vals @checked?)) | ||
:customization-color customization-color | ||
:on-press #(reset! revealed? true)} | ||
:container-style style/slide-button}])]))) | ||
|
||
(def view (quo.theme/with-theme view-internal)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters