-
Notifications
You must be signed in to change notification settings - Fork 984
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix lint errors Add edit action props Add illustration Update bottom_actions test Update usages and docs Fixes Specs Add actions Add tests Update styles Fix naming Roll back derivation path fn Update styles Fix styles
- Loading branch information
Showing
14 changed files
with
283 additions
and
39 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
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
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
20 changes: 20 additions & 0 deletions
20
src/status_im2/contexts/wallet/create_account/edit_derivation_path/component_spec.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,20 @@ | ||
(ns status-im2.contexts.wallet.create-account.edit-derivation-path.component-spec | ||
(:require | ||
[status-im2.contexts.wallet.create-account.edit-derivation-path.view :as edit-derivation-path] | ||
[test-helpers.component :as h])) | ||
|
||
(h/describe "Edit derivation path page" | ||
(h/test "Default render" | ||
(h/render [edit-derivation-path/view {}]) | ||
(h/is-truthy (h/get-by-translation-text :t/edit-derivation-path)) | ||
(h/is-truthy (h/get-by-translation-text :t/path-format)) | ||
(h/is-truthy (h/get-by-translation-text :t/derivation-path)) | ||
(h/is-truthy (h/get-by-translation-text :t/reveal-address)) | ||
(h/is-truthy (h/get-by-translation-text :t/save)) | ||
|
||
|
||
(h/fire-event :press (h/get-by-translation-text :t/reveal-address)) | ||
(h/wait-for #(h/is-truthy (h/get-by-translation-text :t/address-activity))) | ||
|
||
(h/fire-event :press (h/get-by-translation-text :t/reset)) | ||
(h/wait-for #(h/is-truthy (h/get-by-translation-text :t/derive-addresses))))) |
49 changes: 49 additions & 0 deletions
49
src/status_im2/contexts/wallet/create_account/edit_derivation_path/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,49 @@ | ||
(ns status-im2.contexts.wallet.create-account.edit-derivation-path.style | ||
(:require [quo.foundations.colors :as colors])) | ||
|
||
(defn screen | ||
[top] | ||
{:flex 1 | ||
:margin-top top}) | ||
|
||
(def header | ||
{:padding-horizontal 20 | ||
:padding-top 12 | ||
:padding-bottom 8}) | ||
|
||
(def tag | ||
{:padding-horizontal 20 | ||
:flex-direction :row}) | ||
|
||
(def input-container | ||
{:padding-horizontal 20 | ||
:padding-top 12}) | ||
|
||
(defn save-button-container | ||
[bottom] | ||
{:flex 1 | ||
:justify-content :flex-end | ||
:padding-bottom bottom}) | ||
|
||
(def revealed-address-container | ||
{:padding-horizontal 20 | ||
:padding-top 24}) | ||
|
||
(defn revealed-address | ||
[theme] | ||
{:border-width 1 | ||
:border-color (colors/resolve-color :success theme 40) | ||
:border-style :dashed | ||
:border-radius 16 | ||
:padding-horizontal 12 | ||
:padding-vertical 7}) | ||
|
||
(def info | ||
{:margin-vertical 9 | ||
:padding-left 2}) | ||
|
||
(def temporal-placeholder | ||
{:height 94 | ||
:background-color colors/danger-50 | ||
:align-items :center | ||
:justify-content :center}) |
114 changes: 114 additions & 0 deletions
114
src/status_im2/contexts/wallet/create_account/edit_derivation_path/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,114 @@ | ||
(ns status-im2.contexts.wallet.create-account.edit-derivation-path.view | ||
(:require | ||
[quo.core :as quo] | ||
[quo.theme :as quo.theme] | ||
[react-native.core :as rn] | ||
[react-native.safe-area :as safe-area] | ||
[reagent.core :as reagent] | ||
[status-im2.contexts.wallet.common.temp :as temp] | ||
[status-im2.contexts.wallet.common.utils :as utils] | ||
[status-im2.contexts.wallet.create-account.edit-derivation-path.style :as style] | ||
[utils.i18n :as i18n] | ||
[utils.re-frame :as rf])) | ||
|
||
(defn- view-internal | ||
"States: | ||
default(filled) | ||
| -> (reveal-action) -> show | ||
| -> (clear-action) -> empty -> (derive-action) -> choose -> (choose-action) -> show" | ||
[] | ||
(let [top (safe-area/get-top) | ||
bottom (safe-area/get-bottom) | ||
state (reagent/atom :default) | ||
reveal-action #(reset! state :show) | ||
clear-action #(reset! state :empty) | ||
derive-action #(reset! state :choose) | ||
choose-action #(reset! state :show) | ||
path-value (reagent/atom (utils/formatted-derivation-path 3)) | ||
handle-path-change (fn [v] | ||
(reset! path-value v) | ||
(when (empty? v) | ||
(clear-action))) | ||
reset-path-value (fn [_] | ||
(reset! path-value "") | ||
(clear-action))] | ||
(fn [{:keys [theme]}] | ||
[rn/view | ||
{:style (style/screen top)} | ||
[quo/page-nav | ||
{:background :blur | ||
:icon-name :i/close | ||
:on-press #(rf/dispatch [:navigate-back])}] | ||
[quo/text | ||
{:size :heading-1 | ||
:weight :semi-bold | ||
:style style/header} | ||
(i18n/label :t/edit-derivation-path)] | ||
[rn/view {:style style/tag} | ||
[quo/context-tag | ||
{:type :icon | ||
:size 24 | ||
:icon :i/placeholder | ||
:style style/tag | ||
:context "Alisher Card"}]] | ||
[rn/view {:style style/temporal-placeholder} | ||
[quo/text "Dropdown input will be here"] | ||
[quo/text (i18n/label :t/path-format)]] | ||
[quo/input | ||
{:container-style style/input-container | ||
:value @path-value | ||
:label (i18n/label :t/derivation-path) | ||
:placeholder (utils/formatted-derivation-path 3) | ||
:button {:on-press reset-path-value | ||
:text (i18n/label :t/reset)} | ||
:on-change-text handle-path-change}] | ||
|
||
(cond | ||
(= @state :default) | ||
[quo/bottom-actions | ||
{:theme theme | ||
:actions :1-action | ||
:button-one-label (i18n/label :t/reveal-address) | ||
:button-one-props {:type :outline | ||
:icon-left :i/keycard-card | ||
:on-press reveal-action}}] | ||
|
||
(= @state :empty) | ||
[quo/bottom-actions | ||
{:theme theme | ||
:actions :1-action | ||
:button-one-label (i18n/label :t/derive-addresses) | ||
:button-one-props {:type :outline | ||
:icon-left :i/keycard-card | ||
:on-press derive-action}}] | ||
|
||
(= @state :show) | ||
[rn/view {:style style/revealed-address-container} | ||
[rn/view {:style (style/revealed-address theme)} | ||
[quo/text | ||
{:weight :monospace} | ||
temp/address]] | ||
[quo/info-message | ||
{:type :success | ||
:icon :i/done | ||
:style style/info} | ||
(i18n/label :t/address-activity)]] | ||
|
||
(= @state :choose) | ||
[rn/view {:style style/temporal-placeholder} | ||
[quo/text "Dropdown input will be here"] | ||
[quo/button | ||
{:on-press (fn [_] | ||
(reset! path-value (utils/formatted-derivation-path 1)) | ||
(choose-action))} "Choose"]]) | ||
|
||
[rn/view {:style (style/save-button-container bottom)} | ||
[quo/bottom-actions | ||
{:theme theme | ||
:actions :1-action | ||
:button-one-label (i18n/label :t/save) | ||
:button-one-props {:type :primary | ||
:on-press #(js/alert "Save!") | ||
:disabled? true}}]]]))) | ||
|
||
(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
(ns status-im2.core-spec | ||
(:require | ||
[status-im2.contexts.chat.messages.content.audio.component-spec] | ||
[status-im2.contexts.communities.actions.community-options.component-spec])) | ||
[status-im2.contexts.communities.actions.community-options.component-spec] | ||
[status-im2.contexts.wallet.create-account.edit-derivation-path.component-spec])) |
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
Oops, something went wrong.