ekzyis d237861ff5
Use module path aliases (#938)
* Use module path aliases

* fix broken refactor

* path mapping for svgs, style, and remaining places (bonus: lose babel dep)

---------

Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-03-19 19:37:31 -05:00

29 lines
873 B
JavaScript

import Layout from '@/components/layout'
import { ITEM_FULL } from '@/fragments/items'
import ItemFull from '@/components/item-full'
import { getGetServerSideProps } from '@/api/ssrApollo'
import { useQuery } from '@apollo/client'
import { useRouter } from 'next/router'
import PageLoading from '@/components/page-loading'
export const getServerSideProps = getGetServerSideProps({
query: ITEM_FULL,
notFound: data => !data.item || (data.item.status === 'STOPPED' && !data.item.mine)
})
export default function Item ({ ssrData }) {
const router = useRouter()
const { data } = useQuery(ITEM_FULL, { variables: { ...router.query } })
if (!data && !ssrData) return <PageLoading />
const { item } = data || ssrData
const sub = item.subName || item.root?.subName
return (
<Layout sub={sub} item={item}>
<ItemFull item={item} />
</Layout>
)
}