feat: some fixes

This commit is contained in:
ivannoskov
2026-02-02 11:17:50 +03:00
parent f46a3265c6
commit 74ef1108e1
10 changed files with 945 additions and 262 deletions

View File

@@ -5,7 +5,7 @@
// ============================================================================
import { useEffect, useMemo, useState } from "react";
import { useParams, useRouter } from "next/navigation";
import { useParams, useRouter, useSearchParams } from "next/navigation";
import Link from "next/link";
import {
Loader2,
@@ -531,6 +531,7 @@ function ChannelGroup({
export default function PurchasePlanDetailPage() {
const params = useParams();
const router = useRouter();
const searchParams = useSearchParams();
const workspaceId = params?.workspaceId as string;
const projectId = params?.projectId as string;
const { projects, hasPermission } = useWorkspace();
@@ -543,6 +544,10 @@ export default function PurchasePlanDetailPage() {
const [saveError, setSaveError] = useState<string | null>(null);
const [editingCell, setEditingCell] = useState<EditingCell | null>(null);
// Create placements dialog
const prefilledCreativeId = searchParams.get("creative_id");
const [showCreateDialog, setShowCreateDialog] = useState(false);
const [searchQuery, setSearchQuery] = useState("");
const [statusFilter, setStatusFilter] = useState("all");
const [expandedAll, setExpandedAll] = useState(true);
@@ -574,6 +579,13 @@ export default function PurchasePlanDetailPage() {
}
}, [projects, projectId]);
// Auto-open create dialog if creative_id is provided
useEffect(() => {
if (prefilledCreativeId && project) {
setShowCreateDialog(true);
}
}, [prefilledCreativeId, project]);
useEffect(() => {
loadPlacements();
}, [workspaceId, projectId]);
@@ -913,6 +925,9 @@ export default function PurchasePlanDetailPage() {
workspaceId={workspaceId}
projectId={projectId}
existingPlacements={placements}
prefilledCreativeId={prefilledCreativeId}
open={showCreateDialog}
onOpenChange={setShowCreateDialog}
onSuccess={loadPlacements}
>
<Button disabled={isDemoMode}>