Improve admin ban UX, add product cloning, and enhance auth handling
Refines the admin ban page with better dialog state management and feedback during ban/unban actions. Adds a product cloning feature to the products dashboard and updates the product table to support cloning. Improves error handling in ChatDetail for authentication errors, and enhances middleware to handle auth check timeouts and network errors more gracefully. Also updates BanUserCard to validate user ID and ensure correct request formatting.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||
import { Edit, Trash, AlertTriangle, CheckCircle, AlertCircle, Calculator } from "lucide-react";
|
||||
import { Edit, Trash, AlertTriangle, CheckCircle, AlertCircle, Calculator, Copy } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Product } from "@/models/products";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
@@ -9,6 +9,7 @@ interface ProductTableProps {
|
||||
products: Product[];
|
||||
loading: boolean;
|
||||
onEdit: (product: Product) => void;
|
||||
onClone?: (product: Product) => void;
|
||||
onDelete: (productId: string) => void;
|
||||
onToggleEnabled: (productId: string, enabled: boolean) => void;
|
||||
onProfitAnalysis?: (productId: string, productName: string) => void;
|
||||
@@ -19,6 +20,7 @@ const ProductTable = ({
|
||||
products,
|
||||
loading,
|
||||
onEdit,
|
||||
onClone,
|
||||
onDelete,
|
||||
onToggleEnabled,
|
||||
onProfitAnalysis,
|
||||
@@ -109,7 +111,18 @@ const ProductTable = ({
|
||||
<Calculator className="h-4 w-4" />
|
||||
</Button>
|
||||
)}
|
||||
<Button variant="ghost" size="sm" onClick={() => onEdit(product)}>
|
||||
{onClone && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => onClone(product)}
|
||||
className="text-blue-600 hover:text-blue-700 hover:bg-blue-50 dark:hover:bg-blue-950/20"
|
||||
title="Clone Listing"
|
||||
>
|
||||
<Copy className="h-4 w-4" />
|
||||
</Button>
|
||||
)}
|
||||
<Button variant="ghost" size="sm" onClick={() => onEdit(product)} title="Edit Product">
|
||||
<Edit className="h-4 w-4" />
|
||||
</Button>
|
||||
<Button
|
||||
@@ -117,6 +130,7 @@ const ProductTable = ({
|
||||
size="sm"
|
||||
onClick={() => onDelete(product._id as string)}
|
||||
className="text-red-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-950/20"
|
||||
title="Delete Product"
|
||||
>
|
||||
<Trash className="h-4 w-4" />
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user