diff --git a/src/frontend/src/components/barcodes/BarcodeInput.tsx b/src/frontend/src/components/barcodes/BarcodeInput.tsx index 28504a23d3..dafc2009d8 100644 --- a/src/frontend/src/components/barcodes/BarcodeInput.tsx +++ b/src/frontend/src/components/barcodes/BarcodeInput.tsx @@ -14,6 +14,7 @@ import { IconCamera, IconScan } from '@tabler/icons-react'; import { useCallback, useMemo, useState } from 'react'; import { useLocalStorage } from '@mantine/hooks'; +import { useGlobalSettingsState } from '../../states/SettingsState'; import { Boundary } from '../Boundary'; import BarcodeCameraInput from './BarcodeCameraInput'; import BarcodeKeyboardInput from './BarcodeKeyboardInput'; @@ -33,6 +34,8 @@ export function BarcodeInput({ label = t`Barcode`, actionText = t`Scan` }: Readonly) { + const globalSettings = useGlobalSettingsState(); + const [barcode, setBarcode] = useState(''); const [inputType, setInputType] = useLocalStorage({ @@ -43,15 +46,16 @@ export function BarcodeInput({ const scanningOptions: SegmentedControlItem[] = useMemo(() => { const options: SegmentedControlItem[] = []; - // TODO : Hide camera input optionally - options.push({ - value: 'camera', - label: ( - - - - ) - }); + if (globalSettings.isSet('BARCODE_WEBCAM_SUPPORT', true)) { + options.push({ + value: 'camera', + label: ( + + + + ) + }); + } options.push({ value: 'scanner', @@ -63,7 +67,7 @@ export function BarcodeInput({ }); return options; - }, []); + }, [globalSettings]); const onScanBarcode = useCallback( (barcode: string) => {