From 930c7ac78671a8c541004f7237f51a658f602c27 Mon Sep 17 00:00:00 2001 From: Ayyub I Date: Sat, 30 Sep 2023 18:18:08 -0500 Subject: [PATCH] updated thumbnail syntax --- packages/web/components/Citation.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/web/components/Citation.tsx b/packages/web/components/Citation.tsx index 339494ff..41034319 100644 --- a/packages/web/components/Citation.tsx +++ b/packages/web/components/Citation.tsx @@ -16,9 +16,9 @@ function isYouTubeURL(url: string): boolean { return url.includes('youtube.com'); } -function getYouTubeThumbnail(url: string): string | null { +function getYouTubeThumbnail(url: string): string | undefined { const videoId = url.split("v=")[1]?.split("&")[0]; - if (!videoId) return null; + if (!videoId) return undefined; return `https://img.youtube.com/vi/${videoId}/0.jpg`; } @@ -37,9 +37,9 @@ const Citation = ({ citation, index }: CitationProps) => { :{" "} {key === "source_url" && citation[key] ? ( - isYouTubeURL(citation[key]) ? ( + isYouTubeURL(citation[key]) && getYouTubeThumbnail(citation[key]) ? ( - YouTube Thumbnail + YouTube Thumbnail ) : (