make DocumentViewer actually client side
This commit is contained in:
parent
8be8cdd6be
commit
207d23b94c
1 changed files with 2 additions and 14 deletions
|
@ -1,4 +1,4 @@
|
||||||
import { DocumentType } from '@/app/db/data'
|
import { DocumentType, documents } from '@/app/db/data'
|
||||||
import { Zilla_Slab } from 'next/font/google'
|
import { Zilla_Slab } from 'next/font/google'
|
||||||
import { epoch2datestring } from '@/app/utils/epoch2datestring'
|
import { epoch2datestring } from '@/app/utils/epoch2datestring'
|
||||||
import {
|
import {
|
||||||
|
@ -10,21 +10,11 @@ import {
|
||||||
} from '@/app/components/DataDisplay'
|
} from '@/app/components/DataDisplay'
|
||||||
import { ItemBadge, Status } from '@/app/components/Badges'
|
import { ItemBadge, Status } from '@/app/components/Badges'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { useSuspenseQuery } from '@tanstack/react-query'
|
|
||||||
import { loadDocument } from '@/app/db/loaders'
|
|
||||||
|
|
||||||
const zillaSlab = Zilla_Slab({ subsets: ['latin'], weight: ['500'] })
|
const zillaSlab = Zilla_Slab({ subsets: ['latin'], weight: ['500'] })
|
||||||
|
|
||||||
export default function DocumentViewer({ slug }: Readonly<{ slug: string }>) {
|
export default function DocumentViewer({ slug }: Readonly<{ slug: string }>) {
|
||||||
const { data, error } = useSuspenseQuery({
|
const { manifest, abstract, file, citation } = documents[slug]
|
||||||
queryKey: [slug],
|
|
||||||
queryFn: () => {
|
|
||||||
const data = loadDocument(slug)
|
|
||||||
return data
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const { manifest, abstract, file, citation } = data
|
|
||||||
const {
|
const {
|
||||||
title,
|
title,
|
||||||
authors,
|
authors,
|
||||||
|
@ -38,8 +28,6 @@ export default function DocumentViewer({ slug }: Readonly<{ slug: string }>) {
|
||||||
status,
|
status,
|
||||||
} = manifest
|
} = manifest
|
||||||
|
|
||||||
if (error) throw error
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='max-w-4xl lg:max-w-6xl mx-auto'>
|
<div className='max-w-4xl lg:max-w-6xl mx-auto'>
|
||||||
<h1
|
<h1
|
||||||
|
|
Loading…
Reference in a new issue