fix: use next/image for profile picture

This commit is contained in:
trafficlunar 2025-03-30 18:04:48 +01:00
parent 9d35d93d9e
commit 961ec9bfcd
2 changed files with 18 additions and 2 deletions

View file

@ -1,7 +1,16 @@
import type { NextConfig } from "next"; import type { NextConfig } from "next";
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
/* config options here */ images: {
remotePatterns: [
{
hostname: "avatars.githubusercontent.com",
},
{
hostname: "cdn.discordapp.com",
},
],
},
}; };
export default nextConfig; export default nextConfig;

View file

@ -1,3 +1,4 @@
import Image from "next/image";
import { auth } from "@/lib/auth"; import { auth } from "@/lib/auth";
export default async function ProfileOverview() { export default async function ProfileOverview() {
@ -6,7 +7,13 @@ export default async function ProfileOverview() {
return ( return (
<li title="Your profile"> <li title="Your profile">
<button className="pill button !gap-2 !p-0 h-full max-w-64"> <button className="pill button !gap-2 !p-0 h-full max-w-64">
<img src={session?.user?.image ?? "/missing.webp"} alt="profile picture" className="rounded-full h-full outline-2 outline-orange-400" /> <Image
src={session?.user?.image ?? "/missing.webp"}
alt="profile picture"
width={40}
height={40}
className="rounded-full aspect-square object-cover h-full outline-2 outline-orange-400"
/>
<span className="pr-4 overflow-hidden whitespace-nowrap text-ellipsis w-full">{session?.user?.username ?? "unknown"}</span> <span className="pr-4 overflow-hidden whitespace-nowrap text-ellipsis w-full">{session?.user?.username ?? "unknown"}</span>
</button> </button>
</li> </li>