From 472614ec8d1f08a9ea8adf586c2d2bb99c30fecd Mon Sep 17 00:00:00 2001 From: rarandeyo Date: Tue, 10 Sep 2024 02:34:56 +0900 Subject: [PATCH] chore: Remove unused camera component --- .../src/routes/_app/upload/.camera-view.tsx | 83 ------------------- 1 file changed, 83 deletions(-) delete mode 100644 apps/frontend/src/routes/_app/upload/.camera-view.tsx diff --git a/apps/frontend/src/routes/_app/upload/.camera-view.tsx b/apps/frontend/src/routes/_app/upload/.camera-view.tsx deleted file mode 100644 index 5b6244b..0000000 --- a/apps/frontend/src/routes/_app/upload/.camera-view.tsx +++ /dev/null @@ -1,83 +0,0 @@ -import { IconCamera, IconX } from '@tabler/icons-react' -import { type FC, useCallback, useEffect, useRef, useState } from 'react' -import type React from 'react' -import Webcam from 'react-webcam' -import { IconButton } from '../../../components/common/IconButton' - -interface CameraViewProps { - uploadFiles: (file: File) => Promise - close: () => void -} - -const CameraAccessChecking: FC = () =>

カメラへのアクセスを確認中...

- -const CameraAccessDenied: FC<{ close: () => void }> = ({ close }) => ( -
-

カメラへのアクセスが許可されていません。

- -
-) - -const CameraComponent: FC<{ - webcamRef: React.RefObject - handleTakePhoto: () => void - close: () => void -}> = ({ webcamRef, handleTakePhoto, close }) => ( - <> -
- -
-
- - -
- -) - -export const CameraView: FC = ({ uploadFiles, close }) => { - const webcamRef = useRef(null) - const [hasPermission, setHasPermission] = useState(null) - - useEffect(() => { - navigator.mediaDevices - .getUserMedia({ video: true }) - .then(() => setHasPermission(true)) - .catch(() => setHasPermission(false)) - }, []) - - const handleTakePhoto = useCallback(async () => { - const imageSrc = webcamRef.current?.getScreenshot() - if (!imageSrc) return - - const imageFile = await fetch(imageSrc) - .then((res) => res.blob()) - .then((blob) => new File([blob], 'screenshot.jpg', { type: 'image/jpeg' })) - - uploadFiles(imageFile) - close() - }, [uploadFiles, close]) - - return ( -
-
- {hasPermission === null ? ( - - ) : hasPermission ? ( - - ) : ( - - )} -
-
- ) -}