Commit 7e3a4f67 by luoqi

fix(persona-ui): 说明卡恢复「取值 + 短说明」两列结构

上一版为了"精简"把自明标签的 rules 清成空数组,结果卡片退化成三段平铺文字 ——
没有层次,也没有取值之间的对照,取值多的标签(权益身份 5 类、治疗史 4 类)尤其难读。

精简该精简的是 body 字数,不是砍结构。16 个标签统一回「加粗取值 + 一句短说明」:
客服先扫左边那列找到自己要的取值,再读右边一句。措辞仍是上一版改过的客服版,
口径订正(权益身份 5 类、转介绍达人门槛、急迫档位)都保留。

`rules[].label` 由可选改必填;CI 断言相应收紧:至少一条、每条都得有 label。

454 tests green · pac-web build 通过 · 本地逐个 hover 核对过。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
parent 5b72d147
......@@ -41,10 +41,16 @@ describe('PERSONA_FEATURE_SPECS ↔ FeatureRegistry', () => {
});
describe('spec.display —— 详情页说明', () => {
test('⭐ 每个标签都要有一句副标题(rules 可为空 —— 取值自明就别复述)', () => {
test('⭐ 副标题 + 至少一条取值条目,且每条都带加粗取值', () => {
// 结构即可读性:卡片靠「取值 → 说明」两列对照来扫。曾试过把自明的标签 rules 清空,
// 卡片退化成三段平铺文字,没有层次也无从对照 —— 要精简就精简 body,不是砍结构。
for (const [key, spec] of Object.entries(PERSONA_FEATURE_SPECS)) {
expect(spec.display?.subtitle?.length ?? 0).toBeGreaterThan(0);
for (const r of spec.display.rules ?? []) expect(r.body.length).toBeGreaterThan(0);
expect(spec.display?.rules?.length ?? 0).toBeGreaterThan(0);
for (const r of spec.display.rules) {
expect(`${key} 缺 label`).toBe(r.label ? `${key} 缺 label` : '');
expect(r.body.length).toBeGreaterThan(0);
}
expect(`${key}:${spec.display.subtitle}`).not.toContain('undefined');
}
});
......
......@@ -53,8 +53,9 @@ export function PersonaFeatureHover({
{display.rules.map((r, i) => (
<li key={i} className="flex gap-2">
<span className="flex-none text-slate-400">·</span>
{/* 两列对照:加粗取值 + 短说明。客服先扫左边找到自己要的那个取值,再读右边 */}
<span>
{r.label && <strong className="mr-1 text-slate-800">{r.label}</strong>}
<strong className="mr-1 text-slate-800">{r.label}</strong>
{r.body}
</span>
</li>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment