From fd4909bba7be8abc1eeab9ae1b4621c66a61604a Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Sun, 23 Nov 2025 16:40:37 +0900 Subject: (김준회) 돌체 재개발 - 1차 (다운로드 오류 수정 필요) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/dolce/table/file-list-columns.tsx | 70 +++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 lib/dolce/table/file-list-columns.tsx (limited to 'lib/dolce/table/file-list-columns.tsx') diff --git a/lib/dolce/table/file-list-columns.tsx b/lib/dolce/table/file-list-columns.tsx new file mode 100644 index 00000000..f703d56d --- /dev/null +++ b/lib/dolce/table/file-list-columns.tsx @@ -0,0 +1,70 @@ +"use client"; + +import { ColumnDef } from "@tanstack/react-table"; +import { FileInfoItem } from "../actions"; +import { Button } from "@/components/ui/button"; +import { Download } from "lucide-react"; + +interface FileListColumnsProps { + onDownload: (file: FileInfoItem) => void; +} + +export const createFileListColumns = ({ + onDownload, +}: FileListColumnsProps): ColumnDef[] => [ + { + accessorKey: "FileSeq", + header: "순번", + minSize: 80, + cell: ({ row }) => { + return
{row.getValue("FileSeq")}
; + }, + }, + { + accessorKey: "FileName", + header: "파일명", + minSize: 300, + cell: ({ row }) => { + return
{row.getValue("FileName")}
; + }, + }, + { + accessorKey: "FileSize", + header: "파일크기", + minSize: 100, + cell: ({ row }) => { + const size = parseInt(row.getValue("FileSize") as string); + if (isNaN(size) || size === 0) return "-"; + + if (size < 1024) return `${size} B`; + if (size < 1024 * 1024) return `${(size / 1024).toFixed(2)} KB`; + return `${(size / (1024 * 1024)).toFixed(2)} MB`; + }, + }, + { + accessorKey: "CreateDt", + header: "생성일시", + minSize: 200, + cell: ({ row }) => { + return
{row.getValue("CreateDt")}
; + }, + }, + { + id: "actions", + header: "다운로드", + minSize: 120, + cell: ({ row }) => { + return ( + + ); + }, + }, +]; + -- cgit v1.2.3