🐛 Fix issue with external images (#1334)

This commit is contained in:
Luke Vella 2024-09-08 16:06:08 +01:00 committed by GitHub
parent cc38d5cb1f
commit 33385f9039
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,5 @@
"use client"; "use client";
import { Avatar, AvatarFallback } from "@rallly/ui/avatar"; import { Avatar, AvatarFallback, AvatarImage } from "@rallly/ui/avatar";
import Image from "next/image"; import Image from "next/image";
import { useUser } from "@/components/user-provider"; import { useUser } from "@/components/user-provider";
@ -24,6 +24,9 @@ export const CurrentUserAvatar = ({
return ( return (
<Avatar className={className} style={{ width: size, height: size }}> <Avatar className={className} style={{ width: size, height: size }}>
{user.image ? ( {user.image ? (
user.image.startsWith("http") ? (
<AvatarImage src={user.image} />
) : (
<Image <Image
src={getAvatarUrl(user.image)} src={getAvatarUrl(user.image)}
width={128} width={128}
@ -32,6 +35,7 @@ export const CurrentUserAvatar = ({
style={{ objectFit: "cover" }} style={{ objectFit: "cover" }}
objectFit="cover" objectFit="cover"
/> />
)
) : ( ) : (
<AvatarFallback>{user.name[0]}</AvatarFallback> <AvatarFallback>{user.name[0]}</AvatarFallback>
)} )}