fix(Community): 优化搜索和时间筛选交互

- 搜索框添加清空按钮(allowClear)
- 自定义时间范围限制不能超过当前时间(精确到分钟)
- 相关概念移除"相关度"显示

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
zdl
2025-12-15 16:09:16 +08:00
parent afe1180736
commit 9990d95e28
3 changed files with 44 additions and 13 deletions

View File

@@ -493,6 +493,9 @@ const CompactSearchBox = ({
}}
style={{ flex: 1, minWidth: isMobile ? 100 : 200 }}
className="gold-placeholder"
allowClear={{
clearIcon: <CloseCircleOutlined style={{ color: PROFESSIONAL_COLORS.text.muted, fontSize: 14 }} />
}}
>
<Input
prefix={<SearchOutlined style={{ color: PROFESSIONAL_COLORS.gold[500] }} />}

View File

@@ -340,6 +340,44 @@ const TradingTimeFilter = ({ value, onChange, compact = false, mobile = false })
}
};
// 禁用未来日期
const disabledDate = (current) => {
return current && current > dayjs().endOf('day');
};
// 禁用未来时间(精确到分钟)
const disabledTime = (current) => {
if (!current) return {};
const now = dayjs();
const isToday = current.isSame(now, 'day');
if (!isToday) return {};
const currentHour = now.hour();
const currentMinute = now.minute();
return {
disabledHours: () => {
const hours = [];
for (let i = currentHour + 1; i < 24; i++) {
hours.push(i);
}
return hours;
},
disabledMinutes: (selectedHour) => {
if (selectedHour === currentHour) {
const minutes = [];
for (let i = currentMinute + 1; i < 60; i++) {
minutes.push(i);
}
return minutes;
}
return [];
}
};
};
// "更多时间" 按钮内容
const customRangeContent = (
<div style={{ padding: 8 }}>
@@ -350,10 +388,12 @@ const TradingTimeFilter = ({ value, onChange, compact = false, mobile = false })
placeholder={['开始时间', '结束时间']}
onChange={handleCustomRangeOk}
value={customRange}
disabledDate={disabledDate}
disabledTime={disabledTime}
style={{ marginBottom: 8 }}
/>
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>
支持精确到分钟的时间范围选择
支持精确到分钟的时间范围选择不能超过当前时间
</div>
</div>
);

View File

@@ -86,15 +86,6 @@ const ConceptCard = ({ concept, tradingDate, onViewDetails }) => {
{concept.concept}
</Text>
<HStack spacing={2} flexWrap="wrap">
<Badge
bg="rgba(168, 85, 247, 0.15)"
color="#A855F7"
borderWidth="1px"
borderColor="#A855F7"
fontSize="xs"
>
相关度: {concept.score.toFixed(2)}
</Badge>
<Badge
bg="rgba(20, 184, 166, 0.15)"
color="#14B8A6"
@@ -618,9 +609,6 @@ const RelatedConcepts = ({ eventTitle, eventTime, eventId, loading: externalLoad
<VStack align="start" spacing={1}>
<Text fontSize="xl">{selectedConcept?.concept}</Text>
<HStack spacing={2}>
<Badge colorScheme="purple">
相关度: {selectedConcept?.score?.toFixed(2)}
</Badge>
<Badge colorScheme="teal">
{selectedConcept?.stock_count} 只股票
</Badge>