mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-03-15 02:27:29 +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)}
|
||||
|
||||
Reference in New Issue
Block a user