mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-02-24 12:24:46 +08:00
feat: enhance video match
This commit is contained in:
@@ -10,11 +10,13 @@ interface SearchResult {
|
||||
poster: string;
|
||||
source: string;
|
||||
source_name: string;
|
||||
episodes?: number;
|
||||
episodes: string[];
|
||||
}
|
||||
|
||||
interface AggregateCardProps {
|
||||
/** 同一标题下的多个搜索结果 */
|
||||
query?: string;
|
||||
year?: string;
|
||||
items: SearchResult[];
|
||||
}
|
||||
|
||||
@@ -52,14 +54,24 @@ function PlayCircleSolid({
|
||||
* 点击播放按钮 -> 跳到第一个源播放
|
||||
* 点击卡片其他区域 -> 跳到聚合详情页 (/aggregate)
|
||||
*/
|
||||
const AggregateCard: React.FC<AggregateCardProps> = ({ items }) => {
|
||||
const AggregateCard: React.FC<AggregateCardProps> = ({
|
||||
query = '',
|
||||
year = 0,
|
||||
items,
|
||||
}) => {
|
||||
// 使用列表中的第一个结果做展示 & 播放
|
||||
const first = items[0];
|
||||
const [playHover, setPlayHover] = useState(false);
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<Link href={`/aggregate?q=${encodeURIComponent(first.title)}`}>
|
||||
<Link
|
||||
href={`/aggregate?q=${encodeURIComponent(
|
||||
query
|
||||
)}&title=${encodeURIComponent(first.title)}${
|
||||
year ? `&year=${encodeURIComponent(year)}` : ''
|
||||
}`}
|
||||
>
|
||||
<div className='group relative w-full rounded-lg bg-transparent shadow-none flex flex-col'>
|
||||
{/* 封面图片 2:3 */}
|
||||
<div className='relative aspect-[2/3] w-full overflow-hidden rounded-md'>
|
||||
@@ -85,7 +97,9 @@ const AggregateCard: React.FC<AggregateCardProps> = ({ items }) => {
|
||||
router.push(
|
||||
`/play?source=${first.source}&id=${
|
||||
first.id
|
||||
}&title=${encodeURIComponent(first.title)}&from=aggregate`
|
||||
}&title=${encodeURIComponent(first.title)}${
|
||||
year ? `&year=${year}` : ''
|
||||
}&from=aggregate`
|
||||
);
|
||||
}}
|
||||
onMouseEnter={() => setPlayHover(true)}
|
||||
|
||||
@@ -101,6 +101,7 @@ export default function ContinueWatching({ className }: ContinueWatchingProps) {
|
||||
id={id}
|
||||
title={record.title}
|
||||
poster={record.cover}
|
||||
year={record.year}
|
||||
source={source}
|
||||
source_name={record.source_name}
|
||||
progress={getProgress(record)}
|
||||
|
||||
@@ -14,6 +14,7 @@ interface VideoCardProps {
|
||||
episodes?: number;
|
||||
source_name: string;
|
||||
progress?: number;
|
||||
year?: string;
|
||||
from?: string;
|
||||
currentEpisode?: number;
|
||||
onDelete?: () => void;
|
||||
@@ -79,6 +80,7 @@ export default function VideoCard({
|
||||
source,
|
||||
source_name,
|
||||
progress,
|
||||
year,
|
||||
from,
|
||||
currentEpisode,
|
||||
onDelete,
|
||||
@@ -112,6 +114,7 @@ export default function VideoCard({
|
||||
const newState = await toggleFavorite(source, id, {
|
||||
title,
|
||||
source_name,
|
||||
year: year || '',
|
||||
cover: poster,
|
||||
total_episodes: episodes ?? 1,
|
||||
save_time: Date.now(),
|
||||
@@ -147,7 +150,7 @@ export default function VideoCard({
|
||||
<Link
|
||||
href={`/detail?source=${source}&id=${id}&title=${encodeURIComponent(
|
||||
title
|
||||
)}${from ? `&from=${from}` : ''}`}
|
||||
)}${year ? `&year=${year}` : ''}${from ? `&from=${from}` : ''}`}
|
||||
>
|
||||
<div className='group relative w-full rounded-lg bg-transparent shadow-none flex flex-col'>
|
||||
{/* 海报图片 - 2:3 比例 */}
|
||||
@@ -174,7 +177,7 @@ export default function VideoCard({
|
||||
router.push(
|
||||
`/play?source=${source}&id=${id}&title=${encodeURIComponent(
|
||||
title
|
||||
)}`
|
||||
)}${year ? `&year=${year}` : ''}`
|
||||
);
|
||||
}}
|
||||
onMouseEnter={() => setPlayHover(true)}
|
||||
|
||||
Reference in New Issue
Block a user