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 { formatTimestamp } from "@/lib/admin-helpers";
|
||||
import type { DataTableColumn, PaginatedResult } from "@/types";
|
||||
@@ -12,37 +13,39 @@ interface CommandLogRow {
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
const columns: DataTableColumn<CommandLogRow>[] = [
|
||||
{ key: "id", label: "ID", sortable: true },
|
||||
{ key: "username", label: "User" },
|
||||
{ key: "command", label: "Command", sortable: true },
|
||||
{
|
||||
key: "params",
|
||||
label: "Params",
|
||||
render: (value) => (
|
||||
<span className="max-w-[200px] truncate block font-mono text-sm">
|
||||
{String(value) || "-"}
|
||||
</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: "timestamp",
|
||||
label: "Time",
|
||||
sortable: true,
|
||||
render: (value) => <span>{formatTimestamp(Number(value))}</span>,
|
||||
},
|
||||
];
|
||||
|
||||
interface CommandsTableProps {
|
||||
data: PaginatedResult<CommandLogRow>;
|
||||
}
|
||||
|
||||
export function CommandsTable({ data }: CommandsTableProps) {
|
||||
const t = useTranslations("pages.admin.logs");
|
||||
|
||||
const columns: DataTableColumn<CommandLogRow>[] = [
|
||||
{ key: "id", label: t("colId"), sortable: true },
|
||||
{ key: "username", label: t("colUser") },
|
||||
{ key: "command", label: t("commands.colCommand"), sortable: true },
|
||||
{
|
||||
key: "params",
|
||||
label: t("commands.colParams"),
|
||||
render: (value) => (
|
||||
<span className="max-w-[200px] truncate block font-mono text-sm">
|
||||
{String(value) || t("emptyValue")}
|
||||
</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: "timestamp",
|
||||
label: t("colTime"),
|
||||
sortable: true,
|
||||
render: (value) => <span>{formatTimestamp(Number(value))}</span>,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<DataTable
|
||||
data={data}
|
||||
columns={columns}
|
||||
searchPlaceholder="Search by username, command, or params..."
|
||||
searchPlaceholder={t("commands.searchPlaceholder")}
|
||||
exportUrl="/api/admin/export?type=commands"
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user