Skip to content

Commit 14891b9

Browse files
committed
created radio button to enable axSnapshots
1 parent a01084b commit 14891b9

File tree

1 file changed

+42
-7
lines changed
  • src/app/components/StateRoute

1 file changed

+42
-7
lines changed

src/app/components/StateRoute/Ax.tsx

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import React, { useEffect } from 'react';
1+
import React, { useState } from 'react';
22
import { JSONTree } from 'react-json-tree'; // React JSON Viewer Component;
33
import { setCurrentTabInApp, toggleAxTree } from '../../slices/mainSlice';
44
import { useDispatch } from 'react-redux';
5+
import { display, style } from '@mui/system';
56

67
const theme = {
78
scheme: 'monokai',
@@ -33,20 +34,54 @@ const AxTree = (props) => {
3334
} = props;
3435

3536
const dispatch = useDispatch();
37+
const [hideButton, setHideButton] = useState(true);
38+
const [showTree, setShowTree] = useState(false);
39+
const [selectedValue, setSelectedValue] = useState('disable')
3640

37-
let AccessibilityHasBeenDisabled = true;
38-
const enableAxTreeButton = () => {
41+
const enableAxTreeButton = () => {
3942
dispatch(toggleAxTree('toggleAxRecord'));
4043
dispatch(setCurrentTabInApp('AxTree'));
41-
AccessibilityHasBeenDisabled = false;
44+
setSelectedValue('enable')
45+
setHideButton(false);
46+
setShowTree(true);
4247
}
4348

49+
const disableAxTree = () => {
50+
setSelectedValue('disable');
51+
setShowTree(false);
52+
}
53+
54+
// useEffect(() => {
55+
// // dispatch sent at initial page load allowing changing "immer's" draft.currentTabInApp to 'tree' to facilitate render.
56+
// }, []);
57+
4458

4559
return (
4660
<div>
47-
{
48-
AccessibilityHasBeenDisabled ? <button onClick={enableAxTreeButton}>Click Here to Enable Accessibility</button> :
49-
<JSONTree
61+
<p>A Note to Developers: Reactime is using the Chrome Debugging API in order to grab the Accessibility Tree. Enabling this option will allow you to record Accessibility Tree snapshots, but will result in the Chrome browser notifying you that the Chrome Debugger has started.</p>
62+
{/* {<button onClick={enableAxTreeButton}>Click Here to Enable Accessibility</button>} */}
63+
<div>
64+
{<input
65+
type='radio'
66+
value='enable'
67+
checked={selectedValue === 'enable'}
68+
onChange={() => {
69+
enableAxTreeButton();
70+
}}
71+
/>}
72+
<label htmlFor='enable'>Enable</label>
73+
{<input
74+
type='radio'
75+
value='disable'
76+
checked={selectedValue === 'disable'}
77+
onChange={() => {
78+
disableAxTree();
79+
}}
80+
/>}
81+
<label htmlFor='disable'>Disable</label>
82+
</div>
83+
84+
{showTree && <JSONTree
5085
data={axSnapshots[currLocation.index]}
5186
// shouldExpandNodeInitially={() => false}
5287
theme={theme}

0 commit comments

Comments
 (0)