2022-09-22 18:44:50 +00:00
|
|
|
import Layout from '../components/layout'
|
|
|
|
import { ItemsSkeleton } from '../components/items'
|
|
|
|
import { getGetServerSideProps } from '../api/ssrApollo'
|
|
|
|
import { OUTLAWED_ITEMS } from '../fragments/items'
|
|
|
|
import { useQuery } from '@apollo/client'
|
2022-09-22 20:42:04 +00:00
|
|
|
import MixedItems from '../components/items-mixed'
|
2022-09-22 18:44:50 +00:00
|
|
|
|
|
|
|
export const getServerSideProps = getGetServerSideProps(OUTLAWED_ITEMS)
|
|
|
|
|
|
|
|
export default function Index ({ data: { outlawedItems: { items, cursor } } }) {
|
|
|
|
return (
|
|
|
|
<Layout>
|
|
|
|
<Items
|
|
|
|
items={items} cursor={cursor}
|
|
|
|
/>
|
|
|
|
</Layout>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
function Items ({ rank, items, cursor }) {
|
|
|
|
const { data, fetchMore } = useQuery(OUTLAWED_ITEMS)
|
|
|
|
|
|
|
|
if (!data && !items) {
|
|
|
|
return <ItemsSkeleton rank={rank} />
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data) {
|
|
|
|
({ outlawedItems: { items, cursor } } = data)
|
|
|
|
}
|
|
|
|
|
2022-09-23 14:27:01 +00:00
|
|
|
return <MixedItems items={items} cursor={cursor} rank={rank} fetchMore={fetchMore} />
|
2022-09-22 18:44:50 +00:00
|
|
|
}
|