fix(vision): hide flip camera button when only one camera available

Only show camera controls section when there's something to display:
- Flip button: only if multiple cameras
- Torch button: only if torch available
- Whole section: only if either button would be shown

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock 2025-12-31 22:35:34 -06:00
parent da97ad0675
commit 7a9185eadb
1 changed files with 28 additions and 25 deletions

View File

@ -415,8 +415,9 @@ export function AbacusVisionBridge({
</button>
</div>
{/* Camera controls (local camera) */}
{cameraSource === 'local' && vision.availableDevices.length > 0 && (
{/* Camera controls (local camera) - only show if there's something to display */}
{cameraSource === 'local' &&
(vision.availableDevices.length > 1 || vision.isTorchAvailable) && (
<div
data-element="camera-controls"
className={css({
@ -452,29 +453,31 @@ export function AbacusVisionBridge({
</select>
)}
{/* Flip camera button */}
<button
type="button"
onClick={() => vision.flipCamera()}
data-action="flip-camera"
className={css({
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
width: '40px',
height: '40px',
bg: 'gray.700',
color: 'white',
border: 'none',
borderRadius: 'md',
cursor: 'pointer',
fontSize: 'lg',
_hover: { bg: 'gray.600' },
})}
title={`Switch to ${vision.facingMode === 'environment' ? 'front' : 'back'} camera`}
>
🔄
</button>
{/* Flip camera button - only show if multiple cameras available */}
{vision.availableDevices.length > 1 && (
<button
type="button"
onClick={() => vision.flipCamera()}
data-action="flip-camera"
className={css({
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
width: '40px',
height: '40px',
bg: 'gray.700',
color: 'white',
border: 'none',
borderRadius: 'md',
cursor: 'pointer',
fontSize: 'lg',
_hover: { bg: 'gray.600' },
})}
title={`Switch to ${vision.facingMode === 'environment' ? 'front' : 'back'} camera`}
>
🔄
</button>
)}
{/* Torch toggle button (only if available) */}
{vision.isTorchAvailable && (