import type { FC } from 'react'; import { useNavigate } from 'react-router'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faArrowLeft, faArrowUpRightFromSquare } from '@fortawesome/pro-duotone-svg-icons'; const ArrowLeft: FC<{ className?: string }> = ({ className }) => ; const LinkExternal01: FC<{ className?: string }> = ({ className }) => ; import { Button } from '@/components/base/buttons/button'; import { CampaignStatusBadge } from '@/components/shared/status-badge'; import type { Campaign } from '@/types/entities'; interface CampaignHeroProps { campaign: Campaign; } const formatDateRange = (startDate: string | null, endDate: string | null): string => { const fmt = (d: string) => new Intl.DateTimeFormat('en-IN', { month: 'short', day: 'numeric', year: 'numeric' }).format(new Date(d)); if (!startDate) return '--'; if (!endDate) return `${fmt(startDate)} \u2014 Ongoing`; return `${fmt(startDate)} \u2014 ${fmt(endDate)}`; }; const formatDuration = (startDate: string | null, endDate: string | null): string => { if (!startDate) return '--'; const start = new Date(startDate); const end = endDate ? new Date(endDate) : new Date(); const diffDays = Math.ceil((end.getTime() - start.getTime()) / (1000 * 60 * 60 * 24)); return `${diffDays} days`; }; export const CampaignHero = ({ campaign }: CampaignHeroProps) => { const navigate = useNavigate(); return (
{/* Back button */} {/* Title row */}

{campaign.campaignName ?? 'Untitled Campaign'}

{campaign.externalCampaignId ?? campaign.id.slice(0, 12)} · {formatDateRange(campaign.startDate, campaign.endDate)}
{/* Badges */}
{campaign.platform && ( {campaign.platform} )} {campaign.campaignType && ( {campaign.campaignType.replace(/_/g, ' ')} )} {campaign.campaignStatus && } {formatDuration(campaign.startDate, campaign.endDate)}
{/* Actions */}
{campaign.platformUrl && ( )}
); };