diff --git a/src/components/project/ProjectDetail.tsx b/src/components/project/ProjectDetail.tsx index 1de0670..299c781 100644 --- a/src/components/project/ProjectDetail.tsx +++ b/src/components/project/ProjectDetail.tsx @@ -48,48 +48,6 @@ function formatDate(date: Date | string, locale: string): string { } } -// Helper function to check if URL is an image -function isImageUrl(url: string): boolean { - const imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.webp', '.svg', '.bmp'] - const lowerUrl = url.toLowerCase() - return imageExtensions.some(ext => lowerUrl.includes(ext)) -} - -// Helper function to check if URL can be embedded in iframe -// Many sites like GitHub, Google, etc. block iframe embedding via CSP -function isEmbeddableUrl(url: string): boolean { - const hostname = new URL(url).hostname.toLowerCase() - - // Whitelist of domains that allow iframe embedding - const embeddableDomains = [ - 'youtube.com', - 'youtu.be', - 'vimeo.com', - 'player.vimeo.com', - 'drive.google.com', - 'docs.google.com', - 'www.figma.com', - 'codepen.io', - 'jsfiddle.net', - 'codesandbox.io', - 'stackblitz.com', - 'replit.com', - 'loom.com', - 'wistia.com', - 'brightcove.com', - 'dailymotion.com', - 'twitch.tv', - 'soundcloud.com', - 'spotify.com', - 'canva.com', - 'notion.so', - 'typeform.com', - ] - - // Check if hostname matches any embeddable domain - return embeddableDomains.some((domain) => hostname === domain || hostname.endsWith('.' + domain)) -} - export async function ProjectDetail({ project, locale }: ProjectDetailProps) { const t = await getTranslations('project') @@ -149,26 +107,6 @@ export async function ProjectDetail({ project, locale }: ProjectDetailProps) { ))} - - {/* Featured Image/Video Placeholder - only show if source exists */} - {project.source && ( -
- {isImageUrl(project.source) ? ( - {`${displayName} - ) : isEmbeddableUrl(project.source) ? ( -