style(web): translate the comments in the src/views directory into English

This commit is contained in:
zhaoying
2026-02-04 10:27:27 +08:00
parent 9e195ea63b
commit 7e650d86a5
24 changed files with 115 additions and 995 deletions

View File

@@ -134,11 +134,10 @@ const EmotionTags: FC = () => {
<div ref={chartRef} className="rb:mt-6 rb:px-6" style={{ height: '320px', width: '100%' }} />
<div className="rb:flex rb:flex-wrap rb:items-center rb:justify-center rb:gap-10 rb:text-sm rb:mt-3 rb:p-3 rb:bg-[#F0F3F8] rb:rounded-[0_0_8px_8px]">
{Object.entries(emotionStats).map(([type, count]) => {
console.log(type)
return (
<div key={type} className="rb:flex rb:items-center rb:gap-2">
<div className="rb:w-3 rb:h-3 rb:rounded-full" style={{ backgroundColor: getEmotionColor(type) }}></div>
<span className="rb:leading-5">{t(`statementDetail.${type || 'neutral'}`)} ({count})</span>
<span className="rb:leading-5">{t(`statementDetail.${type || 'neutral'}`)} ({count}{t('statementDetail.item')})</span>
</div>
)
})}

View File

@@ -69,7 +69,7 @@ const NodeStatistics: FC = () => {
getNodeStatistics(id).then((res) => {
const response = res as NodeStatisticsItem[]
setData(response)
// 计算count总计
// Calculate total count
const totalCount = response.reduce((sum, item) => sum + (item.count || 0), 0)
setTotal(totalCount)
setLoading(false)

View File

@@ -51,19 +51,19 @@ const RelationshipNetwork:FC = () => {
const curEdges: Edge[] = []
const curNodeTypes = Object.keys(statistics.node_types).filter(vo => vo !== 'Dialogue')
// 计算每个节点的连接数
// Calculate connection count for each node
const connectionCount: Record<string, number> = {}
edges.forEach(edge => {
connectionCount[edge.source] = (connectionCount[edge.source] || 0) + 1
connectionCount[edge.target] = (connectionCount[edge.target] || 0) + 1
})
// 处理节点数据
// Process node data
nodes.filter(vo => vo.label !== 'Dialogue').forEach(node => {
const connections = connectionCount[node.id] || 0
const categoryIndex = curNodeTypes.indexOf(node.label)
// 根据节点类型获取显示名称
// Get display name based on node type
let displayName = ''
switch (node.label) {
// case 'Statement':
@@ -93,16 +93,16 @@ const RelationshipNetwork:FC = () => {
...node,
name: displayName,
category: categoryIndex >= 0 ? categoryIndex : 0,
symbolSize: symbolSize, // 根据连接数调整节点大小
symbolSize: symbolSize, // Adjust node size based on connection count
})
})
// 创建节点ID到标签的映射
// Create mapping from node ID to label
const nodeIdToLabel: Record<string, string> = {}
nodes.forEach(node => {
nodeIdToLabel[node.id] = node.label
})
// 处理边数据
// Process edge data
edges.forEach(edge => {
curEdges.push({
...edge,
@@ -112,7 +112,7 @@ const RelationshipNetwork:FC = () => {
})
})
// 设置分类
// Set categories
const curCategories = curNodeTypes.map(type => ({ name: type }))
setNodes(curNodes)
@@ -160,7 +160,7 @@ const RelationshipNetwork:FC = () => {
return (
<Row gutter={16}>
{/* 关系网络 */}
{/* Relationship Network */}
<Col span={16}>
<RbCard
title={t('userMemory.relationshipNetwork')}
@@ -211,22 +211,22 @@ const RelationshipNetwork:FC = () => {
},
force: {
repulsion: 100,
// 启用类别聚合
// Enable category aggregation
edgeLength: 80,
gravity: 0.3,
// 同类别的节点相互吸引
// Nodes of the same category attract each other
layoutAnimation: true,
// 防止点击时重新计算布局
// Prevent layout recalculation on click
preventOverlap: true,
// 点击节点后保持布局稳定
// Keep layout stable after node click
edgeSymbol: ['none', 'arrow'],
edgeSymbolSize: [4, 10],
// 初始布局完成后关闭力导向
// Disable force-directed after initial layout
initLayout: 'force'
},
selectedMode: 'single',
draggable: true,
// 防止数据更新时重新计算布局
// Prevent layout recalculation on data update
animationDurationUpdate: 0,
select: {
itemStyle: {
@@ -242,12 +242,12 @@ const RelationshipNetwork:FC = () => {
notMerge={false}
lazyUpdate={true}
onEvents={{
// 节点点击事件处理
// Node click event handler
click: (params: { dataType: string; data: Node; name: string }) => {
if (params.dataType === 'node') {
// 处理节点点击事件
// Handle node click event
console.log('Node clicked:', params.data);
// 使用函数式更新避免状态依赖问题
// Use functional update to avoid state dependency issues
setSelectedNode(params.data)
}
}
@@ -257,7 +257,7 @@ const RelationshipNetwork:FC = () => {
</div>
</RbCard>
</Col>
{/* 记忆详情 */}
{/* Memory Details */}
<Col span={8}>
<RbCard
title={t('userMemory.memoryDetails')}

View File

@@ -79,7 +79,7 @@ const WordCloud: FC = () => {
const radarOption = useMemo(() => {
if (!wordCloud?.tags.length) return {}
// avg_intensity转换为1-100范围
// Convert avg_intensity to 1-100 range
const radarData = wordCloud.tags.map(item => ({
name: item.emotion_type,
value: Math.round(item.avg_intensity * 100),