Skip to content

show buttons for taking photo etc#742

Open
SharonStrats wants to merge 1 commit intomainfrom
fix/camera
Open

show buttons for taking photo etc#742
SharonStrats wants to merge 1 commit intomainfrom
fix/camera

Conversation

@SharonStrats
Copy link
Copy Markdown
Contributor

When trying to use for the new design of the profile pane I wasn't able to take a picture. I was only able to pause the video, there was a black button underneath, but that disappeared. I'm not sure how that was supposed to work exactly. Take Photo, Retake photo, and Use Photo are now visible and it works. I have only tested this when I copied the code over to profile pane and worked on it there. I've copied the changes exactly. Will test further.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Makes the camera capture controls usable in the new profile pane design by ensuring the “Take Photo / Retake / Use Photo” actions are visibly presented and toggled through the capture flow.

Changes:

  • Introduces a setButtonVisible() helper to toggle button visibility via style.display.
  • Updates button labels and initial visibility for “Take Photo”, “Retake”, and “Use Photo”.
  • Adjusts getUserMedia success/failure handling to show the shutter button on preview start and to handle preview start failures.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +68 to +69
retakeButton.textContent = 'Retake'
setButtonVisible(retakeButton, false)
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

retakeButton is created via widgets.button(dom, retakeIcon, 'Retake'), which appends an <img> icon. Setting retakeButton.textContent = 'Retake' replaces all children and removes the icon/tooltip. If the intent is a text-only button, create it as a text button (e.g., call widgets.button without an icon) instead of overwriting textContent, or update the widget to render icon + label without destroying children.

Copilot uses AI. Check for mistakes.
Comment on lines +77 to +78
shutterButton.textContent = 'Take Photo'
setButtonVisible(shutterButton, false)
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

shutterButton is initially created with an icon (widgets.button(..., 'Snap')), but shutterButton.textContent = 'Take Photo' replaces the button contents and removes the icon/tooltip. If a labeled button is desired, prefer constructing it as a text button (no icon) or adjust the widget to support icon + label instead of overwriting textContent.

Copilot uses AI. Check for mistakes.
Comment on lines +86 to +87
sendButton.textContent = 'Use Photo'
setButtonVisible(sendButton, false)
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

sendButton comes from widgets.continueButton(dom), which creates an icon-only button. Setting sendButton.textContent = 'Use Photo' removes that icon and any tooltip set on it. If the goal is to switch to a text label, create a text button directly (or update the continue button/widget to support icon + label) rather than replacing textContent.

Copilot uses AI. Check for mistakes.
shutterButton.style.visibility = 'visible' // Enable
sendButton.style.visibility = 'collapse'
retakeButton.style.visibility = 'collapse'
setButtonVisible(shutterButton, true)
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

There is inconsistent indentation on the setButtonVisible(shutterButton, true) line inside the getUserMedia(...).then(...) block, which makes the block harder to read and may trip linting/formatting checks. Align it with the other statements in the block.

Suggested change
setButtonVisible(shutterButton, true)
setButtonVisible(shutterButton, true)

Copilot uses AI. Check for mistakes.
Comment on lines +43 to +45
const setButtonVisible = (button: HTMLElement, visible: boolean) => {
button.style.display = visible ? 'inline-flex' : 'none'
}
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

New UI-state logic is introduced via setButtonVisible(...)/style.display and the updated state transitions in displayPlayer()/reviewImage(), but the existing unit test for this module only asserts the navigator.mediaDevices not available throw. Consider adding a Jest test that stubs navigator.mediaDevices.getUserMedia to resolve and then asserts the expected style.display values (and button labels) for shutter/retake/send in each state.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

2 participants