|
1
|
import { PencilSquare } from "@medusajs/icons" |
|
2
|
import { HttpTypes } from "@medusajs/types" |
|
3
|
import { Container, Heading, Text } from "@medusajs/ui" |
|
4
|
import { useTranslation } from "react-i18next" |
|
5
|
import { ActionMenu } from "../../../../../components/common/action-menu" |
|
6
|
import { languages } from "../../../../../i18n/languages" |
|
7
|
|
|
8
|
type ProfileGeneralSectionProps = { |
|
9
|
user: HttpTypes.AdminUser |
|
10
|
} |
|
11
|
|
|
12
|
export const ProfileGeneralSection = ({ user }: ProfileGeneralSectionProps) => { |
|
13
|
const { i18n, t } = useTranslation() |
|
14
|
|
|
15
|
const name = [user.first_name, user.last_name].filter(Boolean).join(" ") |
|
16
|
|
|
17
|
return ( |
|
18
|
<Container className="divide-y p-0"> |
|
19
|
<div className="flex items-center justify-between px-6 py-4"> |
|
20
|
<div> |
|
21
|
<Heading>{t("profile.domain")}</Heading> |
|
22
|
<Text className="text-ui-fg-subtle" size="small"> |
|
23
|
{t("profile.manageYourProfileDetails")} |
|
24
|
</Text> |
|
25
|
</div> |
|
26
|
<ActionMenu |
|
27
|
groups={[ |
|
28
|
{ |
|
29
|
actions: [ |
|
30
|
{ |
|
31
|
label: t("actions.edit"), |
|
32
|
to: "edit", |
|
33
|
icon: <PencilSquare />, |
|
34
|
}, |
|
35
|
], |
|
36
|
}, |
|
37
|
]} |
|
38
|
/> |
|
39
|
</div> |
|
40
|
<div className="text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4"> |
|
41
|
<Text size="small" leading="compact" weight="plus"> |
|
42
|
{t("fields.name")} |
|
43
|
</Text> |
|
44
|
<Text size="small" leading="compact"> |
|
45
|
{name || "-"} |
|
46
|
</Text> |
|
47
|
</div> |
|
48
|
<div className="grid grid-cols-2 items-center px-6 py-4"> |
|
49
|
<Text size="small" leading="compact" weight="plus"> |
|
50
|
{t("fields.email")} |
|
51
|
</Text> |
|
52
|
<Text size="small" leading="compact"> |
|
53
|
{user.email} |
|
54
|
</Text> |
|
55
|
</div> |
|
56
|
<div className="grid grid-cols-2 items-center px-6 py-4"> |
|
57
|
<Text size="small" leading="compact" weight="plus"> |
|
58
|
{t("profile.fields.languageLabel")} |
|
59
|
</Text> |
|
60
|
<Text size="small" leading="compact"> |
|
61
|
{languages.find((lang) => lang.code === i18n.language) |
|
62
|
?.display_name || "-"} |
|
63
|
</Text> |
|
64
|
</div> |
|
65
|
{/* TODO: Do we want to implement usage insights in V2? */} |
|
66
|
{/* <div className="grid grid-cols-2 items-center px-6 py-4"> |
|
67
|
<Text size="small" leading="compact" weight="plus"> |
|
68
|
{t("profile.fields.usageInsightsLabel")} |
|
69
|
</Text> |
|
70
|
<StatusBadge color="red" className="w-fit"> |
|
71
|
{t("general.disabled")} |
|
72
|
</StatusBadge> |
|
73
|
</div> */} |
|
74
|
</Container> |
|
75
|
) |
|
76
|
} |