diff --git a/frontend/src/renderer/components/FileItem.jsx b/frontend/src/renderer/components/FileItem.jsx new file mode 100644 index 0000000..571bef4 --- /dev/null +++ b/frontend/src/renderer/components/FileItem.jsx @@ -0,0 +1,58 @@ +import React from 'react'; +import { FileOutlined, FolderOutlined, FilePdfOutlined, FileImageOutlined, FileWordOutlined, FileExcelOutlined } from '@ant-design/icons'; + +const getFileIcon = (filename) => { + const ext = filename.split('.').pop().toLowerCase(); + const iconMap = { + pdf: , + jpg: , + jpeg: , + png: , + gif: , + doc: , + docx: , + xls: , + xlsx: , + }; + return iconMap[ext] || ; +}; + +function FileItem({ file, onClick, onSelect }) { + const isFolder = file.is_folder; + + return ( +
onClick?.(file)} + style={{ + display: 'flex', + alignItems: 'center', + padding: '12px', + borderBottom: '1px solid #f0f0f0', + cursor: 'pointer', + background: '#fff' + }} + > + { + e.stopPropagation(); + onSelect?.(file); + }} + style={{ marginRight: '8px' }} + > + + + + {isFolder ? : getFileIcon(file.name)} + + {file.name} + + {file.size ? `${(file.size / 1024 / 1024).toFixed(2)} MB` : '-'} + + + {file.updated_at ? new Date(file.updated_at).toLocaleDateString() : '-'} + +
+ ); +} + +export default FileItem;