From 4f4f7f7ae27905c3e2aa09669bbb9a4d8ef3117b Mon Sep 17 00:00:00 2001 From: zaidmukaddam Date: Mon, 26 Aug 2024 13:16:00 +0530 Subject: [PATCH] improve citation component --- app/page.tsx | 49 ++++++++++++++++++++++++++++++++----------------- package.json | 1 + pnpm-lock.yaml | 3 +++ 3 files changed, 36 insertions(+), 17 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index c21ea78..06c69ce 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1241,28 +1241,39 @@ export default function Home() { href: string; children: React.ReactNode; index: number; + citationText: string; } - const CitationComponent: React.FC = React.memo(({ href, index }) => { - const faviconUrl = `https://www.google.com/s2/favicons?sz=128&domain=${new URL(href).hostname}`; + const CitationComponent: React.FC = React.memo(({ href, index, citationText }) => { + const { hostname } = new URL(href); + const faviconUrl = `https://www.google.com/s2/favicons?sz=128&domain=${hostname}`; return ( - + - - {index + 1} - + + + {index + 1} + + - - Favicon - - {href} - + + +

{citationText}

); @@ -1290,7 +1301,11 @@ export default function Home() { if (!href) return null; const index = citationLinks.findIndex((link) => link.link === href); return index !== -1 ? ( - + {children} ) : ( diff --git a/package.json b/package.json index e57777d..4364055 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "clsx": "^2.1.1", "date-fns": "^3.6.0", "framer-motion": "^11.3.19", + "katex": "^0.16.11", "lucide-react": "^0.424.0", "next": "^14.2.5", "openai": "^4.56.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 155708f..139de53 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -77,6 +77,9 @@ dependencies: framer-motion: specifier: ^11.3.19 version: 11.3.20(react-dom@18.3.1)(react@18.3.1) + katex: + specifier: ^0.16.11 + version: 0.16.11 lucide-react: specifier: ^0.424.0 version: 0.424.0(react@18.3.1)