diff --git a/packages/admin/dashboard/src/routes/profile/profile-detail/components/profile-general-section/profile-general-section.tsx b/packages/admin/dashboard/src/routes/profile/profile-detail/components/profile-general-section/profile-general-section.tsx index 390681924c..5c5661aaff 100644 --- a/packages/admin/dashboard/src/routes/profile/profile-detail/components/profile-general-section/profile-general-section.tsx +++ b/packages/admin/dashboard/src/routes/profile/profile-detail/components/profile-general-section/profile-general-section.tsx @@ -1,6 +1,6 @@ import { PencilSquare } from "@medusajs/icons" import { HttpTypes } from "@medusajs/types" -import { Container, Heading, StatusBadge, Text } from "@medusajs/ui" +import { Container, Heading, Text } from "@medusajs/ui" import { useTranslation } from "react-i18next" import { ActionMenu } from "../../../../../components/common/action-menu" import { languages } from "../../../../../i18n/languages" @@ -62,14 +62,15 @@ export const ProfileGeneralSection = ({ user }: ProfileGeneralSectionProps) => { ?.display_name || "-"} -
+ {/* TODO: Do we want to implement usage insights in V2? */} + {/*
{t("profile.fields.usageInsightsLabel")} {t("general.disabled")} -
+
*/} ) } diff --git a/packages/admin/dashboard/src/routes/profile/profile-edit/components/edit-profile-form/edit-profile-form.tsx b/packages/admin/dashboard/src/routes/profile/profile-edit/components/edit-profile-form/edit-profile-form.tsx index fcf8cc6bb0..a8439cff35 100644 --- a/packages/admin/dashboard/src/routes/profile/profile-edit/components/edit-profile-form/edit-profile-form.tsx +++ b/packages/admin/dashboard/src/routes/profile/profile-edit/components/edit-profile-form/edit-profile-form.tsx @@ -1,7 +1,7 @@ import { zodResolver } from "@hookform/resolvers/zod" -import { Button, Input, Select, Switch, toast } from "@medusajs/ui" +import { Button, Input, Select, toast } from "@medusajs/ui" import { useForm } from "react-hook-form" -import { Trans, useTranslation } from "react-i18next" +import { useTranslation } from "react-i18next" import * as zod from "zod" import { UserDTO } from "@medusajs/types" @@ -13,17 +13,17 @@ import { languages } from "../../../../../i18n/languages" type EditProfileProps = { user: Partial> - usageInsights: boolean + // usageInsights: boolean } const EditProfileSchema = zod.object({ first_name: zod.string().optional(), last_name: zod.string().optional(), language: zod.string(), - usage_insights: zod.boolean(), + // usage_insights: zod.boolean(), }) -export const EditProfileForm = ({ user, usageInsights }: EditProfileProps) => { +export const EditProfileForm = ({ user }: EditProfileProps) => { const { t, i18n } = useTranslation() const { handleSuccess } = useRouteModal() @@ -32,7 +32,7 @@ export const EditProfileForm = ({ user, usageInsights }: EditProfileProps) => { first_name: user.first_name ?? "", last_name: user.last_name ?? "", language: i18n.language, - usage_insights: usageInsights, + // usage_insights: usageInsights, }, resolver: zodResolver(EditProfileSchema), }) @@ -48,19 +48,23 @@ export const EditProfileForm = ({ user, usageInsights }: EditProfileProps) => { const { mutateAsync, isPending } = useUpdateUser(user.id!) const handleSubmit = form.handleSubmit(async (values) => { - try { - await mutateAsync({ + await mutateAsync( + { first_name: values.first_name, last_name: values.last_name, - }) + }, + { + onError: (error) => { + toast.error(error.message) + return + }, + } + ) - await changeLanguage(values.language) + await changeLanguage(values.language) - toast.success(t("profile.toast.edit")) - handleSuccess() - } catch (e) { - toast.error(e.message) - } + toast.success(t("profile.toast.edit")) + handleSuccess() }) return ( @@ -136,7 +140,8 @@ export const EditProfileForm = ({ user, usageInsights }: EditProfileProps) => { )} /> - ( @@ -173,7 +178,7 @@ export const EditProfileForm = ({ user, usageInsights }: EditProfileProps) => { )} - /> + /> */}