mirror of
https://github.com/KuekHaoYang/KVideo.git
synced 2026-08-22 04:03:42 +08:00
feat: Extract and display video quality from titles on video cards and update package version.
This commit is contained in:
@@ -10,6 +10,7 @@ import { LatencyBadge } from '@/components/ui/LatencyBadge';
|
||||
import { FavoriteButton } from '@/components/favorites/FavoriteButton';
|
||||
|
||||
import { Video } from '@/lib/types';
|
||||
import { parseVideoTitle } from '@/lib/utils/video';
|
||||
|
||||
interface VideoCardProps {
|
||||
video: Video;
|
||||
@@ -139,17 +140,36 @@ export const VideoCard = memo<VideoCardProps>(({
|
||||
</div>
|
||||
|
||||
{/* Info */}
|
||||
<div className="pt-3">
|
||||
<h4 className="font-semibold text-sm text-[var(--text-color)] line-clamp-2">
|
||||
{video.vod_remarks && (
|
||||
<span className="text-xs text-[var(--accent-color)] mr-1">[{video.vod_remarks}]</span>
|
||||
)}
|
||||
{video.vod_name}
|
||||
</h4>
|
||||
<div className="p-3 flex-1 flex flex-col">
|
||||
{(() => {
|
||||
const { cleanTitle, quality } = parseVideoTitle(video.vod_name);
|
||||
// Visual priority: Quality from title tag, then vod_remarks
|
||||
const displayQuality = quality || video.vod_remarks;
|
||||
|
||||
return (
|
||||
<>
|
||||
<h4 className="font-semibold text-sm text-[var(--text-color)] line-clamp-2 min-h-[2.5rem] mb-1">
|
||||
{cleanTitle}
|
||||
</h4>
|
||||
{displayQuality && (
|
||||
<p className="text-xs text-[var(--accent-color)] font-medium">
|
||||
{displayQuality}
|
||||
</p>
|
||||
)}
|
||||
{/* Hide remarks if it was used as quality to avoid duplication */}
|
||||
{video.vod_remarks && video.vod_remarks !== displayQuality && (
|
||||
<p className="text-xs text-[var(--text-color-secondary)] mt-1 line-clamp-1">
|
||||
{video.vod_remarks}
|
||||
</p>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
})()}
|
||||
</div>
|
||||
</Card>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</Link>
|
||||
</div >
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user