diff --git a/src/views/Dashboard/components/CalendarPanel.tsx b/src/views/Dashboard/components/CalendarPanel.tsx index 230dd4d2..947b940e 100644 --- a/src/views/Dashboard/components/CalendarPanel.tsx +++ b/src/views/Dashboard/components/CalendarPanel.tsx @@ -8,7 +8,6 @@ import { Box, Button, Badge, - IconButton, Flex, Modal, ModalOverlay, @@ -23,16 +22,12 @@ import { Text, Spinner, Center, - Tooltip, Icon, Tag, TagLabel, TagLeftIcon, } from '@chakra-ui/react'; import { - FiPlus, - FiEdit2, - FiTrash2, FiStar, FiTrendingUp, } from 'react-icons/fi'; @@ -45,10 +40,7 @@ import dayjs, { Dayjs } from 'dayjs'; import 'dayjs/locale/zh-cn'; import { usePlanningData } from './PlanningContext'; -import { EventFormModal } from './EventFormModal'; import type { InvestmentEvent } from '@/types'; -import { logger } from '@/utils/logger'; -import { getApiBase } from '@/utils/apiConfig'; dayjs.locale('zh-cn'); @@ -74,17 +66,13 @@ interface CalendarEvent { export const CalendarPanel: React.FC = () => { const { allEvents, - loadAllData, loading, - toast, borderColor, secondaryText, } = usePlanningData(); // 详情弹窗 const { isOpen, onOpen, onClose } = useDisclosure(); - // 添加弹窗状态 - const [isAddModalOpen, setIsAddModalOpen] = useState(false); const [selectedDate, setSelectedDate] = useState(null); const [selectedDateEvents, setSelectedDateEvents] = useState([]); @@ -129,61 +117,6 @@ export const CalendarPanel: React.FC = () => { onOpen(); }; - // 打开添加弹窗 - const handleOpenAddModal = (): void => { - onClose(); // 先关闭详情弹窗 - setIsAddModalOpen(true); - }; - - // 关闭添加弹窗 - const handleCloseAddModal = (): void => { - setIsAddModalOpen(false); - }; - - // 删除事件 - const handleDeleteEvent = async (eventId: number): Promise => { - if (!eventId) { - logger.warn('CalendarPanel', '删除事件失败: 缺少事件 ID', { eventId }); - toast({ - title: '无法删除', - description: '缺少事件 ID', - status: 'error', - duration: 3000, - }); - return; - } - try { - const base = getApiBase(); - - const response = await fetch(base + `/api/account/calendar/events/${eventId}`, { - method: 'DELETE', - credentials: 'include', - }); - - if (response.ok) { - logger.info('CalendarPanel', '删除事件成功', { eventId }); - toast({ - title: '删除成功', - status: 'success', - duration: 2000, - }); - loadAllData(); - } - } catch (error) { - logger.error('CalendarPanel', 'handleDeleteEvent', error, { eventId }); - toast({ - title: '删除失败', - status: 'error', - duration: 3000, - }); - } - }; - - // 查看事件详情(关闭弹窗) - const handleViewDetails = (): void => { - onClose(); - }; - return ( {loading ? ( @@ -228,17 +161,7 @@ export const CalendarPanel: React.FC = () => { {selectedDateEvents.length === 0 ? (
- - 当天没有事件 - - + 当天没有事件
) : ( @@ -273,30 +196,6 @@ export const CalendarPanel: React.FC = () => { )} - - {!event.source || event.source === 'user' ? ( - <> - - } - size="sm" - variant="ghost" - colorScheme="blue" - onClick={() => handleViewDetails()} - aria-label="查看详情" - /> - - } - size="sm" - variant="ghost" - colorScheme="red" - onClick={() => handleDeleteEvent(event.id)} - aria-label="删除事件" - /> - - ) : null} - {event.description && ( @@ -328,24 +227,6 @@ export const CalendarPanel: React.FC = () => { )} - {/* 使用通用弹窗组件 - 添加事件 */} -
); };