mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-14 12:30:06 +02:00
implement item list grid card row customization
This commit is contained in:
@@ -3,6 +3,7 @@ import { forwardRef } from 'react';
|
||||
|
||||
import { api } from '/@/renderer/api';
|
||||
import { useItemListInfiniteLoader } from '/@/renderer/components/item-list/helpers/item-list-infinite-loader';
|
||||
import { useGridRows } from '/@/renderer/components/item-list/helpers/use-grid-rows';
|
||||
import { useItemListScrollPersist } from '/@/renderer/components/item-list/helpers/use-item-list-scroll-persist';
|
||||
import { ItemGridList } from '/@/renderer/components/item-list/item-grid-list/item-grid-list';
|
||||
import { ItemListGridComponentProps } from '/@/renderer/components/item-list/types';
|
||||
@@ -52,6 +53,8 @@ export const AlbumListInfiniteGrid = forwardRef<any, AlbumListInfiniteGridProps>
|
||||
enabled: saveScrollOffset,
|
||||
});
|
||||
|
||||
const rows = useGridRows(LibraryItem.ALBUM, ItemListKey.ALBUM);
|
||||
|
||||
return (
|
||||
<ItemGridList
|
||||
data={data}
|
||||
@@ -64,6 +67,7 @@ export const AlbumListInfiniteGrid = forwardRef<any, AlbumListInfiniteGridProps>
|
||||
itemType={LibraryItem.ALBUM}
|
||||
onRangeChanged={onRangeChanged}
|
||||
onScrollEnd={handleOnScrollEnd}
|
||||
rows={rows}
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
||||
@@ -3,6 +3,7 @@ import { forwardRef } from 'react';
|
||||
|
||||
import { api } from '/@/renderer/api';
|
||||
import { useItemListPaginatedLoader } from '/@/renderer/components/item-list/helpers/item-list-paginated-loader';
|
||||
import { useGridRows } from '/@/renderer/components/item-list/helpers/use-grid-rows';
|
||||
import { useItemListScrollPersist } from '/@/renderer/components/item-list/helpers/use-item-list-scroll-persist';
|
||||
import { ItemGridList } from '/@/renderer/components/item-list/item-grid-list/item-grid-list';
|
||||
import { ItemListWithPagination } from '/@/renderer/components/item-list/item-list-pagination/item-list-pagination';
|
||||
@@ -15,6 +16,7 @@ import {
|
||||
LibraryItem,
|
||||
SortOrder,
|
||||
} from '/@/shared/types/domain-types';
|
||||
import { ItemListKey } from '/@/shared/types/types';
|
||||
|
||||
interface AlbumListPaginatedGridProps extends ItemListGridComponentProps<AlbumListQuery> {}
|
||||
|
||||
@@ -55,6 +57,8 @@ export const AlbumListPaginatedGrid = forwardRef<any, AlbumListPaginatedGridProp
|
||||
enabled: saveScrollOffset,
|
||||
});
|
||||
|
||||
const rows = useGridRows(LibraryItem.ALBUM, ItemListKey.ALBUM);
|
||||
|
||||
return (
|
||||
<ItemListWithPagination
|
||||
currentPage={currentPage}
|
||||
@@ -74,6 +78,7 @@ export const AlbumListPaginatedGrid = forwardRef<any, AlbumListPaginatedGridProp
|
||||
itemType={LibraryItem.ALBUM}
|
||||
onScrollEnd={handleOnScrollEnd}
|
||||
ref={ref}
|
||||
rows={rows}
|
||||
/>
|
||||
</ItemListWithPagination>
|
||||
);
|
||||
|
||||
@@ -3,6 +3,7 @@ import { forwardRef } from 'react';
|
||||
|
||||
import { api } from '/@/renderer/api';
|
||||
import { useItemListInfiniteLoader } from '/@/renderer/components/item-list/helpers/item-list-infinite-loader';
|
||||
import { useGridRows } from '/@/renderer/components/item-list/helpers/use-grid-rows';
|
||||
import { useItemListScrollPersist } from '/@/renderer/components/item-list/helpers/use-item-list-scroll-persist';
|
||||
import { ItemGridList } from '/@/renderer/components/item-list/item-grid-list/item-grid-list';
|
||||
import { ItemListGridComponentProps } from '/@/renderer/components/item-list/types';
|
||||
@@ -15,7 +16,8 @@ import {
|
||||
} from '/@/shared/types/domain-types';
|
||||
import { ItemListKey } from '/@/shared/types/types';
|
||||
|
||||
interface AlbumArtistListInfiniteGridProps extends ItemListGridComponentProps<AlbumArtistListQuery> {}
|
||||
interface AlbumArtistListInfiniteGridProps
|
||||
extends ItemListGridComponentProps<AlbumArtistListQuery> {}
|
||||
|
||||
export const AlbumArtistListInfiniteGrid = forwardRef<any, AlbumArtistListInfiniteGridProps>(
|
||||
(
|
||||
@@ -53,6 +55,8 @@ export const AlbumArtistListInfiniteGrid = forwardRef<any, AlbumArtistListInfini
|
||||
enabled: saveScrollOffset,
|
||||
});
|
||||
|
||||
const rows = useGridRows(LibraryItem.ALBUM_ARTIST, ItemListKey.ALBUM_ARTIST);
|
||||
|
||||
return (
|
||||
<ItemGridList
|
||||
data={data}
|
||||
@@ -65,6 +69,7 @@ export const AlbumArtistListInfiniteGrid = forwardRef<any, AlbumArtistListInfini
|
||||
itemType={LibraryItem.ALBUM_ARTIST}
|
||||
onRangeChanged={onRangeChanged}
|
||||
onScrollEnd={handleOnScrollEnd}
|
||||
rows={rows}
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
||||
@@ -3,6 +3,7 @@ import { forwardRef } from 'react';
|
||||
|
||||
import { api } from '/@/renderer/api';
|
||||
import { useItemListPaginatedLoader } from '/@/renderer/components/item-list/helpers/item-list-paginated-loader';
|
||||
import { useGridRows } from '/@/renderer/components/item-list/helpers/use-grid-rows';
|
||||
import { useItemListScrollPersist } from '/@/renderer/components/item-list/helpers/use-item-list-scroll-persist';
|
||||
import { ItemGridList } from '/@/renderer/components/item-list/item-grid-list/item-grid-list';
|
||||
import { ItemListWithPagination } from '/@/renderer/components/item-list/item-list-pagination/item-list-pagination';
|
||||
@@ -15,6 +16,7 @@ import {
|
||||
LibraryItem,
|
||||
SortOrder,
|
||||
} from '/@/shared/types/domain-types';
|
||||
import { ItemListKey } from '/@/shared/types/types';
|
||||
|
||||
interface AlbumArtistListPaginatedGridProps
|
||||
extends ItemListGridComponentProps<AlbumArtistListQuery> {}
|
||||
@@ -57,6 +59,8 @@ export const AlbumArtistListPaginatedGrid = forwardRef<any, AlbumArtistListPagin
|
||||
enabled: saveScrollOffset,
|
||||
});
|
||||
|
||||
const rows = useGridRows(LibraryItem.ALBUM_ARTIST, ItemListKey.ALBUM_ARTIST);
|
||||
|
||||
return (
|
||||
<ItemListWithPagination
|
||||
currentPage={currentPage}
|
||||
@@ -77,6 +81,7 @@ export const AlbumArtistListPaginatedGrid = forwardRef<any, AlbumArtistListPagin
|
||||
itemType={LibraryItem.ALBUM_ARTIST}
|
||||
onScrollEnd={handleOnScrollEnd}
|
||||
ref={ref}
|
||||
rows={rows}
|
||||
/>
|
||||
</ItemListWithPagination>
|
||||
);
|
||||
|
||||
@@ -3,6 +3,7 @@ import { forwardRef } from 'react';
|
||||
|
||||
import { api } from '/@/renderer/api';
|
||||
import { useItemListInfiniteLoader } from '/@/renderer/components/item-list/helpers/item-list-infinite-loader';
|
||||
import { useGridRows } from '/@/renderer/components/item-list/helpers/use-grid-rows';
|
||||
import { useItemListScrollPersist } from '/@/renderer/components/item-list/helpers/use-item-list-scroll-persist';
|
||||
import { ItemGridList } from '/@/renderer/components/item-list/item-grid-list/item-grid-list';
|
||||
import { ItemListGridComponentProps } from '/@/renderer/components/item-list/types';
|
||||
@@ -53,6 +54,8 @@ export const ArtistListInfiniteGrid = forwardRef<any, ArtistListInfiniteGridProp
|
||||
enabled: saveScrollOffset,
|
||||
});
|
||||
|
||||
const rows = useGridRows(LibraryItem.ARTIST, ItemListKey.ARTIST);
|
||||
|
||||
return (
|
||||
<ItemGridList
|
||||
data={data}
|
||||
@@ -65,6 +68,7 @@ export const ArtistListInfiniteGrid = forwardRef<any, ArtistListInfiniteGridProp
|
||||
itemType={LibraryItem.ARTIST}
|
||||
onRangeChanged={onRangeChanged}
|
||||
onScrollEnd={handleOnScrollEnd}
|
||||
rows={rows}
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
||||
@@ -3,6 +3,7 @@ import { forwardRef } from 'react';
|
||||
|
||||
import { api } from '/@/renderer/api';
|
||||
import { useItemListPaginatedLoader } from '/@/renderer/components/item-list/helpers/item-list-paginated-loader';
|
||||
import { useGridRows } from '/@/renderer/components/item-list/helpers/use-grid-rows';
|
||||
import { useItemListScrollPersist } from '/@/renderer/components/item-list/helpers/use-item-list-scroll-persist';
|
||||
import { ItemGridList } from '/@/renderer/components/item-list/item-grid-list/item-grid-list';
|
||||
import { ItemListWithPagination } from '/@/renderer/components/item-list/item-list-pagination/item-list-pagination';
|
||||
@@ -15,6 +16,7 @@ import {
|
||||
LibraryItem,
|
||||
SortOrder,
|
||||
} from '/@/shared/types/domain-types';
|
||||
import { ItemListKey } from '/@/shared/types/types';
|
||||
|
||||
interface ArtistListPaginatedGridProps extends ItemListGridComponentProps<ArtistListQuery> {}
|
||||
|
||||
@@ -56,6 +58,8 @@ export const ArtistListPaginatedGrid = forwardRef<any, ArtistListPaginatedGridPr
|
||||
enabled: saveScrollOffset,
|
||||
});
|
||||
|
||||
const rows = useGridRows(LibraryItem.ARTIST, ItemListKey.ARTIST);
|
||||
|
||||
return (
|
||||
<ItemListWithPagination
|
||||
currentPage={currentPage}
|
||||
@@ -76,6 +80,7 @@ export const ArtistListPaginatedGrid = forwardRef<any, ArtistListPaginatedGridPr
|
||||
itemType={LibraryItem.ARTIST}
|
||||
onScrollEnd={handleOnScrollEnd}
|
||||
ref={ref}
|
||||
rows={rows}
|
||||
/>
|
||||
</ItemListWithPagination>
|
||||
);
|
||||
|
||||
@@ -3,6 +3,7 @@ import { forwardRef } from 'react';
|
||||
|
||||
import { api } from '/@/renderer/api';
|
||||
import { useItemListInfiniteLoader } from '/@/renderer/components/item-list/helpers/item-list-infinite-loader';
|
||||
import { useGridRows } from '/@/renderer/components/item-list/helpers/use-grid-rows';
|
||||
import { useItemListScrollPersist } from '/@/renderer/components/item-list/helpers/use-item-list-scroll-persist';
|
||||
import { ItemGridList } from '/@/renderer/components/item-list/item-grid-list/item-grid-list';
|
||||
import { ItemListGridComponentProps } from '/@/renderer/components/item-list/types';
|
||||
@@ -53,6 +54,8 @@ export const GenreListInfiniteGrid = forwardRef<any, GenreListInfiniteGridProps>
|
||||
enabled: saveScrollOffset,
|
||||
});
|
||||
|
||||
const rows = useGridRows(LibraryItem.GENRE, ItemListKey.GENRE);
|
||||
|
||||
return (
|
||||
<ItemGridList
|
||||
data={data}
|
||||
@@ -65,6 +68,7 @@ export const GenreListInfiniteGrid = forwardRef<any, GenreListInfiniteGridProps>
|
||||
itemType={LibraryItem.GENRE}
|
||||
onRangeChanged={onRangeChanged}
|
||||
onScrollEnd={handleOnScrollEnd}
|
||||
rows={rows}
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
||||
@@ -3,6 +3,7 @@ import { forwardRef } from 'react';
|
||||
|
||||
import { api } from '/@/renderer/api';
|
||||
import { useItemListPaginatedLoader } from '/@/renderer/components/item-list/helpers/item-list-paginated-loader';
|
||||
import { useGridRows } from '/@/renderer/components/item-list/helpers/use-grid-rows';
|
||||
import { useItemListScrollPersist } from '/@/renderer/components/item-list/helpers/use-item-list-scroll-persist';
|
||||
import { ItemGridList } from '/@/renderer/components/item-list/item-grid-list/item-grid-list';
|
||||
import { ItemListWithPagination } from '/@/renderer/components/item-list/item-list-pagination/item-list-pagination';
|
||||
@@ -15,6 +16,7 @@ import {
|
||||
LibraryItem,
|
||||
SortOrder,
|
||||
} from '/@/shared/types/domain-types';
|
||||
import { ItemListKey } from '/@/shared/types/types';
|
||||
|
||||
interface GenreListPaginatedGridProps extends ItemListGridComponentProps<GenreListQuery> {}
|
||||
|
||||
@@ -56,6 +58,8 @@ export const GenreListPaginatedGrid = forwardRef<any, GenreListPaginatedGridProp
|
||||
enabled: saveScrollOffset,
|
||||
});
|
||||
|
||||
const rows = useGridRows(LibraryItem.GENRE, ItemListKey.GENRE);
|
||||
|
||||
return (
|
||||
<ItemListWithPagination
|
||||
currentPage={currentPage}
|
||||
@@ -76,6 +80,7 @@ export const GenreListPaginatedGrid = forwardRef<any, GenreListPaginatedGridProp
|
||||
itemType={LibraryItem.GENRE}
|
||||
onScrollEnd={handleOnScrollEnd}
|
||||
ref={ref}
|
||||
rows={rows}
|
||||
/>
|
||||
</ItemListWithPagination>
|
||||
);
|
||||
|
||||
@@ -253,9 +253,6 @@ const GridRowConfig = ({
|
||||
);
|
||||
}, [data]);
|
||||
|
||||
console.log('data', data);
|
||||
console.log(labelMap);
|
||||
|
||||
const handleChangeEnabled = useCallback(
|
||||
(item: ItemGridListRowConfig, checked: boolean) => {
|
||||
const value = useSettingsStore.getState().lists[listKey]?.grid.rows;
|
||||
|
||||
@@ -3,6 +3,7 @@ import { forwardRef } from 'react';
|
||||
|
||||
import { api } from '/@/renderer/api';
|
||||
import { useItemListInfiniteLoader } from '/@/renderer/components/item-list/helpers/item-list-infinite-loader';
|
||||
import { useGridRows } from '/@/renderer/components/item-list/helpers/use-grid-rows';
|
||||
import { useItemListScrollPersist } from '/@/renderer/components/item-list/helpers/use-item-list-scroll-persist';
|
||||
import { ItemGridList } from '/@/renderer/components/item-list/item-grid-list/item-grid-list';
|
||||
import { ItemListGridComponentProps } from '/@/renderer/components/item-list/types';
|
||||
@@ -48,6 +49,8 @@ export const SongListInfiniteGrid = forwardRef<any, SongListInfiniteGridProps>(
|
||||
enabled: saveScrollOffset,
|
||||
});
|
||||
|
||||
const rows = useGridRows(LibraryItem.SONG, ItemListKey.SONG);
|
||||
|
||||
return (
|
||||
<ItemGridList
|
||||
data={data}
|
||||
@@ -60,6 +63,7 @@ export const SongListInfiniteGrid = forwardRef<any, SongListInfiniteGridProps>(
|
||||
itemType={LibraryItem.SONG}
|
||||
onRangeChanged={onRangeChanged}
|
||||
onScrollEnd={handleOnScrollEnd}
|
||||
rows={rows}
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
||||
@@ -3,12 +3,14 @@ import { forwardRef } from 'react';
|
||||
|
||||
import { api } from '/@/renderer/api';
|
||||
import { useItemListPaginatedLoader } from '/@/renderer/components/item-list/helpers/item-list-paginated-loader';
|
||||
import { useGridRows } from '/@/renderer/components/item-list/helpers/use-grid-rows';
|
||||
import { ItemGridList } from '/@/renderer/components/item-list/item-grid-list/item-grid-list';
|
||||
import { ItemListWithPagination } from '/@/renderer/components/item-list/item-list-pagination/item-list-pagination';
|
||||
import { useItemListPagination } from '/@/renderer/components/item-list/item-list-pagination/use-item-list-pagination';
|
||||
import { ItemListGridComponentProps } from '/@/renderer/components/item-list/types';
|
||||
import { songsQueries } from '/@/renderer/features/songs/api/songs-api';
|
||||
import { LibraryItem, SongListQuery, SongListSort, SortOrder } from '/@/shared/types/domain-types';
|
||||
import { ItemListKey } from '/@/shared/types/types';
|
||||
|
||||
interface SongListPaginatedGridProps extends ItemListGridComponentProps<SongListQuery> {}
|
||||
|
||||
@@ -44,6 +46,8 @@ export const SongListPaginatedGrid = forwardRef<any, SongListPaginatedGridProps>
|
||||
serverId,
|
||||
});
|
||||
|
||||
const rows = useGridRows(LibraryItem.SONG, ItemListKey.SONG);
|
||||
|
||||
return (
|
||||
<ItemListWithPagination
|
||||
currentPage={currentPage}
|
||||
@@ -58,6 +62,7 @@ export const SongListPaginatedGrid = forwardRef<any, SongListPaginatedGridProps>
|
||||
gap={gap}
|
||||
itemType={LibraryItem.SONG}
|
||||
ref={ref}
|
||||
rows={rows}
|
||||
/>
|
||||
</ItemListWithPagination>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user