mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-02 19:01:40 +00:00
Add play handlers and item count to list pages
This commit is contained in:
parent
6bb0474d62
commit
915b0eb372
6 changed files with 183 additions and 55 deletions
|
|
@ -19,7 +19,6 @@ import {
|
|||
VirtualGridAutoSizerContainer,
|
||||
VirtualTable,
|
||||
} from '/@/renderer/components';
|
||||
import { useSongList } from '/@/renderer/features/songs/queries/song-list-query';
|
||||
import {
|
||||
useCurrentServer,
|
||||
useSetSongTable,
|
||||
|
|
@ -38,10 +37,11 @@ import { LibraryItem, QueueSong } from '/@/renderer/api/types';
|
|||
import { usePlayQueueAdd } from '/@/renderer/features/player';
|
||||
|
||||
interface SongListContentProps {
|
||||
itemCount?: number;
|
||||
tableRef: MutableRefObject<AgGridReactType | null>;
|
||||
}
|
||||
|
||||
export const SongListContent = ({ tableRef }: SongListContentProps) => {
|
||||
export const SongListContent = ({ itemCount, tableRef }: SongListContentProps) => {
|
||||
const queryClient = useQueryClient();
|
||||
const server = useCurrentServer();
|
||||
const page = useSongListStore();
|
||||
|
|
@ -54,12 +54,6 @@ export const SongListContent = ({ tableRef }: SongListContentProps) => {
|
|||
|
||||
const isPaginationEnabled = page.display === ListDisplayType.TABLE_PAGINATED;
|
||||
|
||||
const checkSongList = useSongList({
|
||||
limit: 1,
|
||||
startIndex: 0,
|
||||
...page.filter,
|
||||
});
|
||||
|
||||
const columnDefs: ColDef[] = useMemo(
|
||||
() => getColumnDefs(page.table.columns),
|
||||
[page.table.columns],
|
||||
|
|
@ -224,7 +218,7 @@ export const SongListContent = ({ tableRef }: SongListContentProps) => {
|
|||
defaultColDef={defaultColumnDefs}
|
||||
enableCellChangeFlash={false}
|
||||
getRowId={(data) => data.data.id}
|
||||
infiniteInitialRowCount={checkSongList.data?.totalRecordCount || 100}
|
||||
infiniteInitialRowCount={itemCount || 100}
|
||||
pagination={isPaginationEnabled}
|
||||
paginationAutoPageSize={isPaginationEnabled}
|
||||
paginationPageSize={page.table.pagination.itemsPerPage || 100}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue