community增加事件详情

This commit is contained in:
2026-01-07 12:15:31 +08:00
parent a68b8127e6
commit 9d9ac699b2

View File

@@ -306,12 +306,7 @@ const DetailModal = ({ isOpen, onClose, selectedDate, ztDetail, events, loading
const [detailDrawerVisible, setDetailDrawerVisible] = useState(false);
const [selectedContent, setSelectedContent] = useState(null);
if (!selectedDate) return null;
const dateStr = `${selectedDate.getFullYear()}${selectedDate.getMonth() + 1}${selectedDate.getDate()}`;
const isPastDate = selectedDate < new Date(new Date().setHours(0, 0, 0, 0));
// 板块数据处理
// 板块数据处理 - 必须在条件返回之前调用所有hooks
const sectorList = useMemo(() => {
if (!ztDetail?.sector_data) return [];
return Object.entries(ztDetail.sector_data)
@@ -323,6 +318,12 @@ const DetailModal = ({ isOpen, onClose, selectedDate, ztDetail, events, loading
.sort((a, b) => b.count - a.count);
}, [ztDetail]);
// 条件返回必须在所有hooks之后
if (!selectedDate) return null;
const dateStr = `${selectedDate.getFullYear()}${selectedDate.getMonth() + 1}${selectedDate.getDate()}`;
const isPastDate = selectedDate < new Date(new Date().setHours(0, 0, 0, 0));
// 渲染重要性星级
const renderStars = (star) => {
const stars = [];