refactor authordisplay, bibtex export toast

This commit is contained in:
Youwen Wu 2024-02-15 13:51:12 -08:00
parent fb1cf67e5f
commit 56df68b988
3 changed files with 12 additions and 10 deletions

View file

@ -1,5 +1,5 @@
import Link from 'next/link'
import { Fragment } from 'react'
import { Fragment, Suspense } from 'react'
import { affiliations, nationalities, authors } from '../../db/data'
import { Zilla_Slab } from 'next/font/google'
import { notFound } from 'next/navigation'
@ -143,7 +143,9 @@ export default function AuthorDisplay({
return (
<>
<KonamiSnowfall nationalityList={nationality} />
<Suspense>
<KonamiSnowfall nationalityList={nationality} />
</Suspense>
<div className='grid grid-cols-1 md:grid-cols-2 items-center max-w-3xl mx-auto'>
<div className='aspect-square w-[60vw] md:w-[30vw] lg:w-[20vw] 2xl:w-[15vw] overflow-hidden mx-auto mb-4'>
<img

View file

@ -9,7 +9,6 @@ import {
Reviewers,
} from '@/app/components/DataDisplay'
import { ItemBadge, Status } from '@/app/components/Badges'
import { notFound } from 'next/navigation'
import VersionChooser from './VersionChooser'
import crypto from 'crypto'
import { Suspense } from 'react'
@ -28,10 +27,9 @@ const DocumentViewer = ({ slug }: Readonly<{ slug: string }>) => {
})
if (error) throw error
let doc = data
// const doc = documents[slug]
const { manifest, abstract, citation } = doc
// if (!manifest) return notFound()
const {
title,
authors,

View file

@ -26,8 +26,7 @@ const VersionChooser = ({
const fileEnding = file === 'other' ? '' : `.${file}`
const [selectedRevision, setSelectedRevision] = useState<number>(latest) // Initialize the selected revision with the latest revision
const notifyCopied = () =>
toast('BibTeX copied to clipboard!', { type: 'success' })
const notifyCopied = () => toast('BibTeX copied to clipboard!')
const handleClick = () => {
const bibtex = `@article{
@ -50,7 +49,7 @@ const VersionChooser = ({
}
return (
<div className='flex flex-wrap gap-2'>
<div>
<Link
href={`/download/${slug}/file${selectedRevision}${fileEnding}`}
target='_blank'
@ -67,11 +66,14 @@ const VersionChooser = ({
})()}
</button>
</Link>
<button className='button-alternate' onClick={handleClick}>
<button
className='ml-2 h-10 px-2.5 bg-slate-300 rounded-md'
onClick={handleClick}
>
Export BibTeX
</button>
<select
className='select-default'
className='ml-2 h-10 px-2.5 bg-slate-300 rounded-md'
value={`v${selectedRevision}`}
onChange={(e) => {
setSelectedRevision(parseInt(e.target.value.replace(/\D/g, ''), 10))