'use client' /** * CustomerInterviewCard (pure presentation). Two densities — `default` * and `sm` (compact horizontal for chat-inline). * * The card writes NO click logic — callers wrap with their own anchor * and pass the resolved detail URL via `href`. */ import React from 'react' import { Card } from '../../ui/card' import { cn } from '../../../utils/cn' import { Video } from 'lucide-react' import type { CustomerInterview } from '../../../types/customer-interview' import { EntityPortraitCard } from './entity-portrait-card' import { useEntityCardLink } from './use-entity-card-link' import { useEntityCardPlaceholder } from './use-entity-card-placeholder' import { COMPACT_CARD_IMAGE_SLOT, COMPACT_CARD_META_ROW_BOX, COMPACT_CARD_OUTER, COMPACT_CARD_ROW_FILLER, COMPACT_CARD_SKELETON_IMAGE_SLOT, COMPACT_CARD_SKELETON_OUTER, COMPACT_CARD_SUBTITLE, COMPACT_CARD_SUMMARY, COMPACT_CARD_TEXT_COL, COMPACT_CARD_TITLE, COMPACT_CARD_TITLE_ROW, } from '../utils/compact-card-classes' import { hideOnError } from './use-cover-image-fallback' export interface CustomerInterviewCardProps { interview: CustomerInterview href: string /** When `_blank`, opens in a new tab. Set by chat dispatch via * `computeIsNewTab`. Defaults to same-tab. */ target?: '_blank' rel?: 'noopener noreferrer' targetPlatform?: string | null /** OG placeholder URL fallback when `interview.featured_image` is missing. */ placeholderUrl?: string | null size?: 'default' | 'sm' | 'portrait' /** Portrait density: render the content-type chip. Mixed rails only; single-type rails pass false. Default true. */ showTypeBadge?: boolean className?: string } /** `portrait` shares the default skeleton shape (same zone boxes). */ export function CustomerInterviewCardSkeleton({ size = 'default' }: { size?: 'default' | 'sm' | 'portrait' }) { if (size === 'sm') { return ( ) } return (
{/* Aspect matches the loaded image slot (OG 1200×630) */}
) } export function CustomerInterviewCard({ interview, href, target: targetProp, rel: relProp, targetPlatform, placeholderUrl: placeholderUrlProp, size = 'default', showTypeBadge = true, className, }: CustomerInterviewCardProps) { const { target, rel } = useEntityCardLink({ href, targetPlatform, target: targetProp, rel: relProp, }) const placeholderUrl = useEntityCardPlaceholder({ title: interview.title, placeholderUrl: placeholderUrlProp, aspect: size === 'sm' ? 'square' : 'wide', }) const thumbnailUrl = interview.featured_image || placeholderUrl || null if (size === 'sm') { return ( {thumbnailUrl ? ( {interview.title} ) : null} {interview.main_video_url ? ( ) : null} {interview.title} {[interview.user?.full_name, interview.msp?.name].filter(Boolean).join(' · ') || 'Customer interview'} {interview.video_summary || COMPACT_CARD_ROW_FILLER} ) } if (size === 'portrait') { // Rail/strip density — shared shell. return ( ) } return ( {/* Fixed aspect matching standard OG card source (1200×630, 1.91:1) — image renders with near-zero CSS-side crop, subject anchored consistently via center-66% safe-zone convention. */}
{thumbnailUrl ? ( <> {interview.title} {interview.main_video_url && (
)} ) : (
)}

{interview.title}

{interview.video_summary && (

{interview.video_summary}

)}
{interview.user?.avatar_url ? ( {interview.user?.full_name ) : (
{(interview.user?.full_name || 'A').charAt(0).toUpperCase()}
)} {interview.msp?.icon_url && (
{interview.msp.name
)}

{interview.user?.full_name || 'Anonymous'} {interview.msp?.name && • {interview.msp.name}}

{interview.user?.job_title || ' '}

) }