From af0f6f7aee64d3a018e74c43e051155b06ad2816 Mon Sep 17 00:00:00 2001 From: Blaster4385 Date: Fri, 26 Aug 2022 14:56:04 +0530 Subject: Yo Man --- client/src/pages/Enrollment/Scanner/Scanner.jsx | 139 +++++++++++++++++++++ .../pages/Enrollment/Scanner/Scanner.module.css | 18 +++ 2 files changed, 157 insertions(+) create mode 100644 client/src/pages/Enrollment/Scanner/Scanner.jsx create mode 100644 client/src/pages/Enrollment/Scanner/Scanner.module.css (limited to 'client/src/pages/Enrollment') diff --git a/client/src/pages/Enrollment/Scanner/Scanner.jsx b/client/src/pages/Enrollment/Scanner/Scanner.jsx new file mode 100644 index 0000000..fb015fe --- /dev/null +++ b/client/src/pages/Enrollment/Scanner/Scanner.jsx @@ -0,0 +1,139 @@ +/* eslint-disable multiline-ternary */ +import React from 'react' +import Webcam from 'react-webcam' +import { useNavigate } from 'react-router-dom' +import Header from '../../../components/Header/Header' +import SubmitButton from '../../../components/SubmitButton/SubmitButton' +import styles from './Scanner.module.css' +import { Button, Grid, Typography } from '@mui/material' +import { t } from 'i18next' +import { userContext } from '../../../context/User' +import PopUpModal from '../../../components/Modal/Modal' +import AudioAutoplay from '../../../components/AudioAutoplay/AudioAutoplay' + +const Scanner = () => { + const navigate = useNavigate() + const { userData, setUserData } = userContext() + const webcamRef = React.useRef(null) + + const capture = React.useCallback(() => { + const imageSrc = webcamRef.current.getScreenshot() + setUserData({ ...userData, photo: imageSrc }) + }) + + const description = [ + 'ENSURE_THAT_YOUR_PHOTO_IS_CLEAR_AND_IN_FOCUS', + 'ALSO_ENSURE_THAT_YOU_ARE_IN_THE_CENTER_OF_YOUR_PHOTO', + 'YOU_WONT_BE_ABLE_TO_PROCEED_UNTIL_YOU_HAVE_CAPTURED_A_CLEAR_AND_CENTERED_PHOTO' + ] + + const svgIcon = () => ( + + + + + + + + + + ) + + return ( + <> +
+ + +
    + {description.map((item) => ( +
  • + {t(item)} +
  • + ))} +
+ + } + /> +
+
+ +
+ {svgIcon()} +
+
+ +
+ + + + + + + + +

+
+ + + {t('PLEASE_LOOK_INTO_THE_CAMERA')} +

+ {t('CLICK_CAPTURE_TO_CAPTURE_THE_PHOTO')} +

+ {t('CLICK_RESET_TO_REMOVE_THE_CAPTURED_PHOTO')} +
+
+
+ navigate('/enrollment/documents')} /> + + ) +} + +export default Scanner diff --git a/client/src/pages/Enrollment/Scanner/Scanner.module.css b/client/src/pages/Enrollment/Scanner/Scanner.module.css new file mode 100644 index 0000000..4a82e8e --- /dev/null +++ b/client/src/pages/Enrollment/Scanner/Scanner.module.css @@ -0,0 +1,18 @@ +.card__container { + display: flex; + justify-content: center; + margin: 10px; +} + +.webcam__container { + position: relative; +} + +.overlay__container { + position: absolute ; + width: 100%; + top: 0 ; + right: 0 ; + bottom: 0 ; + left: 0; +} \ No newline at end of file -- cgit