refactor: 项目详情页预览框改为条件渲染,无演示内容时不显示占位符

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-30 16:01:24 +08:00
co-authored by Claude
parent cae5686d2d
commit 5e43a7d382
+5 -12
View File
@@ -108,24 +108,17 @@ export async function ProjectDetail({ project, locale }: ProjectDetailProps) {
))}
</div>
{/* Featured Image/Video Placeholder */}
<div className="relative w-full aspect-video border-2 border-black dark:border-gray-600 bg-gray-100 dark:bg-gray-800 mb-10 overflow-hidden shadow-brutal dark:shadow-brutal-dark flex items-center justify-center">
{project.source ? (
{/* Featured Image/Video Placeholder - only show if source exists */}
{project.source && (
<div className="relative w-full aspect-video border-2 border-black dark:border-gray-600 bg-gray-100 dark:bg-gray-800 mb-10 overflow-hidden shadow-brutal dark:shadow-brutal-dark">
<iframe
src={project.source}
className="w-full h-full"
title={`${displayName} demo`}
allowFullScreen
/>
) : (
<div className="text-center">
<span className="material-icons text-6xl text-gray-400 dark:text-gray-600 mb-2">
smart_toy
</span>
<p className="text-gray-500 dark:text-gray-400 font-display text-sm">{t('projectPreview')}</p>
</div>
)}
</div>
</div>
)}
</header>
{/* Article Content */}