Add fix to hide the "More from this artist" carousel when it contains no albums (#173)
* Add fix to hide carousel with other albums
This commit is contained in:
parent
287fbab29a
commit
f74e02eb09
1 changed files with 44 additions and 39 deletions
|
@ -194,6 +194,7 @@ export const AlbumDetailContent = ({ tableRef }: AlbumDetailContentProps) => {
|
||||||
const carousels = [
|
const carousels = [
|
||||||
{
|
{
|
||||||
data: artistQuery?.data?.items,
|
data: artistQuery?.data?.items,
|
||||||
|
isHidden: !artistQuery?.data?.items.length,
|
||||||
loading: artistQuery?.isLoading || artistQuery.isFetching,
|
loading: artistQuery?.isLoading || artistQuery.isFetching,
|
||||||
pagination: {
|
pagination: {
|
||||||
handleNextPage: () => handleNextPage('artist'),
|
handleNextPage: () => handleNextPage('artist'),
|
||||||
|
@ -205,7 +206,6 @@ export const AlbumDetailContent = ({ tableRef }: AlbumDetailContentProps) => {
|
||||||
uniqueId: 'mostPlayed',
|
uniqueId: 'mostPlayed',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const playButtonBehavior = usePlayButtonBehavior();
|
const playButtonBehavior = usePlayButtonBehavior();
|
||||||
|
|
||||||
const handlePlay = async (playType?: Play) => {
|
const handlePlay = async (playType?: Play) => {
|
||||||
|
@ -370,7 +370,9 @@ export const AlbumDetailContent = ({ tableRef }: AlbumDetailContentProps) => {
|
||||||
<>
|
<>
|
||||||
{cq.height || cq.width ? (
|
{cq.height || cq.width ? (
|
||||||
<>
|
<>
|
||||||
{carousels.map((carousel, index) => (
|
{carousels
|
||||||
|
.filter((c) => !c.isHidden)
|
||||||
|
.map((carousel, index) => (
|
||||||
<SwiperGridCarousel
|
<SwiperGridCarousel
|
||||||
key={`carousel-${carousel.uniqueId}-${index}`}
|
key={`carousel-${carousel.uniqueId}-${index}`}
|
||||||
cardRows={[
|
cardRows={[
|
||||||
|
@ -379,7 +381,10 @@ export const AlbumDetailContent = ({ tableRef }: AlbumDetailContentProps) => {
|
||||||
route: {
|
route: {
|
||||||
route: AppRoute.LIBRARY_ALBUMS_DETAIL,
|
route: AppRoute.LIBRARY_ALBUMS_DETAIL,
|
||||||
slugs: [
|
slugs: [
|
||||||
{ idProperty: 'id', slugProperty: 'albumId' },
|
{
|
||||||
|
idProperty: 'id',
|
||||||
|
slugProperty: 'albumId',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Reference in a new issue