import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; export type BrandKitBundle = { type: "brand-kit-bundle"; spec: { name: string; tagline: string; primaryColor: string; secondaryColor: string; fontStyle: string; industry: string; }; logoSvgBase64: string; avatarPngs: Record; // "512"|"256"|"128"|"64"|"32" -> base64 socialImages: Record; // "twitter-profile" etc -> base64 signatureHtml: string; letterheadHtml: string; guidelinesPdfBase64: string; zipBase64: string; }; const AVATAR_SIZES = ["512", "256", "128", "64", "32"] as const; const SOCIAL_PLATFORM_LABELS: Record = { "twitter-profile": "Twitter/X Profile", "linkedin-profile": "LinkedIn Profile", "linkedin-banner": "LinkedIn Banner", "instagram-profile": "Instagram Profile", "facebook-cover": "Facebook Cover", }; interface BrandKitResultProps { bundle: BrandKitBundle; } export function BrandKitResult({ bundle }: BrandKitResultProps) { function downloadBlob(base64: string, mimeType: string, filename: string) { const bytes = Uint8Array.from(atob(base64), (c) => c.charCodeAt(0)); const blob = new Blob([bytes], { type: mimeType }); const url = URL.createObjectURL(blob); const a = document.createElement("a"); a.href = url; a.download = filename; a.click(); URL.revokeObjectURL(url); } function handleDownloadZip() { downloadBlob(bundle.zipBase64, "application/zip", `${bundle.spec.name || "brand-kit"}.zip`); } function handleDownloadGuidelines() { downloadBlob( bundle.guidelinesPdfBase64, "application/pdf", `${bundle.spec.name || "brand"}-guidelines.pdf`, ); } const socialEntries = Object.entries(bundle.socialImages); return (
{/* Brand spec summary */}
{bundle.spec.name} {bundle.spec.tagline && ( — {bundle.spec.tagline} )} {bundle.spec.industry} {bundle.spec.fontStyle}
{/* Logo */} Logo
{`${bundle.spec.name}
{/* Avatars */} Avatars
{AVATAR_SIZES.map((size) => { const pngBase64 = bundle.avatarPngs[size]; if (!pngBase64) return null; const px = Number(size); const displaySize = Math.min(px, 96); return (
{`${size}px {size}px
); })}
{/* Social images */} {socialEntries.length > 0 && ( Social Images
{socialEntries.map(([platform, pngBase64]) => (
{`${platform}
{SOCIAL_PLATFORM_LABELS[platform] ?? platform}
))}
)} {/* Templates */} Templates
Email Signature