Skip to content

feat(workspace): add invite reward hint - #363

Merged
huyanxius merged 6 commits into
1024XEngineer:mainfrom
huyanxius:feat/359-invite-rewards-hint-clean
Aug 18, 2026
Merged

feat(workspace): add invite reward hint#363
huyanxius merged 6 commits into
1024XEngineer:mainfrom
huyanxius:feat/359-invite-rewards-hint-clean

Conversation

@huyanxius

@huyanxius huyanxius commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

本 PR 在工作台账号入口旁增加一次性邀请奖励气泡,让用户在不打断当前创作流程的情况下发现账号中心的邀请奖励。

Why

邀请奖励只放在账号中心时几乎不可发现;常驻横幅又会遮挡工作区。需要一个靠近账号入口、低对比、短时存在的发现提示。

Changes

  • 登录后在 /workspace 账号入口旁显示轻量气泡,明确双方各得 200 积分。
  • 气泡指向账号入口,可直接进入账号中心查看邀请奖励。
  • 打开账号菜单、主动关闭或显示 15 秒后自动消失。
  • 退出登录清除当前会话标记,下一次登录重新显示一次。

Implementation

  • 使用认证会话命名空间下的 sessionStorage 记录是否已看过提示,并由统一 clearSession 边界在登出、过期、改密或跨标签退出时清理。
  • 生产组件继续使用现有认证状态和 React Router,不引入 mock 或额外后端接口。
  • 保持账号菜单和工作台现有毛玻璃顶栏的中性表面、边框和阴影层级。

Verification

  • npm exec vitest run --passWithNoTests src/app/layout/app-header.test.tsx src/features/auth-session/index.test.tsx src/features/auth-session/session-storage.test.ts:53 passed
  • npm run typecheck:通过

Scope

Related Issues

Refs #357
Closes #359

Users may not discover invite rewards from the account center without a contextual entry point.

Show a restrained account-adjacent hint once per login session, dismiss it on account-menu open or close, and expire it after fifteen seconds.

Clear the session marker on logout so the next login can discover the reward again.
Reviewers need stable visual evidence for the contextual invitation entry point.

Add desktop and mobile captures of the account-adjacent reward hint from the local workspace.

Keep both responsive states available for direct PR review.
@github-actions

Copy link
Copy Markdown

⚠️ @huyanxius,此 PR 尚未关联 issue。请在 PR 描述中使用 Closes #123 等关闭关键字,或通过 Development 侧栏关联对应 issue。

@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.

审查结论

邀请提示的展示、关闭、账号菜单联动和 15 秒自动收起路径实现清晰,桌面/移动截图与组件表现一致。定向组件测试(22 项)和 TypeScript 类型检查均通过;不过当前 sessionStorage 生命周期在路由切换与账号页退出路径上不完全符合“每次登录会话只显示一次”的约定,具体见行内意见。

Comment thread frontend/src/app/layout/app-header.tsx
Comment thread frontend/src/app/layout/app-header.tsx
@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.66667% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ntend/src/features/auth-session/session-storage.ts 91.66% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Acceptance found that route changes could repeat the hint and non-header logout paths could suppress it on the next login.

Mark the hint as seen when shown, clear the marker for every guest transition, and link directly to the invite section.

Cover timeout, close, route changes, external logout, and responsive evidence format.
Protected routes can unmount the header before a guest-state effect clears the invite hint marker.

Move session-scoped storage cleanup into the shared authentication teardown used by logout, expiry, password changes, and cross-tab logout.

Replace the header-only false positive with provider-level lifecycle coverage.
The session-scoped storage boundary must preserve unrelated preferences and tolerate unavailable browser storage.

Cover prefixed-key removal, null storage, and storage access failures directly.

Raise patch coverage for the lifecycle fix without broadening production behavior.
@vercel

vercel Bot commented Aug 17, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
windup Ignored Ignored Preview Aug 18, 2026 3:00am

@huyanxius

Copy link
Copy Markdown
Collaborator Author

@fennoai 请把你的问题直接修改,修改完成后 用一个干净的子代理验收,验收完后直接 commit 到本 PR

@fennoai

fennoai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

修改完成

  • 修复:移除 Header 对邀请提示标记的重复 sessionStorage.removeItem,统一由认证会话的 clearSession 清理,避免存储异常阻断登出。
  • 测试:新增“会话存储清理失败时仍能退出”的回归覆盖。
  • 验证:定向 Vitest 54 passednpm run typecheckoxfmt --checkoxlint 均通过;独立干净子代理验收结果为 PASS
  • 提交:ad5a51f7d4ede2326d8890704926b42514ccedb5fix(workspace): keep logout resilient to storage errors)。
  • 发布:由于该 PR 来自 fork,按安全发布流程已创建补丁 PR huyanxius/Windup#12,目标为本 PR 的来源分支 feat/359-invite-rewards-hint-clean;合入后会进入当前 PR feat(workspace): add invite reward hint #363

View job run

@huyanxius
huyanxius requested a review from minorcell August 18, 2026 02:02
@fennoai

fennoai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

PASS

  • HEAD 为固定提交 a17e683413f8053f9b42e7280bf9120c633c7f3e,工作区仅有指定两处修改。
  • Header 已移除直接 sessionStorage.removeItem;退出调用 useAuthSession().logout(),其 clearSession 统一清理 windup.auth-session.*,且存储异常被边界内部捕获,不阻断本地退出与远端注销。
  • 新测试能捕获 Header 直接清理导致的异常中断,同时验证共享边界仍完成访客态切换、首页跳转和远端注销;mock 显式恢复,整文件后续测试通过,无隔离污染或误报迹象。
  • 验证通过:定向 Vitest 2 文件、47 测试;TypeScript --noEmit;目标文件 oxlint、格式检查;git diff --check

xiaocheny214 added a commit to xiaocheny214/DireSoul that referenced this pull request Aug 18, 2026
邀请奖励页和工作台提示已分别由 1024XEngineer#3621024XEngineer#363 承担,本 PR 只保留后端接口与 OpenAPI。

@minorcell minorcell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@huyanxius 把非必要图片去掉就好。

Comment thread .github/assets/invite-reward-hint/invite-hint-mobile.jpg Outdated
@minorcell

Copy link
Copy Markdown
Member

@fennoai

处理下 review 的内容。去掉图片。

@fennoai

fennoai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Review 已处理

  • 已删除 .github/assets/invite-reward-hint/ 下的 Desktop、Mobile 两张截图。
  • 已从 PR feat(workspace): add invite reward hint #363 描述中移除截图说明和 Screenshots 区块,避免失效链接。
  • 校验通过:git diff --check 无问题,仓库内无图片路径残留引用;本次仅删除二进制资产,未运行前端测试。
  • 提交:6a02af013c0f6829cb9c428d32b82bce64400ae7chore(workspace): remove invite hint screenshots)。
  • 发布:按 fork 安全流程创建了补丁 PR huyanxius/Windup#14,合入后删除会进入当前 PR feat(workspace): add invite reward hint #363

View job run

@huyanxius

Copy link
Copy Markdown
Collaborator Author

@huyanxius 把非必要图片去掉就好。

🫡下次一定记住

…260818

chore(workspace): remove invite hint screenshots
@minorcell

Copy link
Copy Markdown
Member

@huyanxius 邀请码的设计有点问题;等等 @xiaocheny214 的那个重新设计和合并吧。

@huyanxius
huyanxius merged commit e07fcce into 1024XEngineer:main Aug 18, 2026
7 checks passed
minorcell pushed a commit that referenced this pull request Aug 18, 2026
* feat(auth): 用邀请码重新开放注册

公开注册仍关闭自动建号,改为邀请码门槛,并补齐查看、轮换和补填邀请码接口。

Closes #355

* test: 补齐邀请码注册与兑换的失败路径覆盖

覆盖空邀请码、发码碰撞、兑换接口以及账号中心邀请码加载/生成失败。

* fix(account): 兑换邀请码后刷新积分余额和流水

兑换成功只改了提示,同页余额与流水会停在旧数据。

* revert(frontend): 把邀请码 UI 交还给账号中心与工作台 PR

邀请奖励页和工作台提示已分别由 #362#363 承担,本 PR 只保留后端接口与 OpenAPI。

* fix(quota): 轮换邀请码加行锁,重复兑换改为业务错误

冷启动不加兑换次数上限。并发轮换用 FOR UPDATE 串行化;invitee 唯一约束冲突返回已填写过邀请码。邀请双方奖励默认改为 200,与账号中心 PR 对齐。

* fix(auth): 邀请码校验对齐邀请链接字符集

注册不再返回「请填写邀请码」:前端从链接传入 invite_code,空码和非法字符统一为邀请码无效。

* feat(auth): 邀请码选填,验证码登录可建号

注册无邀请码只发注册赠送;有有效邀请码再发双方奖励。login-by-code 对未知邮箱建号。注册赠送默认改为 300,邀请奖励保持 200。

* feat(auth): 邀请码仅注册可用,改为 TTL 与只增不删

去掉登录后补填;邀请码 30 天过期,轮换插入新行并截断旧码有效期。

* feat(quota): 邀请人每日最多 3 次邀请奖励

未过期邀请码仍可继续被使用并写入关系;邀请人每个 UTC 日最多入账 600 分,超出只跳过邀请人奖励。

* chore(openapi): 按导出脚本排序 InviteCodeOut 字段
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(frontend): 增加邀请奖励页与可分享注册链接

2 participants