Skip to content

Commit

Permalink
Merge pull request #31 from shiva-beehyv/injiver-173-camera-selection
Browse files Browse the repository at this point in the history
[INJIVER-173] Revert "[INJIVER-173] Added feature to select camera"
  • Loading branch information
challabeehyv authored Apr 30, 2024
2 parents d723bcc + 91005ec commit d054344
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {useAlertMessages} from "../../../pages/Home";

let timer: NodeJS.Timeout;

function QrScanner({setActiveStep, setQrData, deviceId}: {
setQrData: (data: string) => void, setActiveStep: (activeStep: number) => void, deviceId?: string
function QrScanner({setActiveStep, setQrData}: {
setQrData: (data: string) => void, setActiveStep: (activeStep: number) => void
}) {
const [isCameraBlocked, setIsCameraBlocked] = useState(false);

Expand Down Expand Up @@ -65,8 +65,7 @@ function QrScanner({setActiveStep, setQrData, deviceId}: {
"max": 1080
}
},
delayBetweenScanSuccess: 100000, // Scan once
deviceId
delayBetweenScanSuccess: 100000 // Scan once
}}
styles={{
container: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
import React, {useEffect, useState} from 'react';
import {Autocomplete, Box, Grid, TextField, Typography, useMediaQuery} from "@mui/material";
import React from 'react';
import {Box, Grid, Typography} from "@mui/material";
import scanQr from "../../../assets/scanner-ouline.svg";
import Loader from "../../commons/Loader";
import QrScanner from "./QrScanner";
import {SetQrDataFunction} from "../../../types/function-types";
import {useActiveStepContext} from "../../../pages/Home";
import StyledButton from "./commons/StyledButton";
import {useCameraSelectionHook} from "../../../hooks/useCameraSelectionHook";

const Verification = ({setQrData}: {
setQrData: SetQrDataFunction
}) => {
const {getActiveStep, setActiveStep} = useActiveStepContext();
const isTabletOrMobile = useMediaQuery("@media(max-width: 720px)");

const {videoInputOptions} = useCameraSelectionHook();
const [selectedDeviceId, setSelectedDeviceId] = useState<string | undefined>();

return (
<Grid container style={{padding: "78px 104px", textAlign: "center", display: "grid", placeContent: "center"}}>
Expand Down Expand Up @@ -46,7 +41,6 @@ const Verification = ({setQrData}: {
: (<QrScanner
setActiveStep={setActiveStep}
setQrData={setQrData}
deviceId={selectedDeviceId}
/>)
}
</Box>
Expand All @@ -58,26 +52,6 @@ const Verification = ({setQrData}: {
Back
</StyledButton>
</Grid>
<Grid item xs={12}>
{isTabletOrMobile && (<Autocomplete
id="grouped-demo"
options={videoInputOptions.map(option => ({
label: option.label,
deviceId: option.deviceId
}))}
getOptionLabel={(option) => option.label}
onChange={(event, value) => {
setSelectedDeviceId(value?.deviceId);
}}
sx={{width: 350, margin: "18px auto"}}
renderInput={(params) =>
<TextField {...params}
style={{borderColor: '#FF7F00', borderRadius: 1000}}
label="Select Camera"
/>
}
/>)}
</Grid>
</Grid>
);
}
Expand Down
21 changes: 0 additions & 21 deletions inji-verify/src/hooks/useCameraSelectionHook.ts

This file was deleted.

0 comments on commit d054344

Please sign in to comment.