refactor authordisplay, bibtex export toast
This commit is contained in:
parent
fb1cf67e5f
commit
56df68b988
3 changed files with 12 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { Fragment } from 'react'
|
import { Fragment, Suspense } from 'react'
|
||||||
import { affiliations, nationalities, authors } from '../../db/data'
|
import { affiliations, nationalities, authors } from '../../db/data'
|
||||||
import { Zilla_Slab } from 'next/font/google'
|
import { Zilla_Slab } from 'next/font/google'
|
||||||
import { notFound } from 'next/navigation'
|
import { notFound } from 'next/navigation'
|
||||||
|
@ -143,7 +143,9 @@ export default function AuthorDisplay({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<Suspense>
|
||||||
<KonamiSnowfall nationalityList={nationality} />
|
<KonamiSnowfall nationalityList={nationality} />
|
||||||
|
</Suspense>
|
||||||
<div className='grid grid-cols-1 md:grid-cols-2 items-center max-w-3xl mx-auto'>
|
<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'>
|
<div className='aspect-square w-[60vw] md:w-[30vw] lg:w-[20vw] 2xl:w-[15vw] overflow-hidden mx-auto mb-4'>
|
||||||
<img
|
<img
|
||||||
|
|
|
@ -9,7 +9,6 @@ import {
|
||||||
Reviewers,
|
Reviewers,
|
||||||
} from '@/app/components/DataDisplay'
|
} from '@/app/components/DataDisplay'
|
||||||
import { ItemBadge, Status } from '@/app/components/Badges'
|
import { ItemBadge, Status } from '@/app/components/Badges'
|
||||||
import { notFound } from 'next/navigation'
|
|
||||||
import VersionChooser from './VersionChooser'
|
import VersionChooser from './VersionChooser'
|
||||||
import crypto from 'crypto'
|
import crypto from 'crypto'
|
||||||
import { Suspense } from 'react'
|
import { Suspense } from 'react'
|
||||||
|
@ -28,10 +27,9 @@ const DocumentViewer = ({ slug }: Readonly<{ slug: string }>) => {
|
||||||
})
|
})
|
||||||
if (error) throw error
|
if (error) throw error
|
||||||
let doc = data
|
let doc = data
|
||||||
// const doc = documents[slug]
|
|
||||||
const { manifest, abstract, citation } = doc
|
const { manifest, abstract, citation } = doc
|
||||||
|
|
||||||
// if (!manifest) return notFound()
|
|
||||||
const {
|
const {
|
||||||
title,
|
title,
|
||||||
authors,
|
authors,
|
||||||
|
|
|
@ -26,8 +26,7 @@ const VersionChooser = ({
|
||||||
|
|
||||||
const fileEnding = file === 'other' ? '' : `.${file}`
|
const fileEnding = file === 'other' ? '' : `.${file}`
|
||||||
const [selectedRevision, setSelectedRevision] = useState<number>(latest) // Initialize the selected revision with the latest revision
|
const [selectedRevision, setSelectedRevision] = useState<number>(latest) // Initialize the selected revision with the latest revision
|
||||||
const notifyCopied = () =>
|
const notifyCopied = () => toast('BibTeX copied to clipboard!')
|
||||||
toast('BibTeX copied to clipboard!', { type: 'success' })
|
|
||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
const bibtex = `@article{
|
const bibtex = `@article{
|
||||||
|
@ -50,7 +49,7 @@ const VersionChooser = ({
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='flex flex-wrap gap-2'>
|
<div>
|
||||||
<Link
|
<Link
|
||||||
href={`/download/${slug}/file${selectedRevision}${fileEnding}`}
|
href={`/download/${slug}/file${selectedRevision}${fileEnding}`}
|
||||||
target='_blank'
|
target='_blank'
|
||||||
|
@ -67,11 +66,14 @@ const VersionChooser = ({
|
||||||
})()}
|
})()}
|
||||||
</button>
|
</button>
|
||||||
</Link>
|
</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
|
Export BibTeX
|
||||||
</button>
|
</button>
|
||||||
<select
|
<select
|
||||||
className='select-default'
|
className='ml-2 h-10 px-2.5 bg-slate-300 rounded-md'
|
||||||
value={`v${selectedRevision}`}
|
value={`v${selectedRevision}`}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setSelectedRevision(parseInt(e.target.value.replace(/\D/g, ''), 10))
|
setSelectedRevision(parseInt(e.target.value.replace(/\D/g, ''), 10))
|
||||||
|
|
Loading…
Reference in a new issue