Skip to content

Commit e8985c7

Browse files
Johan BookJohan Book
Johan Book
authored and
Johan Book
committed
feat(web-ui): improve profile page
1 parent b3e63eb commit e8985c7

File tree

7 files changed

+48
-39
lines changed

7 files changed

+48
-39
lines changed

services/web-ui/public/locales/en/profile.json

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
"placeholder": "Describe yourself in a few words"
1212
},
1313
"header": "Profile",
14+
"links": {
15+
"blog": "Blog"
16+
},
1417
"save": "Save",
1518
"update": {
1619
"error": "There was an error when trying to update your profile",

services/web-ui/public/locales/sv/profile.json

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
"placeholder": "Beskriv dig i ord"
1212
},
1313
"header": "Profil",
14+
"links": {
15+
"blog": "Blog"
16+
},
1417
"save": "Spara",
1518
"update": {
1619
"error": "Något gick fel när din profil skulle uppdateras",

services/web-ui/public/locales/zh/profile.json

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
"placeholder": "简单描述一下自己"
1212
},
1313
"header": "个人资料",
14+
"links": {
15+
"blog": "博客"
16+
},
1417
"save": "保存",
1518
"update": {
1619
"error": "尝试更新您的个人资料时出错",

services/web-ui/src/pages/ProfilePage/ProfilePage.component.tsx

+8-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { Avatar, Typography } from "@mui/material";
44

55
import { ProfileDetails } from "src/api";
66
import { Center } from "src/components/ui/Center";
7-
import { useTranslation } from "src/core/i18n";
87

98
export interface ProfilePageComponentProps {
109
profile: ProfileDetails;
@@ -13,19 +12,21 @@ export interface ProfilePageComponentProps {
1312
export function ProfilePageComponent({
1413
profile,
1514
}: ProfilePageComponentProps): ReactElement {
16-
const { t } = useTranslation("profile");
17-
1815
return (
1916
<>
2017
<Center>
2118
<Avatar src={profile.photo?.url} sx={{ height: 150, width: 150 }} />
2219
</Center>
2320

24-
<Typography gutterBottom sx={{ paddingTop: 2 }} variant="h5">
25-
{t("description.title")}
26-
</Typography>
21+
<Center>
22+
<Typography gutterBottom sx={{ paddingTop: 2 }} variant="h5">
23+
{profile.name}
24+
</Typography>
25+
</Center>
2726

28-
<Typography>{profile.description}</Typography>
27+
<Center>
28+
<Typography>{profile.description}</Typography>
29+
</Center>
2930
</>
3031
);
3132
}

services/web-ui/src/pages/ProfilePage/ProfilePage.container.tsx

+9-15
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { CacheKeysConstants, useQuery } from "src/core/query";
88
import { ErrorView } from "src/views/ErrorView";
99

1010
import { ProfilePageComponent } from "./ProfilePage.component";
11-
import { ProfilePageHeader } from "./ProfilePage.header";
11+
import { ProfilePageNav } from "./ProfilePage.nav";
1212
import { ProfilePageSkeleton } from "./ProfilePage.skeleton";
1313

1414
export function ProfilePageContainer(): ReactElement {
@@ -21,37 +21,31 @@ export function ProfilePageContainer(): ReactElement {
2121

2222
if (error) {
2323
return (
24-
<>
25-
<ProfilePageHeader />
24+
<ProfilePageNav>
2625
<ErrorView error={error} />
27-
</>
26+
</ProfilePageNav>
2827
);
2928
}
3029

3130
if (isPending) {
3231
return (
33-
<>
34-
<ProfilePageHeader />
32+
<ProfilePageNav>
3533
<ProfilePageSkeleton />
36-
</>
34+
</ProfilePageNav>
3735
);
3836
}
3937

4038
if (!data) {
4139
return (
42-
<>
43-
<ProfilePageHeader />
44-
40+
<ProfilePageNav>
4541
<Typography>Nothing found</Typography>
46-
</>
42+
</ProfilePageNav>
4743
);
4844
}
4945

5046
return (
51-
<>
52-
<ProfilePageHeader />
53-
47+
<ProfilePageNav>
5448
<ProfilePageComponent profile={data} />
55-
</>
49+
</ProfilePageNav>
5650
);
5751
}

services/web-ui/src/pages/ProfilePage/ProfilePage.header.tsx

-17
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { ReactElement } from "react";
2+
3+
import { Box } from "@mui/material";
4+
5+
import { NavLayout } from "src/components/layout";
6+
import { useTranslation } from "src/core/i18n";
7+
8+
interface ProfilePageNavProps {
9+
children: ReactElement;
10+
}
11+
12+
export function ProfilePageNav({
13+
children,
14+
}: ProfilePageNavProps): ReactElement {
15+
const { t } = useTranslation("profile");
16+
17+
return (
18+
<NavLayout linkText={t("links.blog")} to="/">
19+
<Box sx={{ pt: 1 }}>{children}</Box>
20+
</NavLayout>
21+
);
22+
}

0 commit comments

Comments
 (0)