Fix image source for script logos to ensure leading slash is consistent for all components' paths

This commit is contained in:
Bram Suurd 2024-11-13 15:16:29 +01:00
parent ca7deabd4d
commit 948f8b0058
4 changed files with 10 additions and 10 deletions

View File

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

View File

@ -92,14 +92,14 @@ export function LatestScripts({ items }: { items: Category[] }) {
<CardTitle className="flex items-center gap-3">
<div className="flex h-16 w-16 items-center justify-center rounded-lg bg-accent p-1">
<Image
src={script.logo || `${basePath}/logo.png`}
src={script.logo || `/${basePath}/logo.png`}
unoptimized
height={64}
width={64}
alt=""
onError={(e) =>
((e.currentTarget as HTMLImageElement).src =
`${basePath}/logo.png`)
`/${basePath}/logo.png`)
}
className="h-11 w-11 object-contain"
/>
@ -165,13 +165,13 @@ 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">
<Image
unoptimized
src={script.logo || `${basePath}/logo.png`}
src={script.logo || `/${basePath}/logo.png`}
height={64}
width={64}
alt=""
onError={(e) =>
((e.currentTarget as HTMLImageElement).src =
`${basePath}/logo.png`)
`/${basePath}/logo.png`)
}
className="h-11 w-11 object-contain"
/>

View File

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

View File

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