1- import React , { useContext , useState , useEffect } from 'react' ;
1+ import React , { useContext , useState } from 'react' ;
22import FormControlLabel from '@material-ui/core/FormControlLabel' ;
33import Checkbox from '@material-ui/core/Checkbox' ;
4+ import { makeStyles } from '@material-ui/core/styles' ;
45import styles from './BrowserView.module.scss' ;
6+
57import { GlobalContext } from '../../context/reducers/globalReducer' ;
68import { setProjectUrl } from '../../context/actions/globalActions' ;
7- import { isPropertySignature } from 'typescript' ;
89
910const BrowserView = ( ) => {
1011 const [ { url } , dispatchToGlobal ] = useContext ( GlobalContext ) ;
@@ -13,28 +14,29 @@ const BrowserView = () => {
1314 const [ checkedBoxes , setCheckBox ] = useState ( {
1415 checkedMouse : false ,
1516 muted : false ,
17+ checkedGrayscale : false ,
1618 } ) ;
17-
19+
1820 // Mute/Unmute webview
1921 const muteAudio = ( muted ) => {
2022 const webview = document . querySelector ( 'webview' ) ;
21- console . log ( webview ) ;
23+ // console.log(webview);
2224 webview . setAudioMuted ( muted ) ;
2325 } ;
24-
26+
2527 // helper function to add the https or http
2628 const addHttps = ( url ) => {
2729 if ( url . indexOf ( 'http://' ) === 0 || url . indexOf ( 'https://' ) === 0 ) {
2830 return url ;
2931 }
3032 if ( url . startsWith ( 'localhost' ) ) {
31- url = ' http://' + url ;
33+ url = ` http://${ url } ` ;
3234 return url ;
3335 }
34- url = ' https://' + url ;
36+ url = ` https://${ url } ` ;
3537 return url ;
3638 } ;
37-
39+
3840 const handleChangeUrl = ( e ) => {
3941 if ( e . keyCode === 13 ) {
4042 const testSiteURL = addHttps ( e . target . value ) ;
@@ -62,11 +64,11 @@ const BrowserView = () => {
6264 } ) ;
6365 break ;
6466
65- // checkedKeyboard state does not impact app usability
66- case 'checkedKeyboard ' :
67+ // checkedGrayscale state does not impact app usability
68+ case 'checkedGrayscale ' :
6769 setCheckBox ( {
6870 ...checkedBoxes ,
69- checkedKeyboard : ! checkedBoxes . checkedKeyboard ,
71+ checkedGrayscale : ! checkedBoxes . checkedGrayscale ,
7072 } ) ;
7173 break ;
7274
@@ -75,61 +77,90 @@ const BrowserView = () => {
7577 }
7678 } ;
7779
80+ const useStyles = makeStyles ( ( ) => ( {
81+ FormControlLabel : {
82+ // fontSize doesn't work, but color does work...
83+ fontSize : '1px' ,
84+ // color: 'white',
85+ // ,
86+ } ,
87+ } ) ) ;
88+
89+ const classes = useStyles ( ) ;
90+
7891 return (
79- < div >
92+ < div id = "Accessibility Lens" >
93+ < div className = { styles . accessLensContainer } >
94+ < div id = { styles . accessLensLabel } >
95+ Accessibility Lens
96+ </ div >
97+ { /* trying to put some sort of flex style or centered style here to center the 3 check boxes...but no avail */ }
98+ < div
99+ id = "Check Boxes"
100+ style = { {
101+ display : 'flex' ,
102+ alignItems : 'center' ,
103+ justifyContent : 'center' ,
104+ // fontSize: 22,
105+ } }
106+ >
107+ < FormControlLabel
108+ // style={{fontSize:2}}
109+ id = "Disable Mouse Checkbox"
110+ control = { (
111+ < Checkbox
112+ // style={{fontSize:2}}
113+ value = "disable mouse clicks"
114+ checked = { checkedBoxes . checkedMouse }
115+ onChange = { handleChangeCheckBox }
116+ name = "checkedMouse"
117+ />
118+ ) }
119+ label = "Disable Mouse Clicks"
120+ />
121+ < FormControlLabel
122+ id = "Grayscale Checkbox"
123+ control = { (
124+ < Checkbox
125+ value = "grayscale"
126+ checked = { checkedBoxes . checkedGrayscale }
127+ onChange = { handleChangeCheckBox }
128+ name = "checkedGrayscale"
129+ />
130+ ) }
131+ label = "Grayscale"
132+ />
133+ < FormControlLabel
134+ id = "Mute Audio Checkbox"
135+ control = { (
136+ < Checkbox
137+ value = "muted"
138+ checked = { checkedBoxes . muted }
139+ onChange = { handleChangeCheckBox }
140+ name = "muted"
141+ />
142+ ) }
143+ label = "Mute"
144+ />
145+ </ div >
146+ </ div >
147+ { /* Search bar */ }
80148 < input
81149 id = { styles . browserAddress }
82150 placeholder = "Enter a new URL (localhost:3000)"
83- type = ' text'
151+ type = " text"
84152 onKeyDown = { handleChangeUrl }
85153 />
86- < div id = { styles . FormControlContainer } >
87- { /* Disable Mouse Checkbox */ }
88- < FormControlLabel
89- control = {
90- < Checkbox
91- value = "disable mouse clicks"
92- checked = { checkedBoxes [ 'checkedMouse' ] }
93- onChange = { handleChangeCheckBox }
94- name = "checkedMouse"
95- />
96- }
97- label = "Disable Mouse Clicks"
98- />
99- { /* Disable Keyboard Checkbox */ }
100- < FormControlLabel
101- control = {
102- < Checkbox
103- value = "disable keyboard"
104- checked = { checkedBoxes [ 'checkedKeyboard' ] }
105- onChange = { handleChangeCheckBox }
106- name = "checkedKeyboard"
107- />
108- }
109- label = "Disable Keyboard Clicks"
110- />
111- { /* Mute Audio Checkbox */ }
112- < FormControlLabel
113- control = {
114- < Checkbox
115- value = "muted"
116- checked = { checkedBoxes [ 'muted' ] }
117- onChange = { handleChangeCheckBox }
118- name = "muted"
119- />
120- }
121- label = "Mute"
122- />
123- </ div >
124154 < webview
125155 id = { styles . browserView }
126156 src = { url }
127157 style = { {
158+ filter : checkedBoxes . checkedGrayscale ? 'grayscale(100%)' : 'grayscale(0%)' ,
128159 pointerEvents : checkedBoxes . checkedMouse ? 'none' : 'auto' ,
129160 } }
130161 />
131162 </ div >
132163 ) ;
133164} ;
134165
135- export default BrowserView ;
166+ export default BrowserView ;
0 commit comments