}
diff --git a/pages/preview/index.js b/pages/preview/index.js
index e69de29b..d0d36750 100644
--- a/pages/preview/index.js
+++ b/pages/preview/index.js
@@ -0,0 +1,44 @@
+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 (
+ <>
+
+
+
+ {items.map((item, i) => (
+
+ ))}
+
+
+
+ >
+ )
+}
diff --git a/pages/preview/items/[id].js b/pages/preview/items/[id].js
index eddae8d7..31f585ae 100644
--- a/pages/preview/items/[id].js
+++ b/pages/preview/items/[id].js
@@ -9,9 +9,9 @@ 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 ({ req, params }) {
+export async function getServerSideProps ({ params }) {
// grab the item on the server side
- const { error, data: { item } } = await (await ApolloClient(req)).query({
+ const { error, data: { item } } = await (await ApolloClient()).query({
query:
gql`
${ITEM_FIELDS}
@@ -36,18 +36,30 @@ export async function getServerSideProps ({ req, params }) {
}
}
+// export async function getStaticPaths () {
+// return {
+// paths: [],
+// // Enable statically generating additional pages
+// // For example: `/posts/3`
+// fallback: 'blocking'
+// }
+// }
+
export default function ItemPreview ({ item }) {
return (
-
-
- {item.parentId
- ?
- : (
-
- {item.text &&