Skip to content

Commit

Permalink
[#19917] fix: resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsen-ghafouri committed May 13, 2024
1 parent 08ae2d1 commit 3a114a9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/status_im/common/validation/keypair.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

(defn keypair-too-short?
[s]
(< (-> s str string/trim count) constants/keypair-name-min-length))
(< (-> s str string/trim count) constants/key-pair-name-min-length))

(defn keypair-too-long?
[s]
(> (-> s str string/trim count) constants/keypair-name-max-length))
(> (-> s str string/trim count) constants/key-pair-name-max-length))

(defn validation-keypair-name
[s]
Expand Down
4 changes: 2 additions & 2 deletions src/status_im/constants.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@
(def ^:const contact-request-message-state-declined 3)
(def ^:const contact-request-message-max-length 280)

(def ^:const keypair-name-max-length 20)
(def ^:const keypair-name-min-length 5)
(def ^:const key-pair-name-max-length 20)
(def ^:const key-pair-name-min-length 5)

(def request-to-join-pending-state 1)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
:placeholder (i18n/label :t/keypair-name-input-placeholder)
:label (i18n/label :t/keypair-name)
:default-value unsaved-keypair-name
:char-limit constants/keypair-name-max-length
:max-length constants/keypair-name-max-length
:char-limit constants/key-pair-name-max-length
:max-length constants/key-pair-name-max-length
:auto-focus true
:clearable? (not (string/blank? unsaved-keypair-name))
:on-clear on-clear
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@
[status-im.common.floating-button-page.view :as floating-button-page]
[status-im.common.not-implemented :as not-implemented]
[status-im.common.validation.general :as validators]
[status-im.constants :as constants]
[status-im.contexts.wallet.add-account.create-account.key-pair-name.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

(def ^:private key-pair-name-max-length 15)
(def ^:private key-pair-name-min-length 5)

(def error-messages
{:too-long (i18n/label :t/key-name-error-length)
:too-short (i18n/label :t/key-name-error-too-short {:count key-pair-name-min-length})
:too-short (i18n/label :t/key-name-error-too-short {:count constants/key-pair-name-min-length})
:emoji (i18n/label :t/key-name-error-emoji)
:special-char (i18n/label :t/key-name-error-special-char)})

Expand All @@ -33,10 +31,10 @@
(fn [value]
(set-key-pair-name value)
(cond
(> (count value) key-pair-name-max-length)
(> (count value) constants/key-pair-name-max-length)
(set-error :too-long)

(< 0 (count value) key-pair-name-min-length)
(< 0 (count value) constants/key-pair-name-min-length)
(set-error :too-short)

(validators/has-emojis? value)
Expand Down Expand Up @@ -81,7 +79,7 @@
{:container-style style/input
:placeholder (i18n/label :t/keypair-name-input-placeholder)
:label (i18n/label :t/keypair-name)
:char-limit key-pair-name-max-length
:char-limit constants/key-pair-name-max-length
:auto-focus true
:on-change-text on-change-text
:error error}]
Expand Down

0 comments on commit 3a114a9

Please sign in to comment.