refactor: simulator panel — floating device controls, lighter chrome#260
Conversation
- Drop redundant Dynamic Island white pill from GenericDeviceFrame — the MJPEG stream already shows the real notch. - Move Home + Screenshot out of the toolbar into a floating pill centered above the device frame (only visible while streaming) so device-level actions read separately from workspace controls. - Hoist a single TooltipProvider over the whole panel (was duplicated). - Consolidate scoreSimulator / scoreSimulatorByType — Booted bonus is composed onto the base score instead of duplicating the function. - Remove dead getStreamInfo path: the service stub always returned null since recovery moved to the sim:streamReady event. Drop the stub and the dead branch in the mount effect; keep the booting-stuck reset. - Extract withoutWorkspace() helper in the store — three identical idle-deletion blocks collapse to one. - Drop showCameraDot flag from GenericShellSpec (it was just isTablet rebranded) and inline the conditional render. - Add .device-use/ to gitignore. Net: 110 lines removed, 46 added.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughRefactors simulator stream initialization and state management: removes polling-based stream lookup, centralizes idle workspace cleanup in the store, simplifies fallback device frame rendering, and splits/refactors simulator scoring and UI composition. Changes
sequenceDiagram
participant UI as "SimulatorPanel (Client)"
participant Store as "Zustand Store"
participant Backend as "Simulator Backend"
participant Service as "simulatorService"
UI->>Service: startStreaming(workspaceId)
Service->>Backend: request/start stream
Backend-->>UI: emit sim:streamReady(workspaceId, streamUrl)
UI->>Store: update session phase -> "streaming" with streamUrl
Store-->>UI: state change triggers re-render (viewport shows stream)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 2/5 reviews remaining, refill in 25 minutes and 12 seconds. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/web/src/features/simulator/ui/SimulatorPanel.tsx`:
- Around line 756-769: The Home and Screenshot icon-only buttons lack accessible
names; update the Button elements that call handleHome and handleScreenshot (the
Button components wrapped by TooltipTrigger) to include descriptive aria-label
attributes (e.g., aria-label="Home" and aria-label="Screenshot") so screen
readers can identify the controls while keeping the existing
Tooltip/TooltipContent intact.
- Around line 196-200: The current recovery unconditionally clears a "booting"
session when layout.simulatorUdid exists, which can race with legitimate boots;
change this to track in-flight boot attempts (e.g., maintain an in-memory
set/map keyed by workspaceId or udid) and only call
simulatorStoreActions.clearWorkspaceSession(workspaceId) if there is no active
in-flight boot for that workspace/udid, updating the tracker when a boot is
initiated and when it completes/fails; also add the same add/remove bookkeeping
around the auto-reconnect path that calls startStreaming(...) so both boot entry
points consult the same in-flight tracker before clearing state.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5c36e654-b3e3-4206-a65f-45513895c9e8
📒 Files selected for processing (5)
.gitignoreapps/web/src/features/simulator/api/simulator.service.tsapps/web/src/features/simulator/store.tsapps/web/src/features/simulator/ui/DeviceFrame.tsxapps/web/src/features/simulator/ui/SimulatorPanel.tsx
💤 Files with no reviewable changes (1)
- apps/web/src/features/simulator/api/simulator.service.ts
- Remove the booting-recovery clear in the workspace-switch effect. The store is in-memory only (zustand, not persisted) so "stuck booting from app crash" can't actually happen — restart resets the store. The boot promise has a 30s timeout that already transitions to error on failure. Keeping the clear could race a real in-flight boot if the user revisits the workspace before STREAM_READY arrives. - Add explicit aria-label to the Home and Screenshot icon buttons in the floating device-control pill (previously relied on tooltip text alone).
Greenlight — Round 1Fixed (2):
Disagreed (0) | Deferred (0) Pushed in 27bda64. |
Summary
bg-bg-basepill on top was just covering it.TooltipProvider, consolidate the two near-identical scoring functions, remove the deadgetStreamInforecovery path (the stub always returned null since recovery moved tosim:streamReady), drop theshowCameraDotflag (it was justisTabletrebranded), and extractwithoutWorkspace()so the three duplicated idle-deletion blocks in the store collapse to one.Net: 110 lines removed, 46 added across 4 files in the simulator feature (plus a one-line
.gitignoreaddition for.device-use/).Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Refactor