import React, { useState } from 'react'; import { Link, useNavigate } from 'react-router-dom'; import { Clock, Users, FileText, User, Edit, Calendar , Trash2, MoreVertical } from 'lucide-react'; import TagDisplay from './TagDisplay'; import ConfirmDialog from './ConfirmDialog'; import Dropdown from './Dropdown'; import MarkdownRenderer from './MarkdownRenderer'; import tools from '../utils/tools'; import './MeetingTimeline.css'; const MeetingTimeline = ({ meetingsByDate, currentUser, onDeleteMeeting, hasMore = false, onLoadMore, loadingMore = false, filterType = 'all', searchQuery = '', selectedTags = [] }) => { const [deleteConfirmInfo, setDeleteConfirmInfo] = useState(null); const navigate = useNavigate(); const shouldShowMoreButton = (summary, maxLines = 3, maxLength = 100) => { if (!summary) return false; const lines = summary.split('\n'); return lines.length > maxLines || summary.length > maxLength; }; const handleEditClick = (meetingId) => { navigate(`/meetings/edit/${meetingId}`); }; const handleDeleteClick = (meeting) => { setDeleteConfirmInfo({ id: meeting.meeting_id, title: meeting.title }); }; const handleConfirmDelete = async () => { if (onDeleteMeeting && deleteConfirmInfo) { await onDeleteMeeting(deleteConfirmInfo.id); } setDeleteConfirmInfo(null); }; const sortedDates = Object.keys(meetingsByDate).sort((a, b) => new Date(b) - new Date(a)); if (sortedDates.length === 0) { return (

暂无会议记录

您还没有参与任何会议

); } return (
{sortedDates.map(date => (
{tools.formatDateLong(date)}
{meetingsByDate[date].map(meeting => { const isCreator = String(meeting.creator_id) === String(currentUser.user_id); const cardClass = isCreator ? 'created-by-me' : 'attended-by-me'; return (

{meeting.title} {meeting.tags && meeting.tags.length > 0 && ( tag.name)} size="small" maxDisplay={3} showIcon={true} className="inline-tags" /> )}

{isCreator && ( } items={[ { icon: , label: '编辑', onClick: () => handleEditClick(meeting.meeting_id) }, { icon: , label: '删除', onClick: () => handleDeleteClick(meeting), danger: true } ]} align="right" /> )}
{tools.formatTime(meeting.meeting_time)}
{meeting.attendees.length} 人参会
{meeting.attendees && meeting.attendees.length > 0 && (
参会人:
{meeting.attendees.map((attendee, idx) => ( {typeof attendee === 'string' ? attendee : attendee.caption} ))}
)} {meeting.summary && (
会议摘要
{shouldShowMoreButton(meeting.summary) && (
点击查看完整摘要
)}
)}
创建人: {meeting.creator_username}
); })}
))} {/* 加载更多/加载完毕 UI */}
{hasMore ? ( ) : ( sortedDates.length > 0 && (
已加载全部会议
) )}
{/* 删除会议确认对话框 */} setDeleteConfirmInfo(null)} onConfirm={handleConfirmDelete} title="删除会议" message={`确定要删除会议"${deleteConfirmInfo?.title}"吗?此操作无法撤销。`} confirmText="删除" cancelText="取消" type="danger" />
); }; export default MeetingTimeline;