🐛 fix: address Copilot review feedback on #3963#3964
Conversation
- Reset save resolution dialog when active mission changes (prevents stale dialog reopening for a different mission) - Round ResizeObserver dimensions and skip no-op updates to avoid unnecessary rerenders and loop warnings - Allow game scaling below 1x so games fit small viewports - Allow 2048 cell size below default when expanded container is small Signed-off-by: Andrew Anderson <andy@clubanderson.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for kubestellarconsole ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
👋 Hey @clubanderson — thanks for opening this PR!
This is an automated message. |
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
There was a problem hiding this comment.
Pull request overview
This PR follows up on Copilot review feedback from #3963 by tightening UI state handling in the mission sidebar and improving arcade game resizing behavior in expanded cards.
Changes:
- Reset “Save Resolution” dialog state when the active mission changes, and only mount the dialog when open.
- Round
ResizeObservercontainer measurements and avoid state updates when dimensions are unchanged. - Update 2048 and Snake sizing logic to better support resizing in expanded views.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
web/src/components/layout/mission-sidebar/MissionSidebar.tsx |
Resets and gates SaveResolutionDialog rendering to avoid stale dialog state across mission switches. |
web/src/components/cards/CardWrapper.tsx |
Rounds observed container dimensions and avoids redundant containerSize state updates. |
web/src/components/cards/Game2048.tsx |
Allows expanded-mode cell size to shrink when space is limited, with guards for invalid/negative sizing. |
web/src/components/cards/KubeSnake.tsx |
Adjusts computed scale to permit downscaling, but currently does not apply scaling when < 1 and can compute invalid negative scales. |
| const canvasScale = (() => { | ||
| if (!isExpanded || containerSize.width === 0 || containerSize.height === 0) return 1 | ||
| const availW = containerSize.width | ||
| const availH = containerSize.height - SNAKE_CHROME_HEIGHT | ||
| return Math.max(1, Math.min(availW / DEFAULT_CANVAS_SIZE, availH / DEFAULT_CANVAS_SIZE)) | ||
| return Math.min(availW / DEFAULT_CANVAS_SIZE, availH / DEFAULT_CANVAS_SIZE) | ||
| })() |
There was a problem hiding this comment.
canvasScale can now be < 1 (or even negative when containerSize.height < SNAKE_CHROME_HEIGHT), but the render logic only applies width/height + transform: scale(...) when canvasScale > 1. As a result, expanded Snake still won’t downscale on small viewports (and a negative scale could cause invalid layout). Clamp the computed scale to a positive minimum and apply scaling whenever isExpanded and canvasScale !== 1 (or otherwise ensure the canvas fits when canvasScale < 1).
🔄 Auto-Applying Copilot Code ReviewCopilot code review found 0 code suggestion(s) and 1 general comment(s). Also address these general comments:
Push all fixes in a single commit. Run Auto-generated by copilot-review-apply workflow. |
Addresses Copilot review comments on #3963: reset dialog on mission change, round ResizeObserver values, allow game downscaling on small viewports.