diff --git a/packages/web/components/nav-containers/HomeContainer.tsx b/packages/web/components/nav-containers/HomeContainer.tsx index 2252481d4..a9b1bb5ad 100644 --- a/packages/web/components/nav-containers/HomeContainer.tsx +++ b/packages/web/components/nav-containers/HomeContainer.tsx @@ -28,6 +28,7 @@ import { Box, HStack, SpanBox, VStack } from '../elements/LayoutPrimitives' import { Toaster } from 'react-hot-toast' import { useGetViewerQuery } from '../../lib/networking/queries/useGetViewerQuery' import useLibraryItemActions from '../../lib/hooks/useLibraryItemActions' +import { SyncLoader } from 'react-spinners' export function HomeContainer(): JSX.Element { const router = useRouter() @@ -44,6 +45,23 @@ export function HomeContainer(): JSX.Element { window.localStorage.setItem('nav-return', router.asPath) }, [router.asPath]) + if (homeData.error && homeData.errorMessage == 'PENDING') { + return ( + + + + ) + } + return ( {homeData.sections?.map((homeSection, idx) => { - if (homeSection.items.length < 1) { - return - } switch (homeSection.layout) { case 'just_added': + if (homeSection.items.length < 1) { + return + } return ( ) case 'hidden': + if (homeSection.items.length < 1) { + return + } return ( { const [items, dispatchList] = useReducer(listReducer, []) - function handleDelete(item: HomeItem) { - dispatchList({ - type: 'REMOVE_ITEM', - itemId: item.id, - }) - } - useEffect(() => { dispatchList({ type: 'RESET', @@ -249,6 +263,29 @@ const TopPicksHomeSection = (props: HomeSectionProps): JSX.Element => { }) }, [props]) + console.log( + 'props.homeSection.items.length: ', + props.homeSection.items.length + ) + if (props.homeSection.items.length < 1) { + return ( + + Your top picks are empty. + + ) + } + return (