update ui
This commit is contained in:
@@ -21,6 +21,8 @@ const { Text } = Typography;
|
|||||||
* @param {Object} props.prefixStyle - 前缀标签的自定义样式(可选)
|
* @param {Object} props.prefixStyle - 前缀标签的自定义样式(可选)
|
||||||
* @param {boolean} props.showAIBadge - 是否显示右上角 AI 标识,默认 true(可选)
|
* @param {boolean} props.showAIBadge - 是否显示右上角 AI 标识,默认 true(可选)
|
||||||
* @param {Object} props.containerStyle - 容器额外样式(可选)
|
* @param {Object} props.containerStyle - 容器额外样式(可选)
|
||||||
|
* @param {string} props.textColor - 文本颜色,默认自动判断背景色(可选)
|
||||||
|
* @param {string} props.titleColor - 标题颜色,默认继承 textColor(可选)
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* <CitedContent
|
* <CitedContent
|
||||||
@@ -30,6 +32,7 @@ const { Text } = Typography;
|
|||||||
* prefixStyle={{ color: '#666' }}
|
* prefixStyle={{ color: '#666' }}
|
||||||
* showAIBadge={true}
|
* showAIBadge={true}
|
||||||
* containerStyle={{ marginTop: 16 }}
|
* containerStyle={{ marginTop: 16 }}
|
||||||
|
* textColor="#E2E8F0"
|
||||||
* />
|
* />
|
||||||
*/
|
*/
|
||||||
const CitedContent = ({
|
const CitedContent = ({
|
||||||
@@ -38,7 +41,9 @@ const CitedContent = ({
|
|||||||
prefix = '',
|
prefix = '',
|
||||||
prefixStyle = {},
|
prefixStyle = {},
|
||||||
showAIBadge = true,
|
showAIBadge = true,
|
||||||
containerStyle = {}
|
containerStyle = {},
|
||||||
|
textColor,
|
||||||
|
titleColor
|
||||||
}) => {
|
}) => {
|
||||||
// 处理数据
|
// 处理数据
|
||||||
const processed = processCitationData(data);
|
const processed = processCitationData(data);
|
||||||
@@ -52,6 +57,19 @@ const CitedContent = ({
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 自动判断文本颜色:如果容器背景是深色,使用浅色文本
|
||||||
|
const bgColor = containerStyle.backgroundColor;
|
||||||
|
const isDarkBg = bgColor && (
|
||||||
|
bgColor.includes('rgba(0,0,0') ||
|
||||||
|
bgColor.includes('rgba(0, 0, 0') ||
|
||||||
|
bgColor === 'transparent' ||
|
||||||
|
bgColor.includes('#1A202C') ||
|
||||||
|
bgColor.includes('#171923')
|
||||||
|
);
|
||||||
|
|
||||||
|
const finalTextColor = textColor || (isDarkBg ? '#E2E8F0' : '#262626');
|
||||||
|
const finalTitleColor = titleColor || finalTextColor;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
@@ -87,7 +105,7 @@ const CitedContent = ({
|
|||||||
{/* 标题栏 */}
|
{/* 标题栏 */}
|
||||||
{title && (
|
{title && (
|
||||||
<div style={{ marginBottom: 12, paddingRight: 80 }}>
|
<div style={{ marginBottom: 12, paddingRight: 80 }}>
|
||||||
<Text strong style={{ fontSize: 14 }}>
|
<Text strong style={{ fontSize: 14, color: finalTitleColor }}>
|
||||||
{title}
|
{title}
|
||||||
</Text>
|
</Text>
|
||||||
</div>
|
</div>
|
||||||
@@ -105,6 +123,7 @@ const CitedContent = ({
|
|||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
display: 'inline',
|
display: 'inline',
|
||||||
marginRight: 4,
|
marginRight: 4,
|
||||||
|
color: finalTextColor,
|
||||||
...prefixStyle
|
...prefixStyle
|
||||||
}}>
|
}}>
|
||||||
{prefix}
|
{prefix}
|
||||||
@@ -114,7 +133,7 @@ const CitedContent = ({
|
|||||||
{processed.segments.map((segment, index) => (
|
{processed.segments.map((segment, index) => (
|
||||||
<React.Fragment key={`segment-${segment.citationId}`}>
|
<React.Fragment key={`segment-${segment.citationId}`}>
|
||||||
{/* 文本片段 */}
|
{/* 文本片段 */}
|
||||||
<Text style={{ fontSize: 14, display: 'inline' }}>
|
<Text style={{ fontSize: 14, display: 'inline', color: finalTextColor }}>
|
||||||
{segment.text}
|
{segment.text}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
@@ -126,7 +145,7 @@ const CitedContent = ({
|
|||||||
|
|
||||||
{/* 在片段之间添加逗号分隔符(最后一个不加) */}
|
{/* 在片段之间添加逗号分隔符(最后一个不加) */}
|
||||||
{index < processed.segments.length - 1 && (
|
{index < processed.segments.length - 1 && (
|
||||||
<Text style={{ fontSize: 14, display: 'inline' }}>,</Text>
|
<Text style={{ fontSize: 14, display: 'inline', color: finalTextColor }}>,</Text>
|
||||||
)}
|
)}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -311,6 +311,7 @@ const StockListItem = ({
|
|||||||
data={stock.relation_desc}
|
data={stock.relation_desc}
|
||||||
title=""
|
title=""
|
||||||
showAIBadge={true}
|
showAIBadge={true}
|
||||||
|
textColor={PROFESSIONAL_COLORS.text.primary}
|
||||||
containerStyle={{
|
containerStyle={{
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: 'transparent',
|
||||||
borderRadius: '0',
|
borderRadius: '0',
|
||||||
|
|||||||
@@ -344,6 +344,7 @@ const HistoricalEvents = ({
|
|||||||
data={content}
|
data={content}
|
||||||
title=""
|
title=""
|
||||||
showAIBadge={true}
|
showAIBadge={true}
|
||||||
|
textColor={PROFESSIONAL_COLORS.text.primary}
|
||||||
containerStyle={{
|
containerStyle={{
|
||||||
backgroundColor: useColorModeValue('#f7fafc', 'rgba(45, 55, 72, 0.6)'),
|
backgroundColor: useColorModeValue('#f7fafc', 'rgba(45, 55, 72, 0.6)'),
|
||||||
borderRadius: '8px',
|
borderRadius: '8px',
|
||||||
|
|||||||
@@ -972,6 +972,7 @@ const TransmissionChainAnalysis = ({ eventId }) => {
|
|||||||
<CitedContent
|
<CitedContent
|
||||||
data={selectedNode.extra.description}
|
data={selectedNode.extra.description}
|
||||||
title=""
|
title=""
|
||||||
|
textColor={PROFESSIONAL_COLORS.text.primary}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
`${selectedNode.extra.description}(AI合成)`
|
`${selectedNode.extra.description}(AI合成)`
|
||||||
@@ -1081,7 +1082,8 @@ const TransmissionChainAnalysis = ({ eventId }) => {
|
|||||||
data={parent.transmission_mechanism}
|
data={parent.transmission_mechanism}
|
||||||
title=""
|
title=""
|
||||||
prefix="机制:"
|
prefix="机制:"
|
||||||
prefixStyle={{ fontSize: 12, color: '#666', fontWeight: 'bold' }}
|
prefixStyle={{ fontSize: 12, color: PROFESSIONAL_COLORS.text.secondary, fontWeight: 'bold' }}
|
||||||
|
textColor={PROFESSIONAL_COLORS.text.primary}
|
||||||
containerStyle={{ marginTop: 8 }}
|
containerStyle={{ marginTop: 8 }}
|
||||||
showAIBadge={false}
|
showAIBadge={false}
|
||||||
/>
|
/>
|
||||||
@@ -1136,7 +1138,8 @@ const TransmissionChainAnalysis = ({ eventId }) => {
|
|||||||
data={child.transmission_mechanism}
|
data={child.transmission_mechanism}
|
||||||
title=""
|
title=""
|
||||||
prefix="机制:"
|
prefix="机制:"
|
||||||
prefixStyle={{ fontSize: 12, color: '#666', fontWeight: 'bold' }}
|
prefixStyle={{ fontSize: 12, color: PROFESSIONAL_COLORS.text.secondary, fontWeight: 'bold' }}
|
||||||
|
textColor={PROFESSIONAL_COLORS.text.primary}
|
||||||
containerStyle={{ marginTop: 8 }}
|
containerStyle={{ marginTop: 8 }}
|
||||||
showAIBadge={false}
|
showAIBadge={false}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user