Skip to content

Commit 206d6dc

Browse files
committed
lint
1 parent 78cc6d2 commit 206d6dc

File tree

4 files changed

+38
-37
lines changed

4 files changed

+38
-37
lines changed

src/quo/components/info/info_message.cljs

+4-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
:text-color colors/white ;; text color override
2424
:icon-color colors/white ;; icon color override
2525
:no-icon-color? false ;; disable tint color for icon"
26-
[{:keys [type size theme icon text-color icon-color no-icon-color? style accessibility-label]} message]
26+
[{:keys [type size theme icon text-color icon-color no-icon-color? style accessibility-label
27+
container-style]} message]
2728
(let [weight (if (= size :default) :regular :medium)
2829
icon-size (if (= size :default) 16 12)
2930
size (if (= size :default) :paragraph-2 :label)
@@ -32,7 +33,8 @@
3233
[rn/view
3334
{:style (merge {:flex-direction :row
3435
:align-items :center}
35-
style)}
36+
style
37+
container-style)}
3638
[quo.icons/icon icon
3739
{:color icon-color
3840
:no-color no-icon-color?

src/status_im/common/validation/general_test.cljs

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
(deftest test-valid-compressed-key
77
(testing "valid"
88
(is (valid-compressed-key?
9-
"zQ3shWj4WaBdf2zYKCkXe6PHxDxNTzZyid1i75879Ue9cX9gA")))
9+
"zQ3shWj4WaBdf2zYKCkXe6PHxDxNTzZyid1i75879Ue9cX9gA")))
1010
(testing "uncompressed key"
1111
(is
12-
(not
13-
(valid-compressed-key?
14-
"0x048a6773339d11ccf5fd81677b7e54daeec544a1287bd92b725047ad6faa9a9b9f8ea86ed5a226d2a994f5f46d0b43321fd8de7b7997a166e67905c8c73cd37ce"))))
12+
(not
13+
(valid-compressed-key?
14+
"0x048a6773339d11ccf5fd81677b7e54daeec544a1287bd92b725047ad6faa9a9b9f8ea86ed5a226d2a994f5f46d0b43321fd8de7b7997a166e67905c8c73cd37ce"))))
1515
(testing "nil"
1616
(is (not (valid-compressed-key? nil))))
1717
(testing "empty string"
@@ -20,16 +20,16 @@
2020
(is (not (valid-compressed-key? "zQ3FGR5y6U5a6"))))
2121
(testing "too long"
2222
(is (not (valid-compressed-key?
23-
"zQ3shWj4WaBdf2zYKCkXe6PHxDxNTzZyid1i75879Ue9cX9gA2"))))
23+
"zQ3shWj4WaBdf2zYKCkXe6PHxDxNTzZyid1i75879Ue9cX9gA2"))))
2424
(testing "0x prefix"
2525
(is (not (valid-compressed-key? "0xFGR5y6U5a6"))))
2626
(testing "contains I"
2727
(is (not (valid-compressed-key?
28-
"zQ3shWj4WaBdf2zYKCkXe6PHxDxNTzZyid1i75879Ue9cX9gI"))))
28+
"zQ3shWj4WaBdf2zYKCkXe6PHxDxNTzZyid1i75879Ue9cX9gI"))))
2929
(testing "contains O"
3030
(is (not (valid-compressed-key?
31-
"zQ3shWj4WaBdf2zYKCkXe6PHxDxNTzZyid1i75879Ue9cX9gO"))))
31+
"zQ3shWj4WaBdf2zYKCkXe6PHxDxNTzZyid1i75879Ue9cX9gO"))))
3232
(testing "contains l"
3333
(is (not (valid-compressed-key?
34-
"zQ3shWj4WaBdf2zYKCkXe6PHxDxNTzZyid1i75879Ue9cX9gl")))))
34+
"zQ3shWj4WaBdf2zYKCkXe6PHxDxNTzZyid1i75879Ue9cX9gl")))))
3535

Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
(ns status-im.contexts.wallet.create-account.new-keypair.keypair-name.style
2-
(:require [quo.foundations.colors :as colors]))
1+
(ns status-im.contexts.wallet.create-account.new-keypair.keypair-name.style)
32

43
(def header-container
54
{:margin-horizontal 20
@@ -10,14 +9,5 @@
109
{:margin-horizontal -20})
1110

1211
(def error-container
13-
{:flex-direction :row
14-
:justify-content :center
15-
:align-items :center
16-
:align-self :flex-start
17-
:margin-left 20
12+
{:margin-left 20
1813
:margin-vertical 8})
19-
20-
(defn error
21-
[theme]
22-
{:margin-left 4
23-
:color (colors/resolve-color :danger theme)})

src/status_im/contexts/wallet/create_account/new_keypair/keypair_name/view.cljs

+24-15
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,32 @@
1616
:emoji (i18n/label :t/key-name-error-emoji)
1717
:special-char (i18n/label :t/key-name-error-special-char)})
1818

19+
(defn navigate-back [] (rf/dispatch [:navigate-back]))
20+
1921
(defn view-internal
2022
[{:keys [theme]}]
2123
(let [[keypair-name set-keypair-name] (rn/use-state "")
2224
customization-color (rf/sub [:profile/customization-color])
23-
[error set-error] (rn/use-state false)]
25+
[error set-error] (rn/use-state false)
26+
on-change-text (rn/use-callback (fn [value]
27+
(set-keypair-name value)
28+
(cond
29+
(> (count value) keypair-name-max-length)
30+
(set-error :length)
31+
(validators/has-emojis? value) (set-error
32+
:emoji)
33+
(validators/has-special-characters? value)
34+
(set-error :special-char)
35+
:else (set-error nil))))
36+
on-continue (rn/use-callback #(rf/dispatch [:wallet/new-keypair-continue
37+
{:keypair-name
38+
keypair-name}])
39+
[keypair-name])]
2440
[rn/view {:style {:flex 1}}
2541
[floating-button-page/view
2642
{:header [quo/page-nav
2743
{:icon-name :i/arrow-left
28-
:on-press #(rf/dispatch [:navigate-back])
44+
:on-press navigate-back
2945
:accessibility-label :top-bar}]
3046
:footer [quo/bottom-actions
3147
{:actions :one-action
@@ -34,9 +50,7 @@
3450
(<= (count keypair-name)
3551
keypair-name-min-length))
3652
:customization-color customization-color
37-
:on-press #(rf/dispatch [:wallet/new-keypair-continue
38-
{:keypair-name
39-
keypair-name}])}
53+
:on-press on-continue}
4054
:container-style style/bottom-action}]}
4155
[quo/text-combinations
4256
{:container-style style/header-container
@@ -48,18 +62,13 @@
4862
:label (i18n/label :t/keypair-name)
4963
:char-limit keypair-name-max-length
5064
:auto-focus true
51-
:on-change-text (fn [value]
52-
(set-keypair-name value)
53-
(cond
54-
(> (count value) keypair-name-max-length) (set-error :length)
55-
(validators/has-emojis? value) (set-error :emoji)
56-
(validators/has-special-characters? value) (set-error :special-char)
57-
:else (set-error nil)))
65+
:on-change-text on-change-text
5866
:error error}]
5967
(when error
6068
[quo/info-message
61-
{:type :error
62-
:size :default
63-
:icon :i/info}
69+
{:type :error
70+
:size :default
71+
:icon :i/info
72+
:container-style style/error-container}
6473
(get error-messages error)])]]))
6574
(def view (quo.theme/with-theme view-internal))

0 commit comments

Comments
 (0)