style: clean up code with prettier and eslint
This commit is contained in:
1 parent
60278b9e71
commit
fb8e77bb68
378 files changed
+22407
-20689
No files matched your search
@@ -1,45 +1,44 @@
|
||||
'use client'
|
||||
"use client";
|
||||
|
||||
import { DataTable } from '@/components/admin/data-table'
|
||||
import { Badge } from '@/components/ui/badge'
|
||||
import { formatTimestamp } from '@/lib/admin-helpers'
|
||||
import type { DataTableColumn, PaginatedResult } from '@/types'
|
||||
import { DataTable } from "@/components/admin/data-table";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { formatTimestamp } from "@/lib/admin-helpers";
|
||||
import type { DataTableColumn, PaginatedResult } from "@/types";
|
||||
|
||||
interface TradeLogRow {
|
||||
id: number
|
||||
userOneName: string
|
||||
userTwoName: string
|
||||
status: string
|
||||
timestamp: number
|
||||
id: number;
|
||||
userOneName: string;
|
||||
userTwoName: string;
|
||||
status: string;
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
const columns: DataTableColumn<TradeLogRow>[] = [
|
||||
{ key: 'id', label: 'ID', sortable: true },
|
||||
{ key: 'userOneName', label: 'User One' },
|
||||
{ key: 'userTwoName', label: 'User Two' },
|
||||
{ key: "id", label: "ID", sortable: true },
|
||||
{ key: "userOneName", label: "User One" },
|
||||
{ key: "userTwoName", label: "User Two" },
|
||||
{
|
||||
key: 'status',
|
||||
label: 'Status',
|
||||
key: "status",
|
||||
label: "Status",
|
||||
sortable: true,
|
||||
render: (value) => {
|
||||
const v = String(value)
|
||||
const variant =
|
||||
v === 'completed' ? 'default' : v === 'cancelled' ? 'destructive' : 'secondary'
|
||||
return <Badge variant={variant}>{v || 'unknown'}</Badge>
|
||||
const v = String(value);
|
||||
const variant = v === "completed" ? "default" : v === "cancelled" ? "destructive" : "secondary";
|
||||
return <Badge variant={variant}>{v || "unknown"}</Badge>;
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'timestamp',
|
||||
label: 'Time',
|
||||
key: "timestamp",
|
||||
label: "Time",
|
||||
sortable: true,
|
||||
render: (value) => <span>{formatTimestamp(Number(value))}</span>,
|
||||
},
|
||||
]
|
||||
];
|
||||
|
||||
interface TradesTableProps {
|
||||
data: PaginatedResult<TradeLogRow>
|
||||
data: PaginatedResult<TradeLogRow>;
|
||||
}
|
||||
|
||||
export function TradesTable({ data }: TradesTableProps) {
|
||||
return <DataTable data={data} columns={columns} searchPlaceholder="Search by username..." />
|
||||
return <DataTable data={data} columns={columns} searchPlaceholder="Search by username..." />;
|
||||
}
|
||||
Reference in new issue
Block a user