feat(home): newcomer home opens on the three questions with the chart folded; the first-chart animation has a real skip button (BUG-2200, BUG-2201)

Owner approved the v2 screenshots on 2026-11-22: no separate expand row;
the existing top-right toggle opens the chart (own storage key), phones use
the existing bottom sheet, and the normal layout returns after the first
question. The old skip hint was aria-hidden, non-focusable 13px text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
This commit is contained in:
2026-11-22 18:50:02 +08:00
co-authored by Claude Opus 5.5
parent 29168812e5
commit 65f0e3da53
13 changed files with 296 additions and 24 deletions
+26
View File
@@ -29682,3 +29682,29 @@
- 防复发:同一测试固定文字和标签。
- 关联记录:复用现有组件规则。
- 修复版本:`claude/acceptance-fixes-d`。
## BUG-2200 | 首次排盘后的星空动画只有一行不可聚焦的小字「点一下跳过」,着急看结果的人以为还在计算
- 状态:fixed-pending-verify。
- 首次发现 / 最近更新:2026-11-22 / 2026-11-22。
- 现象:负责人 2026-11-22 的 AI 验收(staging 1b2af85ba):首次排完盘的星空动画覆盖刚生成的结果,右下角「点一下跳过」很小。
- 触发条件:新用户首次排盘后的动画(电脑和手机)。
- 根因:BUG-2144 的「点一下跳过」是 aria-hidden、不可聚焦的 13px 文字,键盘和读屏用户都无法跳过,视觉上也不像按钮。
- 修复:换成可聚焦的按钮「跳过,查看星盘」(现有按钮样式),键盘可达,点击即结束动画显示星盘。负责人看过截图后同意。
- 验证:`frontend/tests/newcomer-2200-2201.test.tsx`;截图 /workspace/eval-read-1116/newcomer-2200/desktop-1*、phone-1(本地构建 + 模拟数据)。
- 防复发:同上测试。
- 关联记录:BUG-2144。
- 修复版本:`claude/newcomer-2200`。
## BUG-2201 | 新手首页同时铺开完整星盘和提问,第一次进来不知道先看哪个
- 状态:fixed-pending-verify。
- 首次发现 / 最近更新:2026-11-22 / 2026-11-22。
- 现象:AI 验收:桌面首页左侧导航、中间输入、右侧完整星盘同时出现,`Bhava`、`D9`、`罗睺` 等进阶内容在入门阶段就出现。
- 触发条件:还没发出第一问的新用户首页(电脑和手机)。
- 根因:#114 起星盘面板默认展开,对所有用户一样。
- 修复:新手首页标题「从这三个问题开始」;星盘面板默认收起(`chat-chart-frame.tsx` 的 `useStarterChartFold`,layout effect,避免先闪出展开状态),用右上角原有按钮开合,桌面记在单独的键 `starter_chart_details_open`,不动 `chat_chart_panel_open`;手机同一按钮打开原有底部面板;发出第一问后恢复现有布局和已存状态。负责人看 v1 截图后要求去掉「展开星盘详情」那一行,v2 截图同意。
- 验证:`frontend/tests/newcomer-2200-2201.test.tsx`;截图 /workspace/eval-read-1116/newcomer-2200/*-v2.png(本地构建 + 模拟数据)。
- 防复发:同上测试。
- 关联记录:#114、BUG-1431、BUG-2050、BUG-2144。
- 修复版本:`claude/newcomer-2200`。
+6 -2
View File
@@ -19,7 +19,7 @@ import { toggleChatMessageFeedback } from "@/components/chat-message-actions";
import type { ChatTranscriptActions } from "@/components/chat-transcript";
import { ChatStreamingTranscript, useStreamingReplyHasText } from "@/components/chat-streaming-transcript";
import { ChatProfilePicker } from "@/components/chat-profile-picker";
import { ChatChartFrame, ChatChartToggle } from "@/components/chat-chart-frame";
import { ChatChartFrame, ChatChartToggle, useStarterChartFold } from "@/components/chat-chart-frame";
import { usePageCurtain } from "@/hooks/use-page-curtain";
import { readStoredChatChartOpen } from "@/lib/chat-chart-panel-state";
import { preloadChatChartPanel } from "@/lib/chat-chart-preload";
@@ -570,6 +570,10 @@ export default function Home() {
&& !activeSession.messagesHydrated
&& pendingSessionId !== activeSession.id,
);
// BUG-2201: the free first question is unused: the three starters lead and the natal panel is folded.
const newcomerHome = starterHomeVisible && account?.firstConsultFree === true
&& (currentSubjectId === "self" ? selfChartComplete(profile) : Boolean(dailyProfile && selfChartComplete(dailyProfile)));
useStarterChartFold(newcomerHome);
// BUG-2144: every onboarding screen, the name included, is a card; the composer waits until the chart is made.
const onboardingFormActive = !synastryChat && subjectCatalogReady && !profileComplete;
const starterHasPriorSessions = sessions.some((session) => session.id !== activeSession?.id);
@@ -1062,7 +1066,7 @@ export default function Home() {
</div>
{!onboardingFormActive && <div className={`composer-wrap ${starterHomeVisible ? "composer-wrap-starter" : ""}`}>
{starterHomeVisible && account?.firstConsultFree === true && (currentSubjectId === "self" ? selfChartComplete(profile) : Boolean(dailyProfile && selfChartComplete(dailyProfile))) ? (
{newcomerHome ? (
<StarterQuestions
audience={currentSubjectId !== "self" && dailyProfile
? { kind: "other", name: dailyProfile.name.trim() || "TA", relationLabel: personRelationLabel(dailyProfile.relation) }
+2
View File
@@ -612,6 +612,8 @@ button:disabled:where(:not([data-slot="button"])) { cursor: default; opacity: .4
/* BUG-2144: the first question sits right above the composer, as wide as its
column, three equal cards in a row (stacked at 640px and below). */
.starter-questions { display: grid; justify-items: center; gap: 8px; width: min(var(--session-column-width), 100%); margin: 0 auto var(--space-3); }
/* BUG-2201: the newcomer home is headed by 「从这三个问题开始」 (display serif, the onboarding card heading's size). */
.starter-questions-title { margin: 0 0 var(--space-1); color: var(--color-ink); font-family: var(--font-display); font-size: var(--type-title-md); font-weight: 500; letter-spacing: -.3px; line-height: 1.3; text-align: center; }
.starter-questions-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
.starter-questions-list .starter-question { width: 100%; height: auto; min-height: 56px; padding: 10px 12px; border: 1px solid transparent; border-radius: var(--radius-lg); background: var(--color-canvas-soft); box-shadow: none; color: var(--color-ink-secondary); white-space: normal; align-items: flex-start; justify-content: flex-start; text-align: left; font-size: var(--type-body-sm); font-weight: 400; line-height: 1.45; }
/* Owner 2026-11-22: no outline on the starter cards; a soft fill, the selected fill on hover. */
@@ -1,5 +1,5 @@
/* First-chart convergence (TASK-birth-sky-followup-20260928 F4). Loaded with
the lazy overlay chunk only. Full screen, no buttons; opacity is driven
the lazy overlay chunk only. Full screen; opacity is driven
frame by frame from requestAnimationFrame, never from CSS keyframes. The
background is the night palette's floor, set inline from the painter. */
.birth-sky-converge {
@@ -21,17 +21,18 @@
.birth-sky-converge:not([open]) { display: none; }
.birth-sky-converge::backdrop { background: transparent; }
.birth-sky-converge canvas { display: block; }
/* BUG-2144: the first-chart reveal says it can be skipped. Not a button: a tap
anywhere on the layer (or Esc) already ends it. Night ink, quiet, in the
bottom-right corner clear of the subject line. */
.birth-sky-skip { position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); color: color-mix(in srgb, #f2f0ea 72%, transparent); font-size: 13px; line-height: 1.4; letter-spacing: .02em; pointer-events: none; user-select: none; }
/* BUG-2200: the first-chart reveal carries one real button, 「跳过,查看星盘」,
in the bottom-right corner clear of the subject line. It is the replay's
night-ink control (44px, outlined, focus ring); a tap anywhere on the layer
and Esc still end the reveal too. */
.birth-sky-skip { position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); display: flex; }
.birth-sky-subject-line { position: absolute; left: 16px; right: 16px; bottom: 12%; margin: 0; text-align: center; color: #f4efe4; font-size: 16px; line-height: 1.5; pointer-events: none; }
@supports (height: 1dvh) { .birth-sky-converge { height: 100dvh; } }
@media print { .birth-sky-converge { display: none !important; } }
/* Chart page replay controls (TASK-mobile-chart-and-confirmed-edit-20260929 M4):
× top left, 「分享」 top right, on the night floor in its ink (DESIGN §17:
#1a1a19 / #f2f0ea — the picture is always night). 44px targets; the first-
chart reveal passes no controls and stays button-free. */
chart reveal passes no controls and has its own skip button (BUG-2200). */
.birth-sky-controls {
position: absolute;
inset: 0 0 auto 0;
@@ -6,9 +6,11 @@ import { createPortal } from "react-dom";
import "./birth-sky-converge.css";
import { Button } from "@/components/ui/button";
import { birthSkyEntranceFrame, birthSkySceneStyle } from "./birth-sky-entrance";
import { readSkyOrigin } from "./sky-origin";
import { birthSkyHoldAtMs, birthSkyRevealAt, birthSkyScatter, type BirthSkyRevealMode } from "@/lib/birth-sky/converge";
import { BIRTH_SKY_SKIP_LABEL, birthSkyHoldAtMs, birthSkyRevealAt, birthSkyRevealSkipped, birthSkyScatter, type BirthSkyRevealMode } from "@/lib/birth-sky/converge";
import { BIRTH_SKY_PALETTES, drawBirthSky, type BirthSkyCanvas } from "@/lib/birth-sky/draw";
import type { BirthSkyRevealSky } from "@/lib/birth-sky/reveal";
import { birthSkyFactLine, birthSkyHeadline } from "@/lib/birth-sky/sentence";
@@ -37,8 +39,10 @@ export function birthSkyConvergeSize(viewportWidth: number, viewportHeight: numb
* - `reveal` (first chart, TASK-birth-sky-followup-20260928 F4): a full-screen
* layer with no buttons; the stars converge, the words appear, the layer
* fades and the step underneath (unchanged) is simply there. A tap, a click
* or Esc ends it at once; BUG-2144 says so in the bottom-right corner
* (「点一下跳过」, a label, not a button: the whole layer is the target).
* or Esc ends it at once. BUG-2200: the bottom-right corner carries a real,
* focusable 「跳过,查看星盘」 button (the replay's night-ink control; the
* dialog focuses it when it opens, so Enter or Space ends the reveal), and
* with reduced motion the reveal is not played at all: the chart is there.
* - `hold` (chart page, TASK-mobile-chart-and-confirmed-edit-20260929 M4): the
* same converge and words, then it stays on the settled frame. A tap skips to
* that frame; Esc closes. The caller's `controls` (close, share) sit on top.
@@ -63,6 +67,10 @@ export function BirthSkyConverge({ reveal, onDone, mode = "reveal", controls }:
return;
}
const reduced = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
if (birthSkyRevealSkipped(mode, reduced)) {
onDone();
return;
}
const scatter = birthSkyScatter(reveal.sky);
let frameHandle = 0;
let started: number | null = null;
@@ -163,7 +171,11 @@ export function BirthSkyConverge({ reveal, onDone, mode = "reveal", controls }:
aria-label={`${birthSkyHeadline(reveal.sky)}${birthSkyFactLine(reveal.sky)}。`}
/>
{subjectLine ? <p className="birth-sky-subject-line">{subjectLine}</p> : null}
{mode === "reveal" ? <span className="birth-sky-skip" aria-hidden="true">点一下跳过</span> : null}
{mode === "reveal" ? (
<div className="birth-sky-skip">
<Button className="birth-sky-control birth-sky-share" type="button" onClick={onDone}>{BIRTH_SKY_SKIP_LABEL}</Button>
</div>
) : null}
{controls}
</dialog>,
document.body,
+30 -5
View File
@@ -1,7 +1,7 @@
"use client";
import { PanelRightClose, PanelRightOpen } from "lucide-react";
import { useEffect, useState, type ReactNode } from "react";
import { useEffect, useLayoutEffect, useState, type ReactNode } from "react";
import { ChartStyleIcon } from "@/components/chart-style-icon";
import { Button } from "@/components/ui/button";
@@ -9,16 +9,42 @@ import { useSidebar } from "@/components/ui/sidebar";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
import { peekChatChartSplit, preloadChatChartSplit, type ChatChartSplitComponent } from "@/lib/chat-chart-preload";
import { useCurrentSubject } from "@/lib/current-subject";
import { chatChartPanelOpen } from "@/lib/starter-chart-details";
import { useUiStore } from "@/stores/ui-store";
type SheetComponent = (props: { open: boolean; onOpenChange: (open: boolean) => void }) => ReactNode;
type SplitComponent = ChatChartSplitComponent;
/**
* BUG-2201: while the newcomer home is on screen the panel is in fold mode
* (folded unless this browser opened it). A layout effect: it runs before
* paint, so the open-by-default panel is never painted on a newcomer home.
*/
export function useStarterChartFold(active: boolean): void {
const setFold = useUiStore((state) => state.setStarterChartFold);
useLayoutEffect(() => {
if (!active) return;
setFold(true);
return () => setFold(false);
}, [active, setFold]);
}
/**
* The desktop panel's open state and its setter. On the newcomer home
* (BUG-2201) both are the newcomer fold; otherwise the regular panel.
*/
export function useChatChartPanel(): { open: boolean; setOpen: (open: boolean) => void } {
const fold = useUiStore((state) => state.starterChartFold);
const open = useUiStore(chatChartPanelOpen);
const setPanelOpen = useUiStore((state) => state.setChatChartOpen);
const setDetailsOpen = useUiStore((state) => state.setStarterChartDetailsOpen);
return { open, setOpen: fold ? setDetailsOpen : setPanelOpen };
}
export function ChatChartToggle() {
const { isMobile, ready } = useSidebar();
const open = useUiStore((state) => state.chatChartOpen);
const setOpen = useUiStore((state) => state.setChatChartOpen);
const { open, setOpen } = useChatChartPanel();
const setSheetOpen = useUiStore((state) => state.setChatChartSheetOpen);
if (!ready) return null;
if (isMobile) {
@@ -69,11 +95,10 @@ export function ChatChartToggle() {
export function ChatChartFrame({ children }: { children: ReactNode }) {
const { isMobile, ready } = useSidebar();
const subjectId = useCurrentSubject();
const open = useUiStore((state) => state.chatChartOpen);
const { open, setOpen } = useChatChartPanel();
const width = useUiStore((state) => state.chatChartWidth);
const hydrated = useUiStore((state) => state.chatChartHydrated);
const hydrate = useUiStore((state) => state.hydrateChatChart);
const setOpen = useUiStore((state) => state.setChatChartOpen);
const setWidth = useUiStore((state) => state.setChatChartWidth);
// Warmed by the home bootstrap behind the curtain: then it is here in the first render.
const [Split, setSplit] = useState<SplitComponent | null>(() => peekChatChartSplit());
@@ -13,6 +13,7 @@ import {
} from "@/lib/starter-questions";
// BUG-2161: the third starter tells the server it came from this button (it asks for the plan and deadline first).
import { STARTER_PLAN_TIMING_ENTRYPOINT } from "@/lib/plan-timing-clarify";
import { STARTER_QUESTIONS_TITLE } from "@/lib/starter-chart-details";
import { AppLink } from "@/components/app-link";
import { RECTIFICATION_PAGE_HREF } from "@/lib/chat-session-url";
import type { Theme } from "@/lib/home-types";
@@ -20,8 +21,8 @@ import type { Theme } from "@/lib/home-types";
/**
* The first question (BUG-2144): three equal cards right above the composer,
* as wide as its column (three in a row, stacked at 640px and below). All three
* send. The greeting above already invites the question, so there is no lead
* line of its own.
* send. BUG-2201 (owner 2026-11-22): the group is headed 「从这三个问题开始」,
* so a newcomer knows where to begin.
*/
export function StarterQuestions({
audience,
@@ -53,6 +54,7 @@ export function StarterQuestions({
}, [moonKnown, subjectId]);
return (
<div className="starter-questions">
<h2 className="starter-questions-title">{STARTER_QUESTIONS_TITLE}</h2>
{audience.kind === "other" ? <Badge variant="outline">{starterWatching(audience)}</Badge> : null}
<div className="starter-questions-list">
<Button type="button" variant="outline" className="starter-question" data-onboarding-press="" data-onboarding-enter="starter-0" data-onboarding-index={0} data-onboarding-follow-source="" onClick={() => onAsk(prompts[0])}>{questions[0]}</Button>
+8
View File
@@ -125,6 +125,14 @@ export type BirthSkyRevealTimeline = Readonly<{
*/
export type BirthSkyRevealMode = "reveal" | "hold";
/** BUG-2200: the one control on the first-chart reveal. */
export const BIRTH_SKY_SKIP_LABEL = "跳过,查看星盘";
/** BUG-2200: with reduced motion the first-chart reveal is skipped; the chart page's replay (`hold`) still shows its poster. */
export function birthSkyRevealSkipped(mode: BirthSkyRevealMode, reducedMotion: boolean): boolean {
return mode === "reveal" && reducedMotion;
}
/** `hold`: elapsed time at which the settled frame is fully on screen (words faded in). */
export function birthSkyHoldAtMs(reducedMotion: boolean): number {
return reducedMotion ? REDUCED_FADE_IN_MS : BIRTH_SKY_CONVERGE_MS + TEXT_FADE_IN_MS;
+49
View File
@@ -0,0 +1,49 @@
/**
* BUG-2201: the newcomer home (the free first question is still unused) leads
* with the three starter questions and the composer; the natal panel starts
* folded and the top bar's existing chart button opens it (owner 2026-11-22:
* no separate 「展开星盘详情」 row). Whether the reader opened it is remembered
* per browser, apart from the regular panel's `chat_chart_panel_open`: once
* the first question is asked, the home is today's layout with today's default.
*/
import { chatChartStorage, type ChatChartStorage } from "@/lib/chat-chart-panel-state";
export const STARTER_CHART_DETAILS_STORAGE_KEY = "starter_chart_details_open";
export const STARTER_QUESTIONS_TITLE = "从这三个问题开始";
/** Folded unless this browser stored an explicit unfold. */
export function readStoredStarterChartDetailsOpen(
storage: ChatChartStorage | null = chatChartStorage(),
): boolean {
if (storage === null) return false;
try {
return storage.getItem(STARTER_CHART_DETAILS_STORAGE_KEY) === "1";
} catch {
return false;
}
}
export function writeStoredStarterChartDetailsOpen(
open: boolean,
storage: ChatChartStorage | null = chatChartStorage(),
): void {
if (storage === null) return;
try {
storage.setItem(STARTER_CHART_DETAILS_STORAGE_KEY, open ? "1" : "0");
} catch {
/* private mode */
}
}
/**
* The desktop panel's open state. A newcomer home uses its own fold (default
* folded); everyone else keeps the regular panel state (default open).
*/
export function chatChartPanelOpen(state: {
readonly starterChartFold: boolean;
readonly starterChartDetailsOpen: boolean;
readonly chatChartOpen: boolean;
}): boolean {
return state.starterChartFold ? state.starterChartDetailsOpen : state.chatChartOpen;
}
+14
View File
@@ -11,6 +11,7 @@ import {
writeStoredChatChartOpen,
writeStoredChatChartWidth,
} from "@/lib/chat-chart-panel-state";
import { readStoredStarterChartDetailsOpen, writeStoredStarterChartDetailsOpen } from "@/lib/starter-chart-details";
import {
readStoredChartBoardStyle,
writeStoredChartBoardStyle,
@@ -35,6 +36,11 @@ type UiState = {
setChatChartOpen: (open: boolean) => void;
setChatChartWidth: (width: number) => void;
hydrateChatChart: () => void;
/** BUG-2201: the newcomer home is on screen; the panel follows `starterChartDetailsOpen` (default folded), toggled by the top bar's chart button. */
starterChartFold: boolean;
setStarterChartFold: (fold: boolean) => void;
starterChartDetailsOpen: boolean;
setStarterChartDetailsOpen: (open: boolean) => void;
/** Phone bottom sheet with the chat's board; not persisted. */
chatChartSheetOpen: boolean;
setChatChartSheetOpen: (open: boolean) => void;
@@ -78,10 +84,18 @@ export const useUiStore = create<UiState>((set) => ({
hydrateChatChart: () => {
set({
chatChartOpen: readStoredChatChartOpen(),
starterChartDetailsOpen: readStoredStarterChartDetailsOpen(),
chatChartWidth: readStoredChatChartWidth(),
chatChartHydrated: true,
});
},
starterChartFold: false,
setStarterChartFold: (fold) => set({ starterChartFold: fold }),
starterChartDetailsOpen: false,
setStarterChartDetailsOpen: (open) => {
writeStoredStarterChartDetailsOpen(open);
set({ starterChartDetailsOpen: open });
},
chatChartSheetOpen: false,
setChatChartSheetOpen: (open) => set({ chatChartSheetOpen: open }),
chatChartFocus: null,
+121
View File
@@ -0,0 +1,121 @@
import "./install-test-document";
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";
import React from "react";
import { renderToStaticMarkup } from "react-dom/server";
import { createClientLifecycleHarness } from "./react-client-lifecycle-test-support";
import { BIRTH_SKY_SKIP_LABEL, birthSkyRevealSkipped } from "../src/lib/birth-sky/converge";
import { ChatChartToggle, useStarterChartFold } from "../src/components/chat-chart-frame";
import { StarterQuestions } from "../src/components/starter-questions";
import { SidebarProvider } from "../src/components/ui/sidebar";
import { CHAT_CHART_OPEN_STORAGE_KEY, type ChatChartStorage } from "../src/lib/chat-chart-panel-state";
import {
STARTER_CHART_DETAILS_STORAGE_KEY,
chatChartPanelOpen,
readStoredStarterChartDetailsOpen,
writeStoredStarterChartDetailsOpen,
} from "../src/lib/starter-chart-details";
import { useUiStore } from "../src/stores/ui-store";
Object.assign(globalThis, { React });
const read = (path: string) => readFileSync(new URL(`../src/${path}`, import.meta.url), "utf8");
const css = read("app/globals.css");
const noop = () => undefined;
function memoryStorage(seed: Record<string, string> = {}): ChatChartStorage & { values: Map<string, string> } {
const values = new Map(Object.entries(seed));
return { values, getItem: (key) => values.get(key) ?? null, setItem: (key, value) => { values.set(key, String(value)); } };
}
test("BUG-2200: the first-chart reveal has a real, focusable 「跳过,查看星盘」 button and is not played with reduced motion", () => {
const converge = read("components/birth-sky/birth-sky-converge.tsx");
const style = read("components/birth-sky/birth-sky-converge.css");
assert.equal(BIRTH_SKY_SKIP_LABEL, "跳过,查看星盘");
// A UI-kit Button (a native <button>: Tab, Enter and Space work), the replay's outlined night-ink control, not an aria-hidden label.
assert.match(converge, /<div className="birth-sky-skip">\s*<Button className="birth-sky-control birth-sky-share" type="button" onClick=\{onDone\}>\{BIRTH_SKY_SKIP_LABEL\}<\/Button>/);
assert.doesNotMatch(converge, /aria-hidden="true">点一下跳过/);
// It can be pressed (the old label had pointer-events: none) and shows a focus ring; 44px target on a phone.
const skip = style.slice(style.indexOf(".birth-sky-skip {"), style.indexOf("}", style.indexOf(".birth-sky-skip {")));
assert.doesNotMatch(skip, /pointer-events: none/);
assert.match(style, /\.birth-sky-control \{[^}]*pointer-events: auto;[^}]*min-width: 44px;[^}]*height: 44px;/);
assert.match(style, /\.birth-sky-control:focus-visible \{ outline: 2px solid #f2f0ea; outline-offset: 2px; \}/);
// Reduced motion: the reveal goes straight to the chart, before the dialog opens; the chart page's replay keeps its poster.
assert.equal(birthSkyRevealSkipped("reveal", true), true);
assert.equal(birthSkyRevealSkipped("reveal", false), false);
assert.equal(birthSkyRevealSkipped("hold", true), false);
assert.match(converge, /if \(birthSkyRevealSkipped\(mode, reduced\)\) \{\n\s*onDone\(\);\n\s*return;\n\s*\}[\s\S]*layer\.showModal\(\);/);
});
test("BUG-2201: the fold is stored per browser, folded by default, apart from the regular panel", () => {
const storage = memoryStorage();
assert.equal(readStoredStarterChartDetailsOpen(storage), false);
writeStoredStarterChartDetailsOpen(true, storage);
assert.equal(storage.values.get(STARTER_CHART_DETAILS_STORAGE_KEY), "1");
assert.equal(readStoredStarterChartDetailsOpen(storage), true);
assert.equal(storage.values.has(CHAT_CHART_OPEN_STORAGE_KEY), false);
assert.equal(readStoredStarterChartDetailsOpen(null), false);
const broken: ChatChartStorage = { getItem() { throw new Error("blocked"); }, setItem() { throw new Error("blocked"); } };
assert.equal(readStoredStarterChartDetailsOpen(broken), false);
assert.doesNotThrow(() => writeStoredStarterChartDetailsOpen(true, broken));
// Newcomer home: the fold decides. Anyone who already asked: today's panel state (open by default).
assert.equal(chatChartPanelOpen({ starterChartFold: true, starterChartDetailsOpen: false, chatChartOpen: true }), false);
assert.equal(chatChartPanelOpen({ starterChartFold: true, starterChartDetailsOpen: true, chatChartOpen: false }), true);
assert.equal(chatChartPanelOpen({ starterChartFold: false, starterChartDetailsOpen: false, chatChartOpen: true }), true);
});
function NewcomerHome({ newcomer }: { newcomer: boolean }) {
useStarterChartFold(newcomer);
return <ChatChartToggle />;
}
test("BUG-2201: the newcomer home is headed 「从这三个问题开始」; the panel starts folded and the top-bar button opens it", async () => {
const markup = renderToStaticMarkup(<StarterQuestions audience={{ kind: "self" }} subjectId="self" signs={{ ascendantSign: null, moonSign: "Taurus" }} onAsk={noop} />);
assert.match(markup, /^<div class="starter-questions"><h2 class="starter-questions-title">从这三个问题开始<\/h2>/);
assert.match(css, /\.starter-questions-title \{[^}]*font-family: var\(--font-display\); font-size: var\(--type-title-md\); font-weight: 500;/);
// Owner 2026-11-22: no separate 「展开星盘详情」 row; the existing top-bar button is the only control.
const page = read("app/(app)/page.tsx");
assert.doesNotMatch(css, /starter-chart-details/);
assert.doesNotMatch(page, /StarterChartDetails|展开星盘详情/);
assert.match(page, /const newcomerHome = starterHomeVisible && account\?\.firstConsultFree === true/);
assert.match(page, /\{newcomerHome \? \(\n\s*<StarterQuestions/);
assert.match(page, /useStarterChartFold\(newcomerHome\);/);
assert.match(read("components/chat-chart-frame.tsx"), /export function useStarterChartFold[\s\S]*?useLayoutEffect\(/);
const stored = memoryStorage();
Object.defineProperty(globalThis, "localStorage", { value: stored, configurable: true, writable: true });
const harness = createClientLifecycleHarness();
const button = (label: string) => harness.elements().find((node) => node.tagName === "BUTTON" && node.props["aria-label"] === label);
try {
useUiStore.setState({ chatChartOpen: true, starterChartFold: false, starterChartDetailsOpen: false });
// Someone who already asked: the panel is open, as today.
await harness.render(<SidebarProvider><NewcomerHome newcomer={false} /></SidebarProvider>);
await harness.idle();
assert.ok(button("收起本命盘"), "returning user: panel open by default");
await harness.render(<SidebarProvider><NewcomerHome newcomer /></SidebarProvider>);
await harness.idle();
assert.equal(useUiStore.getState().starterChartFold, true);
assert.ok(button("打开本命盘"), "newcomer: the panel is folded");
await harness.event(button("打开本命盘")!);
assert.ok(button("收起本命盘"), "the top-bar button opens it");
assert.equal(stored.values.get(STARTER_CHART_DETAILS_STORAGE_KEY), "1");
assert.equal(stored.values.has(CHAT_CHART_OPEN_STORAGE_KEY), false, "the regular panel's stored state is untouched");
// The first question is asked: fold mode ends and the regular state is back.
await harness.render(<SidebarProvider><NewcomerHome newcomer={false} /></SidebarProvider>);
await harness.idle();
assert.equal(useUiStore.getState().starterChartFold, false);
assert.ok(button("收起本命盘"));
assert.equal(harness.errors.length, 0, harness.errors.map(String).join("\n"));
} finally {
await harness.close();
Reflect.deleteProperty(globalThis, "localStorage");
useUiStore.setState({ starterChartFold: false, starterChartDetailsOpen: false });
}
});
@@ -451,13 +451,16 @@ test("the three starters sit right above the composer, as wide as it, and all th
}
});
test("the sky reveal says 「点一下跳过」 in the bottom-right; tap and Esc still end it", () => {
test("the sky reveal has a 「跳过,查看星盘」 button in the bottom-right; tap and Esc still end it", () => {
const converge = read("components/birth-sky/birth-sky-converge.tsx");
const style = read("components/birth-sky/birth-sky-converge.css");
assert.match(converge, /\{mode === "reveal" \? <span className="birth-sky-skip" aria-hidden="true">点一下跳过<\/span> : null\}/);
// 原值:<span className="birth-sky-skip" aria-hidden="true">点一下跳过</span>,CSS 带 pointer-events: none(只是一行小字)。
// 新值:.birth-sky-skip 里放一枚真正的按钮「跳过,查看星盘」(沿用重播页的夜色按钮),可点、可用键盘聚焦。
// 原因:BUG-2200,测试者 2026-11-22 反馈小字看不清、以为还在计算;负责人同意改成清楚可见、可聚焦的按钮。
assert.match(converge, /\{mode === "reveal" \? \(\n\s*<div className="birth-sky-skip">\n\s*<Button className="birth-sky-control birth-sky-share" type="button" onClick=\{onDone\}>\{BIRTH_SKY_SKIP_LABEL\}<\/Button>/);
assert.match(converge, /const onPointerDown = mode === "hold" \? skip : finish;/);
assert.match(converge, /layer\.addEventListener\("cancel", cancel\);/);
assert.match(style, /\.birth-sky-skip \{ position: absolute; right: max\(16px, env\(safe-area-inset-right\)\); bottom: max\(16px, env\(safe-area-inset-bottom\)\);[^}]*pointer-events: none;/);
assert.match(style, /\.birth-sky-skip \{ position: absolute; right: max\(16px, env\(safe-area-inset-right\)\); bottom: max\(16px, env\(safe-area-inset-bottom\)\); display: flex; \}/);
});
test("selected states follow the product conventions; starter cards have no outline (owner 2026-11-22)", () => {
@@ -235,10 +235,15 @@ test("timeline: converge ~3 s, words ~2.5 s, fade ~1 s; reduced motion only fade
assert.match(converge, /window\.matchMedia\?\.\("\(prefers-reduced-motion: reduce\)"\)/);
});
test("overlay: full screen, no buttons; tap, click or Esc ends it at once; rAF sized to viewport × DPR and cancelled on unmount", () => {
test("overlay: full screen, one skip button; tap, click or Esc ends it at once; rAF sized to viewport × DPR and cancelled on unmount", () => {
assert.match(revealComponent, /dynamic\(\s*\(\) => import\("\.\/birth-sky-converge"\)/);
assert.match(revealComponent, /<BirthSkyConverge reveal=\{cover\} onDone=\{onClose\} \/>/);
assert.doesNotMatch(converge, /<Button|<button|继续|Spinner/);
// 原值:assert.doesNotMatch(converge, /<Button|<button|继续|Spinner/)(过场里没有任何按钮)
// 新值:只有一枚「跳过,查看星盘」按钮(UI 组件 Button);仍没有原生 button、「继续」和 Spinner
// 原因:BUG-2200,负责人 2026-11-22 同意测试者建议:跳过要清楚可见、能用键盘聚焦
assert.equal(converge.match(/<Button/g)?.length, 1);
assert.match(converge, /<Button className="birth-sky-control birth-sky-share" type="button" onClick=\{onDone\}>\{BIRTH_SKY_SKIP_LABEL\}<\/Button>/);
assert.doesNotMatch(converge, /<button|继续|Spinner/);
// 原值:`layer.addEventListener("pointerdown", finish)`
// 新值:`onPointerDown = mode === "hold" ? skip : finish`,首页过场(reveal)仍是点一下就结束
// 原因:M4 星盘页定格模式里点一下只跳到定格帧、不关闭;首页过场行为不变