- env.ts: added 10 missing Zod-validated env vars (imager, paypal currency, argon2/bcrypt params) - Migrated 6 modules from process.env to validated env.* (auth, proxy-auth, paypal, password, redis, imager, moderation, alert, logger) - Replaced console.warn/error with pino logger in 9 server-side modules - Removed 50+ dead exports (SWF wrappers, coalesceHotelName, signIn, isStaff re-export, formatTimestamp, Skeleton/SkeletonCard, 4 unused housekeeping sections) - Consolidated date formatting: 28 files migrated to shared formatDate() from @/lib/format-date - Wired 4 radio/settings API routes through cached siteSettings service instead of raw Prisma queries - Added getMany()/getAll() helpers to SiteSettings service - Removed 88 dead Prisma model definitions (schema 2763→1846 lines) - Created admin action-helper.ts with wrapAction() for standardized error handling - Fixed useEffect dependency arrays in 4 data-heavy components - Replaced raw btn CSS classes with shadcn Button component across admin pages - Stripped dead i18n namespaces (common, pages.client) from all 22 translation files - Removed 2 dead scripts (create-release.sh, check-local-imports.ts) - Fixed knip.json configuration - Added 7 new test suites: format-date, paypal, moderation, alert, webhook, action-helper, and fixed password.test.ts for env mocking - All 358 tests passing across 72 test files - TypeScript: 0 errors
51 lines
1.2 KiB
TypeScript
51 lines
1.2 KiB
TypeScript
"use client";
|
|
|
|
import { useTranslations } from "next-intl";
|
|
import { DataTable } from "@/components/admin/data-table";
|
|
import { formatDate } from "@/lib/format-date";
|
|
import type { DataTableColumn, PaginatedResult } from "@/types";
|
|
|
|
interface ChatLogRow {
|
|
id: number;
|
|
username: string;
|
|
message: string;
|
|
timestamp: number;
|
|
roomId: number;
|
|
}
|
|
|
|
interface ChatTableProps {
|
|
data: PaginatedResult<ChatLogRow>;
|
|
}
|
|
|
|
export function ChatTable({ data }: ChatTableProps) {
|
|
const t = useTranslations("pages.admin.logs");
|
|
|
|
const columns: DataTableColumn<ChatLogRow>[] = [
|
|
{ key: "id", label: t("colId"), sortable: true },
|
|
{ key: "username", label: t("colUser") },
|
|
{
|
|
key: "message",
|
|
label: t("chat.colMessage"),
|
|
render: (value) => (
|
|
<span className="max-w-[300px] truncate block">{String(value)}</span>
|
|
),
|
|
},
|
|
{
|
|
key: "timestamp",
|
|
label: t("colTime"),
|
|
sortable: true,
|
|
render: (value) => <span>{formatDate(new Date(Number(value) * 1000))}</span>,
|
|
},
|
|
{ key: "roomId", label: t("chat.colRoomId"), sortable: true },
|
|
];
|
|
|
|
return (
|
|
<DataTable
|
|
data={data}
|
|
columns={columns}
|
|
searchPlaceholder={t("chat.searchPlaceholder")}
|
|
exportUrl="/api/admin/export?type=chatlogs"
|
|
/>
|
|
);
|
|
}
|