fix(Community): 优化搜索和时间筛选交互
- 搜索框添加清空按钮(allowClear) - 自定义时间范围限制不能超过当前时间(精确到分钟) - 相关概念移除"相关度"显示 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -493,6 +493,9 @@ const CompactSearchBox = ({
|
|||||||
}}
|
}}
|
||||||
style={{ flex: 1, minWidth: isMobile ? 100 : 200 }}
|
style={{ flex: 1, minWidth: isMobile ? 100 : 200 }}
|
||||||
className="gold-placeholder"
|
className="gold-placeholder"
|
||||||
|
allowClear={{
|
||||||
|
clearIcon: <CloseCircleOutlined style={{ color: PROFESSIONAL_COLORS.text.muted, fontSize: 14 }} />
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
prefix={<SearchOutlined style={{ color: PROFESSIONAL_COLORS.gold[500] }} />}
|
prefix={<SearchOutlined style={{ color: PROFESSIONAL_COLORS.gold[500] }} />}
|
||||||
|
|||||||
@@ -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 = (
|
const customRangeContent = (
|
||||||
<div style={{ padding: 8 }}>
|
<div style={{ padding: 8 }}>
|
||||||
@@ -350,10 +388,12 @@ const TradingTimeFilter = ({ value, onChange, compact = false, mobile = false })
|
|||||||
placeholder={['开始时间', '结束时间']}
|
placeholder={['开始时间', '结束时间']}
|
||||||
onChange={handleCustomRangeOk}
|
onChange={handleCustomRangeOk}
|
||||||
value={customRange}
|
value={customRange}
|
||||||
|
disabledDate={disabledDate}
|
||||||
|
disabledTime={disabledTime}
|
||||||
style={{ marginBottom: 8 }}
|
style={{ marginBottom: 8 }}
|
||||||
/>
|
/>
|
||||||
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>
|
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>
|
||||||
支持精确到分钟的时间范围选择
|
支持精确到分钟的时间范围选择(不能超过当前时间)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -86,15 +86,6 @@ const ConceptCard = ({ concept, tradingDate, onViewDetails }) => {
|
|||||||
{concept.concept}
|
{concept.concept}
|
||||||
</Text>
|
</Text>
|
||||||
<HStack spacing={2} flexWrap="wrap">
|
<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
|
<Badge
|
||||||
bg="rgba(20, 184, 166, 0.15)"
|
bg="rgba(20, 184, 166, 0.15)"
|
||||||
color="#14B8A6"
|
color="#14B8A6"
|
||||||
@@ -618,9 +609,6 @@ const RelatedConcepts = ({ eventTitle, eventTime, eventId, loading: externalLoad
|
|||||||
<VStack align="start" spacing={1}>
|
<VStack align="start" spacing={1}>
|
||||||
<Text fontSize="xl">{selectedConcept?.concept}</Text>
|
<Text fontSize="xl">{selectedConcept?.concept}</Text>
|
||||||
<HStack spacing={2}>
|
<HStack spacing={2}>
|
||||||
<Badge colorScheme="purple">
|
|
||||||
相关度: {selectedConcept?.score?.toFixed(2)}
|
|
||||||
</Badge>
|
|
||||||
<Badge colorScheme="teal">
|
<Badge colorScheme="teal">
|
||||||
{selectedConcept?.stock_count} 只股票
|
{selectedConcept?.stock_count} 只股票
|
||||||
</Badge>
|
</Badge>
|
||||||
|
|||||||
Reference in New Issue
Block a user