i18n observability hub: analytics pages and log tables.
Translate analytics overview/activity/economy plus peak-hours/revenue charts, and audit/chat/commands/trades DataTables (en/nl/it). Includes prior events/polls detail i18n. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
a25008deb5
commit
bcbdca841b
13 files changed
+576
-211
No files matched your search
@@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useTranslations } from "next-intl";
|
||||
import { DataTable } from "@/components/admin/data-table";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { formatTimestamp } from "@/lib/admin-helpers";
|
||||
@@ -13,43 +14,47 @@ interface TradeLogRow {
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
const columns: DataTableColumn<TradeLogRow>[] = [
|
||||
{ key: "id", label: "ID", sortable: true },
|
||||
{ key: "userOneName", label: "User One" },
|
||||
{ key: "userTwoName", label: "User Two" },
|
||||
{
|
||||
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>;
|
||||
},
|
||||
},
|
||||
{
|
||||
key: "timestamp",
|
||||
label: "Time",
|
||||
sortable: true,
|
||||
render: (value) => <span>{formatTimestamp(Number(value))}</span>,
|
||||
},
|
||||
];
|
||||
|
||||
interface TradesTableProps {
|
||||
data: PaginatedResult<TradeLogRow>;
|
||||
}
|
||||
|
||||
export function TradesTable({ data }: TradesTableProps) {
|
||||
const t = useTranslations("pages.admin.logs");
|
||||
|
||||
const columns: DataTableColumn<TradeLogRow>[] = [
|
||||
{ key: "id", label: t("colId"), sortable: true },
|
||||
{ key: "userOneName", label: t("trades.colUserOne") },
|
||||
{ key: "userTwoName", label: t("trades.colUserTwo") },
|
||||
{
|
||||
key: "status",
|
||||
label: t("trades.colStatus"),
|
||||
sortable: true,
|
||||
render: (value) => {
|
||||
const v = String(value);
|
||||
const variant =
|
||||
v === "completed"
|
||||
? "default"
|
||||
: v === "cancelled"
|
||||
? "destructive"
|
||||
: "secondary";
|
||||
return (
|
||||
<Badge variant={variant}>{v || t("trades.statusUnknown")}</Badge>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
key: "timestamp",
|
||||
label: t("colTime"),
|
||||
sortable: true,
|
||||
render: (value) => <span>{formatTimestamp(Number(value))}</span>,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<DataTable
|
||||
data={data}
|
||||
columns={columns}
|
||||
searchPlaceholder="Search by username..."
|
||||
searchPlaceholder={t("trades.searchPlaceholder")}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user