2023-02-25 19:01:42 -08:00
|
|
|
import { VirtualInfiniteGridRef } from '/@/renderer/components';
|
2022-12-30 21:04:06 -08:00
|
|
|
import { AlbumArtistListHeader } from '/@/renderer/features/artists/components/album-artist-list-header';
|
|
|
|
|
import { AnimatedPage } from '/@/renderer/features/shared';
|
|
|
|
|
import type { AgGridReact as AgGridReactType } from '@ag-grid-community/react/lib/agGridReact';
|
|
|
|
|
import { useRef } from 'react';
|
|
|
|
|
import { AlbumArtistListContent } from '/@/renderer/features/artists/components/album-artist-list-content';
|
2023-01-28 20:46:07 -08:00
|
|
|
import { useAlbumArtistList } from '/@/renderer/features/artists/queries/album-artist-list-query';
|
2023-03-05 21:02:05 -08:00
|
|
|
import { generatePageKey, useAlbumArtistListFilter } from '/@/renderer/store';
|
|
|
|
|
import { AlbumArtistListContext } from '/@/renderer/features/artists/context/album-artist-list-context';
|
2022-12-30 21:04:06 -08:00
|
|
|
|
|
|
|
|
const AlbumArtistListRoute = () => {
|
|
|
|
|
const gridRef = useRef<VirtualInfiniteGridRef | null>(null);
|
|
|
|
|
const tableRef = useRef<AgGridReactType | null>(null);
|
2023-03-05 21:02:05 -08:00
|
|
|
const pageKey = generatePageKey('albumArtist', undefined);
|
|
|
|
|
|
|
|
|
|
const albumArtistListFilter = useAlbumArtistListFilter({ id: undefined, key: pageKey });
|
2023-01-28 20:46:07 -08:00
|
|
|
|
|
|
|
|
const itemCountCheck = useAlbumArtistList(
|
|
|
|
|
{
|
|
|
|
|
limit: 1,
|
|
|
|
|
startIndex: 0,
|
2023-03-05 21:02:05 -08:00
|
|
|
...albumArtistListFilter,
|
2023-01-28 20:46:07 -08:00
|
|
|
},
|
|
|
|
|
{
|
2023-03-05 21:02:05 -08:00
|
|
|
cacheTime: 1000 * 60,
|
|
|
|
|
staleTime: 1000 * 60,
|
2023-01-28 20:46:07 -08:00
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const itemCount =
|
|
|
|
|
itemCountCheck.data?.totalRecordCount === null
|
|
|
|
|
? undefined
|
|
|
|
|
: itemCountCheck.data?.totalRecordCount;
|
2022-12-30 21:04:06 -08:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<AnimatedPage>
|
2023-03-05 21:02:05 -08:00
|
|
|
<AlbumArtistListContext.Provider value={{ id: undefined, pageKey }}>
|
|
|
|
|
<AlbumArtistListHeader
|
|
|
|
|
gridRef={gridRef}
|
|
|
|
|
itemCount={itemCount}
|
|
|
|
|
tableRef={tableRef}
|
|
|
|
|
/>
|
|
|
|
|
<AlbumArtistListContent
|
|
|
|
|
gridRef={gridRef}
|
|
|
|
|
tableRef={tableRef}
|
|
|
|
|
/>
|
|
|
|
|
</AlbumArtistListContext.Provider>
|
2022-12-30 21:04:06 -08:00
|
|
|
</AnimatedPage>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default AlbumArtistListRoute;
|