bid-tool/auto-bid-admin/src/components/bid/show-histories-api/allbids-histories-view.tsx

72 lines
1.7 KiB
TypeScript

/* eslint-disable @typescript-eslint/no-unused-vars */
import Table from "../../../lib/table/table";
import { IColumn } from "../../../lib/table/type";
import { formatTime } from "../../../utils";
export interface IGraysHistoriesViewProps {
histories: Record<string, string>[];
}
export default function AllbidsHistoriesView({
histories,
}: IGraysHistoriesViewProps) {
type BidHistoryEntry = {
row_id: number;
date: string; // ISO datetime string
amount: number; // Số tiền đặt giá
proxyamount: number; // Giá proxy tối đa
bidQty: number; // Số lượng
flashBuy: boolean; // Mua ngay
proxyBid: boolean; // Có phải đấu giá tự động
instantBid: boolean; // Đặt giá ngay
userName: string; // Tên người dùng
bidBidderID: number; // ID người đặt giá
$$hashKey?: string; // Khóa nội bộ Angular (không cần thiết, có thể bỏ hoặc để optional)
};
const columns: IColumn<BidHistoryEntry>[] = [
{
title: "Username",
key: "userName",
},
{
title: "Amount",
key: "amount",
},
{
title: "Proxy amount",
key: "proxyamount",
},
{
title: "Bid Qty",
key: "bidQty",
},
{
title: "Bid at",
key: "date",
renderRow(row) {
return <span>{formatTime(row.date)}</span>;
},
},
];
return (
<Table
striped
highlightOnHover
withTableBorder
withColumnBorders
styleDefaultHead={{
justifyContent: "flex-start",
width: "fit-content",
}}
showFilter={false}
showActions={false}
showChooses={false}
columns={columns}
rowKey="row_id"
rows={histories as unknown as BidHistoryEntry[]}
/>
);
}