From 27387b7cf1c036e954064ebc4aafa8c6ceb89438 Mon Sep 17 00:00:00 2001 From: Kasper Fabricius Kristensen <45367945+kasperkristensen@users.noreply.github.com> Date: Thu, 11 Apr 2024 09:52:28 +0200 Subject: [PATCH] feat(dashboard): minor fixes to profile (#7046) --- .../public/locales/en-US/translation.json | 15 ++++++++---- .../profile-general-section.tsx | 9 ++++--- .../edit-profile-form/edit-profile-form.tsx | 24 +++++++++---------- .../profile/profile-edit/profile-edit.tsx | 2 +- 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/packages/admin-next/dashboard/public/locales/en-US/translation.json b/packages/admin-next/dashboard/public/locales/en-US/translation.json index 219c0b6867..f50103cae3 100644 --- a/packages/admin-next/dashboard/public/locales/en-US/translation.json +++ b/packages/admin-next/dashboard/public/locales/en-US/translation.json @@ -802,11 +802,16 @@ "profile": { "domain": "Profile", "manageYourProfileDetails": "Manage your profile details", - "editProfile": "Edit profile", - "languageHint": "The language you want to use in the admin dashboard. This will not change the language of your store.", - "userInsightsHint": "Share usage insights and help us improve Medusa. You can read more about what we collect and how we use it in our <0>documentation.", - "language": "Language", - "usageInsights": "Usage insights" + "fields": { + "languageLabel": "Language", + "usageInsightsLabel": "Usage insights" + }, + "edit": { + "header": "Edit Profile", + "languageHint": "The language you want to use in the admin dashboard. This will not change the language of your store.", + "languagePlaceholder": "Select language", + "usageInsightsHint": "Share usage insights and help us improve Medusa. You can read more about what we collect and how we use it in our <0>documentation." + } }, "users": { "domain": "Users", diff --git a/packages/admin-next/dashboard/src/v2-routes/profile/profile-detail/components/profile-general-section/profile-general-section.tsx b/packages/admin-next/dashboard/src/v2-routes/profile/profile-detail/components/profile-general-section/profile-general-section.tsx index 45bed23b88..ec8300b49c 100644 --- a/packages/admin-next/dashboard/src/v2-routes/profile/profile-detail/components/profile-general-section/profile-general-section.tsx +++ b/packages/admin-next/dashboard/src/v2-routes/profile/profile-detail/components/profile-general-section/profile-general-section.tsx @@ -10,6 +10,9 @@ type ProfileGeneralSectionProps = { export const ProfileGeneralSection = ({ user }: ProfileGeneralSectionProps) => { const { i18n, t } = useTranslation() + + const name = [user.first_name, user.last_name].filter(Boolean).join(" ") + return (
@@ -30,7 +33,7 @@ export const ProfileGeneralSection = ({ user }: ProfileGeneralSectionProps) => { {t("fields.name")} - {user.first_name} {user.last_name} + {name || "-"}
@@ -43,7 +46,7 @@ export const ProfileGeneralSection = ({ user }: ProfileGeneralSectionProps) => {
- {t("profile.language")} + {t("profile.fields.languageLabel")} {languages.find((lang) => lang.code === i18n.language) @@ -52,7 +55,7 @@ export const ProfileGeneralSection = ({ user }: ProfileGeneralSectionProps) => {
- {t("profile.usageInsights")} + {t("profile.fields.usageInsightsLabel")} {t("general.disabled")} diff --git a/packages/admin-next/dashboard/src/v2-routes/profile/profile-edit/components/edit-profile-form/edit-profile-form.tsx b/packages/admin-next/dashboard/src/v2-routes/profile/profile-edit/components/edit-profile-form/edit-profile-form.tsx index a636b5322c..e428b9358d 100644 --- a/packages/admin-next/dashboard/src/v2-routes/profile/profile-edit/components/edit-profile-form/edit-profile-form.tsx +++ b/packages/admin-next/dashboard/src/v2-routes/profile/profile-edit/components/edit-profile-form/edit-profile-form.tsx @@ -80,7 +80,7 @@ export const EditProfileForm = ({ user, usageInsights }: EditProfileProps) => { {t("fields.firstName")} - + @@ -93,7 +93,7 @@ export const EditProfileForm = ({ user, usageInsights }: EditProfileProps) => { {t("fields.lastName")} - + @@ -106,18 +106,16 @@ export const EditProfileForm = ({ user, usageInsights }: EditProfileProps) => { render={({ field: { ref, ...field } }) => (
- {t("profile.language")} - {t("profile.languageHint")} + {t("profile.fields.languageLabel")} + {t("profile.edit.languageHint")}
- - + { sortedLanguages.find( (language) => language.code === field.value @@ -148,7 +146,9 @@ export const EditProfileForm = ({ user, usageInsights }: EditProfileProps) => { render={({ field: { value, onChange, ...rest } }) => (
- {t("profile.usageInsights")} + + {t("profile.fields.usageInsightsLabel")} + { { return ( - {t("profile.editProfile")} + {t("profile.edit.header")} {!isLoading && user && (