fix(dashboard): Hide usage insights (#9651)
**What** - Hides everything related to usage insights from the profile page. **Why** - We haven't set up usage insights tracking in V2, so hiding the UI for disabling/enabling it. We can re-add it again later if we decide we want to continue tracking how the dashboard is used.
This commit is contained in:
1 parent
876d8072e7
commit
7a47f5211d
2 files changed
+23
-17
No files matched your search
+4
-3
@@ -1,6 +1,6 @@
|
|||||||
import { PencilSquare } from "@medusajs/icons"
|
import { PencilSquare } from "@medusajs/icons"
|
||||||
import { HttpTypes } from "@medusajs/types"
|
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 { useTranslation } from "react-i18next"
|
||||||
import { ActionMenu } from "../../../../../components/common/action-menu"
|
import { ActionMenu } from "../../../../../components/common/action-menu"
|
||||||
import { languages } from "../../../../../i18n/languages"
|
import { languages } from "../../../../../i18n/languages"
|
||||||
@@ -62,14 +62,15 @@ export const ProfileGeneralSection = ({ user }: ProfileGeneralSectionProps) => {
|
|||||||
?.display_name || "-"}
|
?.display_name || "-"}
|
||||||
</Text>
|
</Text>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid grid-cols-2 items-center px-6 py-4">
|
{/* TODO: Do we want to implement usage insights in V2? */}
|
||||||
|
{/* <div className="grid grid-cols-2 items-center px-6 py-4">
|
||||||
<Text size="small" leading="compact" weight="plus">
|
<Text size="small" leading="compact" weight="plus">
|
||||||
{t("profile.fields.usageInsightsLabel")}
|
{t("profile.fields.usageInsightsLabel")}
|
||||||
</Text>
|
</Text>
|
||||||
<StatusBadge color="red" className="w-fit">
|
<StatusBadge color="red" className="w-fit">
|
||||||
{t("general.disabled")}
|
{t("general.disabled")}
|
||||||
</StatusBadge>
|
</StatusBadge>
|
||||||
</div>
|
</div> */}
|
||||||
</Container>
|
</Container>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
+19
-14
@@ -1,7 +1,7 @@
|
|||||||
import { zodResolver } from "@hookform/resolvers/zod"
|
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 { useForm } from "react-hook-form"
|
||||||
import { Trans, useTranslation } from "react-i18next"
|
import { useTranslation } from "react-i18next"
|
||||||
import * as zod from "zod"
|
import * as zod from "zod"
|
||||||
|
|
||||||
import { UserDTO } from "@medusajs/types"
|
import { UserDTO } from "@medusajs/types"
|
||||||
@@ -13,17 +13,17 @@ import { languages } from "../../../../../i18n/languages"
|
|||||||
|
|
||||||
type EditProfileProps = {
|
type EditProfileProps = {
|
||||||
user: Partial<Omit<UserDTO, "password_hash">>
|
user: Partial<Omit<UserDTO, "password_hash">>
|
||||||
usageInsights: boolean
|
// usageInsights: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const EditProfileSchema = zod.object({
|
const EditProfileSchema = zod.object({
|
||||||
first_name: zod.string().optional(),
|
first_name: zod.string().optional(),
|
||||||
last_name: zod.string().optional(),
|
last_name: zod.string().optional(),
|
||||||
language: zod.string(),
|
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 { t, i18n } = useTranslation()
|
||||||
const { handleSuccess } = useRouteModal()
|
const { handleSuccess } = useRouteModal()
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ export const EditProfileForm = ({ user, usageInsights }: EditProfileProps) => {
|
|||||||
first_name: user.first_name ?? "",
|
first_name: user.first_name ?? "",
|
||||||
last_name: user.last_name ?? "",
|
last_name: user.last_name ?? "",
|
||||||
language: i18n.language,
|
language: i18n.language,
|
||||||
usage_insights: usageInsights,
|
// usage_insights: usageInsights,
|
||||||
},
|
},
|
||||||
resolver: zodResolver(EditProfileSchema),
|
resolver: zodResolver(EditProfileSchema),
|
||||||
})
|
})
|
||||||
@@ -48,19 +48,23 @@ export const EditProfileForm = ({ user, usageInsights }: EditProfileProps) => {
|
|||||||
const { mutateAsync, isPending } = useUpdateUser(user.id!)
|
const { mutateAsync, isPending } = useUpdateUser(user.id!)
|
||||||
|
|
||||||
const handleSubmit = form.handleSubmit(async (values) => {
|
const handleSubmit = form.handleSubmit(async (values) => {
|
||||||
try {
|
await mutateAsync(
|
||||||
await mutateAsync({
|
{
|
||||||
first_name: values.first_name,
|
first_name: values.first_name,
|
||||||
last_name: values.last_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"))
|
toast.success(t("profile.toast.edit"))
|
||||||
handleSuccess()
|
handleSuccess()
|
||||||
} catch (e) {
|
|
||||||
toast.error(e.message)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -136,7 +140,8 @@ export const EditProfileForm = ({ user, usageInsights }: EditProfileProps) => {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<Form.Field
|
{/* TODO: Do we want to implement usage insights in V2? */}
|
||||||
|
{/* <Form.Field
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="usage_insights"
|
name="usage_insights"
|
||||||
render={({ field: { value, onChange, ...rest } }) => (
|
render={({ field: { value, onChange, ...rest } }) => (
|
||||||
@@ -173,7 +178,7 @@ export const EditProfileForm = ({ user, usageInsights }: EditProfileProps) => {
|
|||||||
<Form.ErrorMessage />
|
<Form.ErrorMessage />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
/>
|
/> */}
|
||||||
</div>
|
</div>
|
||||||
</RouteDrawer.Body>
|
</RouteDrawer.Body>
|
||||||
<RouteDrawer.Footer>
|
<RouteDrawer.Footer>
|
||||||
|
|||||||
Reference in new issue
Block a user