Improve admin UX: hub i18n, dynamic topbar, settings strings, staff logs DataTable.
Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
604e63da51
commit
1039044e48
11 files changed
+526
-305
No files matched your search
@@ -0,0 +1,56 @@
|
||||
"use client";
|
||||
|
||||
import { useTranslations } from "next-intl";
|
||||
import { DataTable } from "@/components/admin/data-table";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import type { DataTableColumn, PaginatedResult } from "@/types";
|
||||
|
||||
export interface StaffActivityRow {
|
||||
id: number;
|
||||
when: string;
|
||||
staff: string;
|
||||
action: string;
|
||||
description: string;
|
||||
target: string;
|
||||
ip: string;
|
||||
}
|
||||
|
||||
export function StaffActivitiesTable({
|
||||
data,
|
||||
}: {
|
||||
data: PaginatedResult<StaffActivityRow>;
|
||||
}) {
|
||||
const t = useTranslations("pages.admin.logs");
|
||||
|
||||
const columns: DataTableColumn<StaffActivityRow>[] = [
|
||||
{ key: "when", label: t("colWhen"), sortable: true },
|
||||
{ key: "staff", label: t("colStaff"), sortable: true },
|
||||
{
|
||||
key: "action",
|
||||
label: t("colAction"),
|
||||
sortable: true,
|
||||
render: (value) => (
|
||||
<Badge variant="secondary" className="font-mono text-[0.7rem]">
|
||||
{String(value)}
|
||||
</Badge>
|
||||
),
|
||||
},
|
||||
{ key: "description", label: t("colDescription") },
|
||||
{ key: "target", label: t("colTarget") },
|
||||
{ key: "ip", label: t("colIp") },
|
||||
];
|
||||
|
||||
return (
|
||||
<DataTable
|
||||
data={data}
|
||||
columns={columns}
|
||||
searchPlaceholder={t("searchPlaceholder")}
|
||||
presets={[
|
||||
{
|
||||
label: t("authorizationErrors"),
|
||||
params: { filter_authorization: "1" },
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user