feat(backoffice): afficher le format (cbz/cbr/pdf) au lieu du kind sur les cards

- Ajoute `format: string | null` dans BookDto
- BookCard et page détail utilisent `book.format ?? book.kind` avec les couleurs
  success=CBZ, warning=CBR, destructive=PDF

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 09:09:54 +01:00
parent 9153b0c750
commit 44c6dd626a
4 changed files with 17 additions and 10 deletions

View File

@@ -120,9 +120,12 @@ export default async function BookDetailPage({
<div className="flex items-center justify-between py-2 border-b border-border"> <div className="flex items-center justify-between py-2 border-b border-border">
<span className="text-sm text-muted-foreground">Format:</span> <span className="text-sm text-muted-foreground">Format:</span>
<span className={`inline-flex px-2.5 py-1 rounded-full text-xs font-semibold ${ <span className={`inline-flex px-2.5 py-1 rounded-full text-xs font-semibold ${
book.kind === 'epub' ? 'bg-primary/10 text-primary' : 'bg-muted/50 text-muted-foreground' (book.format ?? book.kind) === 'cbz' ? 'bg-success/10 text-success' :
(book.format ?? book.kind) === 'cbr' ? 'bg-warning/10 text-warning' :
(book.format ?? book.kind) === 'pdf' ? 'bg-destructive/10 text-destructive' :
'bg-muted/50 text-muted-foreground'
}`}> }`}>
{book.kind.toUpperCase()} {(book.format ?? book.kind).toUpperCase()}
</span> </span>
</div> </div>

View File

@@ -44,6 +44,7 @@ export default async function BooksPage({
volume: hit.volume, volume: hit.volume,
language: hit.language, language: hit.language,
page_count: null, page_count: null,
format: null,
file_path: null, file_path: null,
file_format: null, file_format: null,
file_parse_status: null, file_parse_status: null,

View File

@@ -102,14 +102,16 @@ export function BookCard({ book, readingStatus }: BookCardProps) {
{/* Meta Tags */} {/* Meta Tags */}
<div className="flex items-center gap-2 mt-2"> <div className="flex items-center gap-2 mt-2">
<span className={` {(book.format ?? book.kind) && (
px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider rounded-full <span className={`
${book.kind === 'cbz' ? 'bg-success/10 text-success' : ''} px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider rounded-full
${book.kind === 'cbr' ? 'bg-warning/10 text-warning' : ''} ${(book.format ?? book.kind) === 'cbz' ? 'bg-success/10 text-success' : ''}
${book.kind === 'pdf' ? 'bg-destructive/10 text-destructive' : ''} ${(book.format ?? book.kind) === 'cbr' ? 'bg-warning/10 text-warning' : ''}
`}> ${(book.format ?? book.kind) === 'pdf' ? 'bg-destructive/10 text-destructive' : ''}
{book.kind} `}>
</span> {book.format ?? book.kind}
</span>
)}
{book.language && ( {book.language && (
<span className="px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider rounded-full bg-primary/10 text-primary"> <span className="px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider rounded-full bg-primary/10 text-primary">
{book.language} {book.language}

View File

@@ -59,6 +59,7 @@ export type BookDto = {
id: string; id: string;
library_id: string; library_id: string;
kind: string; kind: string;
format: string | null;
title: string; title: string;
author: string | null; author: string | null;
series: string | null; series: string | null;