import type { CSSProperties } from "react"; import { LockKeyhole, Play } from "lucide-react"; import { CharacterAvatar } from "@/app/_components"; import type { PrivateZoneVideoPost } from "@/data/schemas/private-zone"; import styles from "../private-zone-screen.module.css"; export interface PrivateZoneVideoPostCardProps { post: PrivateZoneVideoPost; displayName: string; avatarUrl: string; index: number; isUnlocking: boolean; onUnlock: () => void; onPlaybackError: () => void; } export function PrivateZoneVideoPostCard({ post, displayName, avatarUrl, index, isUnlocking, onUnlock, onPlaybackError, }: PrivateZoneVideoPostCardProps) { return (

{displayName}

Private moment

{post.caption ?

{post.caption}

: null} {post.unlocked && post.videoUrl ? ( ) : (
{post.posterUrl ? ( // Signed private media URLs intentionally bypass Next image optimization. // eslint-disable-next-line @next/next/no-img-element Private video cover ) : (
)}
Private video {post.durationSeconds == null ? "Unlock to watch" : `${formatDuration(post.durationSeconds)} ยท Unlock to watch`}
)}
); } function formatDuration(seconds: number): string { const safe = Math.max(0, Math.round(seconds)); const minutes = Math.floor(safe / 60); const remainder = String(safe % 60).padStart(2, "0"); return `${minutes}:${remainder}`; } function formatMomentTime(value: string): string { const parsed = new Date(value); if (Number.isNaN(parsed.getTime())) return "Just now"; const seconds = Math.max(0, Math.floor((Date.now() - parsed.getTime()) / 1000)); if (seconds < 60) return "Just now"; if (seconds < 3600) return `${Math.floor(seconds / 60)}m`; if (seconds < 86400) return `${Math.floor(seconds / 3600)}h`; if (seconds < 604800) return `${Math.floor(seconds / 86400)}d`; return parsed.toLocaleDateString(undefined, { month: "short", day: "numeric" }); }