Skip to content

Commit

Permalink
resolve issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mmilad75 committed Aug 30, 2023
1 parent 778e1ce commit ea06b4a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 37 deletions.
12 changes: 5 additions & 7 deletions src/quo2/components/wallet/account_origin/component_spec.cljs
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
(ns quo2.components.wallet.account-origin.component-spec
(:require [test-helpers.component :as h]
[quo2.core :as quo]
[utils.i18n :as i18n]))
[quo2.core :as quo]))

(h/describe
"account origin tests"
(h/describe "account origin tests"
(h/test "component renders"
(h/render [quo/account-origin
{:type :recovery-phrase
:stored :on-keycard
:derivation-path "m / 44’ / 60’ / 0’ / 0’ / 2"
:user-name "Alisher Yakupov"
:on-press (h/mock-fn)}])
(h/is-truthy (h/get-by-text (i18n/label "origin"))))
(h/is-truthy (h/get-by-text (h/get-by-translation-text :t/origin))))

(h/test "recovery phrase icon is visible when :type is :recovery-phrase"
(h/render [quo/account-origin
Expand Down Expand Up @@ -66,7 +64,7 @@
:derivation-path "m / 44’ / 60’ / 0’ / 0’ / 2"
:user-name "Alisher Yakupov"
:on-press (h/mock-fn)}])
(h/is-truthy (h/get-by-text (i18n/label "on-device"))))
(h/is-truthy (h/get-by-text (h/get-by-translation-text :t/on-device))))

(h/test "on-keycard text is visible when :stored is :on-keycard"
(h/render [quo/account-origin
Expand All @@ -75,7 +73,7 @@
:derivation-path "m / 44’ / 60’ / 0’ / 0’ / 2"
:user-name "Alisher Yakupov"
:on-press (h/mock-fn)}])
(h/is-truthy (h/get-by-text (i18n/label "on-keycard"))))
(h/is-truthy (h/get-by-text (h/get-by-translation-text :t/on-keycard))))

(h/test "on-press is called when :type is :recovery-phrase"
(let [on-press (h/mock-fn)]
Expand Down
12 changes: 3 additions & 9 deletions src/quo2/components/wallet/account_origin/style.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
[theme]
{:border-radius 16
:border-width 1
:border-color (colors/theme-colors colors/neutral-10
colors/neutral-80
theme)})
:border-color (colors/theme-colors colors/neutral-10 colors/neutral-80 theme)})

(defn title
[color]
Expand All @@ -24,19 +22,15 @@
:margin (when (= :derivation-path type) 8)
:border-radius 12
:border-width (when (= :derivation-path type) 1)
:border-color (colors/theme-colors colors/neutral-10
colors/neutral-80
theme)
:border-color (colors/theme-colors colors/neutral-10 colors/neutral-80 theme)
:padding-bottom (if (not= :private-key type) 8 12)})

(def icon-container
{:margin-right 8})

(defn stored-title
[theme]
{:color (colors/theme-colors colors/neutral-50
colors/neutral-40
theme)
{:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)
:margin-right 4})

(def row-subtitle-container
Expand Down
8 changes: 3 additions & 5 deletions src/quo2/components/wallet/account_origin/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
(defn- list-view
[{:keys [type stored profile-picture user-name theme secondary-color]}]
(let [stored-name (if (= :on-device stored)
(i18n/label "on-device")
(i18n/label "on-keycard"))]
(i18n/label :t/on-device)
(i18n/label :t/on-device))]
[row-view
{:type type
:stored stored
Expand All @@ -91,9 +91,7 @@

(def view-internal
(fn [{:keys [type theme derivation-path on-press] :as props}]
(let [secondary-color (colors/theme-colors colors/neutral-50
colors/neutral-40
theme)]
(let [secondary-color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)]
[rn/view {:style (style/container theme)}
[text/text
{:weight :regular
Expand Down
2 changes: 1 addition & 1 deletion src/status_im2/contexts/quo_preview/main.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@
:wallet [{:name :account-card
:component account-card/preview-account-card}
{:name :account-origin
:component account-origin/preview}
:component account-origin/view}
{:name :account-overview
:component account-overview/preview-account-overview}
{:name :keypair
Expand Down
23 changes: 8 additions & 15 deletions src/status_im2/contexts/quo_preview/wallet/account_origin.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,15 @@
[status-im2.common.resources :as resources]))

(def descriptor
[{:label "Type:"
:type :select
[{:type :select
:key :type
:options [{:key :default-keypair
:value "Default Keypair"}
{:key :recovery-phrase
:value "Recovery Phrase"}
{:key :private-key
:value "Private Key"}]}
{:label "Stored:"
:type :select
:options [{:key :default-keypair}
{:key :recovery-phrase}
{:key :private-key}]}
{:type :select
:key :stored
:options [{:key :on-device
:value "On Device"}
{:key :on-keycard
:value "On Keycard"}]}])
:options [{:key :on-device}
{:key :on-keycard}]}])

(defn cool-preview
[]
Expand All @@ -41,7 +34,7 @@
:margin-horizontal 20}}
[quo/account-origin @state]]])))

(defn preview
(defn view
[]
[rn/view
{:style {:background-color (colors/theme-colors colors/white colors/neutral-90)
Expand Down

0 comments on commit ea06b4a

Please sign in to comment.