Merge branch 'feed-carousel-conditional' into 'develop'
Move condition for FeedCarousel to HomePage Closes #1066 See merge request soapbox-pub/soapbox-fe!1732
This commit is contained in:
commit
6c54d50839
2 changed files with 2 additions and 8 deletions
|
@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
import { replaceHomeTimeline } from 'soapbox/actions/timelines';
|
import { replaceHomeTimeline } from 'soapbox/actions/timelines';
|
||||||
import { useAppDispatch, useAppSelector, useDimensions, useFeatures } from 'soapbox/hooks';
|
import { useAppDispatch, useAppSelector, useDimensions } from 'soapbox/hooks';
|
||||||
import useCarouselAvatars from 'soapbox/queries/carousels';
|
import useCarouselAvatars from 'soapbox/queries/carousels';
|
||||||
|
|
||||||
import { Card, HStack, Icon, Stack, Text } from '../../components/ui';
|
import { Card, HStack, Icon, Stack, Text } from '../../components/ui';
|
||||||
|
@ -59,8 +59,6 @@ const CarouselItem = ({ avatar }: { avatar: any }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const FeedCarousel = () => {
|
const FeedCarousel = () => {
|
||||||
const features = useFeatures();
|
|
||||||
|
|
||||||
const { data: avatars, isFetching, isError } = useCarouselAvatars();
|
const { data: avatars, isFetching, isError } = useCarouselAvatars();
|
||||||
|
|
||||||
const [cardRef, setCardRef, { width }] = useDimensions();
|
const [cardRef, setCardRef, { width }] = useDimensions();
|
||||||
|
@ -83,10 +81,6 @@ const FeedCarousel = () => {
|
||||||
}
|
}
|
||||||
}, [width, widthPerAvatar]);
|
}, [width, widthPerAvatar]);
|
||||||
|
|
||||||
if (!features.feedUserFiltering) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isError) {
|
if (isError) {
|
||||||
return (
|
return (
|
||||||
<Card variant='rounded' size='lg' data-testid='feed-carousel-error'>
|
<Card variant='rounded' size='lg' data-testid='feed-carousel-error'>
|
||||||
|
|
|
@ -58,7 +58,7 @@ const HomePage: React.FC = ({ children }) => {
|
||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<FeedCarousel />
|
{features.feedUserFiltering && <FeedCarousel />}
|
||||||
|
|
||||||
{children}
|
{children}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue