Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 13x 13x 13x 13x 13x 13x 2x 2x 2x 2x 2x 13x 13x 1x 1x 1x 1x 1x 13x 13x 13x 10x 3x 2x 1x 13x 13x 10x 3x 2x 1x 13x 13x 13x 1x 12x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x | 'use client'
import { useMyAbacus } from '@/contexts/MyAbacusContext'
import { css } from '../../../styled-system/css'
interface VisionIndicatorProps {
/** Size variant */
size?: 'small' | 'medium'
/** Position for absolute placement, or 'inline' for flex container usage */
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'inline'
}
/**
* Camera icon indicator for abacus vision mode
*
* Shows:
* - 🔴 Red dot = not configured (no camera or no calibration)
* - 🟢 Green dot = configured and enabled
* - ⚪ Gray = configured but disabled
*
* Click behavior:
* - If not configured: opens setup modal
* - If configured: toggles vision on/off
*/
export function VisionIndicator({
size = 'medium',
position = 'bottom-right',
}: VisionIndicatorProps) {
const { visionConfig, isVisionSetupComplete, openVisionSetup } = useMyAbacus()
const handleClick = (e: React.MouseEvent) => {
e.stopPropagation()
// Always open setup modal on click for now
// This gives users easy access to vision settings
openVisionSetup()
}
const handleContextMenu = (e: React.MouseEvent) => {
e.preventDefault()
e.stopPropagation()
// Right-click always opens setup
openVisionSetup()
}
// Determine status indicator color
const statusColor = !isVisionSetupComplete
? 'red.500' // Not configured
: visionConfig.enabled
? 'green.500' // Enabled
: 'gray.400' // Configured but disabled
const statusLabel = !isVisionSetupComplete
? 'Vision not configured'
: visionConfig.enabled
? 'Vision enabled'
: 'Vision disabled'
const sizeStyles =
size === 'small'
? { w: '20px', h: '20px', fontSize: '10px' }
: { w: '28px', h: '28px', fontSize: '14px' }
const positionStyles =
position === 'inline'
? {} // No absolute positioning for inline usage
: {
position: 'absolute' as const,
...{
'top-left': { top: 0, left: 0, margin: '4px' },
'top-right': { top: 0, right: 0, margin: '4px' },
'bottom-left': { bottom: 0, left: 0, margin: '4px' },
'bottom-right': { bottom: 0, right: 0, margin: '4px' },
}[position],
}
return (
<button
type="button"
data-vision-status={
!isVisionSetupComplete ? 'not-configured' : visionConfig.enabled ? 'enabled' : 'disabled'
}
onClick={handleClick}
onContextMenu={handleContextMenu}
title={`${statusLabel} (right-click for settings)`}
style={positionStyles}
className={css({
...sizeStyles,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
bg: 'rgba(0, 0, 0, 0.5)',
backdropFilter: 'blur(4px)',
border: '1px solid rgba(255, 255, 255, 0.3)',
borderRadius: 'md',
color: 'white',
cursor: 'pointer',
transition: 'all 0.2s',
zIndex: 10,
opacity: 0.8,
_hover: {
bg: 'rgba(0, 0, 0, 0.7)',
opacity: 1,
transform: 'scale(1.1)',
},
})}
>
{/* Camera icon */}
<span style={{ position: 'relative' }}>
📷{/* Status dot */}
<span
data-element="vision-status-dot"
className={css({
position: 'absolute',
top: '-2px',
right: '-4px',
w: '8px',
h: '8px',
borderRadius: 'full',
bg: statusColor,
border: '1px solid white',
boxShadow: '0 1px 2px rgba(0,0,0,0.3)',
})}
/>
</span>
</button>
)
}
|