"use client"; import { useState } from "react"; import Image from "next/image"; import Link from "next/link"; import { ExternalLink, HandHeart } from "lucide-react"; import { getWinnerImpact, type LastYearWinner } from "@/content/last-year-winners"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; type Props = { company: LastYearWinner; className?: string; }; function externalLinkProps(href: string) { return href.startsWith("http") ? { target: "_blank" as const, rel: "noopener noreferrer" } : {}; } function FounderPhoto({ company }: { company: LastYearWinner }) { const [failed, setFailed] = useState(false); const src = company.founderImageSrc; if (src && !failed) { return ( setFailed(true)} /> ); } const initials = company.initials ?? (company.name ? company.name .split(/\s+/) .map((w) => w[0]) .join("") .slice(0, 2) .toUpperCase() : "GR"); return (
{initials}
); } export function LastYearWinnerTip({ company, className }: Props) { const impact = getWinnerImpact(company); const headline = impact.metrics.find((m) => m.highlight) ?? impact.metrics[0]; const supporting = impact.metrics.filter((m) => m !== headline).slice(0, 2); const name = company.name ?? "GRV Summit alumni"; const viewHref = impact.links.view ?? impact.links.website; const donateHref = impact.links.donate; return (

{name}

{company.founderName ? (

{company.founderName}

) : null}

{impact.summary}

{headline ? (

{headline.label}

{headline.value}

) : null} {supporting.length > 0 ? (
{supporting.map((m) => (
{m.label}
{m.value}
))}
) : null} {(viewHref || donateHref) && (
{viewHref ? ( ) : null} {donateHref ? ( ) : null}
)}
); }