From 12253608cb43c9e359bc869e8829e8d9b284ecbc Mon Sep 17 00:00:00 2001 From: Ayyub I Date: Thu, 28 Sep 2023 18:03:59 -0500 Subject: [PATCH] added urls to citations --- packages/web/components/Citation.tsx | 18 ++++++++++++++++-- packages/web/components/NewQuery.tsx | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/web/components/Citation.tsx b/packages/web/components/Citation.tsx index a8eab719..322f1e74 100644 --- a/packages/web/components/Citation.tsx +++ b/packages/web/components/Citation.tsx @@ -5,6 +5,13 @@ interface CitationProps { index: number; } +const citationKeyMap: { [key: string]: string } = { + source_title: "Source Title", + source_name: "Source Name", + source_publish_date: "Source Publish Date", + source_url: "Source URL", +}; + const Citation = ({ citation, index }: CitationProps) => { const hasMetadata = Object.values(citation).some( (value) => value !== null && value !== "" @@ -16,9 +23,16 @@ const Citation = ({ citation, index }: CitationProps) => { {Object.keys(citation).map((key, i) => (
- {"\u2022"} {key} + {"\u2022"} {citationKeyMap[key] || key} - : {citation[key]} + :{" "} + {key === "source_url" && citation[key] ? ( // Check if the current key is 'source_url' and it exists + + {citation[key]} + + ) : ( + citation[key] + )}
))} diff --git a/packages/web/components/NewQuery.tsx b/packages/web/components/NewQuery.tsx index e5dfa9b5..8567be16 100644 --- a/packages/web/components/NewQuery.tsx +++ b/packages/web/components/NewQuery.tsx @@ -59,6 +59,7 @@ export default function NewQuery() { source_title: citation.Title, source_name: citation.Name, source_publish_date: citation.Published, + source_url: citation.URL, }; }); card = card as ICard;