修正更多推荐无数据时的显示

This commit is contained in:
mtvpls
2025-12-28 21:11:39 +08:00
parent d821c0bd7e
commit 9c58618bf7
2 changed files with 38 additions and 48 deletions

View File

@@ -5351,29 +5351,10 @@ function PlayPageClient() {
</div>
{/* 推荐区域 */}
{(videoDoubanId !== 0 || videoTitle) && (
<div className='mt-6 -mx-3 md:mx-0 md:px-4'>
<div className='bg-white/50 dark:bg-gray-800/50 backdrop-blur-sm rounded-xl border border-gray-200/50 dark:border-gray-700/50 overflow-hidden'>
{/* 标题 */}
<div className='px-3 md:px-6 py-4 border-b border-gray-200 dark:border-gray-700'>
<h3 className='text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2'>
<svg className='w-5 h-5' fill='currentColor' viewBox='0 0 24 24'>
<path d='M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z'/>
</svg>
</h3>
</div>
{/* 推荐内容 */}
<div className='px-3 pt-3 md:px-6 md:pt-6'>
<SmartRecommendations
doubanId={videoDoubanId !== 0 ? videoDoubanId : undefined}
videoTitle={videoTitle}
/>
</div>
</div>
</div>
)}
<SmartRecommendations
doubanId={videoDoubanId !== 0 ? videoDoubanId : undefined}
videoTitle={videoTitle}
/>
{/* 豆瓣评论区域 */}
{videoDoubanId !== 0 && enableComments && (

View File

@@ -238,35 +238,44 @@ export default function SmartRecommendations({
);
}
if (error) {
return (
<div className='text-center py-8 text-gray-500 dark:text-gray-400'>
{error}
</div>
);
}
if (recommendations.length === 0) {
if (error || recommendations.length === 0) {
return null;
}
return (
<ScrollableRow scrollDistance={600} bottomPadding='pb-2'>
{recommendations.map((rec, index) => (
<div
key={rec.doubanId || rec.tmdbId || index}
className='min-w-[96px] w-24 sm:min-w-[140px] sm:w-[140px]'
>
<VideoCard
title={rec.title}
poster={rec.poster}
rate={rec.rating}
douban_id={rec.doubanId ? parseInt(rec.doubanId) : undefined}
tmdb_id={rec.tmdbId}
from={rec.doubanId ? 'douban' : 'tmdb'}
/>
<div className='mt-6 -mx-3 md:mx-0 md:px-4'>
<div className='bg-white/50 dark:bg-gray-800/50 backdrop-blur-sm rounded-xl border border-gray-200/50 dark:border-gray-700/50 overflow-hidden'>
{/* 标题 */}
<div className='px-3 md:px-6 py-4 border-b border-gray-200 dark:border-gray-700'>
<h3 className='text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2'>
<svg className='w-5 h-5' fill='currentColor' viewBox='0 0 24 24'>
<path d='M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z'/>
</svg>
</h3>
</div>
))}
</ScrollableRow>
{/* 推荐内容 */}
<div className='px-3 pt-3 md:px-6 md:pt-6'>
<ScrollableRow scrollDistance={600} bottomPadding='pb-2'>
{recommendations.map((rec, index) => (
<div
key={rec.doubanId || rec.tmdbId || index}
className='min-w-[96px] w-24 sm:min-w-[140px] sm:w-[140px]'
>
<VideoCard
title={rec.title}
poster={rec.poster}
rate={rec.rating}
douban_id={rec.doubanId ? parseInt(rec.doubanId) : undefined}
tmdb_id={rec.tmdbId}
from={rec.doubanId ? 'douban' : 'tmdb'}
/>
</div>
))}
</ScrollableRow>
</div>
</div>
</div>
);
}