feat(WEB-169): get profile data from API
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { _ } from "@/lib/translation"
|
||||
import { countries } from "@/components/TempDesignSystem/Form/Country/countries"
|
||||
|
||||
import {
|
||||
CalendarIcon,
|
||||
@@ -11,22 +12,27 @@ import Field from "../Field"
|
||||
|
||||
import styles from "./profile.module.css"
|
||||
|
||||
import type { ProfileProps } from "@/types/components/myPages/myProfile/profile"
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
export default function Profile(props: ProfileProps) {
|
||||
export default async function Profile() {
|
||||
const user = await serverClient().user.get()
|
||||
const countryName = countries.find(
|
||||
(country) => country.code === user.address.country
|
||||
)
|
||||
return (
|
||||
<Container {...props}>
|
||||
<Container user={user}>
|
||||
<section className={styles.info}>
|
||||
<Field>
|
||||
<Field.Icon>SE</Field.Icon>
|
||||
<Field.Icon>{user.address.country}</Field.Icon>
|
||||
<Field.TextLabel>{_("Country")}</Field.TextLabel>
|
||||
<Field.Content>Sweden</Field.Content>
|
||||
<Field.Content>{countryName?.name}</Field.Content>
|
||||
</Field>
|
||||
<Field>
|
||||
<Field.Icon>
|
||||
<CalendarIcon />
|
||||
</Field.Icon>
|
||||
<Field.TextLabel>{_("Date of Birth")}</Field.TextLabel>
|
||||
{/* TODO: Get this from user when API team adds it to payload */}
|
||||
<Field.Content>27/05/1977</Field.Content>
|
||||
</Field>
|
||||
<Field>
|
||||
@@ -34,35 +40,36 @@ export default function Profile(props: ProfileProps) {
|
||||
<EmailIcon />
|
||||
</Field.Icon>
|
||||
<Field.TextLabel>{_("Email")}</Field.TextLabel>
|
||||
<Field.Content>f*********@g****.com</Field.Content>
|
||||
<Field.Content>{user.email}</Field.Content>
|
||||
</Field>
|
||||
<Field>
|
||||
<Field.Icon>
|
||||
<PhoneIcon />
|
||||
</Field.Icon>
|
||||
<Field.TextLabel>{_("Phone number")}</Field.TextLabel>
|
||||
<Field.Content>+46 ******00</Field.Content>
|
||||
<Field.Content>{user.phoneNumber}</Field.Content>
|
||||
</Field>
|
||||
<Field>
|
||||
<Field.Icon>
|
||||
<HouseIcon />
|
||||
</Field.Icon>
|
||||
<Field.TextLabel>{_("Address")}</Field.TextLabel>
|
||||
<Field.Content>T***************</Field.Content>
|
||||
<Field.Content>{user.address.streetAddress || "-"}</Field.Content>
|
||||
</Field>
|
||||
<Field>
|
||||
<Field.Icon>
|
||||
<HouseIcon />
|
||||
</Field.Icon>
|
||||
<Field.TextLabel>{_("City/State")}</Field.TextLabel>
|
||||
<Field.Content>S*******</Field.Content>
|
||||
{/* TODO: Get this from user when API team adds it to payload */}
|
||||
<Field.Content>{user.address.city || "-"}</Field.Content>
|
||||
</Field>
|
||||
<Field>
|
||||
<Field.Icon>
|
||||
<HouseIcon />
|
||||
</Field.Icon>
|
||||
<Field.TextLabel>{_("Zip code")}</Field.TextLabel>
|
||||
<Field.Content>1****</Field.Content>
|
||||
<Field.Content>{user.address.zipCode}</Field.Content>
|
||||
</Field>
|
||||
</section>
|
||||
</Container>
|
||||
|
||||
Reference in New Issue
Block a user