Skip to content

Commit c40a244

Browse files
committed
Use Boring Avatar to show user avatar
1 parent c5ba3b9 commit c40a244

20 files changed

+18
-24
lines changed

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"editor.formatOnSave": true,
44
"prettier.useEditorConfig": false,
55
"prettier.useTabs": false,
6-
"prettier.configPath": ".prettierrc"
6+
"prettier.configPath": "./.prettierrc"
77
}

backend/routes/auth/signup.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = function (sequelize) {
1111

1212
router.post('/signup', async (req, res) => {
1313
try {
14-
const { email, password, username, avatarPath } = req.body;
14+
const { email, password, username } = req.body;
1515
const hashedPassword = await bcrypt.hash(password, 10);
1616

1717
const userCount = await User.count();
@@ -25,7 +25,6 @@ module.exports = function (sequelize) {
2525
password: hashedPassword,
2626
username: username,
2727
role: initialRole,
28-
avatarPath: avatarPath,
2928
});
3029

3130
const accessToken = jwt.sign({ userId: user.id }, 'your-secret-key', {

frontend/config/selection.ts

+1-17
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,4 @@ const testRunCaseStatus = [
5555
{ uid: 'skipped', color: 'primary', chartColor: '#805aab' },
5656
];
5757

58-
const avatars = [
59-
'/avatar/bear.png',
60-
'/avatar/cat.png',
61-
'/avatar/cow.png',
62-
'/avatar/dog.png',
63-
'/avatar/giraffe.png',
64-
'/avatar/koala.png',
65-
'/avatar/lion.png',
66-
'/avatar/owl.png',
67-
'/avatar/panda.png',
68-
'/avatar/penguin.png',
69-
'/avatar/rhinoceros.png',
70-
'/avatar/shark.png',
71-
'/avatar/sloth.png',
72-
];
73-
74-
export { roles, priorities, testTypes, automationStatus, templates, testRunStatus, testRunCaseStatus, avatars };
58+
export { roles, priorities, testTypes, automationStatus, templates, testRunStatus, testRunCaseStatus };

frontend/package-lock.json

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"@types/react-dom": "18.2.7",
1818
"apexcharts": "^3.49.0",
1919
"autoprefixer": "10.4.16",
20+
"boring-avatars": "^1.10.2",
2021
"clsx": "^2.0.0",
2122
"dayjs": "^1.11.10",
2223
"eslint": "8.48.0",

frontend/public/avatar/bear.png

-29 KB
Binary file not shown.

frontend/public/avatar/cat.png

-26.4 KB
Binary file not shown.

frontend/public/avatar/cow.png

-32.7 KB
Binary file not shown.

frontend/public/avatar/dog.png

-27.8 KB
Binary file not shown.

frontend/public/avatar/giraffe.png

-28.5 KB
Binary file not shown.

frontend/public/avatar/koala.png

-28 KB
Binary file not shown.

frontend/public/avatar/lion.png

-35.9 KB
Binary file not shown.

frontend/public/avatar/owl.png

-36.1 KB
Binary file not shown.

frontend/public/avatar/panda.png

-29.9 KB
Binary file not shown.

frontend/public/avatar/penguin.png

-33.7 KB
Binary file not shown.

frontend/public/avatar/rhinoceros.png

-40 KB
Binary file not shown.

frontend/public/avatar/shark.png

-36.1 KB
Binary file not shown.

frontend/public/avatar/sloth.png

-28.1 KB
Binary file not shown.

frontend/src/app/[locale]/account/AccountPage.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
'use client';
22
import { useContext } from 'react';
3-
import { Avatar, Card, CardHeader, CardBody, Divider } from '@nextui-org/react';
3+
import { Card, CardHeader, CardBody, Divider } from '@nextui-org/react';
44
import { TokenContext } from '../TokenProvider';
5+
import Avatar from 'boring-avatars';
56

67
type AccountPageMessages = {
78
yourProjects: string;
@@ -20,7 +21,12 @@ export default function AccountPage({ messages, locale }: Props) {
2021
{context.token && context.token.user && (
2122
<Card className="w-[600px] mt-16 mx-3">
2223
<CardHeader className="flex gap-6">
23-
<Avatar isBordered radius="full" className="w-16 h-16 text-large" src={context.token.user.avatarPath} />
24+
<Avatar
25+
size={48}
26+
name={context.token.user.username}
27+
variant="beam"
28+
colors={['#0A0310', '#49007E', '#FF005B', '#FF7D10', '#FFB238']}
29+
/>
2430
<div className="flex flex-col">
2531
<p className="text-2xl font-bold">{context.token.user.username}</p>
2632
<p className="text-lg text-default-500">{context.token.user.email}</p>

frontend/src/app/[locale]/account/authPage.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ export default function AuthPage({ isSignup, messages, locale }: Props) {
5757
}
5858
}
5959

60-
const initialavatarPath = getRandomAvatarPath();
61-
user.avatarPath = initialavatarPath;
6260
await submit();
6361
};
6462

0 commit comments

Comments
 (0)