2022-12-30 21:04:06 -08:00
|
|
|
import type { AgGridReact as AgGridReactType } from '@ag-grid-community/react/lib/agGridReact';
|
2025-05-18 14:03:18 -07:00
|
|
|
|
2023-07-16 13:33:23 -07:00
|
|
|
import { lazy, MutableRefObject, Suspense } from 'react';
|
2025-05-18 14:03:18 -07:00
|
|
|
|
2023-07-16 13:33:23 -07:00
|
|
|
import { VirtualInfiniteGridRef } from '/@/renderer/components/virtual-grid';
|
2023-07-19 20:53:49 -07:00
|
|
|
import { useListContext } from '/@/renderer/context/list-context';
|
2025-05-20 19:23:36 -07:00
|
|
|
import { useListStoreByKey } from '/@/renderer/store';
|
2025-06-24 00:04:36 -07:00
|
|
|
import { Spinner } from '/@/shared/components/spinner/spinner';
|
2025-05-20 19:23:36 -07:00
|
|
|
import { ListDisplayType } from '/@/shared/types/types';
|
2023-07-16 13:33:23 -07:00
|
|
|
|
|
|
|
|
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 {
|
2025-05-18 14:03:18 -07:00
|
|
|
gridRef: MutableRefObject<null | VirtualInfiniteGridRef>;
|
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 = ({
|
|
|
|
|
gridRef,
|
2025-05-18 14:03:18 -07:00
|
|
|
itemCount,
|
2023-07-16 13:33:23 -07:00
|
|
|
tableRef,
|
|
|
|
|
}: AlbumArtistListContentProps) => {
|
2023-07-19 20:53:49 -07:00
|
|
|
const { pageKey } = useListContext();
|
|
|
|
|
const { display } = useListStoreByKey({ key: pageKey });
|
2025-06-24 00:04:36 -07:00
|
|
|
const isGrid = display === ListDisplayType.CARD || display === ListDisplayType.GRID;
|
2023-07-01 19:10:05 -07:00
|
|
|
|
|
|
|
|
return (
|
2023-07-16 13:33:23 -07:00
|
|
|
<Suspense fallback={<Spinner container />}>
|
|
|
|
|
{isGrid ? (
|
2025-07-12 11:17:54 -07:00
|
|
|
<AlbumArtistListGridView gridRef={gridRef} itemCount={itemCount} />
|
2023-07-16 13:33:23 -07:00
|
|
|
) : (
|
2025-07-12 11:17:54 -07:00
|
|
|
<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
|
|
|
};
|