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:
@@ -67,12 +67,14 @@ const createMutation = graphql`
|
|||||||
interface CategoryDialogProps {
|
interface CategoryDialogProps {
|
||||||
cookieBannerId: string;
|
cookieBannerId: string;
|
||||||
connectionId: string;
|
connectionId: string;
|
||||||
|
nextRank: number;
|
||||||
onOpenChange: (open: boolean) => void;
|
onOpenChange: (open: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function CategoryDialog({
|
export function CategoryDialog({
|
||||||
cookieBannerId,
|
cookieBannerId,
|
||||||
connectionId,
|
connectionId,
|
||||||
|
nextRank,
|
||||||
onOpenChange,
|
onOpenChange,
|
||||||
}: CategoryDialogProps) {
|
}: CategoryDialogProps) {
|
||||||
const { __ } = useTranslate();
|
const { __ } = useTranslate();
|
||||||
@@ -93,7 +95,7 @@ export function CategoryDialog({
|
|||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
required: false,
|
required: false,
|
||||||
rank: 0,
|
rank: nextRank,
|
||||||
},
|
},
|
||||||
connections: [connectionId],
|
connections: [connectionId],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -195,6 +195,7 @@ export function CategoryList({ cookieBannerKey }: CategoryListProps) {
|
|||||||
<CategoryDialog
|
<CategoryDialog
|
||||||
cookieBannerId={banner.id}
|
cookieBannerId={banner.id}
|
||||||
connectionId={connectionId}
|
connectionId={connectionId}
|
||||||
|
nextRank={sorted.length > 0 ? sorted[sorted.length - 1].rank + 1 : 0}
|
||||||
onOpenChange={setShowCreateDialog}
|
onOpenChange={setShowCreateDialog}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -123,7 +123,15 @@ export function CategorySection({ categoryKey }: CategorySectionProps) {
|
|||||||
...input,
|
...input,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
onCompleted() {
|
onCompleted(_response, errors) {
|
||||||
|
if (errors?.length) {
|
||||||
|
toast({
|
||||||
|
title: __("Error"),
|
||||||
|
description: errors[0].message,
|
||||||
|
variant: "error",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
toast({
|
toast({
|
||||||
title: __("Success"),
|
title: __("Success"),
|
||||||
description: __("Category updated"),
|
description: __("Category updated"),
|
||||||
@@ -169,6 +177,7 @@ export function CategorySection({ categoryKey }: CategorySectionProps) {
|
|||||||
|
|
||||||
const handleSaveEditCookie = () => {
|
const handleSaveEditCookie = () => {
|
||||||
if (editingCookieIndex === null) return;
|
if (editingCookieIndex === null) return;
|
||||||
|
if (!cookieForm.name.trim()) return;
|
||||||
const newCookies = category.cookies.map((c, i) =>
|
const newCookies = category.cookies.map((c, i) =>
|
||||||
i === editingCookieIndex
|
i === editingCookieIndex
|
||||||
? { ...cookieForm }
|
? { ...cookieForm }
|
||||||
|
|||||||
@@ -31,12 +31,22 @@ export function CodeSnippets() {
|
|||||||
></script>`;
|
></script>`;
|
||||||
|
|
||||||
const handleCopy = () => {
|
const handleCopy = () => {
|
||||||
void navigator.clipboard.writeText(code);
|
navigator.clipboard.writeText(code).then(
|
||||||
toast({
|
() => {
|
||||||
title: __("Copied"),
|
toast({
|
||||||
description: __("Code copied to clipboard"),
|
title: __("Copied"),
|
||||||
variant: "success",
|
description: __("Code copied to clipboard"),
|
||||||
});
|
variant: "success",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
toast({
|
||||||
|
title: __("Error"),
|
||||||
|
description: __("Failed to copy to clipboard"),
|
||||||
|
variant: "error",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -326,16 +326,10 @@ pages/organizations/vendors/
|
|||||||
VendorsPageLoader.tsx # lazy entry — providers + Suspense + query loader
|
VendorsPageLoader.tsx # lazy entry — providers + Suspense + query loader
|
||||||
VendorsPage.tsx # page component (usePreloadedQuery)
|
VendorsPage.tsx # page component (usePreloadedQuery)
|
||||||
VendorsPageSkeleton.tsx # loading fallback
|
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
|
VendorDetailLayoutLoader.tsx # lazy entry for detail layout
|
||||||
VendorDetailLayout.tsx # layout — breadcrumbs, tabs, <Outlet />
|
VendorDetailLayout.tsx # layout — breadcrumbs, tabs, <Outlet />
|
||||||
VendorDetailLayoutSkeleton.tsx # detail loading fallback
|
VendorDetailLayoutSkeleton.tsx # detail loading fallback
|
||||||
NewVendorPage.tsx # mutation-only page — default export, wraps itself in the Relay provider
|
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
|
_components/ # sub-components used only by vendor pages
|
||||||
VendorContactRow.tsx
|
VendorContactRow.tsx
|
||||||
VendorRiskSummary.tsx
|
VendorRiskSummary.tsx
|
||||||
|
|||||||
Reference in New Issue
Block a user