diff --git a/apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/products/page-client-product-lines-view.tsx b/apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/products/page-client-product-lines-view.tsx index f8231d210..2bb1e15d7 100644 --- a/apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/products/page-client-product-lines-view.tsx +++ b/apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/products/page-client-product-lines-view.tsx @@ -1155,7 +1155,8 @@ function productLineTypeKeyToString(key: ProductLineTypeKey): string { } function ProductLineView({ groupedProducts, groups, existingItems, onSaveProduct, onDeleteProduct, onCreateNewItem, onOpenProductDetails, onSaveProductWithGroup, onCreateProductLine, onUpdateProductLine, onDeleteProductLine, createDraftRequestId, draftCustomerType, onDraftHandled, paymentsConfig, onMoveProduct }: ProductLineViewProps) { - const projectId = useProjectId(); + const hexclaveAdminApp = useAdminApp(); + const projectId = hexclaveAdminApp.projectId; const [drafts, setDrafts] = useState>([]); const [creatingGroupKey, setCreatingGroupKey] = useState(undefined); const [newProductLineDisplayName, setNewProductLineDisplayName] = useState(""); @@ -1203,6 +1204,12 @@ function ProductLineView({ groupedProducts, groups, existingItems, onSaveProduct return new Set(all); }, [groupedProducts, drafts]); const lastHandledDraftRequestRef = useRef(undefined); + const getCreateProductHref = (productLineId: string | undefined, customerType: 'user' | 'team' | 'custom' | undefined) => { + if (productLineId == null || customerType == null) { + return urlString`/projects/${projectId}/payments/products/new`; + } + return urlString`/projects/${projectId}/payments/products/new?productLineId=${productLineId}&customerType=${customerType}`; + }; useEffect(() => { if (!createDraftRequestId) return; @@ -1478,7 +1485,7 @@ function ProductLineView({ groupedProducts, groups, existingItems, onSaveProduct ))} {/* Add product button */} - +