fix(record-modal): implement ScreenSelector SolidJS component (#114) - #2318
adamscarmccoy-boop wants to merge 7 commits into
Conversation
| is_primary: boolean; | ||
| } | ||
|
|
||
| export const ScreenSelector: Component<{ onSelect?: (display: DisplayInfo) => void }> = (props) => { |
There was a problem hiding this comment.
This component is not imported or rendered anywhere. The application still routes display selection through target-select-overlay.tsx, so users cannot reach this selector and the promised recording-modal interaction is not enabled.
Knowledge Base Used:
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/components/record-modal/ScreenSelector.tsx
Line: 10
Comment:
**Selector Is Never Rendered**
This component is not imported or rendered anywhere. The application still routes display selection through `target-select-overlay.tsx`, so users cannot reach this selector and the promised recording-modal interaction is not enabled.
**Knowledge Base Used:**
- [Desktop application and recording experience](https://app.greptile.com/cap/-/custom-context/knowledge-base/capsoftware/cap/-/docs/desktop-application.md)
- [Desktop recording orchestration](https://app.greptile.com/cap/-/custom-context/knowledge-base/capsoftware/cap/-/docs/desktop-recording-orchestration.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.|
|
||
| onMount(async () => { | ||
| try { | ||
| const list = await invoke<DisplayInfo[]>("list_displays"); |
There was a problem hiding this comment.
Display Command Does Not Exist
list_displays is not a registered Tauri command. If this selector is mounted, the invocation rejects and leaves displays empty, producing a blank selector. Use the generated display-list command and its CaptureDisplay type, which also does not contain the expected is_primary field.
Knowledge Base Used:
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/components/record-modal/ScreenSelector.tsx
Line: 16
Comment:
**Display Command Does Not Exist**
`list_displays` is not a registered Tauri command. If this selector is mounted, the invocation rejects and leaves `displays` empty, producing a blank selector. Use the generated display-list command and its `CaptureDisplay` type, which also does not contain the expected `is_primary` field.
**Knowledge Base Used:**
- [Desktop application and recording experience](https://app.greptile.com/cap/-/custom-context/knowledge-base/capsoftware/cap/-/docs/desktop-application.md)
- [Desktop recording orchestration](https://app.greptile.com/cap/-/custom-context/knowledge-base/capsoftware/cap/-/docs/desktop-recording-orchestration.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| <button | ||
| class={`px-3 py-1.5 rounded text-sm ${ | ||
| selectedId() === display.id ? "bg-blue-600 text-white" : "bg-gray-800 text-gray-300" | ||
| }`} | ||
| onClick={() => { | ||
| setSelectedId(display.id); | ||
| props.onSelect?.(display); | ||
| }} | ||
| > | ||
| {display.name} {display.is_primary ? "(Primary)" : ""} | ||
| </button> |
There was a problem hiding this comment.
The selected display is indicated only by different background and text colors. Assistive-technology and color-impaired users cannot reliably determine the current selection. Add an explicit state such as aria-pressed and a visible non-color indicator.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/components/record-modal/ScreenSelector.tsx
Line: 32-42
Comment:
**Selection Relies On Color**
The selected display is indicated only by different background and text colors. Assistive-technology and color-impaired users cannot reliably determine the current selection. Add an explicit state such as `aria-pressed` and a visible non-color indicator.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| id: string; | ||
| name: string; | ||
| is_primary: boolean; | ||
| } | ||
|
|
||
| export const ScreenSelector: Component<{ onSelect?: (display: DisplayInfo) => void }> = (props) => { | ||
| const [displays, setDisplays] = createSignal<DisplayInfo[]>([]); | ||
| const [selectedId, setSelectedId] = createSignal<string>(""); | ||
|
|
||
| onMount(async () => { | ||
| try { | ||
| const list = await invoke<DisplayInfo[]>("list_displays"); | ||
| setDisplays(list); | ||
| const primary = list.find((d) => d.is_primary) || list[0]; | ||
| if (primary) { | ||
| setSelectedId(primary.id); | ||
| props.onSelect?.(primary); | ||
| } | ||
| } catch (err) { | ||
| console.error("Failed to load displays:", err); | ||
| } | ||
| }); | ||
|
|
||
| return ( | ||
| <div class="screen-selector flex gap-2"> | ||
| <For each={displays()}> | ||
| {(display) => ( | ||
| <button | ||
| class={`px-3 py-1.5 rounded text-sm ${ | ||
| selectedId() === display.id ? "bg-blue-600 text-white" : "bg-gray-800 text-gray-300" | ||
| }`} | ||
| onClick={() => { | ||
| setSelectedId(display.id); | ||
| props.onSelect?.(display); | ||
| }} | ||
| > | ||
| {display.name} {display.is_primary ? "(Primary)" : ""} | ||
| </button> | ||
| )} | ||
| </For> | ||
| </div> | ||
| ); | ||
| }; |
There was a problem hiding this comment.
Indentation Violates Repository Rules
This new TSX code uses space indentation, while the repository requires tabs for TypeScript and TSX. This explicit repository requirement must be satisfied before merging; format the file with the repository's Biome configuration.
Context Used: AGENTS.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/components/record-modal/ScreenSelector.tsx
Line: 5-47
Comment:
**Indentation Violates Repository Rules**
This new TSX code uses space indentation, while the repository requires tabs for TypeScript and TSX. This explicit repository requirement must be satisfied before merging; format the file with the repository's Biome configuration.
**Context Used:** AGENTS.md ([source](https://github.com/capsoftware/cap/blob/main/AGENTS.md))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| @@ -0,0 +1,47 @@ | |||
| import { Component, For, createSignal, onMount } from "solid-js"; | |||
There was a problem hiding this comment.
Filename Violates Naming Rules
The new ScreenSelector.tsx filename uses PascalCase, while the repository requires component filenames to use kebab-case. This explicit repository requirement must be satisfied before merging by renaming the file to screen-selector.tsx.
Context Used: AGENTS.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/components/record-modal/ScreenSelector.tsx
Line: 1
Comment:
**Filename Violates Naming Rules**
The new `ScreenSelector.tsx` filename uses PascalCase, while the repository requires component filenames to use kebab-case. This explicit repository requirement must be satisfied before merging by renaming the file to `screen-selector.tsx`.
**Context Used:** AGENTS.md ([source](https://github.com/capsoftware/cap/blob/main/AGENTS.md))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
…y and add aria-pressed (CapSoftware#114)
Fixes #114
Changes:
ScreenSelector.tsxintoapps/desktop/src/components/record-modal/ScreenSelector.tsx./claim #114
The PR is not ready to merge because the new selector is not integrated into the recording flow and explicit repository conventions remain unsatisfied.
Findings
Fix with agent prompt
Summary
This PR adds a standalone SolidJS display selector intended for the recording modal.
Reviews (1) · Last reviewed commit: "feat(ui): add SolidJS ScreenSelector com..."