Product-approved home UI cleanup (2026-11-02): - Blank home has no 「新对话」 title; conversations keep theirs. The chat header person control is a two-line chip (initial, full name + relation tag, then date time · city only). Points pill reads 「N 点」 with a coin in the action colour, 36px like its neighbours, label 「剩余 N 点,点开充值」. - The chart panel's person switcher (issue #150) is removed; the header chip is the only entry. Panel title stays. - 今日星语 leaves the UI: greeting sub-line, entry pill and its captions, binder, warm snapshot / prefetch / localStorage cache, checklist item and its signal. Loading copy no longer mentions it. The API route and the consultation's daily answers are untouched; starter-question signs come from the computed chart. - No model picker: chat and rectification composers lose it, client-side per-session model persistence is gone, ordinary turns ask for the admin default, and the consult route moves an older session onto the default (persisted, so billing reads the answering model). Synastry turns keep their session model. - Composer: one strong hairline + soft shadow, focus only recolours the border (input-group ring cancelled); AI notice centred under it. Tests that pinned removed UI are replaced with ones asserting the new behaviour (原值/新值/原因 comments). DESIGN.md, VOICE.md, CHANGELOG updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXoyeZrYn6ryNcSe5Y2Y
67 lines
5.1 KiB
TypeScript
67 lines
5.1 KiB
TypeScript
import assert from "node:assert/strict";
|
||
import { readFileSync } from "node:fs";
|
||
import test from "node:test";
|
||
|
||
const readProjectFile = (path: string) => readFileSync(new URL(`../${path}`, import.meta.url), "utf8");
|
||
const globalStyles = readProjectFile("src/app/globals.css");
|
||
const messageRowSource = readProjectFile("src/components/chat-message-row.tsx");
|
||
|
||
test("aligns the session transcript and composer to one readable column", () => {
|
||
assert.match(globalStyles, /--session-column-width:\s*760px/);
|
||
assert.match(globalStyles, /\.conversation:not\(\.is-empty\):not\(\.is-rectification\) \.message-list\s*\{[^}]*width:\s*min\(calc\(var\(--session-column-width\)/);
|
||
assert.match(globalStyles, /\.conversation:not\(\.is-empty\):not\(\.is-rectification\) \+ \.composer-wrap \.composer[^\{]*\{[^}]*width:\s*min\(var\(--session-column-width\),\s*100%\)/);
|
||
// 原值:`.composer-footer` 与 `.composer` 同宽 / 新值:只剩 `.composer`(上一条已断言)
|
||
// / 原因:常驻底栏已删,工具行移进输入框内部,不再有第二个需要对齐的盒子。
|
||
assert.doesNotMatch(globalStyles, /\.composer-footer\s*\{/);
|
||
});
|
||
|
||
test("keeps onboarding transcript and intake card on the same session column", () => {
|
||
const pageSource = readProjectFile("src/app/(app)/page.tsx");
|
||
assert.match(pageSource, /\$\{!profileComplete \? " is-onboarding" : ""\}/);
|
||
assert.match(globalStyles, /\.conversation\.is-onboarding \.welcome \{[\s\S]*width:\s*min\(calc\(var\(--session-column-width\) \+ \(var\(--session-column-gutter\) \* 2\)\), 100%\)/);
|
||
assert.match(globalStyles, /\.conversation\.is-onboarding\.is-empty \.welcome \{[\s\S]*width:\s*min\(var\(--session-column-width\), 100%\)/);
|
||
assert.match(globalStyles, /\.conversation\.is-onboarding \.onboarding-card,\s*\n\.conversation\.is-onboarding \.onboarding-card\.birth-time-transition-card \{[\s\S]*width:\s*100%;[\s\S]*max-width:\s*none/);
|
||
assert.match(globalStyles, /\.conversation\.is-onboarding-form \.welcome \{[\s\S]*padding:\s*var\(--space-6\) var\(--session-column-gutter\) var\(--space-8\)/);
|
||
});
|
||
|
||
test("centers the starter home even when the conversation grid is not is-empty", () => {
|
||
const pageSource = readProjectFile("src/app/(app)/page.tsx");
|
||
// 原值:空态 `.welcome` 与 `.starter-list` 都是 1040px
|
||
// 新值:`.welcome` 收到 `--session-column-width`,`.starter-list` 已删
|
||
// 原因:空态输入框此前 1040px、会话态 760px,首条消息落地时输入框会当场变窄一截。
|
||
// 现在两态同宽——这比原断言更强:它顺带锁住了「不跳宽度」。
|
||
assert.match(globalStyles, /\.welcome \{\s*width:\s*min\(var\(--session-column-width\), 100%\);\s*margin-inline:\s*auto;/);
|
||
assert.match(globalStyles, /\.composer-wrap-starter \.composer \{\s*width:\s*min\(var\(--session-column-width\), 100%\);/);
|
||
assert.doesNotMatch(globalStyles, /\.starter-list/);
|
||
assert.match(
|
||
pageSource,
|
||
/!onboardingFormActive && !activeSession\?\.messages\.length && \(Boolean\(activeSession\?\.messagesHydrated\) \|\| activeSession\?\.sessionType !== "consultation"\) \? " is-empty"/,
|
||
);
|
||
});
|
||
|
||
test("keeps message motion restrained and honors reduced-motion preferences", () => {
|
||
// 原值: gsap.matchMedia() / 新值: matchMedia("(prefers-reduced-motion: no-preference)")
|
||
// 原因: GSAP 换成 Motion 后仍只在用户允许动态效果时入场。时长、曲线、清属性不变。
|
||
assert.match(messageRowSource, /matchMedia\("\(prefers-reduced-motion: no-preference\)"\)/);
|
||
assert.match(messageRowSource, /prefers-reduced-motion:\s*no-preference/);
|
||
// Former value: `duration:\s*0\.18`. DESIGN.md §6 gives the message entrance 160ms; 0.18 was
|
||
// the GSAP copy drifting from the (now removed) 160ms CSS keyframe that ran alongside it.
|
||
assert.match(messageRowSource, /duration:\s*0\.16/);
|
||
assert.match(messageRowSource, /ease:\s*"cubic-bezier\(\.22,\s*1,\s*\.36,\s*1\)"/);
|
||
assert.match(messageRowSource, /clearProps:\s*"opacity,transform,visibility"/);
|
||
});
|
||
|
||
// 原值:「lets model controls fit their labels and keeps the stop action on-brand」——前半锁模型选择器按钮与弹层的宽度
|
||
// 新值:输入框没有模型选择器,`.model-selector-*` 样式一并删除;停止键的断言不变
|
||
// 原因:2026-11-02 首页界面整理第 4 条:用户不再选模型
|
||
test("the composer carries no model controls and keeps the stop action on-brand", () => {
|
||
assert.doesNotMatch(globalStyles, /\.model-selector-/);
|
||
// 原值 `var(--color-action)` / 新值 `var(--color-action-strong)` / 原因:停止键是填充面,
|
||
// 走品牌 coral 那一阶;文字阶留给 --color-action。见 BUG-738。
|
||
// 原值 `var(--color-action-strong)` + 悬停 `var(--color-action-hover)` / 新值
|
||
// `var(--color-action-fill)` + 悬停 `var(--color-action-fill-hover)` / 原因:BUG-1079
|
||
// 全站实心按钮统一一种底色(浅 #a9583e 4.85:1、深 #8f4a33 5.77:1),停止键与发送键同色。
|
||
assert.match(globalStyles, /\.composer \.composer-stop\s*\{[^}]*background:\s*var\(--color-action-fill\)/);
|
||
assert.match(globalStyles, /\.composer \.composer-stop:not\(:disabled\):hover\s*\{[^}]*background:\s*var\(--color-action-fill-hover\)/);
|
||
});
|