Change type name, add paginated table

This commit is contained in:
jeffvli 2022-12-26 04:47:40 -08:00
parent 1883164150
commit 5ed06f79b3
8 changed files with 25 additions and 30 deletions

View file

@ -4,7 +4,7 @@ import { areEqual } from 'react-window';
import { DefaultCard } from '/@/renderer/components/virtual-grid/grid-card/default-card';
import { PosterCard } from '/@/renderer/components/virtual-grid/grid-card/poster-card';
import type { GridCardData } from '/@/renderer/types';
import { CardDisplayType } from '/@/renderer/types';
import { ListDisplayType } from '/@/renderer/types';
export const GridCard = memo(({ data, index, style }: ListChildComponentProps) => {
const {
@ -26,7 +26,7 @@ export const GridCard = memo(({ data, index, style }: ListChildComponentProps) =
const startIndex = index * columnCount;
const stopIndex = Math.min(itemCount - 1, startIndex + columnCount - 1);
const View = display === CardDisplayType.CARD ? DefaultCard : PosterCard;
const View = display === ListDisplayType.CARD ? DefaultCard : PosterCard;
for (let i = startIndex; i <= stopIndex; i += 1) {
cards.push(

View file

@ -8,7 +8,7 @@ import { GridCard } from '/@/renderer/components/virtual-grid/grid-card';
import type {
CardRow,
LibraryItem,
CardDisplayType,
ListDisplayType,
CardRoute,
PlayQueueAddOptions,
} from '/@/renderer/types';
@ -64,7 +64,7 @@ export const VirtualGridWrapper = ({
}: Omit<FixedSizeListProps, 'ref' | 'itemSize' | 'children'> & {
cardRows: CardRow<Album | AlbumArtist | Artist>[];
columnCount: number;
display: CardDisplayType;
display: ListDisplayType;
handlePlayQueueAdd?: (options: PlayQueueAddOptions) => void;
itemData: any[];
itemGap: number;

View file

@ -12,7 +12,7 @@ import type { FixedSizeListProps } from 'react-window';
import InfiniteLoader from 'react-window-infinite-loader';
import { VirtualGridWrapper } from '/@/renderer/components/virtual-grid/virtual-grid-wrapper';
import type { CardRoute, CardRow, LibraryItem, PlayQueueAddOptions } from '/@/renderer/types';
import { CardDisplayType } from '/@/renderer/types';
import { ListDisplayType } from '/@/renderer/types';
export type VirtualInfiniteGridRef = {
resetLoadMoreItemsCache: () => void;
@ -22,7 +22,7 @@ export type VirtualInfiniteGridRef = {
interface VirtualGridProps extends Omit<FixedSizeListProps, 'children' | 'itemSize'> {
cardRows: CardRow<any>[];
display?: CardDisplayType;
display?: ListDisplayType;
fetchFn: (options: { columnCount: number; skip: number; take: number }) => Promise<any>;
handlePlayQueueAdd?: (options: PlayQueueAddOptions) => void;
itemGap: number;
@ -144,7 +144,7 @@ export const VirtualInfiniteGrid = forwardRef(
<VirtualGridWrapper
cardRows={cardRows}
columnCount={columnCount}
display={display || CardDisplayType.CARD}
display={display || ListDisplayType.CARD}
handlePlayQueueAdd={handlePlayQueueAdd}
height={height}
initialScrollOffset={initialScrollOffset}
@ -171,7 +171,7 @@ export const VirtualInfiniteGrid = forwardRef(
);
VirtualInfiniteGrid.defaultProps = {
display: CardDisplayType.CARD,
display: ListDisplayType.CARD,
minimumBatchSize: 20,
route: undefined,
};