feat: Image is always an unoptimized original

This commit is contained in:
Julien Froidefond
2025-04-03 10:21:43 +02:00
parent 60e2b0e507
commit 459a8c96f9
6 changed files with 4 additions and 32 deletions

View File

@@ -129,11 +129,7 @@ function MediaCard({ item, onClick }: MediaCardProps) {
<div className="relative aspect-[2/3] bg-muted"> <div className="relative aspect-[2/3] bg-muted">
{isSeries ? ( {isSeries ? (
<> <>
<SeriesCover <SeriesCover series={item as KomgaSeries} alt={`Couverture de ${title}`} />
series={item as KomgaSeries}
alt={`Couverture de ${title}`}
quality={100}
/>
<div className="absolute inset-0 bg-black/60 opacity-0 hover:opacity-100 transition-opacity duration-200 flex flex-col justify-end p-3"> <div className="absolute inset-0 bg-black/60 opacity-0 hover:opacity-100 transition-opacity duration-200 flex flex-col justify-end p-3">
<h3 className="font-medium text-sm text-white line-clamp-2">{title}</h3> <h3 className="font-medium text-sm text-white line-clamp-2">{title}</h3>
<p className="text-xs text-white/80 mt-1"> <p className="text-xs text-white/80 mt-1">
@@ -146,7 +142,6 @@ function MediaCard({ item, onClick }: MediaCardProps) {
<BookCover <BookCover
book={item as KomgaBook} book={item as KomgaBook}
alt={`Couverture de ${title}`} alt={`Couverture de ${title}`}
quality={100}
showControls={false} showControls={false}
overlayVariant="home" overlayVariant="home"
/> />

View File

@@ -77,8 +77,6 @@ export function SeriesGrid({ series, isCompact = false }: SeriesGridProps) {
<SeriesCover <SeriesCover
series={series as KomgaSeries} series={series as KomgaSeries}
alt={t("series.coverAlt", { title: series.metadata.title })} alt={t("series.coverAlt", { title: series.metadata.title })}
quality={25}
sizes="(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 33vw"
/> />
<div className="absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/60 to-transparent p-4 space-y-2 translate-y-full group-hover:translate-y-0 transition-transform duration-200"> <div className="absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/60 to-transparent p-4 space-y-2 translate-y-full group-hover:translate-y-0 transition-transform duration-200">
<h3 className="font-medium text-sm text-white line-clamp-2">{series.metadata.title}</h3> <h3 className="font-medium text-sm text-white line-clamp-2">{series.metadata.title}</h3>

View File

@@ -126,7 +126,6 @@ export const SeriesHeader = ({ series, refreshSeries }: SeriesHeaderProps) => {
series={series as KomgaSeries} series={series as KomgaSeries}
alt={t("series.header.coverAlt", { title: series.metadata.title })} alt={t("series.header.coverAlt", { title: series.metadata.title })}
className="blur-sm scale-105 brightness-50" className="blur-sm scale-105 brightness-50"
quality={60}
showProgressUi={false} showProgressUi={false}
/> />
</div> </div>
@@ -139,7 +138,6 @@ export const SeriesHeader = ({ series, refreshSeries }: SeriesHeaderProps) => {
<SeriesCover <SeriesCover
series={series as KomgaSeries} series={series as KomgaSeries}
alt={t("series.header.coverAlt", { title: series.metadata.title })} alt={t("series.header.coverAlt", { title: series.metadata.title })}
quality={90}
showProgressUi={false} showProgressUi={false}
/> />
</div> </div>

View File

@@ -51,8 +51,6 @@ export function BookCover({
book, book,
alt = "Image de couverture", alt = "Image de couverture",
className, className,
quality = 80,
sizes = "(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw",
showProgressUi = true, showProgressUi = true,
onSuccess, onSuccess,
showControls = true, showControls = true,
@@ -88,8 +86,6 @@ export function BookCover({
imageUrl={imageUrl} imageUrl={imageUrl}
alt={alt} alt={alt}
className={className} className={className}
quality={quality}
sizes={sizes}
isCompleted={isCompleted} isCompleted={isCompleted}
/> />
{showProgress && <ProgressBar progress={currentPage} total={totalPages} type="book" />} {showProgress && <ProgressBar progress={currentPage} total={totalPages} type="book" />}

View File

@@ -10,8 +10,6 @@ interface CoverClientProps {
imageUrl: string; imageUrl: string;
alt: string; alt: string;
className?: string; className?: string;
quality?: number;
sizes?: string;
isCompleted?: boolean; isCompleted?: boolean;
} }
@@ -19,8 +17,6 @@ export const CoverClient = ({
imageUrl, imageUrl,
alt, alt,
className, className,
quality = 80,
sizes = "(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw",
isCompleted = false, isCompleted = false,
}: CoverClientProps) => { }: CoverClientProps) => {
const [imageError, setImageError] = useState(false); const [imageError, setImageError] = useState(false);
@@ -43,15 +39,13 @@ export const CoverClient = ({
fill fill
className={cn( className={cn(
"object-cover transition-opacity duration-300 rounded-lg", "object-cover transition-opacity duration-300 rounded-lg",
isLoading ? "opacity-0" : "opacity-100",
isCompleted && "opacity-50", isCompleted && "opacity-50",
className className
)} )}
sizes={sizes}
onError={() => setImageError(true)} onError={() => setImageError(true)}
onLoad={() => setIsLoading(false)} onLoad={() => setIsLoading(false)}
loading={"lazy"} loading="lazy"
quality={quality} unoptimized
/> />
</div> </div>
); );

View File

@@ -9,8 +9,6 @@ export function SeriesCover({
series, series,
alt = "Image de couverture", alt = "Image de couverture",
className, className,
quality = 80,
sizes = "(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw",
showProgressUi = true, showProgressUi = true,
}: SeriesCoverProps) { }: SeriesCoverProps) {
const imageUrl = getImageUrl("series", series.id); const imageUrl = getImageUrl("series", series.id);
@@ -22,14 +20,7 @@ export function SeriesCover({
return ( return (
<div className="relative w-full h-full"> <div className="relative w-full h-full">
<CoverClient <CoverClient imageUrl={imageUrl} alt={alt} className={className} isCompleted={isCompleted} />
imageUrl={imageUrl}
alt={alt}
className={className}
quality={quality}
sizes={sizes}
isCompleted={isCompleted}
/>
{showProgress && <ProgressBar progress={readBooks} total={totalBooks} type="series" />} {showProgress && <ProgressBar progress={readBooks} total={totalBooks} type="series" />}
</div> </div>
); );