From a27828ed7954c165cc6aa090c98e171bce74298a Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 26 May 2020 13:56:32 +0200 Subject: [PATCH] :recycle: Refactor frontend code for adapt to new banners. --- .../resources/emails/change-email/en.mustache | 2 +- .../emails/password-recovery/en.mustache | 2 +- backend/resources/emails/register/en.mustache | 2 +- backend/src/uxbox/emails.clj | 6 +- backend/src/uxbox/fixtures.clj | 2 +- .../src/uxbox/services/mutations/profile.clj | 3 + backend/src/uxbox/util/emails.clj | 5 +- frontend/resources/locales.json | 192 +++++++++--------- .../resources/styles/common/framework.scss | 84 +++----- .../styles/main/partials/user-settings.scss | 2 + frontend/src/uxbox/main/data/auth.cljs | 3 +- frontend/src/uxbox/main/data/messages.cljs | 47 +++-- frontend/src/uxbox/main/ui.cljs | 105 +++++----- frontend/src/uxbox/main/ui/auth.cljs | 34 ++-- frontend/src/uxbox/main/ui/auth/login.cljs | 65 +++--- frontend/src/uxbox/main/ui/auth/recovery.cljs | 1 - .../uxbox/main/ui/auth/recovery_request.cljs | 1 - frontend/src/uxbox/main/ui/auth/register.cljs | 12 +- frontend/src/uxbox/main/ui/dashboard.cljs | 21 +- frontend/src/uxbox/main/ui/messages.cljs | 85 ++++---- frontend/src/uxbox/main/ui/settings.cljs | 2 - .../uxbox/main/ui/settings/change_email.cljs | 23 +-- .../src/uxbox/main/ui/settings/profile.cljs | 22 +- frontend/src/uxbox/main/ui/viewer.cljs | 31 ++- frontend/src/uxbox/main/ui/workspace.cljs | 4 +- 25 files changed, 387 insertions(+), 369 deletions(-) diff --git a/backend/resources/emails/change-email/en.mustache b/backend/resources/emails/change-email/en.mustache index efae9b35f7..93ed9a5772 100644 --- a/backend/resources/emails/change-email/en.mustache +++ b/backend/resources/emails/change-email/en.mustache @@ -9,7 +9,7 @@ We received a request to change your current email to {{ pendingEmail }}. Click to the link below to confirm the change: -{{ publicUrl }}/#/auth/verify-token?token={{token}} +{{ publicUri }}/#/auth/verify-token?token={{token}} If you received this email by mistake, please consider changing your password for security reasons. diff --git a/backend/resources/emails/password-recovery/en.mustache b/backend/resources/emails/password-recovery/en.mustache index c08997c515..f419e46a60 100644 --- a/backend/resources/emails/password-recovery/en.mustache +++ b/backend/resources/emails/password-recovery/en.mustache @@ -8,7 +8,7 @@ Hello {{name}}! We received a request to reset your password. Click the link below to choose a new one: -{{ publicUrl }}/#/auth/recovery?token={{token}} +{{ publicUri }}/#/auth/recovery?token={{token}} If you received this email by mistake, you can safely ignore it. Your password won't be changed. diff --git a/backend/resources/emails/register/en.mustache b/backend/resources/emails/register/en.mustache index 23992f8740..ff63fd0b78 100644 --- a/backend/resources/emails/register/en.mustache +++ b/backend/resources/emails/register/en.mustache @@ -8,7 +8,7 @@ Hello {{name}}! Thanks for signing up for your UXBOX account! Please verify your email using the link below adn get started building mockups and prototypes today! -{{ publicUrl }}/#/auth/verify-token?token={{token}} +{{ publicUri }}/#/auth/verify-token?token={{token}} Enjoy! The UXBOX team. diff --git a/backend/src/uxbox/emails.clj b/backend/src/uxbox/emails.clj index 901e1fb9e9..28077838c8 100644 --- a/backend/src/uxbox/emails.clj +++ b/backend/src/uxbox/emails.clj @@ -22,9 +22,11 @@ ;; --- Defaults -(def default-context +(defn default-context + [] {:static media/resolve-asset - :comment (constantly nil)}) + :comment (constantly nil) + :public-uri (:public-uri cfg/config)}) ;; --- Public API diff --git a/backend/src/uxbox/fixtures.clj b/backend/src/uxbox/fixtures.clj index 24dbd58aae..a928c27c8d 100644 --- a/backend/src/uxbox/fixtures.clj +++ b/backend/src/uxbox/fixtures.clj @@ -220,7 +220,7 @@ (let [owner-id (:id owner) id (mk-uuid "file" "draft" owner-id index) name (str "file" index) - project-id (:default-project owner)] + project-id (:default-project-id owner)] (log/info "create draft file" id) (db/insert! conn :file {:id id diff --git a/backend/src/uxbox/services/mutations/profile.clj b/backend/src/uxbox/services/mutations/profile.clj index 42045ec8b0..d2b43537aa 100644 --- a/backend/src/uxbox/services/mutations/profile.clj +++ b/backend/src/uxbox/services/mutations/profile.clj @@ -156,6 +156,9 @@ (sm/defmutation ::login [{:keys [email password scope] :as params}] (letfn [(check-password [profile password] + (when (= (:password profile) "!") + (ex/raise :type :validation + :code ::account-without-password)) (let [result (sodi.pwhash/verify password (:password profile))] (:valid result))) diff --git a/backend/src/uxbox/util/emails.clj b/backend/src/uxbox/util/emails.clj index b7d4897269..2540859c24 100644 --- a/backend/src/uxbox/util/emails.clj +++ b/backend/src/uxbox/util/emails.clj @@ -95,7 +95,10 @@ (when-let [spec (s/get-spec id)] (s/assert spec context)) - (let [context (merge extra-context context) + (let [context (merge (if (fn? extra-context) + (extra-context) + extra-context) + context) email (impl-build-email id context)] (when-not email (ex/raise :type :internal diff --git a/frontend/resources/locales.json b/frontend/resources/locales.json index 4183c8d8a2..0af2112762 100644 --- a/frontend/resources/locales.json +++ b/frontend/resources/locales.json @@ -1,47 +1,47 @@ { "auth.already-have-account" : { - "used-in" : [ "src/uxbox/main/ui/auth/register.cljs:111" ], + "used-in" : [ "src/uxbox/main/ui/auth/register.cljs:110" ], "translations" : { "en" : "Already have an account?", "fr" : "Vous avez déjà un compte ?" } }, "auth.confirm-password-label" : { - "used-in" : [ "src/uxbox/main/ui/auth/recovery.cljs:78" ], + "used-in" : [ "src/uxbox/main/ui/auth/recovery.cljs:77" ], "translations" : { "en" : "Confirm password", "fr" : "Confirmez mot de passe" } }, "auth.create-demo-profile" : { - "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:90", "src/uxbox/main/ui/auth/register.cljs:120" ], + "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:126", "src/uxbox/main/ui/auth/register.cljs:119" ], "translations" : { "en" : "Create demo account", "fr" : null } }, "auth.create-demo-profile-label" : { - "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:87", "src/uxbox/main/ui/auth/register.cljs:117" ], + "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:123", "src/uxbox/main/ui/auth/register.cljs:116" ], "translations" : { "en" : "Just wanna try it?" } }, "auth.email-label" : { - "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:55", "src/uxbox/main/ui/auth/register.cljs:86", "src/uxbox/main/ui/auth/recovery_request.cljs:47" ], + "used-in" : [ "src/uxbox/main/ui/auth/recovery_request.cljs:46", "src/uxbox/main/ui/auth/login.cljs:83", "src/uxbox/main/ui/auth/register.cljs:85" ], "translations" : { "en" : "Email", "fr" : "adresse email" } }, "auth.forgot-password" : { - "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:78" ], + "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:114" ], "translations" : { "en" : "Forgot your password?", "fr" : "Mot de passe oublié ?" } }, "auth.fullname-label" : { - "used-in" : [ "src/uxbox/main/ui/auth/register.cljs:80" ], + "used-in" : [ "src/uxbox/main/ui/auth/register.cljs:79" ], "translations" : { "en" : "Full Name", "fr" : "Nom complet" @@ -61,66 +61,66 @@ } }, "auth.login-here" : { - "used-in" : [ "src/uxbox/main/ui/auth/register.cljs:114" ], + "used-in" : [ "src/uxbox/main/ui/auth/register.cljs:113" ], "translations" : { "en" : "Login here" } }, "auth.login-submit-label" : { - "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:63" ], + "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:91" ], "translations" : { "en" : "Sign in", "fr" : "Se connecter" } }, "auth.login-subtitle" : { - "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:70" ], + "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:99" ], "translations" : { "en" : "Enter your details below" } }, "auth.login-title" : { - "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:69" ], + "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:98" ], "translations" : { "en" : "Great to see you again!" } }, "auth.new-password-label" : { - "used-in" : [ "src/uxbox/main/ui/auth/recovery.cljs:74" ], + "used-in" : [ "src/uxbox/main/ui/auth/recovery.cljs:73" ], "translations" : { "en" : "Type a new password", "fr" : null } }, "auth.notifications.invalid-token-error" : { - "used-in" : [ "src/uxbox/main/ui/auth/recovery.cljs:50" ], + "used-in" : [ "src/uxbox/main/ui/auth/recovery.cljs:49" ], "translations" : { "en" : "The recovery token is invalid.", "fr" : "Le jeton de récupération n'est pas valide." } }, "auth.notifications.password-changed-succesfully" : { - "used-in" : [ "src/uxbox/main/ui/auth/recovery.cljs:54" ], + "used-in" : [ "src/uxbox/main/ui/auth/recovery.cljs:53" ], "translations" : { "en" : "Password successfully changed" } }, "auth.notifications.recovery-token-sent" : { - "used-in" : [ "src/uxbox/main/ui/auth/recovery_request.cljs:34" ], + "used-in" : [ "src/uxbox/main/ui/auth/recovery_request.cljs:33" ], "translations" : { "en" : "Password recovery link sent to your inbox.", "fr" : "Lien de récupération de mot de passe envoyé." } }, "auth.password-label" : { - "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:61", "src/uxbox/main/ui/auth/register.cljs:90" ], + "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:89", "src/uxbox/main/ui/auth/register.cljs:89" ], "translations" : { "en" : "Password", "fr" : "Mot de passe" } }, "auth.password-length-hint" : { - "used-in" : [ "src/uxbox/main/ui/auth/register.cljs:89" ], + "used-in" : [ "src/uxbox/main/ui/auth/register.cljs:88" ], "translations" : { "en" : "At least 8 characters" } @@ -144,43 +144,43 @@ } }, "auth.recovery-submit-label" : { - "used-in" : [ "src/uxbox/main/ui/auth/recovery.cljs:81" ], + "used-in" : [ "src/uxbox/main/ui/auth/recovery.cljs:80" ], "translations" : { "en" : "Change your password" } }, "auth.register" : { - "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:84" ], + "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:120" ], "translations" : { "en" : "Sign up here" } }, "auth.register-label" : { - "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:81" ], + "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:117" ], "translations" : { "en" : "No account yet?" } }, "auth.register-submit-label" : { - "used-in" : [ "src/uxbox/main/ui/auth/register.cljs:94" ], + "used-in" : [ "src/uxbox/main/ui/auth/register.cljs:93" ], "translations" : { "en" : "Create an account" } }, "auth.register-subtitle" : { - "used-in" : [ "src/uxbox/main/ui/auth/register.cljs:103" ], + "used-in" : [ "src/uxbox/main/ui/auth/register.cljs:102" ], "translations" : { "en" : "It's free, it's Open Source" } }, "auth.register-title" : { - "used-in" : [ "src/uxbox/main/ui/auth/register.cljs:102" ], + "used-in" : [ "src/uxbox/main/ui/auth/register.cljs:101" ], "translations" : { "en" : "Create an account" } }, "auth.sidebar-tagline" : { - "used-in" : [ "src/uxbox/main/ui/auth.cljs:44" ], + "used-in" : [ "src/uxbox/main/ui/auth.cljs:42" ], "translations" : { "en" : "The open-source solution for design and prototyping." } @@ -520,27 +520,27 @@ "unused" : true }, "errors.auth.unauthorized" : { - "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:37" ], + "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:38", "src/uxbox/main/ui/auth/login.cljs:72" ], "translations" : { "en" : "Username or password seems to be wrong.", "fr" : "Le nom d'utilisateur ou le mot de passe semble être faux." } }, "errors.email-already-exists" : { - "used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:38", "src/uxbox/main/ui/auth.cljs:84" ], + "used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:39", "src/uxbox/main/ui/auth.cljs:87" ], "translations" : { "en" : "Email already used" } }, "errors.generic" : { - "used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:37", "src/uxbox/main/ui/auth.cljs:88", "src/uxbox/main/ui.cljs:179" ], + "used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:38", "src/uxbox/main/ui/auth.cljs:91", "src/uxbox/main/ui.cljs:184" ], "translations" : { "en" : "Something wrong has happened.", "fr" : "Quelque chose c'est mal passé." } }, "errors.network" : { - "used-in" : [ "src/uxbox/main/ui.cljs:173" ], + "used-in" : [ "src/uxbox/main/ui.cljs:178" ], "translations" : { "en" : "Unable to connect to backend server.", "fr" : "Impossible de se connecter au serveur principal." @@ -560,14 +560,14 @@ } }, "errors.registration-disabled" : { - "used-in" : [ "src/uxbox/main/ui/auth/register.cljs:52" ], + "used-in" : [ "src/uxbox/main/ui/auth/register.cljs:51" ], "translations" : { "en" : "The registration is currently disabled.", "fr" : "L'enregistrement est actuellement désactivé." } }, "errors.unexpected-error" : { - "used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:44", "src/uxbox/main/ui/auth/register.cljs:58" ], + "used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:43", "src/uxbox/main/ui/auth/register.cljs:57" ], "translations" : { "en" : "An unexpected error occurred.", "fr" : "Une erreur inattendue c'est produite" @@ -635,7 +635,7 @@ } }, "profile.recovery.go-to-login" : { - "used-in" : [ "src/uxbox/main/ui/auth/recovery.cljs:97" ], + "used-in" : [ "src/uxbox/main/ui/auth/recovery.cljs:96" ], "translations" : { "en" : null, "fr" : null @@ -647,32 +647,56 @@ "en" : "Cancel and keep my account" } }, + "settings.cancel-email-change" : { + "used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:82" ], + "translations" : { + "en" : "Cancel" + } + }, + "settings.change-email-info" : { + "used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:59" ], + "translations" : { + "en" : "We'll send you an email to your current email “%s” to verify your identity." + } + }, + "settings.change-email-info2" : { + "used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:83" ], + "translations" : { + "en" : "We have sent you an email to “%s”. Please follow the instructions to verify the email." + } + }, + "settings.change-email-info3" : { + "used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:79" ], + "translations" : { + "en" : "There is a pending change of your email to “%s”." + } + }, "settings.change-email-label" : { - "used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:73" ], + "used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:74" ], "translations" : { "en" : "Change email" } }, "settings.change-email-submit-label" : { - "used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:76" ], + "used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:73" ], "translations" : { "en" : "Change email" } }, "settings.change-email-title" : { - "used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:56" ], + "used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:55" ], "translations" : { "en" : "Change your email" } }, "settings.close-modal-label" : { - "used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:92" ], + "used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:87" ], "translations" : { "en" : "Close" } }, "settings.confirm-email-label" : { - "used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:73" ], + "used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:70" ], "translations" : { "en" : "Verify new email" } @@ -697,13 +721,19 @@ } }, "settings.email-label" : { - "used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:67" ], + "used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:68" ], "translations" : { "en" : "Email" } }, + "settings.email-verification-pending" : { + "used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:87" ], + "translations" : { + "en" : "There is a pending email validation." + } + }, "settings.fullname-label" : { - "used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:60" ], + "used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:61" ], "translations" : { "en" : "Your name", "fr" : "Votre nom complet" @@ -722,7 +752,7 @@ } }, "settings.new-email-label" : { - "used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:69" ], + "used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:66" ], "translations" : { "en" : "New email" } @@ -734,53 +764,24 @@ "fr" : "Nouveau mot de passe" } }, - "settings.notifications.description" : { - "translations" : { - "en" : null, - "fr" : null - }, - "unused" : true - }, "settings.notifications.email-changed-successfully" : { - "used-in" : [ "src/uxbox/main/ui/auth.cljs:64" ], + "used-in" : [ "src/uxbox/main/ui/auth.cljs:62" ], "translations" : { "en" : "Your email address has been updated successfully" } }, + "settings.notifications.email-not-verified" : { + "used-in" : [ "src/uxbox/main/ui/dashboard.cljs:109" ], + "translations" : { + "en" : "Your email address has not been verified yet. Please check your inbox at “%s” for a confirmation email." + } + }, "settings.notifications.email-verified-successfully" : { - "used-in" : [ "src/uxbox/main/ui/auth.cljs:57" ], + "used-in" : [ "src/uxbox/main/ui/auth.cljs:55" ], "translations" : { "en" : "Your email address has been verified successfully" } }, - "settings.notifications.every-day" : { - "translations" : { - "en" : null, - "fr" : null - }, - "unused" : true - }, - "settings.notifications.every-hour" : { - "translations" : { - "en" : null, - "fr" : null - }, - "unused" : true - }, - "settings.notifications.none" : { - "translations" : { - "en" : null, - "fr" : null - }, - "unused" : true - }, - "settings.notifications.notifications-saved" : { - "translations" : { - "en" : null, - "fr" : null - }, - "unused" : true - }, "settings.notifications.password-saved" : { "used-in" : [ "src/uxbox/main/ui/settings/password.cljs:36" ], "translations" : { @@ -789,14 +790,13 @@ } }, "settings.notifications.profile-deletion-not-allowed" : { + "used-in" : [ "src/uxbox/main/data/auth.cljs:136" ], "translations" : { - "en" : null, - "fr" : null - }, - "used-in" : [ "src/uxbox/main/data/auth.cljs:121" ] + "en" : "You can't delete you profile. Reasign your teams before proceed." + } }, "settings.notifications.profile-saved" : { - "used-in" : [ "src/uxbox/main/ui/settings/options.cljs:37", "src/uxbox/main/ui/settings/profile.cljs:42" ], + "used-in" : [ "src/uxbox/main/ui/settings/options.cljs:37", "src/uxbox/main/ui/settings/profile.cljs:43" ], "translations" : { "en" : "Profile saved successfully!", "fr" : "Profil enregistré avec succès !" @@ -810,13 +810,13 @@ } }, "settings.options" : { - "used-in" : [ "src/uxbox/main/ui/settings/header.cljs:52" ], + "used-in" : [ "src/uxbox/main/ui/settings/header.cljs:55" ], "translations" : { "en" : "OPTIONS" } }, "settings.password" : { - "used-in" : [ "src/uxbox/main/ui/settings/header.cljs:47" ], + "used-in" : [ "src/uxbox/main/ui/settings/header.cljs:50" ], "translations" : { "en" : "PASSWORD", "fr" : "MOT DE PASSE" @@ -830,27 +830,27 @@ } }, "settings.profile" : { - "used-in" : [ "src/uxbox/main/ui/settings/header.cljs:42" ], + "used-in" : [ "src/uxbox/main/ui/settings/header.cljs:45" ], "translations" : { "en" : "PROFILE", "fr" : "PROFIL" } }, "settings.profile-submit-label" : { - "used-in" : [ "src/uxbox/main/ui/settings/options.cljs:65", "src/uxbox/main/ui/settings/password.cljs:94", "src/uxbox/main/ui/settings/profile.cljs:92" ], + "used-in" : [ "src/uxbox/main/ui/settings/options.cljs:65", "src/uxbox/main/ui/settings/password.cljs:94", "src/uxbox/main/ui/settings/profile.cljs:90" ], "translations" : { "en" : "Update settings", "fr" : "Mettre à jour les paramètres" } }, "settings.remove-account-label" : { - "used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:97" ], + "used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:95" ], "translations" : { "en" : "Want to remove your account?" } }, "settings.teams" : { - "used-in" : [ "src/uxbox/main/ui/settings/header.cljs:57" ], + "used-in" : [ "src/uxbox/main/ui/settings/header.cljs:60" ], "translations" : { "en" : "TEAMS" } @@ -868,7 +868,7 @@ } }, "settings.update-photo-label" : { - "used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:119" ], + "used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:117" ], "translations" : { "en" : "UPDATE" } @@ -881,7 +881,7 @@ "unused" : true }, "settings.verification-sent-title" : { - "used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:81" ], + "used-in" : [ "src/uxbox/main/ui/settings/change_email.cljs:78" ], "translations" : { "en" : "Verification email sent" } @@ -893,13 +893,13 @@ } }, "viewer.empty-state" : { - "used-in" : [ "src/uxbox/main/ui/viewer.cljs:44" ], + "used-in" : [ "src/uxbox/main/ui/viewer.cljs:43" ], "translations" : { "en" : "No frames found on the page." } }, "viewer.frame-not-found" : { - "used-in" : [ "src/uxbox/main/ui/viewer.cljs:48" ], + "used-in" : [ "src/uxbox/main/ui/viewer.cljs:47" ], "translations" : { "en" : "Frame not found." } @@ -1467,7 +1467,7 @@ "unused" : true }, "workspace.options.position" : { - "used-in" : [ "src/uxbox/main/ui/workspace/sidebar/options/frame.cljs:127", "src/uxbox/main/ui/workspace/sidebar/options/measures.cljs:138" ], + "used-in" : [ "src/uxbox/main/ui/workspace/sidebar/options/frame.cljs:127", "src/uxbox/main/ui/workspace/sidebar/options/measures.cljs:134" ], "translations" : { "en" : "Position", "fr" : "Position" @@ -1480,14 +1480,14 @@ } }, "workspace.options.radius" : { - "used-in" : [ "src/uxbox/main/ui/workspace/sidebar/options/measures.cljs:179" ], + "used-in" : [ "src/uxbox/main/ui/workspace/sidebar/options/measures.cljs:175" ], "translations" : { "en" : "Radius", "fr" : "TODO" } }, "workspace.options.rotation" : { - "used-in" : [ "src/uxbox/main/ui/workspace/sidebar/options/measures.cljs:154" ], + "used-in" : [ "src/uxbox/main/ui/workspace/sidebar/options/measures.cljs:150" ], "translations" : { "en" : "Rotation", "fr" : "TODO" @@ -1513,7 +1513,7 @@ } }, "workspace.options.size" : { - "used-in" : [ "src/uxbox/main/ui/workspace/sidebar/options/frame.cljs:102", "src/uxbox/main/ui/workspace/sidebar/options/measures.cljs:110" ], + "used-in" : [ "src/uxbox/main/ui/workspace/sidebar/options/frame.cljs:102", "src/uxbox/main/ui/workspace/sidebar/options/measures.cljs:106" ], "translations" : { "en" : "Size", "fr" : "Taille" @@ -1717,7 +1717,7 @@ } }, "workspace.viewport.click-to-close-path" : { - "used-in" : [ "src/uxbox/main/ui/workspace/drawarea.cljs:363" ], + "used-in" : [ "src/uxbox/main/ui/workspace/drawarea.cljs:373" ], "translations" : { "en" : "Click to close the path" } diff --git a/frontend/resources/styles/common/framework.scss b/frontend/resources/styles/common/framework.scss index c94526be8d..f12e85a295 100644 --- a/frontend/resources/styles/common/framework.scss +++ b/frontend/resources/styles/common/framework.scss @@ -1002,7 +1002,7 @@ input[type=range]:focus::-ms-fill-upper { // Banner top -.msg-banner { +.banner { top: 0; left: 0px; width: 100%; @@ -1013,7 +1013,7 @@ input[type=range]:focus::-ms-fill-upper { justify-content: center; align-items: center; - .close-button { + .btn-close { position: absolute; right: 0px; top: 0px; @@ -1038,7 +1038,7 @@ input[type=range]:focus::-ms-fill-upper { } } - .msg-content { + .content { align-items: center; color: $color-white; display: flex; @@ -1075,23 +1075,23 @@ input[type=range]:focus::-ms-fill-upper { &.warning { background-color: $color-warning; } - + &.info { background-color: $color-info; } &.quick { - .close-button { + .btn-close { display: none; } } - &.hide-message { + &.hide { @include animation(0, .6s, fadeOutUp); } } -.msg-inline { +.inline-banner { display: flex; margin-bottom: $big; min-height: 40px; @@ -1112,13 +1112,32 @@ input[type=range]:focus::-ms-fill-upper { } } - .msg-text { + .content { + display: flex; + flex-direction: column; + } + + .main { + display: flex; + } + + .extra { + display: flex; + justify-content: flex-end; + padding: $small; + + > div:not(:last-child) { + margin-right: $small; + } + } + + .text { display: flex; font-size: $fs14; color: $color-black; padding: $small; } - + &.error { background-color: lighten($color-danger,30%); .icon { @@ -1139,7 +1158,7 @@ input[type=range]:focus::-ms-fill-upper { background-color: $color-warning; } } - + &.info { background-color: lighten($color-info,30%); .icon { @@ -1147,7 +1166,7 @@ input[type=range]:focus::-ms-fill-upper { } } - .close-button { + .btn-close { width: 40px; height: 40px; flex-shrink: 0; @@ -1168,53 +1187,14 @@ input[type=range]:focus::-ms-fill-upper { opacity: .8; } } - + &.quick { - .close-button { + .btn-close { display: none; } } } -.message-version { - align-items: center; - background-color: rgba(27, 170, 214, .6); - border-radius: $br-small; - color: $color-white; - display: flex; - flex-direction: column; - justify-content: center; - padding: $small; - position: absolute; - right: 250px; - top: 40px; - @include animation(0, 1s, fadeInDown); - - span { - font-size: $fs13; - font-weight: bold; - } - - .message-action { - align-items: center; - display: flex; - justify-content: space-around; - margin-top: $small; - width: 100%; - - .btn-transparent { - font-size: $fs12; - padding: .3rem .5rem; - } - - } - - &.hide-message { - @include animation(0, .6s, fadeOutUp); - } - -} - .close-bezier { fill: $color-danger; stroke: $color-danger-dark; diff --git a/frontend/resources/styles/main/partials/user-settings.scss b/frontend/resources/styles/main/partials/user-settings.scss index c06d0fc0b4..7b64072708 100644 --- a/frontend/resources/styles/main/partials/user-settings.scss +++ b/frontend/resources/styles/main/partials/user-settings.scss @@ -145,7 +145,9 @@ .profile-form { flex-grow: 1; + flex-basis: 390px; display: flex; + flex-direction: column; .change-email { diff --git a/frontend/src/uxbox/main/data/auth.cljs b/frontend/src/uxbox/main/data/auth.cljs index 4f79190353..3047a3d815 100644 --- a/frontend/src/uxbox/main/data/auth.cljs +++ b/frontend/src/uxbox/main/data/auth.cljs @@ -57,7 +57,8 @@ params {:email email :password password :scope "webapp"}] - (->> (rp/mutation :login params) + (->> (rx/timer 100) + (rx/mapcat #(rp/mutation :login params)) (rx/tap on-success) (rx/catch (fn [err] (on-error err) diff --git a/frontend/src/uxbox/main/data/messages.cljs b/frontend/src/uxbox/main/data/messages.cljs index 2b2f50c9d4..e92623e1f6 100644 --- a/frontend/src/uxbox/main/data/messages.cljs +++ b/frontend/src/uxbox/main/data/messages.cljs @@ -9,13 +9,13 @@ (ns uxbox.main.data.messages (:require + [beicon.core :as rx] [cljs.spec.alpha :as s] [potok.core :as ptk] - [beicon.core :as rx] [uxbox.common.data :as d] + [uxbox.common.exceptions :as ex] [uxbox.common.pages :as cp] [uxbox.common.spec :as us] - [uxbox.common.exceptions :as ex] [uxbox.config :as cfg])) (declare hide) @@ -33,10 +33,11 @@ ptk/WatchEvent (watch [_ state stream] - (let [stoper (rx/filter (ptk/type? ::show) stream)] - (->> (rx/of hide) - (rx/delay (:timeout data)) - (rx/take-until stoper)))))) + (when (:timeout data) + (let [stoper (rx/filter (ptk/type? ::show) stream)] + (->> (rx/of hide) + (rx/delay (:timeout data)) + (rx/take-until stoper))))))) (def hide (ptk/reify ::hide @@ -51,19 +52,29 @@ (defn error - [message & {:keys [timeout] :or {timeout 3000}}] - (show {:content message - :type :error - :timeout timeout})) + ([content] (error content {})) + ([content {:keys [timeout] :or {timeout 3000}}] + (show {:content content + :type :error + :timeout timeout}))) (defn info - [message & {:keys [timeout] :or {timeout 3000}}] - (show {:content message - :type :info - :timeout timeout})) + ([content] (info content {})) + ([content {:keys [timeout] :or {timeout 3000}}] + (show {:content content + :type :info + :timeout timeout}))) (defn success - [message & {:keys [timeout] :or {timeout 3000}}] - (show {:content message - :type :info - :timeout timeout})) + ([content] (success content {})) + ([content {:keys [timeout] :or {timeout 3000}}] + (show {:content content + :type :success + :timeout timeout}))) + +(defn warn + ([content] (warn content {})) + ([content {:keys [timeout] :or {timeout 3000}}] + (show {:content content + :type :warning + :timeout timeout}))) diff --git a/frontend/src/uxbox/main/ui.cljs b/frontend/src/uxbox/main/ui.cljs index b418982c22..84f30e87e7 100644 --- a/frontend/src/uxbox/main/ui.cljs +++ b/frontend/src/uxbox/main/ui.cljs @@ -13,20 +13,22 @@ [cuerdas.core :as str] [potok.core :as ptk] [rumext.alpha :as mf] - [uxbox.main.ui.icons :as i] [uxbox.common.data :as d] [uxbox.common.exceptions :as ex] + [uxbox.common.uuid :as uuid] [uxbox.main.data.auth :refer [logout]] [uxbox.main.data.messages :as dm] [uxbox.main.refs :as refs] [uxbox.main.store :as st] - [uxbox.main.ui.dashboard :refer [dashboard]] - [uxbox.main.ui.static :refer [not-found-page not-authorized-page]] [uxbox.main.ui.auth :refer [auth verify-token]] + [uxbox.main.ui.dashboard :refer [dashboard]] + [uxbox.main.ui.icons :as i] + [uxbox.main.ui.messages :as msgs] [uxbox.main.ui.settings :as settings] + [uxbox.main.ui.static :refer [not-found-page not-authorized-page]] [uxbox.main.ui.viewer :refer [viewer-page]] [uxbox.main.ui.workspace :as workspace] - [uxbox.util.i18n :refer [tr]] + [uxbox.util.i18n :as i18n :refer [tr t]] [uxbox.util.timers :as ts])) ;; --- Routes @@ -84,62 +86,63 @@ (mf/defc app-container {::mf/wrap [#(mf/catch % {:fallback app-error})]} [{:keys [route] :as props}] - (case (get-in route [:data :name]) + [:* + [:& msgs/notifications] + (case (get-in route [:data :name]) + (:auth-login + :auth-register + :auth-goodbye + :auth-recovery-request + :auth-recovery) + [:& auth {:route route}] - (:auth-login - :auth-register - :auth-goodbye - :auth-recovery-request - :auth-recovery) - [:& auth {:route route}] + :auth-verify-token + [:& verify-token {:route route}] - :auth-verify-token - [:& verify-token {:route route}] + (:settings-profile + :settings-password + :settings-options) + [:& settings/settings {:route route}] - (:settings-profile - :settings-password - :settings-options) - [:& settings/settings {:route route}] + :debug-icons-preview + (when *assert* + [:& i/debug-icons-preview]) - :debug-icons-preview - (when *assert* - [:& i/debug-icons-preview]) + (:dashboard-search + :dashboard-team + :dashboard-project + :dashboard-library-icons + :dashboard-library-icons-index + :dashboard-library-images + :dashboard-library-images-index + :dashboard-library-palettes + :dashboard-library-palettes-index) + [:& dashboard {:route route}] - (:dashboard-search - :dashboard-team - :dashboard-project - :dashboard-library-icons - :dashboard-library-icons-index - :dashboard-library-images - :dashboard-library-images-index - :dashboard-library-palettes - :dashboard-library-palettes-index) - [:& dashboard {:route route}] + :viewer + (let [index (d/parse-integer (get-in route [:params :query :index])) + token (get-in route [:params :query :token]) + page-id (uuid (get-in route [:params :path :page-id]))] + [:& viewer-page {:page-id page-id + :index index + :token token}]) - :viewer - (let [index (d/parse-integer (get-in route [:params :query :index])) - token (get-in route [:params :query :token]) - page-id (uuid (get-in route [:params :path :page-id]))] - [:& viewer-page {:page-id page-id - :index index - :token token}]) + :workspace + (let [project-id (uuid (get-in route [:params :path :project-id])) + file-id (uuid (get-in route [:params :path :file-id])) + page-id (uuid (get-in route [:params :query :page-id]))] + [:& workspace/workspace {:project-id project-id + :file-id file-id + :page-id page-id + :key file-id}]) - :workspace - (let [project-id (uuid (get-in route [:params :path :project-id])) - file-id (uuid (get-in route [:params :path :file-id])) - page-id (uuid (get-in route [:params :query :page-id]))] - [:& workspace/workspace {:project-id project-id - :file-id file-id - :page-id page-id - :key file-id}]) + :not-authorized + [:& not-authorized-page] - :not-authorized - [:& not-authorized-page] + :not-found + [:& not-found-page] - :not-found - [:& not-found-page] - - nil)) + nil)]) (mf/defc app [] diff --git a/frontend/src/uxbox/main/ui/auth.cljs b/frontend/src/uxbox/main/ui/auth.cljs index 189f2d5dc7..e7d3f13d90 100644 --- a/frontend/src/uxbox/main/ui/auth.cljs +++ b/frontend/src/uxbox/main/ui/auth.cljs @@ -17,7 +17,6 @@ [uxbox.main.data.users :as du] [uxbox.main.data.messages :as dm] [uxbox.main.store :as st] - [uxbox.main.ui.messages :refer [messages]] [uxbox.main.ui.auth.login :refer [login-page]] [uxbox.main.ui.auth.recovery :refer [recovery-page]] [uxbox.main.ui.auth.recovery-request :refer [recovery-request-page]] @@ -37,28 +36,19 @@ [{:keys [route] :as props}] (let [section (get-in route [:data :name]) locale (mf/deref i18n/locale)] - [:* - [:& messages] + [:div.auth + [:section.auth-sidebar + [:a.logo {:href "/#/"} i/logo] + [:span.tagline (t locale "auth.sidebar-tagline")]] - [:div.msg-banner.error - [:div.msg-content - [:div.icon i/msg-error] - [:span "Lorem ipsum dolor sit amet"] - [:div.close-button i/close]]] - - [:div.auth - [:section.auth-sidebar - [:a.logo {:href "/#/"} i/logo] - [:span.tagline (t locale "auth.sidebar-tagline")]] - - [:section.auth-content - (case section - :auth-register [:& register-page {:locale locale}] - :auth-login [:& login-page {:locale locale}] - :auth-goodbye [:& goodbye-page {:locale locale}] - :auth-recovery-request [:& recovery-request-page {:locale locale}] - :auth-recovery [:& recovery-page {:locale locale - :params (:query-params route)}])]]])) + [:section.auth-content + (case section + :auth-register [:& register-page {:locale locale}] + :auth-login [:& login-page {:locale locale}] + :auth-goodbye [:& goodbye-page {:locale locale}] + :auth-recovery-request [:& recovery-request-page {:locale locale}] + :auth-recovery [:& recovery-page {:locale locale + :params (:query-params route)}])]])) (defn- handle-email-verified [data] diff --git a/frontend/src/uxbox/main/ui/auth/login.cljs b/frontend/src/uxbox/main/ui/auth/login.cljs index 882480656f..b238c72add 100644 --- a/frontend/src/uxbox/main/ui/auth/login.cljs +++ b/frontend/src/uxbox/main/ui/auth/login.cljs @@ -18,6 +18,7 @@ [uxbox.main.data.auth :as da] [uxbox.main.repo :as rp] [uxbox.main.store :as st] + [uxbox.main.ui.messages :as msgs] [uxbox.main.data.messages :as dm] [uxbox.main.ui.components.forms :refer [input submit-button form]] [uxbox.util.object :as obj] @@ -32,16 +33,6 @@ (s/def ::login-form (s/keys :req-un [::email ::password])) -(defn- on-error - [form error] - (st/emit! (dm/error (tr "errors.auth.unauthorized")))) - -(defn- on-submit - [form event] - (let [params (with-meta (:clean-data form) - {:on-error (partial on-error form)})] - (st/emit! (da/login params)))) - (defn- login-with-google [event] (dom/prevent-default event) @@ -51,23 +42,43 @@ (mf/defc login-form [{:keys [locale] :as props}] - [:& form {:on-submit on-submit - :spec ::login-form - :initial {}} - [:& input - {:name :email - :type "text" - :tab-index "2" - :help-icon i/at - :label (t locale "auth.email-label")}] - [:& input - {:type "password" - :name :password - :tab-index "3" - :help-icon i/eye - :label (t locale "auth.password-label")}] - [:& submit-button - {:label (t locale "auth.login-submit-label")}]]) + (let [error? (mf/use-state false) + + on-error + (fn [form event] + (reset! error? true)) + + on-submit + (fn [form event] + (reset! error? false) + (let [params (with-meta (:clean-data form) + {:on-error on-error})] + (st/emit! (da/login params))))] + + [:* + (when @error? + [:& msgs/inline-banner + {:type :warning + :content (t locale "errors.auth.unauthorized") + :on-close #(reset! error? false)}]) + + [:& form {:on-submit on-submit + :spec ::login-form + :initial {}} + [:& input + {:name :email + :type "text" + :tab-index "2" + :help-icon i/at + :label (t locale "auth.email-label")}] + [:& input + {:type "password" + :name :password + :tab-index "3" + :help-icon i/eye + :label (t locale "auth.password-label")}] + [:& submit-button + {:label (t locale "auth.login-submit-label")}]]])) (mf/defc login-page [{:keys [locale] :as props}] diff --git a/frontend/src/uxbox/main/ui/auth/recovery.cljs b/frontend/src/uxbox/main/ui/auth/recovery.cljs index a021e5e8cd..a345a79732 100644 --- a/frontend/src/uxbox/main/ui/auth/recovery.cljs +++ b/frontend/src/uxbox/main/ui/auth/recovery.cljs @@ -18,7 +18,6 @@ [uxbox.main.data.messages :as dm] [uxbox.main.store :as st] [uxbox.main.ui.components.forms :refer [input submit-button form]] - [uxbox.main.ui.messages :refer [messages]] [uxbox.main.ui.navigation :as nav] [uxbox.util.dom :as dom] [uxbox.util.forms :as fm] diff --git a/frontend/src/uxbox/main/ui/auth/recovery_request.cljs b/frontend/src/uxbox/main/ui/auth/recovery_request.cljs index f7b8b0803a..f2cda56438 100644 --- a/frontend/src/uxbox/main/ui/auth/recovery_request.cljs +++ b/frontend/src/uxbox/main/ui/auth/recovery_request.cljs @@ -19,7 +19,6 @@ [uxbox.main.data.messages :as dm] [uxbox.main.store :as st] [uxbox.main.ui.components.forms :refer [input submit-button form]] - [uxbox.main.ui.messages :refer [messages]] [uxbox.main.ui.navigation :as nav] [uxbox.util.dom :as dom] [uxbox.util.forms :as fm] diff --git a/frontend/src/uxbox/main/ui/auth/register.cljs b/frontend/src/uxbox/main/ui/auth/register.cljs index 016c467689..f88d910a1b 100644 --- a/frontend/src/uxbox/main/ui/auth/register.cljs +++ b/frontend/src/uxbox/main/ui/auth/register.cljs @@ -18,9 +18,9 @@ [uxbox.main.data.auth :as uda] [uxbox.main.store :as st] [uxbox.main.data.auth :as da] - [uxbox.main.ui.messages :refer [messages]] [uxbox.main.ui.components.forms :refer [input submit-button form]] [uxbox.main.ui.navigation :as nav] + [uxbox.main.ui.messages :as msgs] [uxbox.util.dom :as dom] [uxbox.util.forms :as fm] [uxbox.util.i18n :refer [tr t]] @@ -28,14 +28,10 @@ (mf/defc demo-warning - [_] - - [:div.msg-inline.warning.quick - [:div.icon i/msg-warning] - [:span.msg-text - "WARNING: This is a service, DO NOT USE for real work, the projects will be periodicaly wiped."] - [:div.close-button i/close]]) + [:& msgs/inline-banner + {:type :warning + :content (tr "auth.demo-warning")}]) (s/def ::fullname ::fm/not-empty-string) (s/def ::password ::fm/not-empty-string) diff --git a/frontend/src/uxbox/main/ui/dashboard.cljs b/frontend/src/uxbox/main/ui/dashboard.cljs index 7d10462540..943858aec3 100644 --- a/frontend/src/uxbox/main/ui/dashboard.cljs +++ b/frontend/src/uxbox/main/ui/dashboard.cljs @@ -13,6 +13,7 @@ [rumext.alpha :as mf] [uxbox.main.ui.icons :as i] [uxbox.common.exceptions :as ex] + [uxbox.common.uuid :as uuid] [uxbox.common.spec :as us] [uxbox.main.refs :as refs] [uxbox.main.ui.dashboard.sidebar :refer [sidebar]] @@ -21,7 +22,7 @@ [uxbox.main.ui.dashboard.recent-files :refer [recent-files-page]] [uxbox.main.ui.dashboard.library :refer [library-page]] [uxbox.main.ui.dashboard.profile :refer [profile-section]] - [uxbox.main.ui.messages :refer [messages]])) + [uxbox.util.i18n :as i18n :refer [t]])) (defn ^boolean uuid-str? [s] @@ -53,6 +54,8 @@ (uuid-str? library-id) (assoc :library-id (uuid library-id))))) +(declare global-notifications) + (mf/defc dashboard [{:keys [route] :as props}] @@ -61,7 +64,7 @@ {:keys [search-term team-id project-id library-id library-section] :as params} (parse-params route profile)] [:* - [:& messages] + [:& global-notifications {:profile profile}] [:section.dashboard-layout [:div.main-logo i/logo-icon] [:& profile-section {:profile profile}] @@ -91,3 +94,17 @@ :dashboard-project [:& project-page {:team-id team-id :project-id project-id}])]]])) + + +(mf/defc global-notifications + [{:keys [profile] :as props}] + (let [locale (mf/deref i18n/locale)] + (when (and profile + (not= uuid/zero (:id profile)) + (= (:pending-email profile) + (:email profile))) + [:section.banner.error.quick + [:div.content + [:div.icon i/msg-warning] + [:span (t locale "settings.notifications.email-not-verified" (:email profile))]]]))) + diff --git a/frontend/src/uxbox/main/ui/messages.cljs b/frontend/src/uxbox/main/ui/messages.cljs index df15ce75b3..3e55146cbc 100644 --- a/frontend/src/uxbox/main/ui/messages.cljs +++ b/frontend/src/uxbox/main/ui/messages.cljs @@ -10,41 +10,56 @@ [uxbox.util.i18n :as i18n :refer [t]] [uxbox.util.timers :as ts])) -;; --- Main Component (entry point) +(defn- type->icon + [type] + (case type + :warning i/msg-warning + :error i/msg-error + :success i/msg-success + :info i/msg-info)) -(declare notification) - -(mf/defc messages - [] - (let [message (mf/deref refs/message)] - (when message - [:& notification {:type (:type message) - :status (:status message) - :content (:content message)}]))) - -(mf/defc messages-widget - [] - (let [message (mf/deref refs/message) - message {:type :error - :content "Hello world!"}] - - [:& notification {:type (:type message) - :status (:status message) - :content (:content message)}])) - -;; --- Notification Component - -(mf/defc notification - [{:keys [type status content] :as props}] - (let [on-close #(st/emit! dm/hide) - klass (classnames - :error (= type :error) - :info (= type :info) - :hide-message (= status :hide) +(mf/defc notification-item + [{:keys [type status on-close quick? content] :as props}] + (let [klass (dom/classnames + :fixed true :success (= type :success) - :quick false)] - [:div.message {:class klass} - [:a.close-button {:on-click on-close} i/close] - [:div.message-content - [:span content]]])) + :error (= type :error) + :info (= type :info) + :warning (= type :warning) + :hide (= status :hide) + :quick quick?)] + [:section.banner {:class klass} + [:div.content + [:div.icon (type->icon type)] + [:span content]] + [:div.btn-close {:on-click on-close} i/close]])) + +(mf/defc notifications + [] + (let [message (mf/deref refs/message) + on-close #(st/emit! dm/hide)] + (when message + [:& notification-item {:type (:type message) + :quick? (boolean (:timeout message)) + :status (:status message) + :content (:content message) + :on-close on-close}]))) + +(mf/defc inline-banner + {::mf/wrap [mf/memo]} + [{:keys [type on-close content children] :as props}] + [:div.inline-banner {:class (dom/classnames + :warning (= type :warning) + :error (= type :error) + :success (= type :success) + :info (= type :info) + :quick (not on-close))} + [:div.icon (type->icon type)] + [:div.content + [:div.main + [:span.text content] + [:div.btn-close {:on-click on-close} i/close]] + (when children + [:div.extra + children])]]) diff --git a/frontend/src/uxbox/main/ui/settings.cljs b/frontend/src/uxbox/main/ui/settings.cljs index 3d9bcf99ea..07865712d3 100644 --- a/frontend/src/uxbox/main/ui/settings.cljs +++ b/frontend/src/uxbox/main/ui/settings.cljs @@ -17,7 +17,6 @@ [uxbox.main.store :as st] [uxbox.util.router :as rt] [uxbox.main.ui.dashboard.profile :refer [profile-section]] - [uxbox.main.ui.messages :refer [messages]] [uxbox.main.ui.settings.header :refer [header]] [uxbox.main.ui.settings.password :refer [password-page]] [uxbox.main.ui.settings.options :refer [options-page]] @@ -28,7 +27,6 @@ (let [section (get-in route [:data :name]) profile (mf/deref refs/profile)] [:main.settings-main - [:& messages] [:div.settings-content [:& header {:section section :profile profile}] (case section diff --git a/frontend/src/uxbox/main/ui/settings/change_email.cljs b/frontend/src/uxbox/main/ui/settings/change_email.cljs index 8a433abad9..24ecbe207a 100644 --- a/frontend/src/uxbox/main/ui/settings/change_email.cljs +++ b/frontend/src/uxbox/main/ui/settings/change_email.cljs @@ -17,6 +17,7 @@ [uxbox.main.data.auth :as da] [uxbox.main.data.users :as du] [uxbox.main.ui.components.forms :refer [input submit-button form]] + [uxbox.main.ui.messages :as msgs] [uxbox.main.data.messages :as dm] [uxbox.main.store :as st] [uxbox.main.refs :as refs] @@ -36,9 +37,7 @@ (= (:code error) :uxbox.services.mutations.profile/email-already-exists) (swap! form (fn [data] (let [error {:message (tr "errors.email-already-exists")}] - (-> data - (assoc-in [:errors :email-1] error) - (assoc-in [:errors :email-2] error))))) + (assoc-in data [:errors :email-1] error)))) :else (let [msg (tr "errors.unexpected-error")] @@ -55,11 +54,9 @@ [:section.modal-content.generic-form [:h2 (t locale "settings.change-email-title")] - [:span.featured-note - [:span.text - [:span "We’ll send you an email to your current email "] - [:strong (:email profile)] - [:span " to verify your identity."]]] + [:& msgs/inline-banner + {:type :info + :content (t locale "settings.change-email-info" (:email profile))}] [:& form {:on-submit on-submit :spec ::email-change-form @@ -80,12 +77,10 @@ [:section.modal-content.generic-form.confirmation [:h2 (t locale "settings.verification-sent-title")] - [:span.featured-note - [:span.icon i/trash] - [:span.text - [:span (str/format "We have sent you an email to “")] - [:strong (:email profile)] - [:span "” Please follow the instructions to verify the email."]]] + + [:& msgs/inline-banner + {:type :info + :content (t locale "settings.change-email-info2" (:email profile))}] [:button.btn-primary.btn-large {:on-click #(modal/hide!)} diff --git a/frontend/src/uxbox/main/ui/settings/profile.cljs b/frontend/src/uxbox/main/ui/settings/profile.cljs index 146c4a646f..23aa959b68 100644 --- a/frontend/src/uxbox/main/ui/settings/profile.cljs +++ b/frontend/src/uxbox/main/ui/settings/profile.cljs @@ -19,6 +19,7 @@ [uxbox.main.ui.settings.change-email :refer [change-email-modal]] [uxbox.main.ui.settings.delete-account :refer [delete-account-modal]] [uxbox.main.ui.modal :as modal] + [uxbox.main.ui.messages :as msgs] [uxbox.main.data.messages :as dm] [uxbox.main.store :as st] [uxbox.main.refs :as refs] @@ -73,20 +74,17 @@ (t locale "settings.change-email-label")]] (not= (:pending-email prof) (:email prof)) - [:span.featured-note - [:span.icon i/trash] - [:span.text - [:span "There is a pending change of your email to "] - [:strong (:pending-email prof)] - [:span "."] [:br] - [:a {:on-click #(st/emit! udu/cancel-email-change)} - "Dismiss"]]] + [:& msgs/inline-banner + {:type :info + :content (t locale "settings.change-email-info3" (:pending-email prof))} + [:div.btn-secondary.btn-small + {:on-click #(st/emit! udu/cancel-email-change)} + (t locale "settings.cancel-email-change")]] :else - [:span.featured-note.warning - [:span.text - [:span "There is a pending email validation."]]]) - + [:& msgs/inline-banner + {:type :info + :content (t locale "settings.email-verification-pending")}]) [:& submit-button {:label (t locale "settings.profile-submit-label")}] diff --git a/frontend/src/uxbox/main/ui/viewer.cljs b/frontend/src/uxbox/main/ui/viewer.cljs index 53368656dd..f444e41378 100644 --- a/frontend/src/uxbox/main/ui/viewer.cljs +++ b/frontend/src/uxbox/main/ui/viewer.cljs @@ -22,7 +22,6 @@ [uxbox.main.ui.components.dropdown :refer [dropdown]] [uxbox.main.ui.hooks :as hooks] [uxbox.main.ui.keyboard :as kbd] - [uxbox.main.ui.messages :refer [messages]] [uxbox.main.ui.viewer.header :refer [header]] [uxbox.main.ui.viewer.thumbnails :refer [thumbnails-panel]] [uxbox.main.ui.viewer.shapes :refer [frame-svg]] @@ -87,23 +86,21 @@ (mf/use-effect on-mount) (hooks/use-shortcuts dv/shortcuts) - [:* - [:& messages] - [:div.viewer-layout {:class (classnames :fullscreen fullscreen?) - :ref container} + [:div.viewer-layout {:class (classnames :fullscreen fullscreen?) + :ref container} - [:& header {:data data - :toggle-fullscreen toggle-fullscreen - :fullscreen? fullscreen? - :local local - :index index}] - [:div.viewer-content {:on-click on-click} - (when (:show-thumbnails local) - [:& thumbnails-panel {:index index - :data data}]) - [:& main-panel {:data data - :local local - :index index}]]]])) + [:& header {:data data + :toggle-fullscreen toggle-fullscreen + :fullscreen? fullscreen? + :local local + :index index}] + [:div.viewer-content {:on-click on-click} + (when (:show-thumbnails local) + [:& thumbnails-panel {:index index + :data data}]) + [:& main-panel {:data data + :local local + :index index}]]])) ;; --- Component: Viewer Page diff --git a/frontend/src/uxbox/main/ui/workspace.cljs b/frontend/src/uxbox/main/ui/workspace.cljs index 5ca04a9138..15ac832d43 100644 --- a/frontend/src/uxbox/main/ui/workspace.cljs +++ b/frontend/src/uxbox/main/ui/workspace.cljs @@ -22,7 +22,6 @@ [uxbox.main.ui.confirm] [uxbox.main.ui.keyboard :as kbd] [uxbox.main.ui.hooks :as hooks] - [uxbox.main.ui.messages :refer [messages]] [uxbox.main.ui.workspace.viewport :refer [viewport coordinates]] [uxbox.main.ui.workspace.colorpalette :refer [colorpalette]] [uxbox.main.ui.workspace.context-menu :refer [context-menu]] @@ -117,12 +116,11 @@ (let [file (mf/deref refs/workspace-file) project (mf/deref refs/workspace-project) layout (mf/deref refs/workspace-layout)] - [:* + [:section [:& header {:file file :project project :layout layout}] - [:& messages] [:& context-menu] (if (and (and file project)