🛠️ VitNode is still in development! You can try it out, but it is not recommended to use it now in production.
Frontend
Components
Avatar

Avatar User

To use the Avatar component you have to import from @/components/user/avatar/avatar-user. Component requires sizeInRem prop to be passed.

ℹ️

1rem === 16px

Current User

If you want to display the user avatar, you need to pass a user object with:

  • id - user's id
  • name - user's name
  • avatar - user's UploadCoreAttachmentsObj interface,
  • avatar_color - user's avatar color
import { AvatarUser } from '@/components/user/avatar/avatar-user';
 
<AvatarUser
  user={{
    avatar,
    name,
    id,
    avatar_color
  }}
  sizeInRem={1.75}
/>;

Current User

If you want to display the user avatar, you need to pass a user object form useSession or useSessionAdmin (if you want to use in AdminCP) hook.

import { AvatarUser } from '@/components/user/avatar/avatar-user';
import { useSession } from '@/hooks/core/use-session';
 
const { session } = useSession();
if (!session) return null;
 
return <AvatarUser user={session} sizeInRem={1.75} />;