Fix sorting of order table, and keepOnline to thefront

This commit is contained in:
g
2025-02-09 01:43:24 +00:00
parent dc30150760
commit 7ec17cfd73
3 changed files with 32 additions and 6 deletions

View File

@@ -37,11 +37,11 @@ interface Order {
orderId: string;
status: string;
totalPrice: number;
createdAt: string;
orderDate: Date;
telegramUsername?: string;
}
type SortableColumns = "orderId" | "totalPrice" | "status" | "createdAt";
type SortableColumns = "orderId" | "totalPrice" | "status" | "orderDate";
interface StatusConfig {
icon: React.ElementType;
@@ -59,7 +59,7 @@ export default function OrderTable() {
const [sortConfig, setSortConfig] = useState<{
column: SortableColumns;
direction: "asc" | "desc";
}>({ column: "createdAt", direction: "desc" });
}>({ column: "orderDate", direction: "desc" });
const [selectedOrders, setSelectedOrders] = useState<Set<string>>(new Set());
const ITEMS_PER_PAGE = 10;
@@ -213,7 +213,7 @@ export default function OrderTable() {
<TableHead className="cursor-pointer" onClick={() => handleSort("status")}>
Status <ArrowUpDown className="ml-2 inline h-4 w-4" />
</TableHead>
<TableHead className="cursor-pointer" onClick={() => handleSort("createdAt")}>
<TableHead className="cursor-pointer" onClick={() => handleSort("orderDate")}>
Date <ArrowUpDown className="ml-2 inline h-4 w-4" />
</TableHead>
<TableHead>Buyer</TableHead>
@@ -255,7 +255,7 @@ export default function OrderTable() {
</div>
</TableCell>
<TableCell>
{new Date(order.createdAt).toLocaleDateString("en-GB")}
{new Date(order.orderDate).toLocaleDateString("en-GB")}
</TableCell>
<TableCell>
{order.telegramUsername ? `@${order.telegramUsername}` : "-"}