diff --git a/packages/admin/dashboard/public/medusa-avatar.png b/packages/admin/dashboard/public/medusa-avatar.png new file mode 100644 index 0000000000..868804a9db Binary files /dev/null and b/packages/admin/dashboard/public/medusa-avatar.png differ diff --git a/packages/admin/dashboard/src/components/common/logo-box/avatar-box.tsx b/packages/admin/dashboard/src/components/common/logo-box/avatar-box.tsx new file mode 100644 index 0000000000..b92cef0e4d --- /dev/null +++ b/packages/admin/dashboard/src/components/common/logo-box/avatar-box.tsx @@ -0,0 +1,51 @@ +import { motion } from "framer-motion" + +import { IconAvatar } from "../icon-avatar" + +export default function AvatarBox({ checked }: { checked?: boolean }) { + return ( + + {checked && ( + + + + + + )} + + + + ) +} diff --git a/packages/admin/dashboard/src/components/common/logo-box/index.ts b/packages/admin/dashboard/src/components/common/logo-box/index.ts index ee20f53faa..96e7eccdda 100644 --- a/packages/admin/dashboard/src/components/common/logo-box/index.ts +++ b/packages/admin/dashboard/src/components/common/logo-box/index.ts @@ -1 +1,2 @@ export * from "./logo-box" +export * from "./avatar-box" diff --git a/packages/admin/dashboard/src/i18n/translations/en.json b/packages/admin/dashboard/src/i18n/translations/en.json index c2d4ed74c3..510d176b1e 100644 --- a/packages/admin/dashboard/src/i18n/translations/en.json +++ b/packages/admin/dashboard/src/i18n/translations/en.json @@ -115,6 +115,7 @@ "close": "Close", "showMore": "Show more", "continue": "Continue", + "continueWithEmail": "Continue with Email", "addReason": "Add Reason", "addNote": "Add Note", "reset": "Reset", @@ -546,7 +547,7 @@ "inventory": { "notManaged": "Not managed", "manageItems": "Manage inventory items", - "notManagedDesc":"Inventory is not managed for this variant. Turn on ‘Manage Inventory’ to track the variant's inventory.", + "notManagedDesc": "Inventory is not managed for this variant. Turn on ‘Manage Inventory’ to track the variant's inventory.", "manageKit": "Manage inventory kit", "navigateToItem": "Go to inventory item", "actions": { @@ -2338,19 +2339,20 @@ }, "login": { "forgotPassword": "Forgot password? - <0>Reset", - "title": "Log in", - "hint": "to continue to Medusa" + "title": "Welcome to Medusa", + "hint": "Sign in to access the account area" }, "invite": { - "title": "Create your account", - "hint": "to continue to Medusa", + "title": "Welcome to Medusa", + "hint": "Create you account below", + "backToLogin": "Back to login", "createAccount": "Create account", "alreadyHaveAccount": "Already have an account? - <0>Log in", "emailTooltip": "Your email cannot be changed. If you would like to use another email, a new invite must be sent.", "invalidInvite": "The invite is invalid or has expired.", - "successTitle": "Your account has been created", + "successTitle": "Your account has is registered", "successHint": "Get started with Medusa Admin right away.", - "successAction": "Sign in to start using Medusa", + "successAction": "Start Medusa Admin", "invalidTokenTitle": "Your invite token is invalid", "invalidTokenHint": "Try requesting a new invite link.", "passwordMismatch": "Passwords do not match", diff --git a/packages/admin/dashboard/src/routes/invite/invite.tsx b/packages/admin/dashboard/src/routes/invite/invite.tsx index 84f6048760..d5e71828f1 100644 --- a/packages/admin/dashboard/src/routes/invite/invite.tsx +++ b/packages/admin/dashboard/src/routes/invite/invite.tsx @@ -1,18 +1,18 @@ import { zodResolver } from "@hookform/resolvers/zod" -import { Alert, Button, Heading, Input, Text, toast } from "@medusajs/ui" +import { Alert, Button, Heading, Hint, Input, Text, toast } from "@medusajs/ui" import { AnimatePresence, motion } from "framer-motion" import i18n from "i18next" import { useState } from "react" import { useForm } from "react-hook-form" -import { Trans, useTranslation } from "react-i18next" +import { useTranslation } from "react-i18next" import { decodeToken } from "react-jwt" import { Link, useSearchParams } from "react-router-dom" import * as z from "zod" import { Form } from "../../components/common/form" -import { LogoBox } from "../../components/common/logo-box" import { useSignUpWithEmailPass } from "../../hooks/api/auth" import { useAcceptInvite } from "../../hooks/api/invites" import { isFetchError } from "../../lib/is-fetch-error" +import AvatarBox from "../../components/common/logo-box/avatar-box" const CreateAccountSchema = z .object({ @@ -50,23 +50,9 @@ export const Invite = () => { const isValidInvite = invite && validateDecodedInvite(invite) return ( -
-
- +
+
+
{isValidInvite ? ( @@ -150,19 +136,13 @@ const LoginLink = () => { return (
- - , - ]} - /> - + + {t("invite.backToLogin")} +
) } @@ -250,6 +230,14 @@ const CreateView = ({ } }) + const serverError = form.formState.errors.root?.message + const validationError = + form.formState.errors.email?.message || + form.formState.errors.password?.message || + form.formState.errors.repeat_password?.message || + form.formState.errors.first_name?.message || + form.formState.errors.last_name?.message + return (
@@ -260,18 +248,21 @@ const CreateView = ({
-
+
{ return ( - {t("fields.email")} - + - ) }} @@ -282,11 +273,14 @@ const CreateView = ({ render={({ field }) => { return ( - {t("fields.firstName")} - + - ) }} @@ -297,11 +291,14 @@ const CreateView = ({ render={({ field }) => { return ( - {t("fields.lastName")} - + - ) }} @@ -312,15 +309,15 @@ const CreateView = ({ render={({ field }) => { return ( - {t("fields.password")} - ) }} @@ -331,22 +328,33 @@ const CreateView = ({ render={({ field }) => { return ( - {t("fields.repeatPassword")} - + - ) }} /> - {form.formState.errors.root && ( + {validationError && ( +
+ + {validationError} + +
+ )} + {serverError && ( - {form.formState.errors.root.message} + {serverError} )}
@@ -381,6 +389,14 @@ const SuccessView = () => { {t("invite.successAction")} + + + {t("invite.backToLogin")} +
) } diff --git a/packages/admin/dashboard/src/routes/login/login.tsx b/packages/admin/dashboard/src/routes/login/login.tsx index ec62128014..44081f4668 100644 --- a/packages/admin/dashboard/src/routes/login/login.tsx +++ b/packages/admin/dashboard/src/routes/login/login.tsx @@ -1,18 +1,18 @@ import { zodResolver } from "@hookform/resolvers/zod" -import { Alert, Button, Heading, Input, Text } from "@medusajs/ui" +import { Alert, Button, Heading, Hint, Input, Text } from "@medusajs/ui" import { useForm } from "react-hook-form" import { Trans, useTranslation } from "react-i18next" import { Link, useLocation, useNavigate } from "react-router-dom" import * as z from "zod" -import { Divider } from "../../components/common/divider" import { Form } from "../../components/common/form" -import { LogoBox } from "../../components/common/logo-box" + import { useSignInWithEmailPassword } from "../../hooks/api/auth" import after from "virtual:medusa/widgets/login/after" import before from "virtual:medusa/widgets/login/before" import { isFetchError } from "../../lib/is-fetch-error" +import AvatarBox from "../../components/common/logo-box/avatar-box" const LoginSchema = z.object({ email: z.string().email(), @@ -68,11 +68,14 @@ export const Login = () => { }) const serverError = form.formState.errors?.root?.serverError?.message + const validationError = + form.formState.errors.email?.message || + form.formState.errors.password?.message return ( -
-
- +
+
+
{t("login.title")} @@ -92,18 +95,21 @@ export const Login = () => { onSubmit={handleSubmit} className="flex w-full flex-col gap-y-6" > -
+
{ return ( - {t("fields.email")} - + - ) }} @@ -114,29 +120,41 @@ export const Login = () => { render={({ field }) => { return ( - {t("fields.password")} + {} - ) }} />
+ {validationError && ( +
+ + {validationError} + +
+ )} + {serverError && ( + + {serverError} + + )} - {serverError && ( - - {serverError} - - )} {after.widgets.map((w, i) => { return ( @@ -146,15 +164,14 @@ export const Login = () => { ) })}
- - + , ]} />