mirror of
https://github.com/pterodactyl/panel.git
synced 2026-11-30 19:36:02 -05:00
Co-authored-by: Anthony <anthony@infraly.co> Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
27 lines
814 B
TypeScript
27 lines
814 B
TypeScript
import type { AvatarProps } from 'boring-avatars';
|
|
import BoringAvatar from 'boring-avatars';
|
|
import { useCurrentUser } from '@/api/account/queries';
|
|
|
|
const palette = ['var(--chart-1)', 'var(--chart-2)', 'var(--chart-3)', 'var(--chart-4)', 'var(--chart-5)'];
|
|
|
|
type Props = Omit<AvatarProps, 'colors'>;
|
|
|
|
const _Avatar = ({ variant = 'beam', ...props }: AvatarProps) => (
|
|
<BoringAvatar colors={palette} variant={variant} {...props} />
|
|
);
|
|
|
|
const UserAvatar = ({ variant = 'beam', ...props }: Omit<Props, 'name'>) => {
|
|
const uuid = useCurrentUser().uuid;
|
|
|
|
return <BoringAvatar colors={palette} name={uuid} variant={variant} {...props} />;
|
|
};
|
|
|
|
_Avatar.displayName = 'Avatar';
|
|
UserAvatar.displayName = 'Avatar.User';
|
|
|
|
const Avatar = Object.assign(_Avatar, {
|
|
User: UserAvatar,
|
|
});
|
|
|
|
export default Avatar;
|