mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-21 10:50:14 +01:00
👤 feat: Show Default Icon if No Avatar or Username provided (#1943)
This commit is contained in:
parent
c52ea9490b
commit
ef86b25dae
2 changed files with 26 additions and 2 deletions
|
|
@ -3,6 +3,7 @@ import UnknownIcon from '~/components/Chat/Menus/Endpoints/UnknownIcon';
|
|||
import {
|
||||
Plugin,
|
||||
GPTIcon,
|
||||
UserIcon,
|
||||
PaLMIcon,
|
||||
CodeyIcon,
|
||||
GeminiIcon,
|
||||
|
|
@ -42,7 +43,16 @@ const Icon: React.FC<IconProps> = (props) => {
|
|||
}}
|
||||
className={cn('relative flex items-center justify-center', props.className ?? '')}
|
||||
>
|
||||
<img className="rounded-sm" src={user?.avatar || avatarSrc} alt="avatar" />
|
||||
{!user?.avatar && !user?.username ? (
|
||||
<div
|
||||
style={{ backgroundColor: 'rgb(121, 137, 255)', width: '24px', height: '24px' }}
|
||||
className="relative flex h-9 w-9 items-center justify-center rounded-sm p-1 text-white"
|
||||
>
|
||||
<UserIcon />
|
||||
</div>
|
||||
) : (
|
||||
<img className="rounded-sm" src={user?.avatar || avatarSrc} alt="avatar" />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue