2022-12-30 21:04:06 -08:00
|
|
|
import type { AgGridReact as AgGridReactType } from '@ag-grid-community/react/lib/agGridReact';
|
2023-07-16 13:33:23 -07:00
|
|
|
import { lazy, MutableRefObject, Suspense } from 'react';
|
|
|
|
|
import { Spinner } from '/@/renderer/components';
|
|
|
|
|
import { VirtualInfiniteGridRef } from '/@/renderer/components/virtual-grid';
|
|
|
|
|
import { useAlbumArtistListStore } from '/@/renderer/store';
|
|
|
|
|
import { ListDisplayType } from '/@/renderer/types';
|
|
|
|
|
|
|
|
|
|
const AlbumArtistListGridView = lazy(() =>
|
|
|
|
|
import('/@/renderer/features/artists/components/album-artist-list-grid-view').then(
|
|
|
|
|
(module) => ({
|
|
|
|
|
default: module.AlbumArtistListGridView,
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const AlbumArtistListTableView = lazy(() =>
|
|
|
|
|
import('/@/renderer/features/artists/components/album-artist-list-table-view').then(
|
|
|
|
|
(module) => ({
|
|
|
|
|
default: module.AlbumArtistListTableView,
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
);
|
2022-12-30 21:04:06 -08:00
|
|
|
|
|
|
|
|
interface AlbumArtistListContentProps {
|
2023-07-01 19:10:05 -07:00
|
|
|
gridRef: MutableRefObject<VirtualInfiniteGridRef | null>;
|
2023-07-16 13:33:23 -07:00
|
|
|
itemCount?: number;
|
2023-07-01 19:10:05 -07:00
|
|
|
tableRef: MutableRefObject<AgGridReactType | null>;
|
2022-12-30 21:04:06 -08:00
|
|
|
}
|
|
|
|
|
|
2023-07-16 13:33:23 -07:00
|
|
|
export const AlbumArtistListContent = ({
|
|
|
|
|
itemCount,
|
|
|
|
|
gridRef,
|
|
|
|
|
tableRef,
|
|
|
|
|
}: AlbumArtistListContentProps) => {
|
|
|
|
|
const { display } = useAlbumArtistListStore();
|
|
|
|
|
const isGrid = display === ListDisplayType.CARD || display === ListDisplayType.POSTER;
|
2023-07-01 19:10:05 -07:00
|
|
|
|
|
|
|
|
return (
|
2023-07-16 13:33:23 -07:00
|
|
|
<Suspense fallback={<Spinner container />}>
|
|
|
|
|
{isGrid ? (
|
|
|
|
|
<AlbumArtistListGridView
|
|
|
|
|
gridRef={gridRef}
|
|
|
|
|
itemCount={itemCount}
|
|
|
|
|
/>
|
|
|
|
|
) : (
|
|
|
|
|
<AlbumArtistListTableView
|
|
|
|
|
itemCount={itemCount}
|
|
|
|
|
tableRef={tableRef}
|
|
|
|
|
/>
|
2022-12-30 21:04:06 -08:00
|
|
|
)}
|
2023-07-16 13:33:23 -07:00
|
|
|
</Suspense>
|
2023-07-01 19:10:05 -07:00
|
|
|
);
|
2022-12-30 21:04:06 -08:00
|
|
|
};
|