import { useQuery } from '@apollo/client' import Button from 'react-bootstrap/Button' import Item, { ItemSkeleton } from './item' import styles from './items.module.css' import { MORE_ITEMS } from '../fragments/items' import { useState } from 'react' import { useRouter } from 'next/router' export default function Items ({ variables, rank }) { const router = useRouter() const { error, data, fetchMore } = useQuery(MORE_ITEMS, { variables, fetchPolicy: router.query.cache ? 'cache-first' : undefined }) if (error) return
Failed to load!
if (!data) { return } const { moreItems: { items, cursor } } = data return ( <>
{items.map((item, i) => ( ))}
) } function ItemsSkeleton ({ rank, startRank = 0 }) { const items = new Array(21).fill(null) return (
{items.map((_, i) => ( ))}
) } function MoreFooter ({ cursor, fetchMore, rank, offset }) { const [loading, setLoading] = useState(false) if (loading) { return } let Footer if (cursor) { Footer = () => ( ) } else { Footer = () => (
GENISIS
) } return
}