refactor(chat): extract profile onboarding and rectification surface hooks

Close the home-page split by moving account/onboarding and rectification glue out of page.tsx without relocating React state, keeping the route static and hook order intact.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-09-02 05:56:58 +08:00
co-authored by Cursor
parent fbb80fa376
commit bf6989eccf
15 changed files with 920 additions and 527 deletions
@@ -4,12 +4,20 @@ from pathlib import Path
PAGE = Path("frontend/src/app/page.tsx")
STARTER_HOME = Path("frontend/src/components/starter-home.tsx")
HOME_CLOUD = Path("frontend/src/lib/home-cloud-sync.ts")
RECTIFICATION_HOOK = Path("frontend/src/hooks/use-rectification-surface.ts")
DAILY_ROUTE = Path("frontend/src/app/api/daily-starlanguage/route.ts")
RECTIFICATION_ROUTE = Path("frontend/src/app/api/birth-rectification/route.ts")
def _home_entrypoint_surface() -> str:
parts = [PAGE, STARTER_HOME, HOME_CLOUD]
if RECTIFICATION_HOOK.exists():
parts.append(RECTIFICATION_HOOK)
return "".join(path.read_text(encoding="utf-8") for path in parts)
def test_daily_starlanguage_entrypoint_is_productized() -> None:
source = PAGE.read_text(encoding="utf-8") + STARTER_HOME.read_text(encoding="utf-8") + HOME_CLOUD.read_text(encoding="utf-8")
source = _home_entrypoint_surface()
assert "今日星语" in source
assert "fetchDailyStarlanguage" in source
assert "daily-starlanguage-card" in source
@@ -32,7 +40,7 @@ def test_daily_starlanguage_api_declares_honest_source_boundary() -> None:
def test_birth_time_rectification_entrypoint_is_productized() -> None:
source = PAGE.read_text(encoding="utf-8") + STARTER_HOME.read_text(encoding="utf-8") + HOME_CLOUD.read_text(encoding="utf-8")
source = _home_entrypoint_surface()
assert "生时校正" in source
assert "birth-rectification-card" in source
assert "openRectificationFromHomepage" in source