Initial commit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
谢宇宁
2026-10-26 17:51:31 +07:00
co-authored by Claude Opus 5.5
commit 61d0a11dfa
371 changed files with 35836 additions and 0 deletions
+148
View File
@@ -0,0 +1,148 @@
import Link from "next/link";
import { CardTags } from "@/components/common/card-tags";
import { DecryptedImage } from "@/components/common/decrypted-image";
import {
MEDIA_CARD_COVER,
MEDIA_CARD_DESC,
MEDIA_CARD_DESC_SM,
MEDIA_CARD_EPISODES,
MEDIA_CARD_EPISODES_H5,
MEDIA_CARD_FOOTER_H5,
MEDIA_CARD_INFO_H5,
MEDIA_CARD_META,
MEDIA_CARD_ROOT,
MEDIA_CARD_TITLE_H5,
MEDIA_CARD_TITLE_PC,
} from "@/components/common/media-card-hover";
import { RankNumber } from "@/components/common/rank-number";
import { Badge } from "@/components/home/section-heading";
import type { ShortDramaItem } from "@/components/short-drama/data";
import { IMG_PLACEHOLDER } from "@/lib/image/decrypt";
export function videoHref(id: string, slug?: string | null) {
return `/video/${(slug?.trim() || id).trim()}`;
}
export function VideoCard({ item, rank }: { item: ShortDramaItem; rank?: number }) {
if (item.kind === "ad") {
return (
<a
href={item.href || "#download"}
target={item.href ? "_blank" : undefined}
rel={item.href ? "sponsored nofollow noopener noreferrer" : undefined}
className={`block w-[324px] ${MEDIA_CARD_ROOT}`}
>
<div className="relative h-[192px] overflow-hidden rounded-t-lg">
<DecryptedImage src={item.cover} fallback={IMG_PLACEHOLDER} alt="" className={MEDIA_CARD_COVER} />
<img src="/logo.svg" alt="海角社区" className="absolute top-[25px] left-[15px] h-[27px] w-[120px]" />
</div>
<div className="flex min-h-24 flex-col justify-center gap-1.5 px-2.5 py-3">
<h3 className={MEDIA_CARD_TITLE_PC}>{item.title}</h3>
<p className={`${MEDIA_CARD_DESC} text-white/60`}>{item.subtitle}</p>
</div>
</a>
);
}
const detailHref = item.href || videoHref(item.id, item.slug);
return (
<article data-component="video-card" className={`w-[324px] ${MEDIA_CARD_ROOT}`}>
<Link href={detailHref} className="block">
<div className="relative h-[192px] overflow-hidden rounded-t-lg">
<DecryptedImage src={item.cover} fallback={IMG_PLACEHOLDER} alt="" className={MEDIA_CARD_COVER} />
{item.badge ? (
<div className="absolute top-[15.5px] right-4">
<Badge tone={item.badge} />
</div>
) : null}
{item.episodes ? (
<span
className={`absolute right-2 bottom-2 rounded-md bg-black/60 px-3 py-2 text-white ${MEDIA_CARD_EPISODES}`}
>
{item.episodes}
</span>
) : null}
</div>
<div className="flex min-w-0 flex-col gap-1.5 px-2.5 pt-3">
<h3 className={`flex min-h-7 items-center gap-1.5 ${MEDIA_CARD_TITLE_PC}`}>
<RankNumber rank={rank} className="media-card-title" />
<span className="min-w-0 truncate">{item.title}</span>
</h3>
<p className={`${MEDIA_CARD_DESC} text-white/60`}>{item.subtitle}</p>
</div>
</Link>
<div className={`flex min-w-0 items-center justify-between gap-2 px-2.5 pt-1.5 pb-3 ${MEDIA_CARD_META}`}>
<CardTags tags={item.tags} kind="video" className="min-w-0 text-white/60" />
<span className="shrink-0 text-[#F92882]">{item.heat}</span>
</div>
</article>
);
}
export function H5VideoCard({
item,
rank,
showEpisodes = true,
}: {
item: ShortDramaItem;
rank?: number;
showEpisodes?: boolean;
}) {
if (item.kind === "ad") {
return (
<a
href={item.href || "#h5-download"}
target={item.href ? "_blank" : undefined}
rel={item.href ? "sponsored nofollow noopener noreferrer" : undefined}
className={`block ${MEDIA_CARD_ROOT}`}
>
<div className="relative aspect-[7/4] overflow-hidden rounded-t-lg">
<DecryptedImage src={item.cover} fallback={IMG_PLACEHOLDER} alt="" className={MEDIA_CARD_COVER} />
<div className="absolute inset-0 bg-black/40" />
<img src="/logo.svg" alt="海角社区" className="absolute top-[17px] left-[13px] h-4 w-[71px]" />
</div>
<div className={`${MEDIA_CARD_INFO_H5} pb-1.5`}>
<h3 className={MEDIA_CARD_TITLE_H5}>{item.title}</h3>
<p className={`${MEDIA_CARD_DESC_SM} text-[#8C859C]`}>{item.subtitle}</p>
</div>
</a>
);
}
const detailHref = item.href || videoHref(item.id, item.slug);
return (
<article data-component="h5-video-card" className={MEDIA_CARD_ROOT}>
<Link href={detailHref} className="block">
<div className="relative aspect-[7/4] overflow-hidden rounded-t-lg">
<DecryptedImage src={item.cover} fallback={IMG_PLACEHOLDER} alt="" className={MEDIA_CARD_COVER} />
{item.badge ? (
<div className="absolute top-2 right-2">
<Badge tone={item.badge} className="h-6" />
</div>
) : null}
{showEpisodes && item.episodes ? (
<span
className={`absolute right-2 bottom-[3px] flex h-6 items-center rounded-lg bg-[#08060D]/88 px-1.5 text-white ${MEDIA_CARD_EPISODES_H5}`}
>
{item.episodes}
</span>
) : null}
</div>
<div className={MEDIA_CARD_INFO_H5}>
<h3 className={`flex items-center gap-1 ${MEDIA_CARD_TITLE_H5}`}>
<RankNumber rank={rank} className="text-sm leading-5" />
<span className="truncate">{item.title}</span>
</h3>
<p className={`${MEDIA_CARD_DESC_SM} text-[#8C859C]`}>{item.subtitle}</p>
</div>
</Link>
<div className={MEDIA_CARD_FOOTER_H5}>
<CardTags tags={item.tags} kind="video" className="min-w-0 text-[#A89EB5]" />
<span className="shrink-0 text-[#F12B9E]">{item.heat}</span>
</div>
</article>
);
}