'use client'; import DataTable, { DataTableColumn } from '@/components/table/DataTable'; import { DividendCalendarRow, DIVIDEND_SORT_LABEL, DIVIDEND_FIX_LABEL, DIVIDEND_SETTLE_LABEL } from '@/types/seibro'; import { codeLabel } from '@/lib/utils/market'; function buildColumns(): DataTableColumn[] { return [ { key: 'name', header: '종목명', align: 'left', priority: 'high', cellClassName: 'data-table__cell--name', cell: (row) => {row.name} }, { key: 'rgtStdDt', header: '권리기준일', align: 'center', priority: 'high', cell: (row) => row.rgtStdDt }, { key: 'xrgtDt', header: '권리락일', align: 'center', priority: 'medium', cell: (row) => row.xrgtDt ?? '—' }, { key: 'sortCode', header: '배당구분', align: 'center', priority: 'high', cell: (row) => {codeLabel(row.sortCode, DIVIDEND_SORT_LABEL)} }, { key: 'settleType', header: '결산', align: 'center', priority: 'low', cell: (row) => codeLabel(row.settleType, DIVIDEND_SETTLE_LABEL) }, { key: 'fixType', header: '확정', align: 'center', priority: 'low', cell: (row) => codeLabel(row.fixType, DIVIDEND_FIX_LABEL) } ]; } export default function DividendCalendarTable({ rows }: { rows: DividendCalendarRow[] }) { return ( caption='배당 캘린더 — 종목명, 권리기준일, 권리락일, 배당구분, 결산, 확정' columns={buildColumns()} rows={rows} rowKey={(row, index) => `${row.issucoCustno}-${row.rgtStdDt}-${row.sortCode}-${index}`} emptyMessage='표시할 배당 일정이 없습니다.' /> ); }