- {articles.data?.length && (
-
- ({
- slug: article.doc.slug,
- date: article.doc.modifiedAt,
- title: article.doc.title,
- description: article.doc.subtitle, // TODO: summary is not available
- author: 'Jinho',
- tags: article.doc.tags,
- coverImage: getArticleCover(article.doc.blocks),
- }))}
- />
-
- )}
+ {articles.data?.length &&
}
-
- Related content blocks
-
-
- {blocks.loading &&
...
}
- {!blocks.error && blocks.data && blocks.data.length > 0 ? (
- blocks.data.map(
- (block: SearchResultItem
) => {
- if (!block.doc.document || !block.doc.document[0]) return null
-
- let refArticle = null
- if (UnbodyGraphQl.UnbodyDocumentTypeNames.GoogleDoc) {
- refArticle = block.doc.document[0]
- }
-
- switch (block.doc.__typename) {
- case UnbodyGraphQl.UnbodyDocumentTypeNames.TextBlock:
- return (
-
- {refArticle && (
-
-
- {refArticle.title}
-
-
- )}
- {
-
- }
-
- )
- case UnbodyGraphQl.UnbodyDocumentTypeNames.ImageBlock: {
- return (
-
- {refArticle && (
-
-
- {refArticle.title}
-
-
- )}
-
-
- )
- }
- }
- },
- )
- ) : (
- Nothing found
- )}
-
-
+ {/* TODO: used initialBlocks instead of blocks.data temporarily to render data */}
+ {initialBlocks?.length &&
}
)
}
diff --git a/src/queries/searchBlocks.ts b/src/queries/searchBlocks.ts
index d2d61e4..f69d5e7 100644
--- a/src/queries/searchBlocks.ts
+++ b/src/queries/searchBlocks.ts
@@ -21,6 +21,7 @@ export const getSearchBlocksQuery = (args: UnbodyGetFilters = defaultArgs) =>
title
mentions
slug
+ modifiedAt
__typename
}
}
@@ -39,6 +40,7 @@ export const getSearchBlocksQuery = (args: UnbodyGetFilters = defaultArgs) =>
title
slug
mentions
+ modifiedAt
__typename
}
}