From e9f707b10b81d9759243473dd03fa463573d0772 Mon Sep 17 00:00:00 2001
From: 0-Zz-ang <s1998319@gmail.com>
Date: Fri, 26 Sep 2025 16:45:59 +0900
Subject: (박서영)이메일발신인조회페이지 생성
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/email-log/table/email-log-table.tsx | 65 +++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 lib/email-log/table/email-log-table.tsx

(limited to 'lib/email-log/table/email-log-table.tsx')

diff --git a/lib/email-log/table/email-log-table.tsx b/lib/email-log/table/email-log-table.tsx
new file mode 100644
index 00000000..db627af5
--- /dev/null
+++ b/lib/email-log/table/email-log-table.tsx
@@ -0,0 +1,65 @@
+"use client"
+
+import * as React from "react"
+import type {
+  DataTableAdvancedFilterField,
+  DataTableFilterField,
+} from "@/types/table"
+
+import { useDataTable } from "@/hooks/use-data-table"
+import { DataTable } from "@/components/data-table/data-table"
+import { DataTableAdvancedToolbar } from "@/components/data-table/data-table-advanced-toolbar"
+import { getColumns } from "./email-log-table-columns"
+import { getEmailLogList } from "../service"
+import { type InferSelectModel } from "drizzle-orm"
+import { emailLogs } from "@/db/schema/emailLogs"
+
+interface EmailLogTableProps {
+  promises: Promise<[
+    Awaited<ReturnType<typeof getEmailLogList>>,
+  ]>
+}
+
+export function EmailLogTable({ promises }: EmailLogTableProps) {
+  const [{ data, pageCount }] = React.use(promises)
+
+  type EmailLog = InferSelectModel<typeof emailLogs>
+
+  const columns = React.useMemo(() => getColumns<EmailLog>(), [])
+
+  const filterFields: DataTableFilterField<EmailLog>[] = []
+
+  const advancedFilterFields: DataTableAdvancedFilterField<EmailLog>[] = [
+    { id: "from", label: "From", type: "text" },
+    { id: "to", label: "To", type: "text" },
+    { id: "subject", label: "Subject", type: "text" },
+    { id: "createdAt", label: "발송시간", type: "date" },
+  ]
+
+  const { table } = useDataTable({
+    data,
+    columns,
+    pageCount,
+    filterFields,
+    enablePinning: true,
+    enableAdvancedFilter: true,
+    initialState: {
+      sorting: [{ id: "createdAt", desc: true }],
+    },
+    getRowId: (row) => String(row.id),
+    shallow: false,
+    clearOnDefault: true,
+  })
+
+  return (
+    <DataTable table={table}>
+      <DataTableAdvancedToolbar
+        table={table}
+        filterFields={advancedFilterFields}
+        shallow={false}
+      />
+    </DataTable>
+  )
+}
+
+
-- 
cgit v1.2.3

