remove unused pages

This commit is contained in:
keyan 2021-07-07 19:25:45 -05:00
parent 68e80b615c
commit caafd54faa
3 changed files with 0 additions and 109 deletions

View File

@ -1,44 +0,0 @@
import ApolloClient from '../../api/client'
import { MORE_ITEMS } from '../../fragments/items'
import Item from '../../components/item'
import styles from '../../components/items.module.css'
import LayoutPreview from '../../components/layout-preview'
import { LightningProvider } from '../../components/lightning'
// we can't SSR on the normal page because we'd have to hyrdate the cache
// on the client which is a lot of work, i.e. a bit fat todo
export async function getServerSideProps ({ params }) {
// grab the item on the server side
const { error, data: { moreItems: { items } } } = await (await ApolloClient()).query({
query: MORE_ITEMS,
variables: { sort: 'hot' }
})
if (!items || error) {
return {
notFound: true
}
}
return {
props: {
items
}
}
}
export default function IndexPreview ({ items }) {
return (
<>
<LayoutPreview>
<LightningProvider>
<div className={styles.grid}>
{items.map((item, i) => (
<Item item={item} rank={i + 1} key={item.id} />
))}
</div>
</LightningProvider>
</LayoutPreview>
</>
)
}

View File

@ -1,65 +0,0 @@
import { gql } from '@apollo/client'
import ApolloClient from '../../../api/client'
import { ITEM_FIELDS } from '../../../fragments/items'
import Item from '../../../components/item'
import Text from '../../../components/text'
import LayoutPreview from '../../../components/layout-preview'
import { LightningProvider } from '../../../components/lightning'
import Comment from '../../../components/comment'
// we can't SSR on the normal page because we'd have to hyrdate the cache
// on the client which is a lot of work, i.e. a bit fat todo
export async function getServerSideProps ({ params }) {
// grab the item on the server side
const { error, data: { item } } = await (await ApolloClient()).query({
query:
gql`
${ITEM_FIELDS}
{
item(id: ${params.id}) {
...ItemFields
text
}
}`
})
if (!item || error) {
return {
notFound: true
}
}
return {
props: {
item
}
}
}
// export async function getStaticPaths () {
// return {
// paths: [],
// // Enable statically generating additional pages
// // For example: `/posts/3`
// fallback: 'blocking'
// }
// }
export default function ItemPreview ({ item }) {
return (
<>
<LayoutPreview>
<LightningProvider>
{item.parentId
? <Comment item={item} includeParent noReply noComments />
: (
<Item item={item}>
{item.text && <div className='mb-3'><Text>{item.text}</Text></div>}
</Item>
)}
</LightningProvider>
</LayoutPreview>
</>
)
}