Fix image source fallback for script logos to use a consistent relative path

This commit is contained in:
Bram Suurd 2024-11-13 14:04:43 +01:00
parent b78979260f
commit bb590c697e
4 changed files with 8 additions and 8 deletions

View File

@ -104,13 +104,13 @@ export default function ScriptAccordion({
> >
<div className="flex items-center"> <div className="flex items-center">
<Image <Image
src={script.logo || "/logo.png"} src={script.logo || "logo.png"}
height={16} height={16}
width={16} width={16}
unoptimized unoptimized
onError={(e) => onError={(e) =>
((e.currentTarget as HTMLImageElement).src = ((e.currentTarget as HTMLImageElement).src =
"/logo.png") "logo.png")
} }
alt={script.name} alt={script.name}
className="mr-1 w-4 h-4 rounded-full" className="mr-1 w-4 h-4 rounded-full"

View File

@ -92,7 +92,7 @@ export function LatestScripts({ items }: { items: Category[] }) {
<CardTitle className="flex items-center gap-3"> <CardTitle className="flex items-center gap-3">
<div className="flex h-16 w-16 items-center justify-center rounded-lg bg-accent p-1"> <div className="flex h-16 w-16 items-center justify-center rounded-lg bg-accent p-1">
<Image <Image
src={script.logo || "/logo.png"} src={script.logo || "logo.png"}
unoptimized unoptimized
height={64} height={64}
width={64} width={64}
@ -161,7 +161,7 @@ export function MostViewedScripts({ items }: { items: Category[] }) {
<div className="flex max-h-16 min-h-16 min-w-16 max-w-16 items-center justify-center rounded-lg bg-accent p-1"> <div className="flex max-h-16 min-h-16 min-w-16 max-w-16 items-center justify-center rounded-lg bg-accent p-1">
<Image <Image
unoptimized unoptimized
src={script.logo || "/logo.png"} src={script.logo || "logo.png"}
height={64} height={64}
width={64} width={64}
alt="" alt=""

View File

@ -40,10 +40,10 @@ function ScriptItem({
<div className="flex"> <div className="flex">
<Image <Image
className="h-32 w-32 rounded-lg bg-accent/60 object-contain p-3 shadow-md" className="h-32 w-32 rounded-lg bg-accent/60 object-contain p-3 shadow-md"
src={item.logo || "/logo.png"} src={item.logo || "logo.png"}
width={400} width={400}
onError={(e) => onError={(e) =>
((e.currentTarget as HTMLImageElement).src = "/logo.png") ((e.currentTarget as HTMLImageElement).src = "logo.png")
} }
height={400} height={400}
alt={item.name} alt={item.name}

View File

@ -102,10 +102,10 @@ export default function CommandMenu() {
> >
<div className="flex gap-2" onClick={() => setOpen(false)}> <div className="flex gap-2" onClick={() => setOpen(false)}>
<Image <Image
src={script.logo || "/logo.png"} src={script.logo || "logo.png"}
onError={(e) => onError={(e) =>
((e.currentTarget as HTMLImageElement).src = ((e.currentTarget as HTMLImageElement).src =
"/logo.png") "logo.png")
} }
unoptimized unoptimized
width={16} width={16}