diff --git a/src/app/components/DataDisplay.tsx b/src/app/components/DataDisplay.tsx
index ce800b5..249bd92 100644
--- a/src/app/components/DataDisplay.tsx
+++ b/src/app/components/DataDisplay.tsx
@@ -1,8 +1,10 @@
import { Fragment } from 'react'
import Link from 'next/link'
-import { reviewer } from '@/app/db/data'
-import { loadAllTopics, loadAllAuthors } from '@/app/db/loaders'
-import { useSuspenseQuery } from '@tanstack/react-query'
+import {
+ reviewer,
+ authors as authorList,
+ topics as topicList,
+} from '@/app/db/data'
export const Code = ({
code,
@@ -52,18 +54,6 @@ export const Topics = ({
topics,
showTitle = true,
}: Readonly<{ topics: string[]; showTitle?: boolean }>) => {
- 'use client'
-
- const { data, error } = useSuspenseQuery({
- queryKey: ['topics_all'],
- queryFn: () => {
- const data = loadAllTopics()
- return data
- },
- })
- if (error) throw error
- const topicList = data
-
return (
<>
{showTitle ? Topics: : null}
@@ -82,19 +72,6 @@ export const Topics = ({
export const Authors = ({
authors,
}: Readonly<{ authors: string[]; noLink?: boolean }>) => {
- 'use client'
-
- const { data, error } = useSuspenseQuery({
- queryKey: ['authors_all'],
- queryFn: () => {
- const data = loadAllAuthors()
- return data
- },
- })
- if (error) throw error
-
- const authorList = data
-
return (
<>
{authors.map((a: string, i) => (
@@ -141,7 +118,7 @@ export const Reviewers = ({
<>
{showTitle ? Reviewed by: : null}
{reviewers.map((r: reviewer, i) => (
-
+
{i !== reviewers.length - 1 && reviewers.length > 2 ? ', ' : null}
{i === reviewers.length - 2 ? ' and ' : null}
diff --git a/src/app/components/DataDisplayClient.tsx b/src/app/components/DataDisplayClient.tsx
new file mode 100644
index 0000000..88df604
--- /dev/null
+++ b/src/app/components/DataDisplayClient.tsx
@@ -0,0 +1,68 @@
+// these variants of the data display compnents are designed for client side components
+// and fetch data asynchronously
+import { loadAllTopics, loadAllAuthors } from '@/app/db/loaders'
+import { useSuspenseQuery } from '@tanstack/react-query'
+import { Fragment } from 'react'
+import Link from 'next/link'
+
+export const Authors = ({
+ authors,
+}: Readonly<{ authors: string[]; noLink?: boolean }>) => {
+ 'use client'
+
+ const { data, error } = useSuspenseQuery({
+ queryKey: ['authors_all'],
+ queryFn: () => {
+ const data = loadAllAuthors()
+ return data
+ },
+ })
+ if (error) throw error
+
+ const authorList = data
+
+ return (
+ <>
+ {authors.map((a: string, i) => (
+
+
+ {authorList[a].name.first} {authorList[a].name.last}
+
+ {i !== authors.length - 1 && authors.length > 2 ? ', ' : null}
+ {i === authors.length - 2 ? ' and ' : null}
+
+ ))}
+ >
+ )
+}
+
+export const Topics = ({
+ topics,
+ showTitle = true,
+}: Readonly<{ topics: string[]; showTitle?: boolean }>) => {
+ 'use client'
+
+ const { data, error } = useSuspenseQuery({
+ queryKey: ['topics_all'],
+ queryFn: () => {
+ const data = loadAllTopics()
+ return data
+ },
+ })
+ if (error) throw error
+ const topicList = data
+
+ return (
+ <>
+ {showTitle ? Topics: : null}
+ {topics.map((t: string, i) => (
+
+
+ {topicList[t].name}
+
+ {i !== topics.length - 1 ? ', ' : null}
+
+ ))}
+ >
+ )
+}
diff --git a/src/app/document/view/[slug]/page.tsx b/src/app/document/view/[slug]/page.tsx
index 40f5290..0ca1ba9 100644
--- a/src/app/document/view/[slug]/page.tsx
+++ b/src/app/document/view/[slug]/page.tsx
@@ -1,6 +1,11 @@
-'use client'
import DocumentViewer from './DocumentViewer'
import ErrorBoundary from '@/app/utils/ErrorBoundary'
+import { documents } from '@/app/db/data'
+
+export function generateStaticParams() {
+ const docsList = Object.keys(documents)
+ return docsList.map((doc) => ({ doc }))
+}
export default function Page({
params,