,
+ reorderDisabled: true,
+ hiddenFromCustomColumnsSelection: true
+ },
+ {
+ id: 'name',
+ title: 'Product / Description',
+ render: (row: products.Product) => (
+
+
+ {row.name}
+
+
+ {row.description}
+
+
+ ),
+ width: 'auto',
+ reorderDisabled: true,
+ hideable: false
+ },
+ {
+ id: 'price',
+ title: 'Price',
+ render: (row: products.Product) => `$${row.priceData?.price}`,
+ width: '100px',
+ sortable: true,
+ },
+ {
+ id: 'type',
+ title: 'Type',
+ render: (row: products.Product) => {
+ if (!row.productType) {
+ return ''
+ }
+
+ return productTypeToDisplayName[row.productType] ?? row.productType
+ },
+ width: '100px',
+ },
+ {
+ id: 'last-updated',
+ title: 'Last Updated',
+ render: (row: products.Product) => row.lastUpdated,
+ width: '200px',
+ defaultHidden: true,
+ },
+ ]}
+ actionCell={(_product, _index, actionCellAPI) => ({
+ secondaryActions: [
+ deleteSecondaryAction({
+ optimisticActions,
+ actionCellAPI,
+ submit: (products: products.Product[]) => (
+ Promise.all(
+ products.map((product: products.Product) => deleteProduct(product._id!))
+ )
+ ),
+ successToast: {
+ message: `${_product.name} deleted successfully.`,
+ type: 'SUCCESS',
+ },
+ errorToast: () => 'Product deletion failed.',
+ }),
+ ]
}
- title="We couldn't load this page"
- // You likely didn't added required permissions or installed stores app in your site, please check the template documentation for more information.
- subtitle={"Looks like there was a technical issue"}
- >
- products.refetch()}
- prefixIcon={}
- >
- Try Again
-
-
- ) : (
-
-
-
-
-
-
-
- {productIdsToDelete.size > 0
- ? `${productIdsToDelete.size}/${products.data?.length} selected`
- : `${products.data?.length || 0} products`}
-
-
-
- {productIdsToDelete.size > 0 && (
-
-
- }
- onClick={() => deleteProducts.mutate()}
- >
- Delete
-
-
-
- )}
-
-
-
-
-
-
- )}
-
-
+ )}
+ />
+
+
);
}
diff --git a/custom-products-catalog/template/src/dashboard/svg/EmptyState_ServerError.svg b/custom-products-catalog/template/src/dashboard/svg/EmptyState_ServerError.svg
deleted file mode 100644
index ab26ffc..0000000
--- a/custom-products-catalog/template/src/dashboard/svg/EmptyState_ServerError.svg
+++ /dev/null
@@ -1,14 +0,0 @@
-
diff --git a/custom-products-catalog/template/src/dashboard/withProviders.tsx b/custom-products-catalog/template/src/dashboard/withProviders.tsx
index f585430..3e0de21 100644
--- a/custom-products-catalog/template/src/dashboard/withProviders.tsx
+++ b/custom-products-catalog/template/src/dashboard/withProviders.tsx
@@ -1,17 +1,15 @@
import React from 'react';
-import { QueryClientProvider, QueryClient } from '@tanstack/react-query';
import { WixDesignSystemProvider } from '@wix/design-system';
import { withDashboard } from '@wix/dashboard-react';
-
-const queryClient = new QueryClient();
+import { WixPatternsProvider } from '@wix/patterns/provider';
export function withProviders(Component: React.FC
) {
return withDashboard(function DashboardProviders(props: P) {
return (
-
-
+
+
-
+
);
});