[#19303] fix: edit profile design feedbacks (#19562)

This commit is contained in:
Mohsen 2024-04-24 20:56:32 +03:00 committed by GitHub
parent 3794742c8f
commit cdb39452d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 31 additions and 21 deletions

View File

@ -9,6 +9,10 @@
;; https://github.com/status-im/status-desktop/blob/2ba96803168461088346bf5030df750cb226df4c/ui/imports/utils/Constants.qml#L468
(def min-length 5)
;; Combine ASCII and Emoji into one regex
(def bio-chars-regex
#"^[\u00a9\u00ae\u2000-\u3300\ud83c\ud000-\udfff\ud83d\ud000-\udfff\ud83e\ud000-\udfff\u0000-\u007F]+$")
(def common-names ["Ethereum" "Bitcoin"])
(defn has-common-names? [s] (pos? (count (filter #(string/includes? s %) common-names))))
@ -19,6 +23,10 @@
(defn bio-too-long? [s] (> (count (string/trim (str s))) constants/profile-bio-max-length))
(defn bio-invalid-characters?
[s]
(not (re-find bio-chars-regex s)))
(defn validation-name
[s]
(cond
@ -41,10 +49,7 @@
[s]
(cond
(string/blank? s) nil
(validators/has-emojis? s) (i18n/label :t/are-not-allowed
{:check (i18n/label :t/emojis)})
(validators/has-special-characters? s) (i18n/label :t/are-not-allowed
{:check (i18n/label :t/special-characters)})
(bio-invalid-characters? s) (i18n/label :t/invalid-characters-bio)
(bio-too-long? s) (i18n/label :t/bio-is-too-long)))
(defn validation-nickname

View File

@ -1,5 +1,6 @@
(ns status-im.contexts.profile.edit.bio.events
(:require [clojure.string :as string]
[taoensso.timbre :as log]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
@ -27,6 +28,7 @@
:params [new-bio]
:on-success [:profile/edit-profile-bio-success
{:bio new-bio
:added? (string/blank? bio)}]}]]]}))
:added? (string/blank? bio)}]
:on-error #(log/error "failed to set bio " %)}]]]}))
(rf/reg-event-fx :profile/edit-bio edit-profile-bio)

View File

@ -12,12 +12,15 @@
(rf/reg-event-fx :profile/edit-profile-picture-success
(fn [_ [images]]
(let [has-picture? (rf/sub [:profile/has-picture])]
{:fx [[:dispatch [:profile/update-local-picture (reverse images)]]
[:dispatch
[:toasts/upsert
{:type :positive
:theme :dark
:text (i18n/label :t/profile-picture-added)}]]]}))
:text (i18n/label (if has-picture?
:t/profile-picture-updated
:t/profile-picture-added))}]]]})))
(defn edit-profile-picture
[{:keys [db]} [picture crop-width crop-height]]

View File

@ -16,7 +16,6 @@
(def camera-button
{:position :absolute
:border-radius 16
:overflow :hidden
:right 0
:bottom 0})

View File

@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im",
"repo": "status-go",
"version": "v0.179.7",
"commit-sha1": "cdac86f73ac3bf7f4f4cf09b5bc27fb1602c1820",
"src-sha256": "0svj36zq1v7p1d6dwa29s8m82gfy4ffdcajqcn2wyxxr7i1nwnwa"
"version": "v0.179.8",
"commit-sha1": "70a9996d824e1b5b12560e5b3504c340e416f4dc",
"src-sha256": "1gzzgc5frp5hf7sbzxsakgl648c4h5jn61g0c17fgca46vdk3l9c"
}

View File

@ -754,6 +754,7 @@
"invalid-range": "Invalid format, must be between {{min}} and {{max}}",
"invalid-username-or-key": "Invalid username or chat key",
"invalid-ens-or-key": "Invalid ENS or Chat key",
"invalid-characters-bio": "Invalid characters. Standard keyboard characters and emojis only.",
"join-me": "Hey join me on Status: {{url}}",
"join-a-community": "or join a community",
"join-open-community": "Join Community",