import { AdBannersSlot, AdIconsSlot, FriendLinksSlot, H5FriendLinksSlot } from "@/components/common/ads/slots"; import { ChannelHeader, H5ChannelHeader } from "@/components/common/channel-header"; import { FilterChipLink, FilterOptionLink } from "@/components/common/filter-link"; import { Pagination } from "@/components/common/pagination"; import { buildPageHrefMap } from "@/components/common/pagination-map"; import { FloatingActions } from "@/components/home/floating-actions"; import { DownloadBanner } from "@/components/home/page-sections"; import { SeoBreadcrumb } from "@/components/seo/seo-breadcrumb"; import type { HomeTopicData, PlayletData, VideoInfo } from "@/lib/api/types"; import { isTopicVideo, topicTotalPages, unwrapTopicListItem, type TopicPageData, } from "./data"; import { topicListHref, topicSortOptions } from "./route"; import { TopicPlayletCard, TopicVideoCard } from "./topic-cards"; import { TopicListCard } from "./topic-list-card"; const layouts = { playlet: { eyebrow: "短剧专题", gridClassName: "grid grid-cols-[repeat(6,266px)] justify-between gap-y-6", h5GridClassName: "grid grid-cols-2 gap-x-[7px] gap-y-3", morePcClassName: "grid grid-cols-2 gap-5 lg:grid-cols-4", }, video: { eyebrow: "视频专题", gridClassName: "grid grid-cols-[repeat(4,400px)] justify-between gap-y-6", h5GridClassName: "grid grid-cols-2 gap-x-[7px] gap-y-3", morePcClassName: "grid grid-cols-2 gap-5 lg:grid-cols-3", }, } as const; function MoreTopicGrid({ topics, dataType, compact, gridClassName, }: { topics: HomeTopicData[]; dataType: 1 | 2; compact?: boolean; gridClassName: string; }) { if (!topics.length) return null; return (

更多专题

{topics.map((topic) => ( ))}
); } function TopicList({ data, compact, }: { data: TopicPageData; compact?: boolean; }) { const dataType: 1 | 2 = isTopicVideo(data.dataType) ? 2 : 1; const items = (data.list ?? []) .map((item) => unwrapTopicListItem(item, dataType)) .filter((item): item is PlayletData | VideoInfo => Boolean(item?.id)); if (!items.length) { return

暂无专题内容

; } const layout = dataType === 2 ? layouts.video : layouts.playlet; return (
{items.map((item) => dataType === 2 ? (
) : (
), )}
); } function TopicSortBar({ pathKey, dataType, sortType, compact, }: { pathKey: string; dataType: 1 | 2; sortType: TopicPageData["sortType"]; compact?: boolean; }) { if (compact) { return (
排序:
{topicSortOptions.map((item) => ( ))}
); } return (
排序: {topicSortOptions.map((item) => ( ))}
); } export function TopicPage({ data }: { data: TopicPageData }) { const isVideo = isTopicVideo(data.dataType); const dataType: 1 | 2 = isVideo ? 2 : 1; const layout = isVideo ? layouts.video : layouts.playlet; const name = (data.name || "").trim() || "专题"; const desc = (data.desc || "").trim(); // 与标题相同或为空时不展示副标题,避免「科幻 / 科幻」重复 const subtitle = desc && desc !== name ? desc : ""; const moreTopics = data.moreTopics ?? []; const pageNum = data.pageNum || 1; const totalPages = topicTotalPages(data); const pathKey = (data.slug || "").trim() || (data.id != null ? String(data.id) : data.routeKey); const sortType = data.sortType === 2 || data.sortType === 3 ? data.sortType : 1; const hrefMap = totalPages > 1 ? buildPageHrefMap(totalPages, (page) => topicListHref(pathKey, { dataType, page, sortType })) : undefined; return ( <>
{hrefMap ? : null}
{/* 分页放在 design-frame 外,避免 Chrome CSS zoom 热区错位导致点击无响应 */} {hrefMap ? (
) : null}
); }