feat: implement pagination for extractions and playlists with updated API responses
This commit is contained in:
147
src/components/AppPagination.tsx
Normal file
147
src/components/AppPagination.tsx
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
import {
|
||||||
|
Pagination,
|
||||||
|
PaginationContent,
|
||||||
|
PaginationEllipsis,
|
||||||
|
PaginationItem,
|
||||||
|
PaginationLink,
|
||||||
|
PaginationNext,
|
||||||
|
PaginationPrevious,
|
||||||
|
} from '@/components/ui/pagination'
|
||||||
|
import {
|
||||||
|
Select,
|
||||||
|
SelectContent,
|
||||||
|
SelectItem,
|
||||||
|
SelectTrigger,
|
||||||
|
SelectValue,
|
||||||
|
} from '@/components/ui/select'
|
||||||
|
|
||||||
|
interface AppPaginationProps {
|
||||||
|
currentPage: number
|
||||||
|
totalPages: number
|
||||||
|
totalCount: number
|
||||||
|
pageSize: number
|
||||||
|
pageSizeOptions?: number[]
|
||||||
|
onPageChange: (page: number) => void
|
||||||
|
onPageSizeChange: (size: number) => void
|
||||||
|
itemName?: string // e.g., "items", "extractions", "playlists"
|
||||||
|
}
|
||||||
|
|
||||||
|
export function AppPagination({
|
||||||
|
currentPage,
|
||||||
|
totalPages,
|
||||||
|
totalCount,
|
||||||
|
pageSize,
|
||||||
|
pageSizeOptions = [10, 20, 50, 100],
|
||||||
|
onPageChange,
|
||||||
|
onPageSizeChange,
|
||||||
|
itemName = 'items',
|
||||||
|
}: AppPaginationProps) {
|
||||||
|
// Don't render if there are no items
|
||||||
|
if (totalCount === 0) return null
|
||||||
|
|
||||||
|
const getVisiblePages = () => {
|
||||||
|
const delta = 2
|
||||||
|
const range = []
|
||||||
|
const rangeWithDots = []
|
||||||
|
|
||||||
|
for (
|
||||||
|
let i = Math.max(2, currentPage - delta);
|
||||||
|
i <= Math.min(totalPages - 1, currentPage + delta);
|
||||||
|
i++
|
||||||
|
) {
|
||||||
|
range.push(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentPage - delta > 2) {
|
||||||
|
rangeWithDots.push(1, '...')
|
||||||
|
} else {
|
||||||
|
rangeWithDots.push(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
rangeWithDots.push(...range)
|
||||||
|
|
||||||
|
if (currentPage + delta < totalPages - 1) {
|
||||||
|
rangeWithDots.push('...', totalPages)
|
||||||
|
} else if (totalPages > 1) {
|
||||||
|
rangeWithDots.push(totalPages)
|
||||||
|
}
|
||||||
|
|
||||||
|
return rangeWithDots
|
||||||
|
}
|
||||||
|
|
||||||
|
const startItem = Math.min((currentPage - 1) * pageSize + 1, totalCount)
|
||||||
|
const endItem = Math.min(currentPage * pageSize, totalCount)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<p className="text-sm text-muted-foreground whitespace-nowrap">
|
||||||
|
Showing {startItem} to {endItem} of {totalCount} {itemName}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<Pagination>
|
||||||
|
<PaginationContent>
|
||||||
|
<PaginationItem>
|
||||||
|
<PaginationPrevious
|
||||||
|
href="#"
|
||||||
|
onClick={(e) => {
|
||||||
|
e.preventDefault()
|
||||||
|
if (currentPage > 1) onPageChange(currentPage - 1)
|
||||||
|
}}
|
||||||
|
className={currentPage <= 1 ? 'pointer-events-none opacity-50' : ''}
|
||||||
|
/>
|
||||||
|
</PaginationItem>
|
||||||
|
|
||||||
|
{getVisiblePages().map((page, index) => (
|
||||||
|
<PaginationItem key={index}>
|
||||||
|
{page === '...' ? (
|
||||||
|
<PaginationEllipsis />
|
||||||
|
) : (
|
||||||
|
<PaginationLink
|
||||||
|
href="#"
|
||||||
|
onClick={(e) => {
|
||||||
|
e.preventDefault()
|
||||||
|
onPageChange(page as number)
|
||||||
|
}}
|
||||||
|
isActive={currentPage === page}
|
||||||
|
>
|
||||||
|
{page}
|
||||||
|
</PaginationLink>
|
||||||
|
)}
|
||||||
|
</PaginationItem>
|
||||||
|
))}
|
||||||
|
|
||||||
|
<PaginationItem>
|
||||||
|
<PaginationNext
|
||||||
|
href="#"
|
||||||
|
onClick={(e) => {
|
||||||
|
e.preventDefault()
|
||||||
|
if (currentPage < totalPages) onPageChange(currentPage + 1)
|
||||||
|
}}
|
||||||
|
className={currentPage >= totalPages ? 'pointer-events-none opacity-50' : ''}
|
||||||
|
/>
|
||||||
|
</PaginationItem>
|
||||||
|
</PaginationContent>
|
||||||
|
</Pagination>
|
||||||
|
|
||||||
|
<div className="flex items-center gap-2 whitespace-nowrap">
|
||||||
|
<span className="text-sm text-muted-foreground">Show</span>
|
||||||
|
<Select
|
||||||
|
value={pageSize.toString()}
|
||||||
|
onValueChange={value => onPageSizeChange(parseInt(value, 10))}
|
||||||
|
>
|
||||||
|
<SelectTrigger className="w-[75px]">
|
||||||
|
<SelectValue />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{pageSizeOptions.map(size => (
|
||||||
|
<SelectItem key={size} value={size.toString()}>
|
||||||
|
{size}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
<span className="text-sm text-muted-foreground">rows</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -22,6 +22,10 @@ export interface CreateExtractionResponse {
|
|||||||
|
|
||||||
export interface GetExtractionsResponse {
|
export interface GetExtractionsResponse {
|
||||||
extractions: ExtractionInfo[]
|
extractions: ExtractionInfo[]
|
||||||
|
total: number
|
||||||
|
page: number
|
||||||
|
limit: number
|
||||||
|
total_pages: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ExtractionSortField = 'title' | 'status' | 'service' | 'created_at' | 'updated_at'
|
export type ExtractionSortField = 'title' | 'status' | 'service' | 'created_at' | 'updated_at'
|
||||||
@@ -33,6 +37,8 @@ export interface GetExtractionsParams {
|
|||||||
sort_by?: ExtractionSortField
|
sort_by?: ExtractionSortField
|
||||||
sort_order?: ExtractionSortOrder
|
sort_order?: ExtractionSortOrder
|
||||||
status_filter?: ExtractionStatus
|
status_filter?: ExtractionStatus
|
||||||
|
page?: number
|
||||||
|
limit?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ExtractionsService {
|
export class ExtractionsService {
|
||||||
@@ -59,7 +65,7 @@ export class ExtractionsService {
|
|||||||
/**
|
/**
|
||||||
* Get all extractions
|
* Get all extractions
|
||||||
*/
|
*/
|
||||||
async getAllExtractions(params?: GetExtractionsParams): Promise<ExtractionInfo[]> {
|
async getAllExtractions(params?: GetExtractionsParams): Promise<GetExtractionsResponse> {
|
||||||
const searchParams = new URLSearchParams()
|
const searchParams = new URLSearchParams()
|
||||||
|
|
||||||
if (params?.search) {
|
if (params?.search) {
|
||||||
@@ -74,18 +80,24 @@ export class ExtractionsService {
|
|||||||
if (params?.status_filter) {
|
if (params?.status_filter) {
|
||||||
searchParams.append('status_filter', params.status_filter)
|
searchParams.append('status_filter', params.status_filter)
|
||||||
}
|
}
|
||||||
|
if (params?.page) {
|
||||||
|
searchParams.append('page', params.page.toString())
|
||||||
|
}
|
||||||
|
if (params?.limit) {
|
||||||
|
searchParams.append('limit', params.limit.toString())
|
||||||
|
}
|
||||||
|
|
||||||
const queryString = searchParams.toString()
|
const queryString = searchParams.toString()
|
||||||
const url = queryString ? `/api/v1/extractions/?${queryString}` : '/api/v1/extractions/'
|
const url = queryString ? `/api/v1/extractions/?${queryString}` : '/api/v1/extractions/'
|
||||||
|
|
||||||
const response = await apiClient.get<GetExtractionsResponse>(url)
|
const response = await apiClient.get<GetExtractionsResponse>(url)
|
||||||
return response.extractions
|
return response
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get user's extractions
|
* Get user's extractions
|
||||||
*/
|
*/
|
||||||
async getUserExtractions(params?: GetExtractionsParams): Promise<ExtractionInfo[]> {
|
async getUserExtractions(params?: GetExtractionsParams): Promise<GetExtractionsResponse> {
|
||||||
const searchParams = new URLSearchParams()
|
const searchParams = new URLSearchParams()
|
||||||
|
|
||||||
if (params?.search) {
|
if (params?.search) {
|
||||||
@@ -100,12 +112,18 @@ export class ExtractionsService {
|
|||||||
if (params?.status_filter) {
|
if (params?.status_filter) {
|
||||||
searchParams.append('status_filter', params.status_filter)
|
searchParams.append('status_filter', params.status_filter)
|
||||||
}
|
}
|
||||||
|
if (params?.page) {
|
||||||
|
searchParams.append('page', params.page.toString())
|
||||||
|
}
|
||||||
|
if (params?.limit) {
|
||||||
|
searchParams.append('limit', params.limit.toString())
|
||||||
|
}
|
||||||
|
|
||||||
const queryString = searchParams.toString()
|
const queryString = searchParams.toString()
|
||||||
const url = queryString ? `/api/v1/extractions/user?${queryString}` : '/api/v1/extractions/user'
|
const url = queryString ? `/api/v1/extractions/user?${queryString}` : '/api/v1/extractions/user'
|
||||||
|
|
||||||
const response = await apiClient.get<GetExtractionsResponse>(url)
|
const response = await apiClient.get<GetExtractionsResponse>(url)
|
||||||
return response.extractions
|
return response
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,16 +45,24 @@ export interface GetPlaylistsParams {
|
|||||||
search?: string
|
search?: string
|
||||||
sort_by?: PlaylistSortField
|
sort_by?: PlaylistSortField
|
||||||
sort_order?: SortOrder
|
sort_order?: SortOrder
|
||||||
|
page?: number
|
||||||
limit?: number
|
limit?: number
|
||||||
offset?: number
|
|
||||||
favorites_only?: boolean
|
favorites_only?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface GetPlaylistsResponse {
|
||||||
|
playlists: Playlist[]
|
||||||
|
total: number
|
||||||
|
page: number
|
||||||
|
limit: number
|
||||||
|
total_pages: number
|
||||||
|
}
|
||||||
|
|
||||||
export class PlaylistsService {
|
export class PlaylistsService {
|
||||||
/**
|
/**
|
||||||
* Get all playlists with optional filtering, searching, and sorting
|
* Get all playlists with optional filtering, searching, and sorting
|
||||||
*/
|
*/
|
||||||
async getPlaylists(params?: GetPlaylistsParams): Promise<Playlist[]> {
|
async getPlaylists(params?: GetPlaylistsParams): Promise<GetPlaylistsResponse> {
|
||||||
const searchParams = new URLSearchParams()
|
const searchParams = new URLSearchParams()
|
||||||
|
|
||||||
// Handle parameters
|
// Handle parameters
|
||||||
@@ -67,12 +75,12 @@ export class PlaylistsService {
|
|||||||
if (params?.sort_order) {
|
if (params?.sort_order) {
|
||||||
searchParams.append('sort_order', params.sort_order)
|
searchParams.append('sort_order', params.sort_order)
|
||||||
}
|
}
|
||||||
|
if (params?.page) {
|
||||||
|
searchParams.append('page', params.page.toString())
|
||||||
|
}
|
||||||
if (params?.limit) {
|
if (params?.limit) {
|
||||||
searchParams.append('limit', params.limit.toString())
|
searchParams.append('limit', params.limit.toString())
|
||||||
}
|
}
|
||||||
if (params?.offset) {
|
|
||||||
searchParams.append('offset', params.offset.toString())
|
|
||||||
}
|
|
||||||
if (params?.favorites_only) {
|
if (params?.favorites_only) {
|
||||||
searchParams.append('favorites_only', 'true')
|
searchParams.append('favorites_only', 'true')
|
||||||
}
|
}
|
||||||
@@ -80,7 +88,7 @@ export class PlaylistsService {
|
|||||||
const url = searchParams.toString()
|
const url = searchParams.toString()
|
||||||
? `/api/v1/playlists/?${searchParams.toString()}`
|
? `/api/v1/playlists/?${searchParams.toString()}`
|
||||||
: '/api/v1/playlists/'
|
: '/api/v1/playlists/'
|
||||||
return apiClient.get<Playlist[]>(url)
|
return apiClient.get<GetPlaylistsResponse>(url)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { AppLayout } from '@/components/AppLayout'
|
import { AppLayout } from '@/components/AppLayout'
|
||||||
|
import { AppPagination } from '@/components/AppPagination'
|
||||||
import { CreateExtractionDialog } from '@/components/extractions/CreateExtractionDialog'
|
import { CreateExtractionDialog } from '@/components/extractions/CreateExtractionDialog'
|
||||||
import { ExtractionsHeader } from '@/components/extractions/ExtractionsHeader'
|
import { ExtractionsHeader } from '@/components/extractions/ExtractionsHeader'
|
||||||
import {
|
import {
|
||||||
@@ -28,6 +29,12 @@ export function ExtractionsPage() {
|
|||||||
const [sortOrder, setSortOrder] = useState<ExtractionSortOrder>('desc')
|
const [sortOrder, setSortOrder] = useState<ExtractionSortOrder>('desc')
|
||||||
const [statusFilter, setStatusFilter] = useState<ExtractionStatus | 'all'>('all')
|
const [statusFilter, setStatusFilter] = useState<ExtractionStatus | 'all'>('all')
|
||||||
|
|
||||||
|
// Pagination state
|
||||||
|
const [currentPage, setCurrentPage] = useState(1)
|
||||||
|
const [totalPages, setTotalPages] = useState(1)
|
||||||
|
const [totalCount, setTotalCount] = useState(0)
|
||||||
|
const [pageSize, setPageSize] = useState(10)
|
||||||
|
|
||||||
// Create extraction dialog state
|
// Create extraction dialog state
|
||||||
const [showCreateDialog, setShowCreateDialog] = useState(false)
|
const [showCreateDialog, setShowCreateDialog] = useState(false)
|
||||||
const [createLoading, setCreateLoading] = useState(false)
|
const [createLoading, setCreateLoading] = useState(false)
|
||||||
@@ -48,13 +55,17 @@ export function ExtractionsPage() {
|
|||||||
try {
|
try {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
setError(null)
|
setError(null)
|
||||||
const data = await extractionsService.getAllExtractions({
|
const response = await extractionsService.getAllExtractions({
|
||||||
search: debouncedSearchQuery.trim() || undefined,
|
search: debouncedSearchQuery.trim() || undefined,
|
||||||
sort_by: sortBy,
|
sort_by: sortBy,
|
||||||
sort_order: sortOrder,
|
sort_order: sortOrder,
|
||||||
status_filter: statusFilter !== 'all' ? statusFilter : undefined,
|
status_filter: statusFilter !== 'all' ? statusFilter : undefined,
|
||||||
|
page: currentPage,
|
||||||
|
limit: pageSize,
|
||||||
})
|
})
|
||||||
setExtractions(data)
|
setExtractions(response.extractions)
|
||||||
|
setTotalPages(response.total_pages)
|
||||||
|
setTotalCount(response.total)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const errorMessage =
|
const errorMessage =
|
||||||
err instanceof Error ? err.message : 'Failed to fetch extractions'
|
err instanceof Error ? err.message : 'Failed to fetch extractions'
|
||||||
@@ -67,7 +78,24 @@ export function ExtractionsPage() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchExtractions()
|
fetchExtractions()
|
||||||
}, [debouncedSearchQuery, sortBy, sortOrder, statusFilter])
|
}, [debouncedSearchQuery, sortBy, sortOrder, statusFilter, currentPage, pageSize])
|
||||||
|
|
||||||
|
// Reset to page 1 when filters change
|
||||||
|
useEffect(() => {
|
||||||
|
if (currentPage !== 1) {
|
||||||
|
setCurrentPage(1)
|
||||||
|
}
|
||||||
|
}, [debouncedSearchQuery, sortBy, sortOrder, statusFilter, pageSize])
|
||||||
|
|
||||||
|
const handlePageChange = (page: number) => {
|
||||||
|
setCurrentPage(page)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePageSizeChange = (size: number) => {
|
||||||
|
setPageSize(size)
|
||||||
|
setCurrentPage(1) // Reset to first page when changing page size
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const handleCreateExtraction = async () => {
|
const handleCreateExtraction = async () => {
|
||||||
if (!url.trim()) {
|
if (!url.trim()) {
|
||||||
@@ -113,7 +141,20 @@ export function ExtractionsPage() {
|
|||||||
return <ExtractionsEmpty searchQuery={searchQuery} statusFilter={statusFilter} />
|
return <ExtractionsEmpty searchQuery={searchQuery} statusFilter={statusFilter} />
|
||||||
}
|
}
|
||||||
|
|
||||||
return <ExtractionsTable extractions={extractions} />
|
return (
|
||||||
|
<div className="space-y-4">
|
||||||
|
<ExtractionsTable extractions={extractions} />
|
||||||
|
<AppPagination
|
||||||
|
currentPage={currentPage}
|
||||||
|
totalPages={totalPages}
|
||||||
|
totalCount={totalCount}
|
||||||
|
pageSize={pageSize}
|
||||||
|
onPageChange={handlePageChange}
|
||||||
|
onPageSizeChange={handlePageSizeChange}
|
||||||
|
itemName="extractions"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -136,7 +177,7 @@ export function ExtractionsPage() {
|
|||||||
onCreateClick={() => setShowCreateDialog(true)}
|
onCreateClick={() => setShowCreateDialog(true)}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
error={error}
|
error={error}
|
||||||
extractionCount={extractions.length}
|
extractionCount={totalCount}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<CreateExtractionDialog
|
<CreateExtractionDialog
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { AppLayout } from '@/components/AppLayout'
|
import { AppLayout } from '@/components/AppLayout'
|
||||||
|
import { AppPagination } from '@/components/AppPagination'
|
||||||
import { CreatePlaylistDialog } from '@/components/playlists/CreatePlaylistDialog'
|
import { CreatePlaylistDialog } from '@/components/playlists/CreatePlaylistDialog'
|
||||||
import { PlaylistsHeader } from '@/components/playlists/PlaylistsHeader'
|
import { PlaylistsHeader } from '@/components/playlists/PlaylistsHeader'
|
||||||
import {
|
import {
|
||||||
@@ -30,6 +31,12 @@ export function PlaylistsPage() {
|
|||||||
const [sortOrder, setSortOrder] = useState<SortOrder>('asc')
|
const [sortOrder, setSortOrder] = useState<SortOrder>('asc')
|
||||||
const [showFavoritesOnly, setShowFavoritesOnly] = useState(false)
|
const [showFavoritesOnly, setShowFavoritesOnly] = useState(false)
|
||||||
|
|
||||||
|
// Pagination state
|
||||||
|
const [currentPage, setCurrentPage] = useState(1)
|
||||||
|
const [totalPages, setTotalPages] = useState(1)
|
||||||
|
const [totalCount, setTotalCount] = useState(0)
|
||||||
|
const [pageSize, setPageSize] = useState(10)
|
||||||
|
|
||||||
// Create playlist dialog state
|
// Create playlist dialog state
|
||||||
const [showCreateDialog, setShowCreateDialog] = useState(false)
|
const [showCreateDialog, setShowCreateDialog] = useState(false)
|
||||||
const [createLoading, setCreateLoading] = useState(false)
|
const [createLoading, setCreateLoading] = useState(false)
|
||||||
@@ -54,13 +61,17 @@ export function PlaylistsPage() {
|
|||||||
try {
|
try {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
setError(null)
|
setError(null)
|
||||||
const playlistData = await playlistsService.getPlaylists({
|
const response = await playlistsService.getPlaylists({
|
||||||
search: debouncedSearchQuery.trim() || undefined,
|
search: debouncedSearchQuery.trim() || undefined,
|
||||||
sort_by: sortBy,
|
sort_by: sortBy,
|
||||||
sort_order: sortOrder,
|
sort_order: sortOrder,
|
||||||
favorites_only: showFavoritesOnly,
|
favorites_only: showFavoritesOnly,
|
||||||
|
page: currentPage,
|
||||||
|
limit: pageSize,
|
||||||
})
|
})
|
||||||
setPlaylists(playlistData)
|
setPlaylists(response.playlists)
|
||||||
|
setTotalPages(response.total_pages)
|
||||||
|
setTotalCount(response.total)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const errorMessage =
|
const errorMessage =
|
||||||
err instanceof Error ? err.message : 'Failed to fetch playlists'
|
err instanceof Error ? err.message : 'Failed to fetch playlists'
|
||||||
@@ -73,7 +84,23 @@ export function PlaylistsPage() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchPlaylists()
|
fetchPlaylists()
|
||||||
}, [debouncedSearchQuery, sortBy, sortOrder, showFavoritesOnly])
|
}, [debouncedSearchQuery, sortBy, sortOrder, showFavoritesOnly, currentPage, pageSize])
|
||||||
|
|
||||||
|
// Reset to page 1 when filters change
|
||||||
|
useEffect(() => {
|
||||||
|
if (currentPage !== 1) {
|
||||||
|
setCurrentPage(1)
|
||||||
|
}
|
||||||
|
}, [debouncedSearchQuery, sortBy, sortOrder, showFavoritesOnly, pageSize])
|
||||||
|
|
||||||
|
const handlePageChange = (page: number) => {
|
||||||
|
setCurrentPage(page)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePageSizeChange = (size: number) => {
|
||||||
|
setPageSize(size)
|
||||||
|
setCurrentPage(1) // Reset to first page when changing page size
|
||||||
|
}
|
||||||
|
|
||||||
const handleCreatePlaylist = async () => {
|
const handleCreatePlaylist = async () => {
|
||||||
if (!newPlaylist.name.trim()) {
|
if (!newPlaylist.name.trim()) {
|
||||||
@@ -176,12 +203,23 @@ export function PlaylistsPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<div className="space-y-4">
|
||||||
<PlaylistTable
|
<PlaylistTable
|
||||||
playlists={playlists}
|
playlists={playlists}
|
||||||
onEdit={handleEditPlaylist}
|
onEdit={handleEditPlaylist}
|
||||||
onSetCurrent={handleSetCurrent}
|
onSetCurrent={handleSetCurrent}
|
||||||
onFavoriteToggle={handleFavoriteToggle}
|
onFavoriteToggle={handleFavoriteToggle}
|
||||||
/>
|
/>
|
||||||
|
<AppPagination
|
||||||
|
currentPage={currentPage}
|
||||||
|
totalPages={totalPages}
|
||||||
|
totalCount={totalCount}
|
||||||
|
pageSize={pageSize}
|
||||||
|
onPageChange={handlePageChange}
|
||||||
|
onPageSizeChange={handlePageSizeChange}
|
||||||
|
itemName="playlists"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +241,7 @@ export function PlaylistsPage() {
|
|||||||
onCreateClick={() => setShowCreateDialog(true)}
|
onCreateClick={() => setShowCreateDialog(true)}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
error={error}
|
error={error}
|
||||||
playlistCount={playlists.length}
|
playlistCount={totalCount}
|
||||||
showFavoritesOnly={showFavoritesOnly}
|
showFavoritesOnly={showFavoritesOnly}
|
||||||
onFavoritesToggle={setShowFavoritesOnly}
|
onFavoritesToggle={setShowFavoritesOnly}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user