import { useState, useEffect } from "react"; import { X } from "lucide-react"; import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; interface Creative { id: string; name: string; thumbnail_url?: string | null; } interface CreativeSelectDialogProps { open: boolean; onOpenChange: (open: boolean) => void; creatives: Creative[]; onSelect: (creative: Creative) => void; onClear: (() => void) | null; currentCreativeId: string | null | undefined; } export function CreativeSelectDialog({ open, onOpenChange, creatives, onSelect, onClear, currentCreativeId, }: CreativeSelectDialogProps) { return ( Выберите креатив {creatives.length === 0 ? (
Нет доступных креативов
) : (
{creatives.map((creative) => (
{ onSelect(creative); onOpenChange(false); }} >
{creative.thumbnail_url ? ( {creative.name} ) : ( 📷 )}
{creative.name}
))}
)} {currentCreativeId && onClear && (
)}
); }