+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {error && (
+
+ {error}
+
+ )}
+
+ {isLoading ? (
+
+
+
+ ) : (
+
+
+
+
+ {captions.map((caption, idx) => {
+ const field = caption.toLowerCase();
+ const isSortable = ["title", "sku", "price"].includes(field);
+ return (
+ | handleSort(field) : undefined}
+ >
+ {caption}
+ {isSortable && sortField === field && (
+ {sortDirection === "asc" ? "↑" : "↓"}
+ )}
+ |
+ );
+ })}
+
+
+
+ {filteredProducts.length > 0 ? (
+ filteredProducts.map((row) => {
+ // console.log(row);
+ return (
+ handleViewProduct(row)}
+ onEdit={() => handleEditProduct(row)}
+ onDelete={() => handleDeleteClick(row)}
+ />
+ );
+ })
+ ) : (
+
+ |
+ No products found
+ |
+
+ )}
+
+
+
+ )}
+
+
+