diff --git a/app/dashboard/[workspaceId]/placements/[placementId]/page.tsx b/app/dashboard/[workspaceId]/placements/[placementId]/page.tsx
index 30c91ca..ac25c47 100644
--- a/app/dashboard/[workspaceId]/placements/[placementId]/page.tsx
+++ b/app/dashboard/[workspaceId]/placements/[placementId]/page.tsx
@@ -19,7 +19,7 @@ import {
} from "lucide-react";
import { DashboardHeader } from "@/components/layout/dashboard-header";
import { useWorkspace } from "@/components/providers/workspace-provider";
-import { placementsApi } from "@/lib/api";
+import { placementsApi, projectsApi } from "@/lib/api";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import {
@@ -94,13 +94,35 @@ export default function PlacementDetailPage() {
const loadPlacement = async () => {
try {
setLoading(true);
- // First, try to load placement without project_id (deprecated endpoint)
- // If that fails, we'd need projectId
- const data = await placementsApi.get(workspaceId, placementId);
- setPlacement(data);
- // Store projectId from placement for future operations
- if (data.project?.id) {
- setProjectId(data.project.id);
+
+ // First, get all projects to find which project this placement belongs to
+ const projectsResponse = await projectsApi.list(workspaceId, { size: 100 });
+ const projects = projectsResponse.items;
+
+ // Search for the placement in all projects
+ let foundProjectId: string | null = null;
+ let foundPlacement: any = null;
+
+ for (const project of projects) {
+ try {
+ const placements = await placementsApi.getByProject(workspaceId, project.id);
+ const placement = placements.find((p) => p.id === placementId);
+ if (placement) {
+ foundProjectId = project.id;
+ foundPlacement = placement;
+ break;
+ }
+ } catch (e) {
+ // Skip if can't get placements for this project
+ continue;
+ }
+ }
+
+ if (foundPlacement) {
+ setPlacement(foundPlacement);
+ setProjectId(foundProjectId);
+ } else {
+ console.error("Placement not found in any project");
}
} catch (err) {
console.error("Failed to load placement:", err);
diff --git a/app/dashboard/[workspaceId]/purchase-plans/[projectId]/page.tsx b/app/dashboard/[workspaceId]/purchase-plans/[projectId]/page.tsx
index 724d931..588b563 100644
--- a/app/dashboard/[workspaceId]/purchase-plans/[projectId]/page.tsx
+++ b/app/dashboard/[workspaceId]/purchase-plans/[projectId]/page.tsx
@@ -216,6 +216,7 @@ interface ChannelGroupProps {
onOpenCreativeSelect?: (placement: PlacementWithStats) => void;
onClearCreative?: (placementId: string) => void;
onOpenCreativeSend?: (placement: PlacementWithStats) => void;
+ onAddPlacement?: (channel: Placement["channel"]) => void;
}
// ============================================================================
@@ -412,22 +413,22 @@ function CellRenderer({
);
case "creative":
- const hasCreative = !!placement.creative_id;
+ const viewCreativeId = placement.creative_id;
+ const hasCreative = !!viewCreativeId;
return (
{hasCreative ? (
-
-
- 📷
+
+
+ {placement.creative_name || "Без названия"}
- {placement.creative_name || "Без названия"}
|