feat: enhance home and library pages by integrating new data fetching methods, improving error handling, and refactoring components for better structure
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 4m17s
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 4m17s
This commit is contained in:
53
src/app/libraries/[libraryId]/LibraryContent.tsx
Normal file
53
src/app/libraries/[libraryId]/LibraryContent.tsx
Normal file
@@ -0,0 +1,53 @@
|
||||
"use client";
|
||||
|
||||
import { LibraryHeader } from "@/components/library/LibraryHeader";
|
||||
import { PaginatedSeriesGrid } from "@/components/library/PaginatedSeriesGrid";
|
||||
import { Container } from "@/components/ui/container";
|
||||
import { useRefresh } from "@/contexts/RefreshContext";
|
||||
import type { KomgaLibrary } from "@/types/komga";
|
||||
import type { LibraryResponse } from "@/types/library";
|
||||
import type { Series } from "@/types/series";
|
||||
import type { UserPreferences } from "@/types/preferences";
|
||||
|
||||
interface LibraryContentProps {
|
||||
library: KomgaLibrary;
|
||||
series: LibraryResponse<Series>;
|
||||
currentPage: number;
|
||||
preferences: UserPreferences;
|
||||
unreadOnly: boolean;
|
||||
search?: string;
|
||||
pageSize: number;
|
||||
}
|
||||
|
||||
export function LibraryContent({
|
||||
library,
|
||||
series,
|
||||
currentPage,
|
||||
preferences,
|
||||
unreadOnly,
|
||||
pageSize,
|
||||
}: LibraryContentProps) {
|
||||
const { refreshLibrary } = useRefresh();
|
||||
|
||||
return (
|
||||
<>
|
||||
<LibraryHeader
|
||||
library={library}
|
||||
seriesCount={series.totalElements}
|
||||
series={series.content || []}
|
||||
refreshLibrary={refreshLibrary || (async () => ({ success: false }))}
|
||||
/>
|
||||
<Container>
|
||||
<PaginatedSeriesGrid
|
||||
series={series.content || []}
|
||||
currentPage={currentPage}
|
||||
totalPages={series.totalPages}
|
||||
totalElements={series.totalElements}
|
||||
defaultShowOnlyUnread={preferences.showOnlyUnread}
|
||||
showOnlyUnread={unreadOnly}
|
||||
pageSize={pageSize}
|
||||
/>
|
||||
</Container>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user