Fix seat candidate handling and adjust seat UI layout and tests#47
Conversation
📝 WalkthroughWalkthrough本次更新修正完整位置候选下的座位候选追加逻辑,补充随机手牌转移回归测试,并调整座位 UI 的布局、尺寸计算和绘制条件。 Changes候选座位传播
座位界面布局
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
html/iframe.html (1)
1166-1168: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win不要让
.sorderContainer脱离seatUI坐标系这里改为
position: fixed后,容器的top/left会相对 viewport 定位;但src/draw.js的applySeatContainerLayout()直接使用座位相对坐标,而src/dom.js又对父级seatUI设置了居中的left/top。这会导致座位手牌镜像整体偏移。除非同时增加坐标换算,否则应保留absolute定位。建议修复
- position: fixed; + position: absolute;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@html/iframe.html` around lines 1166 - 1168, 将 .sorderContainer 的定位方式恢复为 absolute,保持其 top/left 在 seatUI 坐标系内解释。不要使用 fixed,除非同时修改 applySeatContainerLayout() 及 seatUI 的坐标换算以适配 viewport 定位。
🧹 Nitpick comments (1)
tests/tracker/secondaryRandomHandTransfer.test.ts (1)
98-99: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value移除冗余的断言以简化代码。
expectSeats辅助函数内部已经遍历并校验了传入的所有卡牌 ID(其中包括knownIDs里的112)。因此,第 99 行专门针对card112.seats的重复断言可以安全移除。💡 建议的修改
- expectSeats([...knownIDs, ...hiddenIDs], room, expectedSeats) - expect(Array.from(card112.seats).map(Number).sort((a, b) => a - b)).toEqual(expectedSeats) + expectSeats([...knownIDs, ...hiddenIDs], room, expectedSeats)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/tracker/secondaryRandomHandTransfer.test.ts` around lines 98 - 99, Remove the redundant card112.seats assertion after the expectSeats call; expectSeats already validates all IDs in knownIDs, including 112, so leave the consolidated expectSeats check unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@html/iframe.html`:
- Around line 1166-1168: 将 .sorderContainer 的定位方式恢复为 absolute,保持其 top/left 在
seatUI 坐标系内解释。不要使用 fixed,除非同时修改 applySeatContainerLayout() 及 seatUI 的坐标换算以适配
viewport 定位。
---
Nitpick comments:
In `@tests/tracker/secondaryRandomHandTransfer.test.ts`:
- Around line 98-99: Remove the redundant card112.seats assertion after the
expectSeats call; expectSeats already validates all IDs in knownIDs, including
112, so leave the consolidated expectSeats check unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 3c505e63-856b-495a-9830-d49c157bc04f
📒 Files selected for processing (8)
html/iframe.htmlsrc/dom.jssrc/draw.jssrc/tracker/Card.tssrc/tracker/roomMovement/candidates.tssrc/tracker/state.tstests/tracker/locationCandidates.test.tstests/tracker/secondaryRandomHandTransfer.test.ts
Summary by CodeRabbit
新功能
问题修复
测试