-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: mirror webcam image by default * feat: add configuration modal
- Loading branch information
Showing
5 changed files
with
329 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React from 'react' | ||
import Box from '@mui/material/Box' | ||
import Typography from '@mui/material/Typography' | ||
import Modal from '@mui/material/Modal' | ||
import FormGroup from '@mui/material/FormGroup' | ||
import FormControlLabel from '@mui/material/FormControlLabel' | ||
import Switch from '@mui/material/Switch' | ||
import useSettings from '../../settings' | ||
|
||
const style = { | ||
position: 'absolute', | ||
top: '50%', | ||
left: '50%', | ||
transform: 'translate(-50%, -50%)', | ||
width: 400, | ||
bgcolor: 'background.paper', | ||
border: '2px solid #000', | ||
boxShadow: 24, | ||
p: 4, | ||
} | ||
|
||
export default function SettingsModal({ show, onClose }) { | ||
const { isCameraMirrored, setIsCameraMirrored } = useSettings() | ||
|
||
return ( | ||
<Modal | ||
open={show} | ||
aria-labelledby="zoetic settings" | ||
aria-describedby="change zoetic settings such as camera settings" | ||
onClose={onClose} | ||
> | ||
<Box sx={style}> | ||
<Typography id="modal-modal-title" variant="h6" component="h1"> | ||
zoetic settings | ||
</Typography> | ||
<FormGroup> | ||
<FormControlLabel | ||
control={ | ||
<Switch | ||
defaultChecked | ||
checked={isCameraMirrored} | ||
onChange={(event) => setIsCameraMirrored(event.target.checked)} | ||
/> | ||
} | ||
label="Mirror my camera" | ||
/> | ||
</FormGroup> | ||
</Box> | ||
</Modal> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import createPersistedState from 'use-persisted-state' | ||
|
||
const useIsCameraMirrored = createPersistedState('isCameraMirrored') | ||
|
||
export default function useSettings() { | ||
const [isCameraMirrored, setIsCameraMirrored] = useIsCameraMirrored(true) | ||
return { | ||
isCameraMirrored, | ||
setIsCameraMirrored, | ||
} | ||
} |
Oops, something went wrong.