mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-02 19:55:18 +02:00
refactor: update UserAvatar component to use Next.js Image
This commit is contained in:
parent
d0dcb8a98b
commit
fde8faec7e
1 changed files with 7 additions and 3 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
import { ActionBarPrimitive, MessagePrimitive, useAuiState } from "@assistant-ui/react";
|
import { ActionBarPrimitive, MessagePrimitive, useAuiState } from "@assistant-ui/react";
|
||||||
import { useAtomValue } from "jotai";
|
import { useAtomValue } from "jotai";
|
||||||
import { FileText, Pen } from "lucide-react";
|
import { FileText, Pen } from "lucide-react";
|
||||||
|
import Image from "next/image";
|
||||||
import { type FC, useState } from "react";
|
import { type FC, useState } from "react";
|
||||||
import { messageDocumentsMapAtom } from "@/atoms/chat/mentioned-documents.atom";
|
import { messageDocumentsMapAtom } from "@/atoms/chat/mentioned-documents.atom";
|
||||||
import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button";
|
import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button";
|
||||||
|
|
@ -24,18 +25,21 @@ const UserAvatar: FC<AuthorMetadata> = ({ displayName, avatarUrl }) => {
|
||||||
|
|
||||||
if (avatarUrl && !hasError) {
|
if (avatarUrl && !hasError) {
|
||||||
return (
|
return (
|
||||||
<img
|
<Image
|
||||||
src={avatarUrl}
|
src={avatarUrl}
|
||||||
alt={displayName || "User"}
|
alt={displayName || "User"}
|
||||||
className="size-8 rounded-full object-cover"
|
width={32}
|
||||||
|
height={32}
|
||||||
|
className="size-8 rounded-full object-cover select-none"
|
||||||
referrerPolicy="no-referrer"
|
referrerPolicy="no-referrer"
|
||||||
onError={() => setHasError(true)}
|
onError={() => setHasError(true)}
|
||||||
|
unoptimized
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex size-8 items-center justify-center rounded-full bg-primary/10 text-xs font-medium text-primary">
|
<div className="flex size-8 items-center justify-center rounded-full bg-primary/10 text-xs font-medium text-primary select-none">
|
||||||
{initials}
|
{initials}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue