feat: finalize ticket merging and speaker-aware imports
This commit is contained in:
1 parent
648daa0794
commit
4e71e9b797
35 files changed
+1772
-348
No files matched your search
@@ -85,7 +85,7 @@ export function QrImage({ value, size = 180 }: { value: string; size?: number })
|
||||
* decoded text. The camera only works on a secure context (https or localhost);
|
||||
* the manual field always works.
|
||||
*/
|
||||
export function Scanner({ onResult, label = 'Scan a lanyard QR' }: { onResult: (text: string) => void; label?: string }) {
|
||||
export function Scanner({ onResult, label = 'Scan a lanyard QR', entryLabel = 'QR code', placeholder = '…or type the code (e.g. CVV-XXX-NNNN)', submitLabel = 'Go', disabled = false, submitDisabled = false, onEntryChange }: { onResult: (text: string) => void; label?: string; entryLabel?: string; placeholder?: string; submitLabel?: string; disabled?: boolean; submitDisabled?: boolean; onEntryChange?: (text: string) => void }) {
|
||||
const [manual, setManual] = useState('');
|
||||
const [camError, setCamError] = useState<string | null>(null);
|
||||
const scannerRef = useRef<Html5Qrcode | null>(null);
|
||||
@@ -162,13 +162,17 @@ export function Scanner({ onResult, label = 'Scan a lanyard QR' }: { onResult: (
|
||||
<div className="row" style={{ gap: 8 }}>
|
||||
<input
|
||||
className="input mono"
|
||||
type="text"
|
||||
data-testid="scanner-manual-code"
|
||||
placeholder="…or type the code (e.g. CVV-XXX-NNNN)"
|
||||
aria-label={entryLabel}
|
||||
placeholder={placeholder}
|
||||
disabled={disabled}
|
||||
value={manual}
|
||||
onChange={(e) => setManual(e.target.value)}
|
||||
onChange={(e) => { setManual(e.target.value); onEntryChange?.(e.target.value); }}
|
||||
onKeyDown={(e) => { if (e.key === 'Enter' && manual.trim() && !disabled && !submitDisabled) onResult(manual.trim()); }}
|
||||
/>
|
||||
<button className="btn primary small" data-testid="scanner-manual-go" disabled={!manual.trim()} onClick={() => onResult(manual.trim())}>
|
||||
Go
|
||||
<button className="btn primary small" data-testid="scanner-manual-go" disabled={disabled || submitDisabled || !manual.trim()} onClick={() => onResult(manual.trim())}>
|
||||
{submitLabel}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user