fp/services/next/app/components/vod-card.tsx

60 lines
2.2 KiB
TypeScript
Raw Normal View History

2024-01-20 16:16:14 +00:00
import Link from "next/link";
2024-07-10 22:11:18 +00:00
import { getSafeDate } from '@/app/lib/dates';
2024-07-15 16:07:04 +00:00
import { IVtuber } from '@futureporn/types';
2024-06-13 02:54:44 +00:00
import Image from "next/legacy/image"
2024-07-10 22:11:18 +00:00
import { LocalizedDate } from '@/app/components/localized-date'
2024-12-16 20:39:23 +00:00
import Skeleton from "react-loading-skeleton";
2024-01-20 16:16:14 +00:00
interface IVodCardProps {
id: number;
title: string;
date: string;
muxAsset: string | undefined;
thumbnail: string | undefined;
vtuber: IVtuber;
}
export default function VodCard({id, title, date, muxAsset, thumbnail = 'https://futureporn-b2.b-cdn.net/default-thumbnail.webp', vtuber}: IVodCardProps) {
2024-12-12 07:23:46 +00:00
if (!vtuber?.slug) return <div className="card mb-3 mr-5"><p>VOD {id} is missing VTuber.slug~</p></div>
2024-01-20 16:16:14 +00:00
return (
<div key={id} className="column is-full-mobile is-one-third-tablet is-one-fourth-desktop is-one-fifth-fullhd">
<div className="card">
2024-12-12 07:23:46 +00:00
<Link href={`/vt/${vtuber.slug}/vod/${getSafeDate(date)}`}>
2024-01-20 16:16:14 +00:00
<div className="card-image">
2024-12-16 20:39:23 +00:00
{thumbnail &&
<figure className="image is-16by9">
<Image
src={thumbnail}
alt={title}
placeholder="blur"
blurDataURL={vtuber?.image_blur || 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAABmJLR0QA/wD/AP+gvaeTAAAADUlEQVQImWOIUT7wHwAEXQI/2aBnMAAAAABJRU5ErkJggg=='}
layout="fill"
style={{
objectFit: 'cover',
}}
/>
</figure>
}
{!thumbnail && <p>missing thumbnail</p>}
2024-01-20 16:16:14 +00:00
</div>
<div className="card-content">
2024-12-12 07:23:46 +00:00
<p className="subtitle">{vtuber.display_name}</p>
2024-01-20 16:16:14 +00:00
<LocalizedDate date={new Date(date)} />
2024-03-29 07:28:02 +00:00
<p className="">{title}</p>
2024-01-20 16:16:14 +00:00
</div>
</Link>
</div>
</div>
)
}