mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 04:20:12 +02:00
remove refresh buttons from grid carousel by default
This commit is contained in:
@@ -18,6 +18,7 @@ interface Card {
|
||||
|
||||
interface GridCarouselProps {
|
||||
cards: Card[];
|
||||
enableRefresh?: boolean;
|
||||
hasNextPage?: boolean;
|
||||
loadNextPage?: () => void;
|
||||
onNextPage: (page: number) => void;
|
||||
@@ -46,6 +47,7 @@ const pageVariants: Variants = {
|
||||
function BaseGridCarousel(props: GridCarouselProps) {
|
||||
const {
|
||||
cards,
|
||||
enableRefresh = false,
|
||||
hasNextPage,
|
||||
loadNextPage,
|
||||
onNextPage,
|
||||
@@ -164,10 +166,10 @@ function BaseGridCarousel(props: GridCarouselProps) {
|
||||
) : (
|
||||
title
|
||||
)}
|
||||
{onRefresh && (
|
||||
{enableRefresh && onRefresh && (
|
||||
<ActionIcon
|
||||
icon="refresh"
|
||||
iconProps={{ size: 'md' }}
|
||||
iconProps={{ size: 'xs' }}
|
||||
onClick={onRefresh}
|
||||
size="xs"
|
||||
tooltip={{ label: 'Refresh' }}
|
||||
|
||||
@@ -342,6 +342,7 @@ export const AlbumDetailContent = () => {
|
||||
uniqueId: 'moreFromArtist',
|
||||
},
|
||||
{
|
||||
enableRefresh: true,
|
||||
excludeIds: detailQuery?.data?.id ? [detailQuery.data.id] : undefined,
|
||||
isHidden: !detailQuery?.data?.genres?.[0],
|
||||
query: {
|
||||
@@ -413,6 +414,7 @@ export const AlbumDetailContent = () => {
|
||||
.filter((c) => !c.isHidden)
|
||||
.map((carousel) => (
|
||||
<AlbumInfiniteCarousel
|
||||
enableRefresh={carousel.enableRefresh}
|
||||
excludeIds={carousel.excludeIds}
|
||||
key={`carousel-${carousel.uniqueId}`}
|
||||
query={carousel.query}
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
import { ItemListKey } from '/@/shared/types/types';
|
||||
|
||||
interface AlbumCarouselProps {
|
||||
enableRefresh?: boolean;
|
||||
excludeIds?: string[];
|
||||
query?: Partial<Omit<AlbumListQuery, 'startIndex'>>;
|
||||
rowCount?: number;
|
||||
@@ -28,7 +29,15 @@ interface AlbumCarouselProps {
|
||||
}
|
||||
|
||||
const BaseAlbumInfiniteCarousel = (props: AlbumCarouselProps) => {
|
||||
const { excludeIds, query: additionalQuery, rowCount = 1, sortBy, sortOrder, title } = props;
|
||||
const {
|
||||
enableRefresh,
|
||||
excludeIds,
|
||||
query: additionalQuery,
|
||||
rowCount = 1,
|
||||
sortBy,
|
||||
sortOrder,
|
||||
title,
|
||||
} = props;
|
||||
const rows = useGridRows(LibraryItem.ALBUM, ItemListKey.ALBUM);
|
||||
const {
|
||||
data: albums,
|
||||
@@ -81,6 +90,7 @@ const BaseAlbumInfiniteCarousel = (props: AlbumCarouselProps) => {
|
||||
return (
|
||||
<GridCarousel
|
||||
cards={cards}
|
||||
enableRefresh={enableRefresh}
|
||||
hasNextPage={hasNextPage}
|
||||
loadNextPage={fetchNextPage}
|
||||
onNextPage={handleNextPage}
|
||||
|
||||
@@ -38,6 +38,7 @@ const HomeRoute = () => {
|
||||
title: t('page.home.mostPlayed', { postProcess: 'sentenceCase' }),
|
||||
},
|
||||
[HomeItem.RANDOM]: {
|
||||
enableRefresh: true,
|
||||
itemType: LibraryItem.ALBUM,
|
||||
sortBy: AlbumListSort.RANDOM,
|
||||
sortOrder: SortOrder.ASC,
|
||||
@@ -118,6 +119,7 @@ const HomeRoute = () => {
|
||||
if (carousel.itemType === LibraryItem.ALBUM) {
|
||||
return (
|
||||
<AlbumInfiniteCarousel
|
||||
enableRefresh={carousel.enableRefresh}
|
||||
key={`carousel-${carousel.uniqueId}`}
|
||||
rowCount={1}
|
||||
sortBy={carousel.sortBy}
|
||||
|
||||
Reference in New Issue
Block a user