Fix review issues: clipboard error handling, merge conflicts, mutation error checks, and category ranking

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-04-20 17:20:48 +04:00
parent 09ddbb1f51
commit 6dc234bbe9
5 changed files with 30 additions and 14 deletions

View File

@@ -67,12 +67,14 @@ const createMutation = graphql`
interface CategoryDialogProps {
cookieBannerId: string;
connectionId: string;
nextRank: number;
onOpenChange: (open: boolean) => void;
}
export function CategoryDialog({
cookieBannerId,
connectionId,
nextRank,
onOpenChange,
}: CategoryDialogProps) {
const { __ } = useTranslate();
@@ -93,7 +95,7 @@ export function CategoryDialog({
name,
description,
required: false,
rank: 0,
rank: nextRank,
},
connections: [connectionId],
},

View File

@@ -195,6 +195,7 @@ export function CategoryList({ cookieBannerKey }: CategoryListProps) {
<CategoryDialog
cookieBannerId={banner.id}
connectionId={connectionId}
nextRank={sorted.length > 0 ? sorted[sorted.length - 1].rank + 1 : 0}
onOpenChange={setShowCreateDialog}
/>
)}

View File

@@ -123,7 +123,15 @@ export function CategorySection({ categoryKey }: CategorySectionProps) {
...input,
},
},
onCompleted() {
onCompleted(_response, errors) {
if (errors?.length) {
toast({
title: __("Error"),
description: errors[0].message,
variant: "error",
});
return;
}
toast({
title: __("Success"),
description: __("Category updated"),
@@ -169,6 +177,7 @@ export function CategorySection({ categoryKey }: CategorySectionProps) {
const handleSaveEditCookie = () => {
if (editingCookieIndex === null) return;
if (!cookieForm.name.trim()) return;
const newCookies = category.cookies.map((c, i) =>
i === editingCookieIndex
? { ...cookieForm }

View File

@@ -31,12 +31,22 @@ export function CodeSnippets() {
></script>`;
const handleCopy = () => {
void navigator.clipboard.writeText(code);
toast({
title: __("Copied"),
description: __("Code copied to clipboard"),
variant: "success",
});
navigator.clipboard.writeText(code).then(
() => {
toast({
title: __("Copied"),
description: __("Code copied to clipboard"),
variant: "success",
});
},
() => {
toast({
title: __("Error"),
description: __("Failed to copy to clipboard"),
variant: "error",
});
},
);
};
return (

View File

@@ -326,16 +326,10 @@ pages/organizations/vendors/
VendorsPageLoader.tsx # lazy entry — providers + Suspense + query loader
VendorsPage.tsx # page component (usePreloadedQuery)
VendorsPageSkeleton.tsx # loading fallback
<<<<<<< HEAD
VendorDetailPageLoader.tsx # lazy entry for detail view
VendorDetailPage.tsx # detail page component
VendorDetailPageSkeleton.tsx # detail loading fallback
=======
VendorDetailLayoutLoader.tsx # lazy entry for detail layout
VendorDetailLayout.tsx # layout — breadcrumbs, tabs, <Outlet />
VendorDetailLayoutSkeleton.tsx # detail loading fallback
NewVendorPage.tsx # mutation-only page — default export, wraps itself in the Relay provider
>>>>>>> 4dcc034f7 (Update contrib guides)
_components/ # sub-components used only by vendor pages
VendorContactRow.tsx
VendorRiskSummary.tsx