Skip to content

feat(home): rank the two entries by interaction shape and float the header - #104

Merged
nighca merged 9 commits into
1024XEngineer:mainfrom
huyanxius:refactor/home-entry-naming
Aug 4, 2026
Merged

feat(home): rank the two entries by interaction shape and float the header#104
nighca merged 9 commits into
1024XEngineer:mainfrom
huyanxius:refactor/home-entry-naming

Conversation

@huyanxius

@huyanxius huyanxius commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

把首页的两个入口按交互形态重排,并让 07-31 定稿的悬浮顶栏进入外壳、覆盖包括首页在内的全部路由。

Closes #98

Why

首页「选择一个起点」原来摆的是「快速开始」与「从项目开始」。这组对立的是有没有项目,而 #37 §3.8 定的两个入口是 Quick Start 与画布,差别在控制粒度——一句话交给系统连续跑完,还是在画布上逐个节点决定。卡二从眉标到按钮没有一处提到画布或节点,用户点之前不知道它通向工作流编辑器。

同时根路由留在外壳之外,首页没有顶栏。资产库挂在项目下(/projects/:projectId/assets),首页因此没有任何通往已有项目与资产库的入口,而 08-03 导师会刚把「改已有角色」的入口定在资产库。#91 当时把根路由排除在外,是因为外壳那条 nav 在文档流里占一行高度,会把满幅首屏顶下去;换成悬浮顶栏后这个理由不再成立。

Change Description

  • 首页两张卡改名为「快速开始」与「工作流画布」,描述与中缝说明按控制粒度重写,页面不再出现「项目工作台」。
  • 卡二的动作条在悬停或键盘聚焦后换成「创建新项目」「继续已有项目」两个按钮,就地确定项目归属;触屏设备两个按钮常显。
  • 新增 app/layout/app-header.tsx(111 行)与其测试(35 行),外壳的 nav 换成它,根路由移入 AppShellRoute
  • shared/ui/page-container.tsx 顶部留白由 py-8 改为 pb-8 pt-24,为悬浮顶栏让位。
  • 同步 frontend-architecture-v3.md 第 2 节:「根路由留在外面」在本 PR 后不再成立。
  • 共 9 个文件,8 条原子提交,+254 / −48。

Implementation Approach

  • 次级入口做成 HomeChoiceCard 的可选 actions,给出时卡片由 Link 降级为 section——链接不能嵌套链接。两个按钮用透明度与 pointer-events 切换、配 group-focus-within,不用 display:none,否则隐藏的链接无法聚焦,键盘用户够不到。触屏另给一条基线:Tailwind v4 把 hover: 包在 @media (hover: hover) 里,只留 hover 展开的话这两个入口在手机上永远触发不到,所以 any-pointer: coarse 下折叠行 hidden、按钮行 static / opacity-100 / pointer-events-auto。用 any-pointer 而非 pointer,是因为触屏笔记本与配鼠标的 iPad 主指针报 fine,只判主指针那类设备用手指仍然点不动。
  • 顶栏取自 Windup-Frontend-Complete-2026-07-31app-header.tsxfixed top-3.5 z-50pointer-events-none,不占布局高度,首屏满幅构图因此不变。
  • 没有照搬那一版 AppShell 里按 pathname 给不同页面配不同容器的分支:架构文档写明外壳不读 pathname、不统一夹居中容器。本 PR 的外壳仍只渲染顶栏与 w-fullmain,避让交给 PageContainer。顶栏内部读 pathname 只为高亮当前项,与「外壳不判断自己该不该出现」是两件事。
  • 顶栏的 Playtest 入口没有搬。本仓库预览路由是 /playtest/:characterId/:outfitId,没有角色与造型就构造不出恒定地址,链接会落进 404。理由写在组件顶部注释里,测试也断言了它不存在。

Screenshots

Before — 两张卡按有没有项目对立,首页无顶栏:

before-home

After — 按交互形态命名,顶栏悬浮在上,首屏构图不变:

after-home

After(悬停卡二) — 动作条换成两个按钮:

after-home-hover

Before / After(内容页 /projects — 占位的 nav 换成悬浮顶栏,正文不被遮挡:

before-projects

after-projects

可交互预览:https://windup-git-fork-huyanxius-refactor-hom-4af7a2-huyan-s-projects1.vercel.app

Testing

本地执行了 CI 工作流中的全部步骤:

  • npm run format:check — 通过(44 个文件)
  • npm run lint — 通过,无告警
  • npm run typecheck — 通过
  • npm run test — 通过(3 个文件 / 4 个用例,新增 2 个)
  • npm run build — 通过(244.65 kB,186ms)

浏览器手工核对:首页与 /projects 均带悬浮顶栏且高亮正确;首屏不被顶栏下推;/projects 正文不被遮挡;卡二悬停后出现两个按钮,Tab 也能走到。

Follow-ups

  • 两个按钮当前都落在 /projects 占位页。建项目、建 workflow run、再跳 /workflow-editor/:runId 依赖后端接口对齐,另开 Issue。
  • 08-03 会议第九节要求快速开始入口在建新项目前加前置确认,本 PR 未做,随项目链路一并处理。
  • Playtest 顶栏入口待预览有恒定落地地址后加回。
  • PageContainerpt-24 与顶栏尺寸是手工对齐的两个数,改顶栏高度时要一起改,目前靠注释约束。

Related

The canvas entry has to settle which project the character belongs to before a workflow run exists, so a single destination is not enough for that card.

Add an optional actions prop. When it is present the card renders as a section instead of a link, and the action row swaps to those links on hover or keyboard focus.

Cards without actions keep the previous single-link shape, and the split links stay reachable by keyboard because they are dimmed rather than unmounted.
The two cards contrasted having a project against not having one, while the product tells them apart by control granularity, so nothing on the second card mentioned the canvas it leads to.

Rename the second entry to the workflow canvas, rewrite both descriptions and the section note, and hang the new-project and existing-project links off its action row.

The starting point section now states how each path works instead of where the user comes from.
The home test asserted the old card titles and the second cards href, both of which the rename removed.

Assert the two new titles and the two secondary links, and drop the href check on the second card since it is no longer a link.

The suite pins the entry naming and the split destinations.
The shell ships a plain in-flow nav bar, while the 07-31 design keeps a floating one that leaves the full-bleed screens untouched.

Add AppHeader, fixed above the content, with a brand plate that names the current workspace and three links that highlight by pathname.

The Playtest item from the design is left out because the preview route needs a character and an outfit id, so the header has no constant address for it.
The header decides its highlight from the pathname and drops one item from the reference design, neither of which was pinned by a test.

Assert that the editor route highlights the creation entry, that the home route highlights only itself, and that no Playtest link is rendered.

A later attempt to restore the Playtest entry has to update the test on purpose.
The root route stayed outside the shell so the first screen could run full bleed, which left the home page without any way to reach projects and the asset library.

Replace the nav bar with AppHeader and move the root route inside AppShellRoute.

Home keeps its full-bleed composition because the header floats above the content instead of taking layout height.
The header no longer occupies layout height, so content pages started under it.

Raise the top padding of the container to six rem and keep the other three sides at two.

Content pages clear the bar with room to spare, and the note records that the value tracks the header size.
The layering note stated that the root route stays outside the shell, which stopped being true once the header started floating.

Record that every route now sits inside the shell, why the first screen survives it, and that the header reads the pathname only to highlight the current item.

The document matches the route table again.
@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
windup Ready Ready Preview Aug 4, 2026 5:38am

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found one issue in the changed home card interaction.

Verification note: I could not run the frontend tests/typecheck in this checkout because frontend/node_modules is missing; npm test and npm run typecheck resolved to non-executable shims instead.

Comment thread frontend/src/pages/home/choice-card.tsx Outdated
Tailwind v4 wraps hover variants in @media (hover: hover), so the reveal that exposes the two secondary entries never fires on a touchscreen, and the section wrapper is neither focusable nor clickable.

Show both action links persistently under any-pointer: coarse and hide the collapsed label row there, keeping the hover and focus-within reveal for fine pointers.

The workflow-canvas card is now tappable on phones and on hybrid devices whose primary pointer reports fine.
@nighca
nighca merged commit 023bf0f into 1024XEngineer:main Aug 4, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: 首页入口按交互形态重排,顶栏改为悬浮并覆盖首页

2 participants