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 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | 'use client' import type { ReactNode } from 'react' import { css } from '../../../styled-system/css' // ============================================================================ // Types // ============================================================================ export interface CalibrationControlsProps { /** Called when rotate left is clicked */ onRotateLeft: () => void /** Called when rotate right is clicked */ onRotateRight: () => void /** Called when cancel is clicked */ onCancel: () => void /** Called when done is clicked */ onDone: () => void /** Whether controls are disabled */ isDisabled?: boolean /** Number of columns being calibrated */ columnCount?: number /** Show compact version (no instructions text) */ compact?: boolean } // ============================================================================ // Component // ============================================================================ /** * CalibrationControls - Control buttons for calibration mode * * Renders calibration controls OUTSIDE the video area: * - Brief instructions * - Rotate left/right buttons * - Cancel and Done buttons * * This component should be placed below or beside the video feed, * not overlaid on top of it. */ export function CalibrationControls({ onRotateLeft, onRotateRight, onCancel, onDone, isDisabled = false, columnCount, compact = false, }: CalibrationControlsProps): ReactNode { return ( <div data-component="calibration-controls" className={css({ display: 'flex', flexDirection: 'column', gap: 2, p: 3, bg: 'gray.800', borderRadius: 'lg', })} > {/* Instructions */} {!compact && ( <div data-element="calibration-instructions" className={css({ display: 'flex', flexDirection: 'column', gap: 1, })} > <p className={css({ fontSize: 'sm', fontWeight: 'medium', color: 'white', })} > Calibration Mode </p> <p className={css({ fontSize: 'xs', color: 'gray.400' })}> Drag corners to match your abacus. Yellow lines = column dividers. </p> {columnCount && ( <p className={css({ fontSize: 'xs', color: 'gray.500' })}>{columnCount} columns</p> )} </div> )} {/* Button row */} <div className={css({ display: 'flex', alignItems: 'center', gap: 2, flexWrap: 'wrap', })} > {/* Rotation buttons */} <div className={css({ display: 'flex', gap: 1 })}> <button type="button" onClick={onRotateLeft} disabled={isDisabled} data-action="rotate-left" className={css({ px: 2, py: 1.5, bg: 'blue.600', color: 'white', borderRadius: 'md', fontSize: 'sm', border: 'none', cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', opacity: isDisabled ? 0.5 : 1, _hover: { bg: isDisabled ? 'blue.600' : 'blue.500' }, _disabled: { cursor: 'not-allowed' }, })} title="Rotate 90° left" > ↺ </button> <button type="button" onClick={onRotateRight} disabled={isDisabled} data-action="rotate-right" className={css({ px: 2, py: 1.5, bg: 'blue.600', color: 'white', borderRadius: 'md', fontSize: 'sm', border: 'none', cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', opacity: isDisabled ? 0.5 : 1, _hover: { bg: isDisabled ? 'blue.600' : 'blue.500' }, _disabled: { cursor: 'not-allowed' }, })} title="Rotate 90° right" > ↻ </button> </div> {/* Spacer */} <div className={css({ flex: 1 })} /> {/* Cancel / Done buttons */} <div className={css({ display: 'flex', gap: 2 })}> <button type="button" onClick={onCancel} disabled={isDisabled} data-action="cancel-calibration" className={css({ px: 3, py: 1.5, bg: 'gray.700', color: 'white', borderRadius: 'md', fontSize: 'sm', border: 'none', cursor: 'pointer', opacity: isDisabled ? 0.5 : 1, _hover: { bg: isDisabled ? 'gray.700' : 'gray.600' }, _disabled: { cursor: 'not-allowed' }, })} > Cancel </button> <button type="button" onClick={onDone} disabled={isDisabled} data-action="finish-calibration" className={css({ px: 3, py: 1.5, bg: 'green.600', color: 'white', borderRadius: 'md', fontSize: 'sm', fontWeight: 'medium', border: 'none', cursor: 'pointer', opacity: isDisabled ? 0.5 : 1, _hover: { bg: isDisabled ? 'green.600' : 'green.500' }, _disabled: { cursor: 'not-allowed' }, })} > Done </button> </div> </div> </div> ) } export default CalibrationControls |