fix(monitor): 通知进入/移出配色对齐 A 股红涨绿跌惯例

原配色: 进入=绿(emerald)/移出=黄(warning)+列表里移出=红, 语义反直觉。
调整为 进入=红(text-danger)/移出=绿(text-bear), 与买入/卖出、涨跌幅
配色语义一致 (红=正向, 绿=负向)。

- strategyMonitorEvents.ts META: 事件动作短语配色中心定义, 弹窗/监控页/
  看板/语音播报四处共用, 一处修改全局生效
- AlertToast.tsx SOURCE_BADGE: 弹窗顶部"进入/移出"角标同步换色
- Monitor.tsx renderMessage: 正则补"进入"分支 (原只匹配 新入选|移出,
  实际通知文案是"策略「X」进入选股结果…", 进入消息从未着色) + 换色

验证: tsc 通过; 实测监控中心页面 getComputedStyle — 进入选股结果
rgb(242,76,64)/红, 移出选股结果 rgb(38,192,120)/绿。
This commit is contained in:
shy3130
2026-08-17 13:19:18 +08:00
parent 41e99b6974
commit 867698a696
3 changed files with 11 additions and 11 deletions
+4 -4
View File
@@ -89,12 +89,12 @@ const SOURCE_BADGE: Record<string, { label: string; cls: string }> = {
price: { label: '价格', cls: 'bg-emerald-400/15 text-emerald-400' },
market: { label: '异动', cls: 'bg-purple-500/15 text-purple-400' },
sector: { label: '板块', cls: 'bg-cyan-500/15 text-cyan-700 dark:text-cyan-300' },
pool_entry: { label: '进入', cls: 'bg-emerald-400/15 text-emerald-400' },
pool_exit: { label: '移出', cls: 'bg-warning/15 text-warning' },
pool_entry: { label: '进入', cls: 'bg-danger/15 text-danger' },
pool_exit: { label: '移出', cls: 'bg-bear/15 text-bear' },
buy_signal: { label: '买入', cls: 'bg-danger/15 text-danger' },
sell_signal: { label: '卖出', cls: 'bg-bear/15 text-bear' },
new_entry: { label: '进入', cls: 'bg-emerald-400/15 text-emerald-400' },
dropped: { label: '移出', cls: 'bg-warning/15 text-warning' },
new_entry: { label: '进入', cls: 'bg-danger/15 text-danger' },
dropped: { label: '移出', cls: 'bg-bear/15 text-bear' },
}
// ===== 容器 — 挂在 Layout =====
+4 -4
View File
@@ -20,22 +20,22 @@ const META: Record<string, StrategyEventMeta> = {
pool_entry: {
label: '进入',
action: '进入选股结果',
className: 'text-emerald-400',
className: 'text-danger',
},
pool_exit: {
label: '移出',
action: '移出选股结果',
className: 'text-warning',
className: 'text-bear',
},
new_entry: {
label: '进入',
action: '进入选股结果',
className: 'text-emerald-400',
className: 'text-danger',
},
dropped: {
label: '移出',
action: '移出选股结果',
className: 'text-warning',
className: 'text-bear',
},
}
+3 -3
View File
@@ -39,13 +39,13 @@ const SOURCE_BADGE_STYLE: Record<string, string> = {
}
/**
* 渲染策略类消息 — 策略名黄色、新入选绿、移出红、其余白色。
* 渲染策略类消息 — 策略名黄色、进入红/移出绿 (A 股红涨绿跌惯例)、其余白色。
*/
function renderMessage(source: string, message: string) {
if (source !== 'strategy') {
return <span className="text-secondary">{message}</span>
}
const m = message.match(/^(策略「)([^」]+)(」)(新入选|移出)( .*)$/)
const m = message.match(/^(策略「)([^」]+)(」)(新入选|进入|移出)( .*)$/)
if (!m) return <span className="text-foreground">{message}</span>
const [, pre, strategyName, mid, direction, post] = m
return (
@@ -53,7 +53,7 @@ function renderMessage(source: string, message: string) {
<span className="text-foreground/80">{pre}</span>
<span className="text-amber-400 font-medium">{strategyName}</span>
<span className="text-foreground/80">{mid}</span>
<span className={direction === '新入选' ? 'text-emerald-400 font-medium' : 'text-danger font-medium'}>{direction}</span>
<span className={direction === '移出' ? 'text-bear font-medium' : 'text-danger font-medium'}>{direction}</span>
<span className="text-foreground/80">{post}</span>
</>
)