mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-02-23 03:04:43 +08:00
feat: remove aggregate page, use douban_id to assist search
This commit is contained in:
@@ -19,7 +19,6 @@ interface SearchResult {
|
||||
|
||||
interface AggregateCardProps {
|
||||
/** 同一标题下的多个搜索结果 */
|
||||
query?: string;
|
||||
year?: string;
|
||||
items: SearchResult[];
|
||||
}
|
||||
@@ -58,11 +57,7 @@ function PlayCircleSolid({
|
||||
* 点击播放按钮 -> 跳到第一个源播放
|
||||
* 点击卡片其他区域 -> 跳到聚合详情页 (/aggregate)
|
||||
*/
|
||||
const AggregateCard: React.FC<AggregateCardProps> = ({
|
||||
query = '',
|
||||
year = 0,
|
||||
items,
|
||||
}) => {
|
||||
const AggregateCard: React.FC<AggregateCardProps> = ({ year = 0, items }) => {
|
||||
// 使用列表中的第一个结果做展示 & 播放
|
||||
const first = items[0];
|
||||
const [playHover, setPlayHover] = useState(false);
|
||||
@@ -118,11 +113,9 @@ const AggregateCard: React.FC<AggregateCardProps> = ({
|
||||
|
||||
return (
|
||||
<Link
|
||||
href={`/aggregate?q=${encodeURIComponent(
|
||||
query.trim()
|
||||
)}&title=${encodeURIComponent(first.title)}${
|
||||
year ? `&year=${encodeURIComponent(year)}` : ''
|
||||
}&type=${mostFrequentEpisodes > 1 ? 'tv' : 'movie'}`}
|
||||
href={`/play?source=${first.source}&id=${
|
||||
first.id
|
||||
}&title=${encodeURIComponent(first.title)}${year ? `&year=${year}` : ''}`}
|
||||
>
|
||||
<div className='group relative w-full rounded-lg bg-transparent flex flex-col cursor-pointer transition-all duration-300 ease-in-out'>
|
||||
{/* 封面图片 2:3 */}
|
||||
@@ -162,7 +155,7 @@ const AggregateCard: React.FC<AggregateCardProps> = ({
|
||||
first.id
|
||||
}&title=${encodeURIComponent(first.title)}${
|
||||
year ? `&year=${year}` : ''
|
||||
}&from=aggregate`
|
||||
}`
|
||||
);
|
||||
}}
|
||||
onMouseEnter={() => setPlayHover(true)}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Link as LinkIcon, Search } from 'lucide-react';
|
||||
import { Link as LinkIcon } from 'lucide-react';
|
||||
import Image from 'next/image';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import React, { useRef, useState } from 'react';
|
||||
@@ -13,7 +13,7 @@ interface DemoCardProps {
|
||||
type?: string;
|
||||
}
|
||||
|
||||
function SearchCircle({
|
||||
function PlayCircleSolid({
|
||||
className = '',
|
||||
fillColor = 'none',
|
||||
}: {
|
||||
@@ -37,11 +37,7 @@ function SearchCircle({
|
||||
strokeWidth='1.5'
|
||||
fill={fillColor}
|
||||
/>
|
||||
<foreignObject x='0' y='0' width='44' height='44'>
|
||||
<div className='w-full h-full flex items-center justify-center'>
|
||||
<Search className='h-5 w-5 text-white' strokeWidth={2} />
|
||||
</div>
|
||||
</foreignObject>
|
||||
<polygon points='19,15 19,29 29,22' fill='white' />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -54,7 +50,9 @@ const DemoCard = ({ id, title, poster, rate, type }: DemoCardProps) => {
|
||||
|
||||
const handleClick = () => {
|
||||
router.push(
|
||||
`/aggregate?q=${encodeURIComponent(title.trim())}&type=${type}`
|
||||
`/play?title=${encodeURIComponent(
|
||||
title.trim()
|
||||
)}&douban_id=${id}&type=${type}`
|
||||
);
|
||||
};
|
||||
|
||||
@@ -103,7 +101,7 @@ const DemoCard = ({ id, title, poster, rate, type }: DemoCardProps) => {
|
||||
hover ? 'scale-110 rotate-12' : 'scale-90'
|
||||
}`}
|
||||
>
|
||||
<SearchCircle fillColor={hover ? '#22c55e' : 'none'} />
|
||||
<PlayCircleSolid fillColor={hover ? '#22c55e' : 'none'} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -14,9 +14,7 @@ const PageLayout = ({ children, activePath = '/' }: PageLayoutProps) => {
|
||||
return (
|
||||
<div className='w-full min-h-screen'>
|
||||
{/* 移动端头部 */}
|
||||
<MobileHeader
|
||||
showBackButton={['/play', '/aggregate'].includes(activePath)}
|
||||
/>
|
||||
<MobileHeader showBackButton={['/play'].includes(activePath)} />
|
||||
|
||||
{/* 主要布局容器 */}
|
||||
<div className='flex md:grid md:grid-cols-[auto_1fr] w-full min-h-screen md:min-h-auto'>
|
||||
@@ -28,7 +26,7 @@ const PageLayout = ({ children, activePath = '/' }: PageLayoutProps) => {
|
||||
{/* 主内容区域 */}
|
||||
<div className='relative min-w-0 flex-1 transition-all duration-300'>
|
||||
{/* 桌面端左上角返回按钮 */}
|
||||
{['/play', '/aggregate'].includes(activePath) && (
|
||||
{['/play'].includes(activePath) && (
|
||||
<div className='absolute top-3 left-1 z-20 hidden md:flex'>
|
||||
<BackButton />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user