diff --git a/src/components/library/SeriesGrid.tsx b/src/components/library/SeriesGrid.tsx index ab69c6c..a7a0387 100644 --- a/src/components/library/SeriesGrid.tsx +++ b/src/components/library/SeriesGrid.tsx @@ -84,7 +84,7 @@ function SeriesCard({ series, onClick }: SeriesCardProps) { <> {`Couverture setImageError(true)} onLoad={() => setIsLoading(false)} loading="lazy" - quality={50} + quality={80} + unoptimized + priority={false} + fetchPriority="low" /> ) : ( diff --git a/src/components/series/BookGrid.tsx b/src/components/series/BookGrid.tsx index 2be96b7..edc5efd 100644 --- a/src/components/series/BookGrid.tsx +++ b/src/components/series/BookGrid.tsx @@ -11,7 +11,6 @@ import { cn } from "@/lib/utils"; interface BookGridProps { books: KomgaBook[]; onBookClick: (book: KomgaBook) => void; - getBookThumbnailUrl: (bookId: string) => string; } // Fonction utilitaire pour obtenir les informations de statut de lecture @@ -44,7 +43,7 @@ const getReadingStatusInfo = (book: KomgaBook) => { }; }; -export function BookGrid({ books, onBookClick, getBookThumbnailUrl }: BookGridProps) { +export function BookGrid({ books, onBookClick }: BookGridProps) { if (!books.length) { return (
@@ -63,11 +62,7 @@ export function BookGrid({ books, onBookClick, getBookThumbnailUrl }: BookGridPr onClick={() => onBookClick(book)} className="group relative aspect-[2/3] overflow-hidden rounded-lg bg-muted hover:opacity-100 transition-all" > - +

{book.metadata.title || `Tome ${book.metadata.number}`} @@ -87,11 +82,10 @@ export function BookGrid({ books, onBookClick, getBookThumbnailUrl }: BookGridPr interface BookImageProps { book: KomgaBook; - getBookThumbnailUrl: (bookId: string) => string; isCompleted?: boolean; } -function BookImage({ book, getBookThumbnailUrl, isCompleted }: BookImageProps) { +function BookImage({ book, isCompleted }: BookImageProps) { const [imageError, setImageError] = useState(false); const [isLoading, setIsLoading] = useState(true); @@ -104,23 +98,27 @@ function BookImage({ book, getBookThumbnailUrl, isCompleted }: BookImageProps) { } return ( -

+ <> {book.metadata.title} setImageError(true)} onLoad={() => setIsLoading(false)} loading="lazy" - quality={100} + quality={80} + unoptimized + priority={false} + fetchPriority="low" /> -
+ ); } diff --git a/src/components/series/SeriesHeader.tsx b/src/components/series/SeriesHeader.tsx index 612d973..1348480 100644 --- a/src/components/series/SeriesHeader.tsx +++ b/src/components/series/SeriesHeader.tsx @@ -52,13 +52,10 @@ export const SeriesHeader = ({ series, onSeriesUpdate }: SeriesHeaderProps) => { const { toast } = useToast(); const [languageDisplay, setLanguageDisplay] = useState(series.metadata.language); const [imageError, setImageError] = useState(false); - const [readingStatus, setReadingStatus] = useState( - getReadingStatusInfo(series) - ); + const [isLoading, setIsLoading] = useState(true); const [isFavorite, setIsFavorite] = useState(false); - const [isLoading, setIsLoading] = useState(false); const [mounted, setMounted] = useState(false); - const [imageLoading, setImageLoading] = useState(true); + const statusInfo = getReadingStatusInfo(series); // Vérifier si la série est dans les favoris au chargement useEffect(() => { @@ -78,10 +75,6 @@ export const SeriesHeader = ({ series, onSeriesUpdate }: SeriesHeaderProps) => { setMounted(true); }, [series.id]); - useEffect(() => { - setReadingStatus(getReadingStatusInfo(series)); - }, [series]); - useEffect(() => { try { if (series.metadata.language) { @@ -133,138 +126,90 @@ export const SeriesHeader = ({ series, onSeriesUpdate }: SeriesHeaderProps) => { } }; - const StatusIcon = readingStatus.icon; - return ( -
- {/* Fond flou */} -
- {!imageError && ( -
- setImageLoading(false)} - /> -
- )} -
+
+ {/* Image de fond */} + {!imageError ? ( + <> + + {`Couverture setImageError(true)} + onLoad={() => setIsLoading(false)} + quality={60} + priority + unoptimized + /> + + ) : ( +
+ +
+ )} {/* Contenu */} -
-
- {/* Image de couverture */} -
+
+
+ {/* Image principale */} +
{!imageError ? ( -
- + <> + {series.name} setImageError(true)} - onLoad={() => setImageLoading(false)} - loading="lazy" - quality={100} + onLoad={() => setIsLoading(false)} + quality={90} + priority + unoptimized /> -
+ ) : ( -
- +
+
)}
{/* Informations */} -
-
-

{series.name}

- {mounted && ( - - )} -
- - {/* Métadonnées */} -
- {series.metadata.publisher && ( - {series.metadata.publisher} - )} - {languageDisplay && ( - {languageDisplay} - )} - {series.metadata.status && ( - - {series.metadata.status.toLowerCase()} - - )} -
- - {/* Stats */} -
-
- - {readingStatus.label} -
-
- {series.booksCount} tomes - {series.booksReadCount} lus - {series.booksInProgressCount} en cours -
-
- - {/* Description */} +
+

{series.metadata.title}

{series.metadata.summary && ( -

- {series.metadata.summary} -

- )} - - {/* Tags et genres */} - {(series.metadata.tags?.length > 0 || series.metadata.genres?.length > 0) && ( -
- {[...(series.metadata.genres || []), ...(series.metadata.tags || [])].map((tag) => ( - - {tag} - - ))} -
+

{series.metadata.summary}

)} +
+ + + {statusInfo.label} + + + {series.booksCount} tome{series.booksCount > 1 ? "s" : ""} + + +