fix: placement send func

This commit is contained in:
ivannoskov
2026-02-02 21:49:57 +03:00
parent 233bdf7907
commit 6b16bfa6e2
2 changed files with 33 additions and 8 deletions

View File

@@ -29,6 +29,8 @@ import {
Trash2,
Copy,
Pencil,
Send,
Check,
} from "lucide-react";
import { DashboardHeader } from "@/components/layout/dashboard-header";
import { useWorkspace } from "@/components/providers/workspace-provider";
@@ -415,33 +417,35 @@ function CellRenderer({
<td key={column.id} className="py-2 px-3">
{hasCreative ? (
<div className="flex items-center gap-2">
<div className="w-8 h-8 rounded bg-muted flex items-center justify-center overflow-hidden">
<div className="w-8 h-8 rounded bg-muted flex items-center justify-center overflow-hidden shrink-0">
<span className="text-xs">📷</span>
</div>
<span className="text-xs truncate max-w-[100px]">{placement.creative_name || "Без названия"}</span>
<Button
variant="outline"
variant="ghost"
size="sm"
className="h-6 px-2 text-xs"
className="h-6 w-6 p-0 text-muted-foreground hover:text-primary"
title="Отправить креатив"
onClick={() => {
if (placement.creative_id) {
onOpenCreativeSend?.(placement);
}
}}
>
Отправить
<Send className="h-3.5 w-3.5" />
</Button>
<Button
variant="ghost"
size="sm"
className="h-6 px-1 text-xs text-muted-foreground hover:text-destructive"
className="h-6 w-6 p-0 text-muted-foreground hover:text-destructive"
title="Очистить креатив"
onClick={() => {
if (placement.creative_id) {
onClearCreative?.(placement.id);
}
}}
>
<X className="h-3.5 w-3.5" />
</Button>
</div>
) : (
@@ -1218,8 +1222,16 @@ export default function PurchasePlanDetailPage() {
handleDraftChange(placementId, { creative_id: null, creative_name: null });
};
const handleOpenCreativeSend = (placement: PlacementWithStats) => {
console.log("Sending creative for placement:", placement.id);
const handleOpenCreativeSend = async (placement: PlacementWithStats) => {
if (!placement.creative_id || isDemoMode) return;
try {
await placementsApi.sendCreative(workspaceId, projectId, placement.id);
alert("Креатив успешно отправлен");
} catch (err) {
console.error("Failed to send creative:", err);
alert("Не удалось отправить креатив");
}
};
const handleSelectCreative = (creative: { id: string; name: string }) => {