♻️ Refactor frontend code for adapt to new banners.

This commit is contained in:
Andrey Antukh 2020-05-26 13:56:32 +02:00
parent b331489741
commit a27828ed79
25 changed files with 387 additions and 369 deletions

View file

@ -9,7 +9,7 @@ We received a request to change your current email to {{ pendingEmail }}.
Click to the link below to confirm the change: 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 If you received this email by mistake, please consider changing your password
for security reasons. for security reasons.

View file

@ -8,7 +8,7 @@ Hello {{name}}!
We received a request to reset your password. Click the link below to choose a We received a request to reset your password. Click the link below to choose a
new one: 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 If you received this email by mistake, you can safely ignore it. Your password
won't be changed. won't be changed.

View file

@ -8,7 +8,7 @@ Hello {{name}}!
Thanks for signing up for your UXBOX account! Please verify your email using the Thanks for signing up for your UXBOX account! Please verify your email using the
link below adn get started building mockups and prototypes today! link below adn get started building mockups and prototypes today!
{{ publicUrl }}/#/auth/verify-token?token={{token}} {{ publicUri }}/#/auth/verify-token?token={{token}}
Enjoy! Enjoy!
The UXBOX team. The UXBOX team.

View file

@ -22,9 +22,11 @@
;; --- Defaults ;; --- Defaults
(def default-context (defn default-context
[]
{:static media/resolve-asset {:static media/resolve-asset
:comment (constantly nil)}) :comment (constantly nil)
:public-uri (:public-uri cfg/config)})
;; --- Public API ;; --- Public API

View file

@ -220,7 +220,7 @@
(let [owner-id (:id owner) (let [owner-id (:id owner)
id (mk-uuid "file" "draft" owner-id index) id (mk-uuid "file" "draft" owner-id index)
name (str "file" index) name (str "file" index)
project-id (:default-project owner)] project-id (:default-project-id owner)]
(log/info "create draft file" id) (log/info "create draft file" id)
(db/insert! conn :file (db/insert! conn :file
{:id id {:id id

View file

@ -156,6 +156,9 @@
(sm/defmutation ::login (sm/defmutation ::login
[{:keys [email password scope] :as params}] [{:keys [email password scope] :as params}]
(letfn [(check-password [profile password] (letfn [(check-password [profile password]
(when (= (:password profile) "!")
(ex/raise :type :validation
:code ::account-without-password))
(let [result (sodi.pwhash/verify password (:password profile))] (let [result (sodi.pwhash/verify password (:password profile))]
(:valid result))) (:valid result)))

View file

@ -95,7 +95,10 @@
(when-let [spec (s/get-spec id)] (when-let [spec (s/get-spec id)]
(s/assert spec context)) (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)] email (impl-build-email id context)]
(when-not email (when-not email
(ex/raise :type :internal (ex/raise :type :internal

View file

@ -1,47 +1,47 @@
{ {
"auth.already-have-account" : { "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" : { "translations" : {
"en" : "Already have an account?", "en" : "Already have an account?",
"fr" : "Vous avez déjà un compte ?" "fr" : "Vous avez déjà un compte ?"
} }
}, },
"auth.confirm-password-label" : { "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" : { "translations" : {
"en" : "Confirm password", "en" : "Confirm password",
"fr" : "Confirmez mot de passe" "fr" : "Confirmez mot de passe"
} }
}, },
"auth.create-demo-profile" : { "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" : { "translations" : {
"en" : "Create demo account", "en" : "Create demo account",
"fr" : null "fr" : null
} }
}, },
"auth.create-demo-profile-label" : { "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" : { "translations" : {
"en" : "Just wanna try it?" "en" : "Just wanna try it?"
} }
}, },
"auth.email-label" : { "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" : { "translations" : {
"en" : "Email", "en" : "Email",
"fr" : "adresse email" "fr" : "adresse email"
} }
}, },
"auth.forgot-password" : { "auth.forgot-password" : {
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:78" ], "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:114" ],
"translations" : { "translations" : {
"en" : "Forgot your password?", "en" : "Forgot your password?",
"fr" : "Mot de passe oublié ?" "fr" : "Mot de passe oublié ?"
} }
}, },
"auth.fullname-label" : { "auth.fullname-label" : {
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:80" ], "used-in" : [ "src/uxbox/main/ui/auth/register.cljs:79" ],
"translations" : { "translations" : {
"en" : "Full Name", "en" : "Full Name",
"fr" : "Nom complet" "fr" : "Nom complet"
@ -61,66 +61,66 @@
} }
}, },
"auth.login-here" : { "auth.login-here" : {
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:114" ], "used-in" : [ "src/uxbox/main/ui/auth/register.cljs:113" ],
"translations" : { "translations" : {
"en" : "Login here" "en" : "Login here"
} }
}, },
"auth.login-submit-label" : { "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" : { "translations" : {
"en" : "Sign in", "en" : "Sign in",
"fr" : "Se connecter" "fr" : "Se connecter"
} }
}, },
"auth.login-subtitle" : { "auth.login-subtitle" : {
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:70" ], "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:99" ],
"translations" : { "translations" : {
"en" : "Enter your details below" "en" : "Enter your details below"
} }
}, },
"auth.login-title" : { "auth.login-title" : {
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:69" ], "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:98" ],
"translations" : { "translations" : {
"en" : "Great to see you again!" "en" : "Great to see you again!"
} }
}, },
"auth.new-password-label" : { "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" : { "translations" : {
"en" : "Type a new password", "en" : "Type a new password",
"fr" : null "fr" : null
} }
}, },
"auth.notifications.invalid-token-error" : { "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" : { "translations" : {
"en" : "The recovery token is invalid.", "en" : "The recovery token is invalid.",
"fr" : "Le jeton de récupération n'est pas valide." "fr" : "Le jeton de récupération n'est pas valide."
} }
}, },
"auth.notifications.password-changed-succesfully" : { "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" : { "translations" : {
"en" : "Password successfully changed" "en" : "Password successfully changed"
} }
}, },
"auth.notifications.recovery-token-sent" : { "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" : { "translations" : {
"en" : "Password recovery link sent to your inbox.", "en" : "Password recovery link sent to your inbox.",
"fr" : "Lien de récupération de mot de passe envoyé." "fr" : "Lien de récupération de mot de passe envoyé."
} }
}, },
"auth.password-label" : { "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" : { "translations" : {
"en" : "Password", "en" : "Password",
"fr" : "Mot de passe" "fr" : "Mot de passe"
} }
}, },
"auth.password-length-hint" : { "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" : { "translations" : {
"en" : "At least 8 characters" "en" : "At least 8 characters"
} }
@ -144,43 +144,43 @@
} }
}, },
"auth.recovery-submit-label" : { "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" : { "translations" : {
"en" : "Change your password" "en" : "Change your password"
} }
}, },
"auth.register" : { "auth.register" : {
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:84" ], "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:120" ],
"translations" : { "translations" : {
"en" : "Sign up here" "en" : "Sign up here"
} }
}, },
"auth.register-label" : { "auth.register-label" : {
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:81" ], "used-in" : [ "src/uxbox/main/ui/auth/login.cljs:117" ],
"translations" : { "translations" : {
"en" : "No account yet?" "en" : "No account yet?"
} }
}, },
"auth.register-submit-label" : { "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" : { "translations" : {
"en" : "Create an account" "en" : "Create an account"
} }
}, },
"auth.register-subtitle" : { "auth.register-subtitle" : {
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:103" ], "used-in" : [ "src/uxbox/main/ui/auth/register.cljs:102" ],
"translations" : { "translations" : {
"en" : "It's free, it's Open Source" "en" : "It's free, it's Open Source"
} }
}, },
"auth.register-title" : { "auth.register-title" : {
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:102" ], "used-in" : [ "src/uxbox/main/ui/auth/register.cljs:101" ],
"translations" : { "translations" : {
"en" : "Create an account" "en" : "Create an account"
} }
}, },
"auth.sidebar-tagline" : { "auth.sidebar-tagline" : {
"used-in" : [ "src/uxbox/main/ui/auth.cljs:44" ], "used-in" : [ "src/uxbox/main/ui/auth.cljs:42" ],
"translations" : { "translations" : {
"en" : "The open-source solution for design and prototyping." "en" : "The open-source solution for design and prototyping."
} }
@ -520,27 +520,27 @@
"unused" : true "unused" : true
}, },
"errors.auth.unauthorized" : { "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" : { "translations" : {
"en" : "Username or password seems to be wrong.", "en" : "Username or password seems to be wrong.",
"fr" : "Le nom d'utilisateur ou le mot de passe semble être faux." "fr" : "Le nom d'utilisateur ou le mot de passe semble être faux."
} }
}, },
"errors.email-already-exists" : { "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" : { "translations" : {
"en" : "Email already used" "en" : "Email already used"
} }
}, },
"errors.generic" : { "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" : { "translations" : {
"en" : "Something wrong has happened.", "en" : "Something wrong has happened.",
"fr" : "Quelque chose c'est mal passé." "fr" : "Quelque chose c'est mal passé."
} }
}, },
"errors.network" : { "errors.network" : {
"used-in" : [ "src/uxbox/main/ui.cljs:173" ], "used-in" : [ "src/uxbox/main/ui.cljs:178" ],
"translations" : { "translations" : {
"en" : "Unable to connect to backend server.", "en" : "Unable to connect to backend server.",
"fr" : "Impossible de se connecter au serveur principal." "fr" : "Impossible de se connecter au serveur principal."
@ -560,14 +560,14 @@
} }
}, },
"errors.registration-disabled" : { "errors.registration-disabled" : {
"used-in" : [ "src/uxbox/main/ui/auth/register.cljs:52" ], "used-in" : [ "src/uxbox/main/ui/auth/register.cljs:51" ],
"translations" : { "translations" : {
"en" : "The registration is currently disabled.", "en" : "The registration is currently disabled.",
"fr" : "L'enregistrement est actuellement désactivé." "fr" : "L'enregistrement est actuellement désactivé."
} }
}, },
"errors.unexpected-error" : { "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" : { "translations" : {
"en" : "An unexpected error occurred.", "en" : "An unexpected error occurred.",
"fr" : "Une erreur inattendue c'est produite" "fr" : "Une erreur inattendue c'est produite"
@ -635,7 +635,7 @@
} }
}, },
"profile.recovery.go-to-login" : { "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" : { "translations" : {
"en" : null, "en" : null,
"fr" : null "fr" : null
@ -647,32 +647,56 @@
"en" : "Cancel and keep my account" "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" : { "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" : { "translations" : {
"en" : "Change email" "en" : "Change email"
} }
}, },
"settings.change-email-submit-label" : { "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" : { "translations" : {
"en" : "Change email" "en" : "Change email"
} }
}, },
"settings.change-email-title" : { "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" : { "translations" : {
"en" : "Change your email" "en" : "Change your email"
} }
}, },
"settings.close-modal-label" : { "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" : { "translations" : {
"en" : "Close" "en" : "Close"
} }
}, },
"settings.confirm-email-label" : { "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" : { "translations" : {
"en" : "Verify new email" "en" : "Verify new email"
} }
@ -697,13 +721,19 @@
} }
}, },
"settings.email-label" : { "settings.email-label" : {
"used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:67" ], "used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:68" ],
"translations" : { "translations" : {
"en" : "Email" "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" : { "settings.fullname-label" : {
"used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:60" ], "used-in" : [ "src/uxbox/main/ui/settings/profile.cljs:61" ],
"translations" : { "translations" : {
"en" : "Your name", "en" : "Your name",
"fr" : "Votre nom complet" "fr" : "Votre nom complet"
@ -722,7 +752,7 @@
} }
}, },
"settings.new-email-label" : { "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" : { "translations" : {
"en" : "New email" "en" : "New email"
} }
@ -734,53 +764,24 @@
"fr" : "Nouveau mot de passe" "fr" : "Nouveau mot de passe"
} }
}, },
"settings.notifications.description" : {
"translations" : {
"en" : null,
"fr" : null
},
"unused" : true
},
"settings.notifications.email-changed-successfully" : { "settings.notifications.email-changed-successfully" : {
"used-in" : [ "src/uxbox/main/ui/auth.cljs:64" ], "used-in" : [ "src/uxbox/main/ui/auth.cljs:62" ],
"translations" : { "translations" : {
"en" : "Your email address has been updated successfully" "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" : { "settings.notifications.email-verified-successfully" : {
"used-in" : [ "src/uxbox/main/ui/auth.cljs:57" ], "used-in" : [ "src/uxbox/main/ui/auth.cljs:55" ],
"translations" : { "translations" : {
"en" : "Your email address has been verified successfully" "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" : { "settings.notifications.password-saved" : {
"used-in" : [ "src/uxbox/main/ui/settings/password.cljs:36" ], "used-in" : [ "src/uxbox/main/ui/settings/password.cljs:36" ],
"translations" : { "translations" : {
@ -789,14 +790,13 @@
} }
}, },
"settings.notifications.profile-deletion-not-allowed" : { "settings.notifications.profile-deletion-not-allowed" : {
"used-in" : [ "src/uxbox/main/data/auth.cljs:136" ],
"translations" : { "translations" : {
"en" : null, "en" : "You can't delete you profile. Reasign your teams before proceed."
"fr" : null }
},
"used-in" : [ "src/uxbox/main/data/auth.cljs:121" ]
}, },
"settings.notifications.profile-saved" : { "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" : { "translations" : {
"en" : "Profile saved successfully!", "en" : "Profile saved successfully!",
"fr" : "Profil enregistré avec succès !" "fr" : "Profil enregistré avec succès !"
@ -810,13 +810,13 @@
} }
}, },
"settings.options" : { "settings.options" : {
"used-in" : [ "src/uxbox/main/ui/settings/header.cljs:52" ], "used-in" : [ "src/uxbox/main/ui/settings/header.cljs:55" ],
"translations" : { "translations" : {
"en" : "OPTIONS" "en" : "OPTIONS"
} }
}, },
"settings.password" : { "settings.password" : {
"used-in" : [ "src/uxbox/main/ui/settings/header.cljs:47" ], "used-in" : [ "src/uxbox/main/ui/settings/header.cljs:50" ],
"translations" : { "translations" : {
"en" : "PASSWORD", "en" : "PASSWORD",
"fr" : "MOT DE PASSE" "fr" : "MOT DE PASSE"
@ -830,27 +830,27 @@
} }
}, },
"settings.profile" : { "settings.profile" : {
"used-in" : [ "src/uxbox/main/ui/settings/header.cljs:42" ], "used-in" : [ "src/uxbox/main/ui/settings/header.cljs:45" ],
"translations" : { "translations" : {
"en" : "PROFILE", "en" : "PROFILE",
"fr" : "PROFIL" "fr" : "PROFIL"
} }
}, },
"settings.profile-submit-label" : { "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" : { "translations" : {
"en" : "Update settings", "en" : "Update settings",
"fr" : "Mettre à jour les paramètres" "fr" : "Mettre à jour les paramètres"
} }
}, },
"settings.remove-account-label" : { "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" : { "translations" : {
"en" : "Want to remove your account?" "en" : "Want to remove your account?"
} }
}, },
"settings.teams" : { "settings.teams" : {
"used-in" : [ "src/uxbox/main/ui/settings/header.cljs:57" ], "used-in" : [ "src/uxbox/main/ui/settings/header.cljs:60" ],
"translations" : { "translations" : {
"en" : "TEAMS" "en" : "TEAMS"
} }
@ -868,7 +868,7 @@
} }
}, },
"settings.update-photo-label" : { "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" : { "translations" : {
"en" : "UPDATE" "en" : "UPDATE"
} }
@ -881,7 +881,7 @@
"unused" : true "unused" : true
}, },
"settings.verification-sent-title" : { "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" : { "translations" : {
"en" : "Verification email sent" "en" : "Verification email sent"
} }
@ -893,13 +893,13 @@
} }
}, },
"viewer.empty-state" : { "viewer.empty-state" : {
"used-in" : [ "src/uxbox/main/ui/viewer.cljs:44" ], "used-in" : [ "src/uxbox/main/ui/viewer.cljs:43" ],
"translations" : { "translations" : {
"en" : "No frames found on the page." "en" : "No frames found on the page."
} }
}, },
"viewer.frame-not-found" : { "viewer.frame-not-found" : {
"used-in" : [ "src/uxbox/main/ui/viewer.cljs:48" ], "used-in" : [ "src/uxbox/main/ui/viewer.cljs:47" ],
"translations" : { "translations" : {
"en" : "Frame not found." "en" : "Frame not found."
} }
@ -1467,7 +1467,7 @@
"unused" : true "unused" : true
}, },
"workspace.options.position" : { "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" : { "translations" : {
"en" : "Position", "en" : "Position",
"fr" : "Position" "fr" : "Position"
@ -1480,14 +1480,14 @@
} }
}, },
"workspace.options.radius" : { "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" : { "translations" : {
"en" : "Radius", "en" : "Radius",
"fr" : "TODO" "fr" : "TODO"
} }
}, },
"workspace.options.rotation" : { "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" : { "translations" : {
"en" : "Rotation", "en" : "Rotation",
"fr" : "TODO" "fr" : "TODO"
@ -1513,7 +1513,7 @@
} }
}, },
"workspace.options.size" : { "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" : { "translations" : {
"en" : "Size", "en" : "Size",
"fr" : "Taille" "fr" : "Taille"
@ -1717,7 +1717,7 @@
} }
}, },
"workspace.viewport.click-to-close-path" : { "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" : { "translations" : {
"en" : "Click to close the path" "en" : "Click to close the path"
} }

View file

@ -1002,7 +1002,7 @@ input[type=range]:focus::-ms-fill-upper {
// Banner top // Banner top
.msg-banner { .banner {
top: 0; top: 0;
left: 0px; left: 0px;
width: 100%; width: 100%;
@ -1013,7 +1013,7 @@ input[type=range]:focus::-ms-fill-upper {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.close-button { .btn-close {
position: absolute; position: absolute;
right: 0px; right: 0px;
top: 0px; top: 0px;
@ -1038,7 +1038,7 @@ input[type=range]:focus::-ms-fill-upper {
} }
} }
.msg-content { .content {
align-items: center; align-items: center;
color: $color-white; color: $color-white;
display: flex; display: flex;
@ -1075,23 +1075,23 @@ input[type=range]:focus::-ms-fill-upper {
&.warning { &.warning {
background-color: $color-warning; background-color: $color-warning;
} }
&.info { &.info {
background-color: $color-info; background-color: $color-info;
} }
&.quick { &.quick {
.close-button { .btn-close {
display: none; display: none;
} }
} }
&.hide-message { &.hide {
@include animation(0, .6s, fadeOutUp); @include animation(0, .6s, fadeOutUp);
} }
} }
.msg-inline { .inline-banner {
display: flex; display: flex;
margin-bottom: $big; margin-bottom: $big;
min-height: 40px; 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; display: flex;
font-size: $fs14; font-size: $fs14;
color: $color-black; color: $color-black;
padding: $small; padding: $small;
} }
&.error { &.error {
background-color: lighten($color-danger,30%); background-color: lighten($color-danger,30%);
.icon { .icon {
@ -1139,7 +1158,7 @@ input[type=range]:focus::-ms-fill-upper {
background-color: $color-warning; background-color: $color-warning;
} }
} }
&.info { &.info {
background-color: lighten($color-info,30%); background-color: lighten($color-info,30%);
.icon { .icon {
@ -1147,7 +1166,7 @@ input[type=range]:focus::-ms-fill-upper {
} }
} }
.close-button { .btn-close {
width: 40px; width: 40px;
height: 40px; height: 40px;
flex-shrink: 0; flex-shrink: 0;
@ -1168,53 +1187,14 @@ input[type=range]:focus::-ms-fill-upper {
opacity: .8; opacity: .8;
} }
} }
&.quick { &.quick {
.close-button { .btn-close {
display: none; 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 { .close-bezier {
fill: $color-danger; fill: $color-danger;
stroke: $color-danger-dark; stroke: $color-danger-dark;

View file

@ -145,7 +145,9 @@
.profile-form { .profile-form {
flex-grow: 1; flex-grow: 1;
flex-basis: 390px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.change-email { .change-email {

View file

@ -57,7 +57,8 @@
params {:email email params {:email email
:password password :password password
:scope "webapp"}] :scope "webapp"}]
(->> (rp/mutation :login params) (->> (rx/timer 100)
(rx/mapcat #(rp/mutation :login params))
(rx/tap on-success) (rx/tap on-success)
(rx/catch (fn [err] (rx/catch (fn [err]
(on-error err) (on-error err)

View file

@ -9,13 +9,13 @@
(ns uxbox.main.data.messages (ns uxbox.main.data.messages
(:require (:require
[beicon.core :as rx]
[cljs.spec.alpha :as s] [cljs.spec.alpha :as s]
[potok.core :as ptk] [potok.core :as ptk]
[beicon.core :as rx]
[uxbox.common.data :as d] [uxbox.common.data :as d]
[uxbox.common.exceptions :as ex]
[uxbox.common.pages :as cp] [uxbox.common.pages :as cp]
[uxbox.common.spec :as us] [uxbox.common.spec :as us]
[uxbox.common.exceptions :as ex]
[uxbox.config :as cfg])) [uxbox.config :as cfg]))
(declare hide) (declare hide)
@ -33,10 +33,11 @@
ptk/WatchEvent ptk/WatchEvent
(watch [_ state stream] (watch [_ state stream]
(let [stoper (rx/filter (ptk/type? ::show) stream)] (when (:timeout data)
(->> (rx/of hide) (let [stoper (rx/filter (ptk/type? ::show) stream)]
(rx/delay (:timeout data)) (->> (rx/of hide)
(rx/take-until stoper)))))) (rx/delay (:timeout data))
(rx/take-until stoper)))))))
(def hide (def hide
(ptk/reify ::hide (ptk/reify ::hide
@ -51,19 +52,29 @@
(defn error (defn error
[message & {:keys [timeout] :or {timeout 3000}}] ([content] (error content {}))
(show {:content message ([content {:keys [timeout] :or {timeout 3000}}]
:type :error (show {:content content
:timeout timeout})) :type :error
:timeout timeout})))
(defn info (defn info
[message & {:keys [timeout] :or {timeout 3000}}] ([content] (info content {}))
(show {:content message ([content {:keys [timeout] :or {timeout 3000}}]
:type :info (show {:content content
:timeout timeout})) :type :info
:timeout timeout})))
(defn success (defn success
[message & {:keys [timeout] :or {timeout 3000}}] ([content] (success content {}))
(show {:content message ([content {:keys [timeout] :or {timeout 3000}}]
:type :info (show {:content content
:timeout timeout})) :type :success
:timeout timeout})))
(defn warn
([content] (warn content {}))
([content {:keys [timeout] :or {timeout 3000}}]
(show {:content content
:type :warning
:timeout timeout})))

View file

@ -13,20 +13,22 @@
[cuerdas.core :as str] [cuerdas.core :as str]
[potok.core :as ptk] [potok.core :as ptk]
[rumext.alpha :as mf] [rumext.alpha :as mf]
[uxbox.main.ui.icons :as i]
[uxbox.common.data :as d] [uxbox.common.data :as d]
[uxbox.common.exceptions :as ex] [uxbox.common.exceptions :as ex]
[uxbox.common.uuid :as uuid]
[uxbox.main.data.auth :refer [logout]] [uxbox.main.data.auth :refer [logout]]
[uxbox.main.data.messages :as dm] [uxbox.main.data.messages :as dm]
[uxbox.main.refs :as refs] [uxbox.main.refs :as refs]
[uxbox.main.store :as st] [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.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.settings :as settings]
[uxbox.main.ui.static :refer [not-found-page not-authorized-page]]
[uxbox.main.ui.viewer :refer [viewer-page]] [uxbox.main.ui.viewer :refer [viewer-page]]
[uxbox.main.ui.workspace :as workspace] [uxbox.main.ui.workspace :as workspace]
[uxbox.util.i18n :refer [tr]] [uxbox.util.i18n :as i18n :refer [tr t]]
[uxbox.util.timers :as ts])) [uxbox.util.timers :as ts]))
;; --- Routes ;; --- Routes
@ -84,62 +86,63 @@
(mf/defc app-container (mf/defc app-container
{::mf/wrap [#(mf/catch % {:fallback app-error})]} {::mf/wrap [#(mf/catch % {:fallback app-error})]}
[{:keys [route] :as props}] [{: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-verify-token
:auth-register [:& verify-token {:route route}]
:auth-goodbye
:auth-recovery-request
:auth-recovery)
[:& auth {:route route}]
:auth-verify-token (:settings-profile
[:& verify-token {:route route}] :settings-password
:settings-options)
[:& settings/settings {:route route}]
(:settings-profile :debug-icons-preview
:settings-password (when *assert*
:settings-options) [:& i/debug-icons-preview])
[:& settings/settings {:route route}]
:debug-icons-preview (:dashboard-search
(when *assert* :dashboard-team
[:& i/debug-icons-preview]) :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 :viewer
:dashboard-team (let [index (d/parse-integer (get-in route [:params :query :index]))
:dashboard-project token (get-in route [:params :query :token])
:dashboard-library-icons page-id (uuid (get-in route [:params :path :page-id]))]
:dashboard-library-icons-index [:& viewer-page {:page-id page-id
:dashboard-library-images :index index
:dashboard-library-images-index :token token}])
:dashboard-library-palettes
:dashboard-library-palettes-index)
[:& dashboard {:route route}]
:viewer :workspace
(let [index (d/parse-integer (get-in route [:params :query :index])) (let [project-id (uuid (get-in route [:params :path :project-id]))
token (get-in route [:params :query :token]) file-id (uuid (get-in route [:params :path :file-id]))
page-id (uuid (get-in route [:params :path :page-id]))] page-id (uuid (get-in route [:params :query :page-id]))]
[:& viewer-page {:page-id page-id [:& workspace/workspace {:project-id project-id
:index index :file-id file-id
:token token}]) :page-id page-id
:key file-id}])
:workspace :not-authorized
(let [project-id (uuid (get-in route [:params :path :project-id])) [:& not-authorized-page]
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-found
[:& not-authorized-page] [:& not-found-page]
:not-found nil)])
[:& not-found-page]
nil))
(mf/defc app (mf/defc app
[] []

View file

@ -17,7 +17,6 @@
[uxbox.main.data.users :as du] [uxbox.main.data.users :as du]
[uxbox.main.data.messages :as dm] [uxbox.main.data.messages :as dm]
[uxbox.main.store :as st] [uxbox.main.store :as st]
[uxbox.main.ui.messages :refer [messages]]
[uxbox.main.ui.auth.login :refer [login-page]] [uxbox.main.ui.auth.login :refer [login-page]]
[uxbox.main.ui.auth.recovery :refer [recovery-page]] [uxbox.main.ui.auth.recovery :refer [recovery-page]]
[uxbox.main.ui.auth.recovery-request :refer [recovery-request-page]] [uxbox.main.ui.auth.recovery-request :refer [recovery-request-page]]
@ -37,28 +36,19 @@
[{:keys [route] :as props}] [{:keys [route] :as props}]
(let [section (get-in route [:data :name]) (let [section (get-in route [:data :name])
locale (mf/deref i18n/locale)] locale (mf/deref i18n/locale)]
[:* [:div.auth
[:& messages] [:section.auth-sidebar
[:a.logo {:href "/#/"} i/logo]
[:span.tagline (t locale "auth.sidebar-tagline")]]
[:div.msg-banner.error [:section.auth-content
[:div.msg-content (case section
[:div.icon i/msg-error] :auth-register [:& register-page {:locale locale}]
[:span "Lorem ipsum dolor sit amet"] :auth-login [:& login-page {:locale locale}]
[:div.close-button i/close]]] :auth-goodbye [:& goodbye-page {:locale locale}]
:auth-recovery-request [:& recovery-request-page {:locale locale}]
[:div.auth :auth-recovery [:& recovery-page {:locale locale
[:section.auth-sidebar :params (:query-params route)}])]]))
[: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)}])]]]))
(defn- handle-email-verified (defn- handle-email-verified
[data] [data]

View file

@ -18,6 +18,7 @@
[uxbox.main.data.auth :as da] [uxbox.main.data.auth :as da]
[uxbox.main.repo :as rp] [uxbox.main.repo :as rp]
[uxbox.main.store :as st] [uxbox.main.store :as st]
[uxbox.main.ui.messages :as msgs]
[uxbox.main.data.messages :as dm] [uxbox.main.data.messages :as dm]
[uxbox.main.ui.components.forms :refer [input submit-button form]] [uxbox.main.ui.components.forms :refer [input submit-button form]]
[uxbox.util.object :as obj] [uxbox.util.object :as obj]
@ -32,16 +33,6 @@
(s/def ::login-form (s/def ::login-form
(s/keys :req-un [::email ::password])) (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 (defn- login-with-google
[event] [event]
(dom/prevent-default event) (dom/prevent-default event)
@ -51,23 +42,43 @@
(mf/defc login-form (mf/defc login-form
[{:keys [locale] :as props}] [{:keys [locale] :as props}]
[:& form {:on-submit on-submit (let [error? (mf/use-state false)
:spec ::login-form
:initial {}} on-error
[:& input (fn [form event]
{:name :email (reset! error? true))
:type "text"
:tab-index "2" on-submit
:help-icon i/at (fn [form event]
:label (t locale "auth.email-label")}] (reset! error? false)
[:& input (let [params (with-meta (:clean-data form)
{:type "password" {:on-error on-error})]
:name :password (st/emit! (da/login params))))]
:tab-index "3"
:help-icon i/eye [:*
:label (t locale "auth.password-label")}] (when @error?
[:& submit-button [:& msgs/inline-banner
{:label (t locale "auth.login-submit-label")}]]) {: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 (mf/defc login-page
[{:keys [locale] :as props}] [{:keys [locale] :as props}]

View file

@ -18,7 +18,6 @@
[uxbox.main.data.messages :as dm] [uxbox.main.data.messages :as dm]
[uxbox.main.store :as st] [uxbox.main.store :as st]
[uxbox.main.ui.components.forms :refer [input submit-button form]] [uxbox.main.ui.components.forms :refer [input submit-button form]]
[uxbox.main.ui.messages :refer [messages]]
[uxbox.main.ui.navigation :as nav] [uxbox.main.ui.navigation :as nav]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.forms :as fm] [uxbox.util.forms :as fm]

View file

@ -19,7 +19,6 @@
[uxbox.main.data.messages :as dm] [uxbox.main.data.messages :as dm]
[uxbox.main.store :as st] [uxbox.main.store :as st]
[uxbox.main.ui.components.forms :refer [input submit-button form]] [uxbox.main.ui.components.forms :refer [input submit-button form]]
[uxbox.main.ui.messages :refer [messages]]
[uxbox.main.ui.navigation :as nav] [uxbox.main.ui.navigation :as nav]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.forms :as fm] [uxbox.util.forms :as fm]

View file

@ -18,9 +18,9 @@
[uxbox.main.data.auth :as uda] [uxbox.main.data.auth :as uda]
[uxbox.main.store :as st] [uxbox.main.store :as st]
[uxbox.main.data.auth :as da] [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.components.forms :refer [input submit-button form]]
[uxbox.main.ui.navigation :as nav] [uxbox.main.ui.navigation :as nav]
[uxbox.main.ui.messages :as msgs]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.forms :as fm] [uxbox.util.forms :as fm]
[uxbox.util.i18n :refer [tr t]] [uxbox.util.i18n :refer [tr t]]
@ -28,14 +28,10 @@
(mf/defc demo-warning (mf/defc demo-warning
[_] [_]
[:& msgs/inline-banner
[:div.msg-inline.warning.quick {:type :warning
[:div.icon i/msg-warning] :content (tr "auth.demo-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]])
(s/def ::fullname ::fm/not-empty-string) (s/def ::fullname ::fm/not-empty-string)
(s/def ::password ::fm/not-empty-string) (s/def ::password ::fm/not-empty-string)

View file

@ -13,6 +13,7 @@
[rumext.alpha :as mf] [rumext.alpha :as mf]
[uxbox.main.ui.icons :as i] [uxbox.main.ui.icons :as i]
[uxbox.common.exceptions :as ex] [uxbox.common.exceptions :as ex]
[uxbox.common.uuid :as uuid]
[uxbox.common.spec :as us] [uxbox.common.spec :as us]
[uxbox.main.refs :as refs] [uxbox.main.refs :as refs]
[uxbox.main.ui.dashboard.sidebar :refer [sidebar]] [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.recent-files :refer [recent-files-page]]
[uxbox.main.ui.dashboard.library :refer [library-page]] [uxbox.main.ui.dashboard.library :refer [library-page]]
[uxbox.main.ui.dashboard.profile :refer [profile-section]] [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? (defn ^boolean uuid-str?
[s] [s]
@ -53,6 +54,8 @@
(uuid-str? library-id) (uuid-str? library-id)
(assoc :library-id (uuid library-id))))) (assoc :library-id (uuid library-id)))))
(declare global-notifications)
(mf/defc dashboard (mf/defc dashboard
[{:keys [route] :as props}] [{:keys [route] :as props}]
@ -61,7 +64,7 @@
{:keys [search-term team-id project-id library-id library-section] :as params} {:keys [search-term team-id project-id library-id library-section] :as params}
(parse-params route profile)] (parse-params route profile)]
[:* [:*
[:& messages] [:& global-notifications {:profile profile}]
[:section.dashboard-layout [:section.dashboard-layout
[:div.main-logo i/logo-icon] [:div.main-logo i/logo-icon]
[:& profile-section {:profile profile}] [:& profile-section {:profile profile}]
@ -91,3 +94,17 @@
:dashboard-project :dashboard-project
[:& project-page {:team-id team-id [:& project-page {:team-id team-id
:project-id project-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))]]])))

View file

@ -10,41 +10,56 @@
[uxbox.util.i18n :as i18n :refer [t]] [uxbox.util.i18n :as i18n :refer [t]]
[uxbox.util.timers :as ts])) [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 notification-item
[{:keys [type status on-close quick? content] :as props}]
(mf/defc messages (let [klass (dom/classnames
[] :fixed true
(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)
:success (= type :success) :success (= type :success)
:quick false)] :error (= type :error)
[:div.message {:class klass} :info (= type :info)
[:a.close-button {:on-click on-close} i/close] :warning (= type :warning)
[:div.message-content :hide (= status :hide)
[:span content]]])) :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])]])

View file

@ -17,7 +17,6 @@
[uxbox.main.store :as st] [uxbox.main.store :as st]
[uxbox.util.router :as rt] [uxbox.util.router :as rt]
[uxbox.main.ui.dashboard.profile :refer [profile-section]] [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.header :refer [header]]
[uxbox.main.ui.settings.password :refer [password-page]] [uxbox.main.ui.settings.password :refer [password-page]]
[uxbox.main.ui.settings.options :refer [options-page]] [uxbox.main.ui.settings.options :refer [options-page]]
@ -28,7 +27,6 @@
(let [section (get-in route [:data :name]) (let [section (get-in route [:data :name])
profile (mf/deref refs/profile)] profile (mf/deref refs/profile)]
[:main.settings-main [:main.settings-main
[:& messages]
[:div.settings-content [:div.settings-content
[:& header {:section section :profile profile}] [:& header {:section section :profile profile}]
(case section (case section

View file

@ -17,6 +17,7 @@
[uxbox.main.data.auth :as da] [uxbox.main.data.auth :as da]
[uxbox.main.data.users :as du] [uxbox.main.data.users :as du]
[uxbox.main.ui.components.forms :refer [input submit-button form]] [uxbox.main.ui.components.forms :refer [input submit-button form]]
[uxbox.main.ui.messages :as msgs]
[uxbox.main.data.messages :as dm] [uxbox.main.data.messages :as dm]
[uxbox.main.store :as st] [uxbox.main.store :as st]
[uxbox.main.refs :as refs] [uxbox.main.refs :as refs]
@ -36,9 +37,7 @@
(= (:code error) :uxbox.services.mutations.profile/email-already-exists) (= (:code error) :uxbox.services.mutations.profile/email-already-exists)
(swap! form (fn [data] (swap! form (fn [data]
(let [error {:message (tr "errors.email-already-exists")}] (let [error {:message (tr "errors.email-already-exists")}]
(-> data (assoc-in data [:errors :email-1] error))))
(assoc-in [:errors :email-1] error)
(assoc-in [:errors :email-2] error)))))
:else :else
(let [msg (tr "errors.unexpected-error")] (let [msg (tr "errors.unexpected-error")]
@ -55,11 +54,9 @@
[:section.modal-content.generic-form [:section.modal-content.generic-form
[:h2 (t locale "settings.change-email-title")] [:h2 (t locale "settings.change-email-title")]
[:span.featured-note [:& msgs/inline-banner
[:span.text {:type :info
[:span "Well send you an email to your current email "] :content (t locale "settings.change-email-info" (:email profile))}]
[:strong (:email profile)]
[:span " to verify your identity."]]]
[:& form {:on-submit on-submit [:& form {:on-submit on-submit
:spec ::email-change-form :spec ::email-change-form
@ -80,12 +77,10 @@
[:section.modal-content.generic-form.confirmation [:section.modal-content.generic-form.confirmation
[:h2 (t locale "settings.verification-sent-title")] [:h2 (t locale "settings.verification-sent-title")]
[:span.featured-note
[:span.icon i/trash] [:& msgs/inline-banner
[:span.text {:type :info
[:span (str/format "We have sent you an email to “")] :content (t locale "settings.change-email-info2" (:email profile))}]
[:strong (:email profile)]
[:span "” Please follow the instructions to verify the email."]]]
[:button.btn-primary.btn-large [:button.btn-primary.btn-large
{:on-click #(modal/hide!)} {:on-click #(modal/hide!)}

View file

@ -19,6 +19,7 @@
[uxbox.main.ui.settings.change-email :refer [change-email-modal]] [uxbox.main.ui.settings.change-email :refer [change-email-modal]]
[uxbox.main.ui.settings.delete-account :refer [delete-account-modal]] [uxbox.main.ui.settings.delete-account :refer [delete-account-modal]]
[uxbox.main.ui.modal :as modal] [uxbox.main.ui.modal :as modal]
[uxbox.main.ui.messages :as msgs]
[uxbox.main.data.messages :as dm] [uxbox.main.data.messages :as dm]
[uxbox.main.store :as st] [uxbox.main.store :as st]
[uxbox.main.refs :as refs] [uxbox.main.refs :as refs]
@ -73,20 +74,17 @@
(t locale "settings.change-email-label")]] (t locale "settings.change-email-label")]]
(not= (:pending-email prof) (:email prof)) (not= (:pending-email prof) (:email prof))
[:span.featured-note [:& msgs/inline-banner
[:span.icon i/trash] {:type :info
[:span.text :content (t locale "settings.change-email-info3" (:pending-email prof))}
[:span "There is a pending change of your email to "] [:div.btn-secondary.btn-small
[:strong (:pending-email prof)] {:on-click #(st/emit! udu/cancel-email-change)}
[:span "."] [:br] (t locale "settings.cancel-email-change")]]
[:a {:on-click #(st/emit! udu/cancel-email-change)}
"Dismiss"]]]
:else :else
[:span.featured-note.warning [:& msgs/inline-banner
[:span.text {:type :info
[:span "There is a pending email validation."]]]) :content (t locale "settings.email-verification-pending")}])
[:& submit-button [:& submit-button
{:label (t locale "settings.profile-submit-label")}] {:label (t locale "settings.profile-submit-label")}]

View file

@ -22,7 +22,6 @@
[uxbox.main.ui.components.dropdown :refer [dropdown]] [uxbox.main.ui.components.dropdown :refer [dropdown]]
[uxbox.main.ui.hooks :as hooks] [uxbox.main.ui.hooks :as hooks]
[uxbox.main.ui.keyboard :as kbd] [uxbox.main.ui.keyboard :as kbd]
[uxbox.main.ui.messages :refer [messages]]
[uxbox.main.ui.viewer.header :refer [header]] [uxbox.main.ui.viewer.header :refer [header]]
[uxbox.main.ui.viewer.thumbnails :refer [thumbnails-panel]] [uxbox.main.ui.viewer.thumbnails :refer [thumbnails-panel]]
[uxbox.main.ui.viewer.shapes :refer [frame-svg]] [uxbox.main.ui.viewer.shapes :refer [frame-svg]]
@ -87,23 +86,21 @@
(mf/use-effect on-mount) (mf/use-effect on-mount)
(hooks/use-shortcuts dv/shortcuts) (hooks/use-shortcuts dv/shortcuts)
[:* [:div.viewer-layout {:class (classnames :fullscreen fullscreen?)
[:& messages] :ref container}
[:div.viewer-layout {:class (classnames :fullscreen fullscreen?)
:ref container}
[:& header {:data data [:& header {:data data
:toggle-fullscreen toggle-fullscreen :toggle-fullscreen toggle-fullscreen
:fullscreen? fullscreen? :fullscreen? fullscreen?
:local local :local local
:index index}] :index index}]
[:div.viewer-content {:on-click on-click} [:div.viewer-content {:on-click on-click}
(when (:show-thumbnails local) (when (:show-thumbnails local)
[:& thumbnails-panel {:index index [:& thumbnails-panel {:index index
:data data}]) :data data}])
[:& main-panel {:data data [:& main-panel {:data data
:local local :local local
:index index}]]]])) :index index}]]]))
;; --- Component: Viewer Page ;; --- Component: Viewer Page

View file

@ -22,7 +22,6 @@
[uxbox.main.ui.confirm] [uxbox.main.ui.confirm]
[uxbox.main.ui.keyboard :as kbd] [uxbox.main.ui.keyboard :as kbd]
[uxbox.main.ui.hooks :as hooks] [uxbox.main.ui.hooks :as hooks]
[uxbox.main.ui.messages :refer [messages]]
[uxbox.main.ui.workspace.viewport :refer [viewport coordinates]] [uxbox.main.ui.workspace.viewport :refer [viewport coordinates]]
[uxbox.main.ui.workspace.colorpalette :refer [colorpalette]] [uxbox.main.ui.workspace.colorpalette :refer [colorpalette]]
[uxbox.main.ui.workspace.context-menu :refer [context-menu]] [uxbox.main.ui.workspace.context-menu :refer [context-menu]]
@ -117,12 +116,11 @@
(let [file (mf/deref refs/workspace-file) (let [file (mf/deref refs/workspace-file)
project (mf/deref refs/workspace-project) project (mf/deref refs/workspace-project)
layout (mf/deref refs/workspace-layout)] layout (mf/deref refs/workspace-layout)]
[:* [:section
[:& header {:file file [:& header {:file file
:project project :project project
:layout layout}] :layout layout}]
[:& messages]
[:& context-menu] [:& context-menu]
(if (and (and file project) (if (and (and file project)