Use Boring Avatar to show user avatar

This commit is contained in:
Takeshi Kimata
2024-05-20 23:16:17 +09:00
parent c5ba3b9a00
commit c40a2440ba
20 changed files with 18 additions and 24 deletions

View File

@@ -55,20 +55,4 @@ const testRunCaseStatus = [
{ uid: 'skipped', color: 'primary', chartColor: '#805aab' },
];
const avatars = [
'/avatar/bear.png',
'/avatar/cat.png',
'/avatar/cow.png',
'/avatar/dog.png',
'/avatar/giraffe.png',
'/avatar/koala.png',
'/avatar/lion.png',
'/avatar/owl.png',
'/avatar/panda.png',
'/avatar/penguin.png',
'/avatar/rhinoceros.png',
'/avatar/shark.png',
'/avatar/sloth.png',
];
export { roles, priorities, testTypes, automationStatus, templates, testRunStatus, testRunCaseStatus, avatars };
export { roles, priorities, testTypes, automationStatus, templates, testRunStatus, testRunCaseStatus };

View File

@@ -16,6 +16,7 @@
"@types/react-dom": "18.2.7",
"apexcharts": "^3.49.0",
"autoprefixer": "10.4.16",
"boring-avatars": "^1.10.2",
"clsx": "^2.0.0",
"dayjs": "^1.11.10",
"eslint": "8.48.0",
@@ -3185,6 +3186,11 @@
"node": ">=8"
}
},
"node_modules/boring-avatars": {
"version": "1.10.2",
"resolved": "https://registry.npmjs.org/boring-avatars/-/boring-avatars-1.10.2.tgz",
"integrity": "sha512-uQyvmNeW6loz4Yytj7aDo0IhhuByW/YyOHtqwb3kQ/x48hum22hROA2Wn3qzrLR5JsoZ+FHjPO6z6LrXrWjegg=="
},
"node_modules/brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",

View File

@@ -17,6 +17,7 @@
"@types/react-dom": "18.2.7",
"apexcharts": "^3.49.0",
"autoprefixer": "10.4.16",
"boring-avatars": "^1.10.2",
"clsx": "^2.0.0",
"dayjs": "^1.11.10",
"eslint": "8.48.0",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -1,7 +1,8 @@
'use client';
import { useContext } from 'react';
import { Avatar, Card, CardHeader, CardBody, Divider } from '@nextui-org/react';
import { Card, CardHeader, CardBody, Divider } from '@nextui-org/react';
import { TokenContext } from '../TokenProvider';
import Avatar from 'boring-avatars';
type AccountPageMessages = {
yourProjects: string;
@@ -20,7 +21,12 @@ export default function AccountPage({ messages, locale }: Props) {
{context.token && context.token.user && (
<Card className="w-[600px] mt-16 mx-3">
<CardHeader className="flex gap-6">
<Avatar isBordered radius="full" className="w-16 h-16 text-large" src={context.token.user.avatarPath} />
<Avatar
size={48}
name={context.token.user.username}
variant="beam"
colors={['#0A0310', '#49007E', '#FF005B', '#FF7D10', '#FFB238']}
/>
<div className="flex flex-col">
<p className="text-2xl font-bold">{context.token.user.username}</p>
<p className="text-lg text-default-500">{context.token.user.email}</p>

View File

@@ -57,8 +57,6 @@ export default function AuthPage({ isSignup, messages, locale }: Props) {
}
}
const initialavatarPath = getRandomAvatarPath();
user.avatarPath = initialavatarPath;
await submit();
};