From 0205590b9f6dc72aca419987018d0a6e71407980 Mon Sep 17 00:00:00 2001 From: Ananth Venkatesh <46249765+quantum9Innovation@users.noreply.github.com> Date: Fri, 16 Feb 2024 21:44:32 +0000 Subject: [PATCH] Show QR codes are toasts --- .../document/view/[slug]/DocumentViewer.tsx | 24 +++++++------------ .../document/view/[slug]/VersionChooser.tsx | 11 ++++++++- src/app/search/page.tsx | 2 +- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/app/document/view/[slug]/DocumentViewer.tsx b/src/app/document/view/[slug]/DocumentViewer.tsx index 63ccbec..bbd579a 100644 --- a/src/app/document/view/[slug]/DocumentViewer.tsx +++ b/src/app/document/view/[slug]/DocumentViewer.tsx @@ -14,7 +14,6 @@ import generateHash from '@/app/utils/hash' import { Suspense } from 'react' import { loadDocument } from '@/app/db/loaders' import { useSuspenseQuery } from '@tanstack/react-query' -import QRCode from 'qrcode.react' const zillaSlab = Zilla_Slab({ subsets: ['latin'], weight: ['500'] }) @@ -49,20 +48,15 @@ const DocumentViewer = ({ slug }: Readonly<{ slug: string }>) => { return (
-
-
- -
-

- {title} -

-
+

+ {title} +

diff --git a/src/app/document/view/[slug]/VersionChooser.tsx b/src/app/document/view/[slug]/VersionChooser.tsx index 4ae62b3..2353903 100644 --- a/src/app/document/view/[slug]/VersionChooser.tsx +++ b/src/app/document/view/[slug]/VersionChooser.tsx @@ -7,6 +7,7 @@ import { useSuspenseQuery } from '@tanstack/react-query' import { epoch2date } from '@/app/utils/epoch2datestring' import { toast } from 'react-toastify' import generateHash from '@/app/utils/hash' +import QRCode from 'qrcode.react' const VersionChooser = ({ doc, @@ -51,9 +52,17 @@ const VersionChooser = ({ } const handleCopy = () => { - const id = doc.citation ? doc.citation : generateHash(slug) + const id = doc.citation ? doc.citation.slice(6) : generateHash(slug) navigator.clipboard.writeText(`eeXiv:${id}`) notifyCopied('Citation') + toast.info(( +
+ +
+ ), { + autoClose: false, + closeOnClick: true, + }) } return ( diff --git a/src/app/search/page.tsx b/src/app/search/page.tsx index 231ed6d..43ff99c 100644 --- a/src/app/search/page.tsx +++ b/src/app/search/page.tsx @@ -77,7 +77,7 @@ export default function Page() { let invalid = false - if (search.toLowerCase().startsWith('eexiv')) { + if (search.toLowerCase().startsWith('eexiv:')) { const id = search.slice(6) if (id.length !== 12) {