Skip to content

Commit a31e96d

Browse files
committed
deleted alot of commented out old code
1 parent 93063de commit a31e96d

38 files changed

+51
-446
lines changed

app/src/components/ContextAPIManager/AssignTab/AssignContainer.tsx

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useContext, useState, Fragment, useEffect } from 'react';
1+
import React, { useState, Fragment } from 'react';
22
import DataTable from '../CreateTab/components/DataTable';
33
import ContextDropDown from './components/ContextDropDown';
44
import ComponentDropDown from './components/ComponentDropDrown';
@@ -7,32 +7,23 @@ import Grid from '@mui/material/Grid';
77
import ComponentTable from './components/ComponentTable';
88
import { Button } from '@mui/material';
99
import DoubleArrowIcon from '@mui/icons-material/DoubleArrow';
10-
// import * as actions from '../../../redux/actions/actions';
11-
import StateContext from '../../../context/context';
1210
import { addComponentToContext } from '../../../redux/reducers/slice/contextReducer';
1311
import { useSelector, useDispatch, useStore } from 'react-redux';
1412
import { deleteElement } from '../../../redux/reducers/slice/appStateSlice';
1513

1614
const AssignContainer = () => {
17-
const store = useStore();
1815
const dispatch = useDispatch();
19-
20-
// const [state, setState] = useState([]);
2116
const defaultTableData = [{ key: 'Key', value: 'Value' }];
2217
const [tableState, setTableState] = React.useState(defaultTableData);
2318
const [contextInput, setContextInput] = React.useState(null);
2419
const [componentInput, setComponentInput] = React.useState(null);
2520
const [componentTable, setComponentTable] = useState([]);
26-
// const [stateContext, dispatchContext] = useContext(StateContext);
2721
const { state, contextParam } = useSelector((store) => ({
2822
state: store.appState,
2923
contextParam: store.contextSlice
3024
}));
3125

32-
//fetching data from redux store
33-
// useEffect(() => {
34-
// setState(allContext);
35-
// }, [allContext]);
26+
3627

3728
const renderTable = (targetContext) => {
3829
if (targetContext === null || !targetContext.values) {
@@ -78,13 +69,6 @@ const AssignContainer = () => {
7869
);
7970
//trigger generateCode(), update code preview tab
8071
dispatch(deleteElement({ id: 'FAKE_ID', contextParam: contextParam }));
81-
82-
// dispatchContext({
83-
// type: 'DELETE ELEMENT',
84-
// payload: 'FAKE_ID'
85-
// });
86-
87-
// setState(allContext);
8872
renderComponentTable(componentInput);
8973
};
9074

app/src/components/ContextAPIManager/AssignTab/components/ComponentDropDrown.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import React, { Fragment, useState, useEffect, useContext } from 'react';
1+
import React, { Fragment, } from 'react';
22
import TextField from '@mui/material/TextField';
33
import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
44
import Box from '@mui/material/Box';
5-
import StateContext from '../../../../context/context';
65
import { useSelector } from 'react-redux';
76

87
const filter = createFilterOptions();
@@ -13,8 +12,6 @@ const ComponentDropDown = ({
1312
componentInput,
1413
setComponentInput
1514
}) => {
16-
const { allContext } = contextStore;
17-
// const [componentList] = useContext(StateContext);
1815
const { state, isDarkMode } = useSelector((store) => ({
1916
state: store.appState,
2017
isDarkMode: store.darkMode.isDarkMode

app/src/components/ContextAPIManager/AssignTab/components/ContextDropDown.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import React, { Fragment, useState, useEffect } from 'react';
1+
import React, { Fragment, } from 'react';
22
import TextField from '@mui/material/TextField';
33
import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
44
import Button from '@mui/material/Button';
55
import Box from '@mui/material/Box';
6-
import { Typography } from '@mui/material';
76
import { useSelector } from 'react-redux';
87

98
const filter = createFilterOptions();

app/src/components/ContextAPIManager/ContextManager.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
import React, { useContext } from 'react';
1+
import React from 'react';
22
import { makeStyles } from '@mui/styles';
33
import Box from '@mui/material/Box';
44
import Tab from '@mui/material/Tab';
55
import TabContext from '@mui/lab/TabContext';
66
import TabList from '@mui/lab/TabList';
77
import TabPanel from '@mui/lab/TabPanel';
8-
98
import CreateContainer from './CreateTab/CreateContainer';
109
import AssignContainer from './AssignTab/AssignContainer';
1110
import DisplayContainer from './DisplayTab/DisplayContainer';
1211
import { useSelector } from 'react-redux';
13-
import store from '../../redux/store';
1412

1513
const useStyles = makeStyles({
1614
contextContainer: {
@@ -20,18 +18,17 @@ const useStyles = makeStyles({
2018
});
2119

2220
const ContextManager = (props): JSX.Element => {
23-
const {isDarkMode, style} = useSelector((store) =>({
24-
isDarkMode: store.darkMode.isDarkMode,
25-
style: store.styleSlice
26-
}) );
21+
const { isDarkMode, style } = useSelector((store) => ({
22+
isDarkMode: store.darkMode.isDarkMode,
23+
style: store.styleSlice
24+
}));
2725
const classes = useStyles();
2826
const [value, setValue] = React.useState<string>('1');
2927

3028
const handleChange = (event: React.SyntheticEvent, newValue: string) => {
3129
setValue(newValue);
3230
};
3331

34-
const backgroundColor = isDarkMode ? '#21262b' : 'white';
3532
const color = isDarkMode ? 'lightgray' : 'black';
3633

3734
return (

app/src/components/ContextAPIManager/CreateTab/CreateContainer.tsx

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,28 @@
1-
import React, { useEffect, useState, useContext } from 'react';
2-
import { useStore } from 'react-redux';
1+
import React from 'react';
32
import Divider from '@mui/material/Divider';
43
import Grid from '@mui/material/Grid';
54
import DataTable from './components/DataTable';
65
import AddDataForm from './components/AddDataForm';
76
import AddContextForm from './components/AddContextForm';
8-
// import * as actions from '../../../redux/actions/actions';
97
import { Typography } from '@mui/material';
10-
import StateContext from '../../../context/context';
118
import {
129
addContext,
1310
deleteContext,
1411
addContextValues
1512
} from '../../../redux/reducers/slice/contextReducer';
1613
import { useSelector, useDispatch } from 'react-redux';
1714
import { deleteElement } from '../../../redux/reducers/slice/appStateSlice';
18-
1915
const CreateContainer = () => {
2016
const defaultTableData = [{ key: 'Enter Key', value: 'Enter value' }];
2117
const { state, isDarkMode } = useSelector((store) => ({
2218
state: store.appState,
2319
isDarkMode: store.darkMode.isDarkMode
2420
}));
2521

26-
const store = useStore();
27-
// const [state, setState] = useState([]);
2822
const [tableState, setTableState] = React.useState(defaultTableData);
2923
const [contextInput, setContextInput] = React.useState(null);
30-
// const [stateContext, dispatchContext] = useContext(StateContext);
3124
const dispatch = useDispatch();
3225

33-
//pulling data from redux store
34-
// useEffect(() => {
35-
36-
// setState(allContext)
37-
// // setState(store.getState().contextSlice);
38-
39-
// }, [allContext]);
40-
4126
//update data store when user adds a new context
4227
const handleClickSelectContext = () => {
4328
//prevent user from adding duplicate context
@@ -48,28 +33,20 @@ const CreateContainer = () => {
4833
}
4934
setContextInput('');
5035
dispatch(addContext(contextInput));
51-
52-
// setState(allContext);
5336
};
5437

5538
//update data store when user add new key-value pair to context
5639
const handleClickInputData = ({ name }, { inputKey, inputValue }) => {
5740
dispatch(addContextValues({ name, inputKey, inputValue }));
58-
// setState(allContext);
41+
5942
};
6043

6144
//update data store when user deletes context
6245
const handleDeleteContextClick = () => {
6346
dispatch(deleteContext(contextInput));
6447
setContextInput('');
65-
// setState(allContext);
6648
setTableState(defaultTableData);
67-
6849
dispatch(deleteElement({ id: 'FAKE_ID', contextParam: state }));
69-
// dispatchContext({
70-
// type: 'DELETE ELEMENT',
71-
// payload: 'FAKE_ID'
72-
// });
7350
};
7451

7552
//re-render data table when there's new changes

app/src/components/ContextAPIManager/CreateTab/components/AddContextForm.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import React, { Fragment, useState, useEffect, useContext } from 'react';
1+
import React, { Fragment, useState } from 'react';
22
import TextField from '@mui/material/TextField';
33
import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
44
import Button from '@mui/material/Button';
55
import Box from '@mui/material/Box';
66
import { Typography } from '@mui/material';
7-
import StateContext from '../../../../context/context';
87
import { useSelector } from 'react-redux';
98

109
const filter = createFilterOptions();
@@ -19,8 +18,6 @@ const AddContextForm = ({
1918
}) => {
2019
const { allContext } = contextStore;
2120
const [btnDisabled, setBtnDisabled] = useState(false);
22-
// const [state, dispatch] = useContext(StateContext);
23-
// const state = useSelector(store => store.appState)
2421
const isDarkMode = useSelector((state) => state.darkMode.isDarkMode);
2522

2623
const handleClick = () => {

app/src/components/ContextAPIManager/CreateTab/components/AddDataForm.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import React, { Fragment, useState, useEffect } from 'react';
1+
import React, { Fragment } from 'react';
22
import TextField from '@mui/material/TextField';
33
import Button from '@mui/material/Button';
44
import Box from '@mui/material/Box';
55
import { Typography } from '@mui/material';
66
import { useSelector } from 'react-redux';
77

88
const AddDataForm = ({ handleClickInputData, contextInput }) => {
9-
//const [contextInput, setContextInput] = React.useState(null);
109
const defaultInputData = { inputKey: '', inputValue: '' };
1110
const [dataContext, setDataContext] = React.useState(defaultInputData);
1211
const isDarkMode = useSelector((state) => state.darkMode.isDarkMode);

app/src/components/ContextAPIManager/CreateTab/components/DataTable.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import TableRow from '@mui/material/TableRow';
77
import Paper from '@mui/material/Paper';
88
import { styled } from '@mui/material/styles';
99
import TableCell, { tableCellClasses } from '@mui/material/TableCell';
10-
import TableFooter from '@mui/material/TableFooter';
1110

1211
const StyledTableCell = styled(TableCell)(({ theme }) => ({
1312
[`&.${tableCellClasses.head}`]: {
@@ -40,7 +39,6 @@ export default function DataTable({ target, contextInput }) {
4039
>
4140
<TableHead>
4241
<TableRow>
43-
{/* <StyledTableCell>Key</StyledTableCell> */}
4442
<StyledTableCell align="center" colSpan={3}>
4543
{contextInput ? contextInput.name : 'Context Name'}
4644
</StyledTableCell>
@@ -56,11 +54,6 @@ export default function DataTable({ target, contextInput }) {
5654
</StyledTableRow>
5755
))}
5856
</TableBody>
59-
{/* <TableFooter>
60-
<StyledTableCell align="center" colSpan={3}>
61-
{contextInput ? contextInput.name : 'Context Name'}
62-
</StyledTableCell>
63-
</TableFooter> */}
6457
</Table>
6558
</TableContainer>
6659
</>

app/src/components/bottom/CreationPanel.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import React, { useContext } from 'react';
22
import ComponentPanel from '../right/ComponentPanel'
3-
import StatePropsPanel from '../right/StatePropsPanel'
43
import HTMLPanel from '../left/HTMLPanel'
54
import { useSelector } from 'react-redux';
6-
// import { styleContext } from '../../containers/AppContainer';
75

86
// Creation panel holds all of the creation functionality of the application. ComponentPanel, HTMLPanel, and StatePropsPanel are all hanged here.
97
// This allows users to create all aspects of this application in one place.
108
const CreationPanel = (props): JSX.Element => {
11-
// const {style} = useContext(styleContext);
129
const style = useSelector((store) => store.styleSlice);
1310
console.log('style from creation',style)
1411
return (

app/src/components/bottom/TableStateProps.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@ import {
66
} from '@mui/x-data-grid';
77
import Button from '@mui/material/Button';
88
import ClearIcon from '@mui/icons-material/Clear';
9-
import StateContext from '../../context/context';
109
import makeStyles from '@mui/styles/makeStyles';
1110
import { StatePropsPanelProps } from '../../interfaces/Interfaces';
1211
import { useDispatch, useSelector } from 'react-redux';
1312
import { deleteState } from '../../redux/reducers/slice/appStateSlice';
1413

1514
const TableStateProps = props => {
16-
// const [state, dispatch] = useContext(StateContext);
17-
// const state = useSelector(store => store.appState);
1815
const { state, contextParam } = useSelector((store) => ({
1916
state: store.appState,
2017
contextParam: store.contextSlice,
@@ -76,10 +73,6 @@ const TableStateProps = props => {
7673
const filtered = currentComponent.stateProps.filter(
7774
element => element.id !== selectedId
7875
);
79-
// dispatch({
80-
// type: 'DELETE STATE',
81-
// payload: { stateProps: filtered, rowId: selectedId }
82-
// });
8376
dispatch(deleteState({stateProps: filtered, rowId: selectedId, contextParam: contextParam}))
8477
};
8578

app/src/components/bottom/UseStateModal.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
import React, {useState, useContext, useRef} from 'react';
1+
import React, {useState, useRef} from 'react';
22
import Modal from '@mui/material/Modal';
33
import TableStateProps from './TableStateProps';
4-
import { useSelector } from 'react-redux';
5-
64

75
function UseStateModal({ updateAttributeWithState, attributeToChange, childId }) {
8-
// const [state, dispatch] = useContext(StateContext);
9-
const state = useSelector(store => store.appState)
106
const [open, setOpen] = useState(false);
117
const [stateKey, setStateKey] = useState('');
128
const [statePropsId, setStatePropsId] = useState(-1);

app/src/components/form/Selector.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React from 'react';
33
import FormControl from '@mui/material/FormControl';
44
import Select from '@mui/material/Select';
55
import MenuItem from '@mui/material/MenuItem';
6-
import { SelectLight, SelectDark } from '../../public/styles/theme';
76

87
const FormSelector = (props): JSX.Element => {
98
const items = [];

app/src/components/left/DragDropPanel.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React, { useContext } from 'react';
22
import Grid from '@mui/material/Grid';
3-
import StateContext from '../../context/context';
43
import HTMLItem from './HTMLItem';
54

65
import { useSelector, useDispatch } from 'react-redux';
@@ -20,21 +19,15 @@ Hook state:
2019
*/
2120
// Extracted the drag and drop functionality from HTMLPanel to make a modular component that can hang wherever the future designers may choose.
2221
const DragDropPanel = (props): JSX.Element => {
23-
// const [state, dispatch] = useContext(StateContext);
24-
// const { isThemeLight } = props;
2522
const isDarkMode = useSelector(store => store.darkMode.isDarkMode);
2623
const dispatch = useDispatch();
27-
// const state = useSelector(store => store.appState)
2824
const { state, contextParam } = useSelector((store) => ({
2925
state: store.appState,
3026
contextParam: store.contextSlice,
3127
}));
3228
const handleDelete = (id: number): void => {
3329
dispatch(deleteElement({id:id, contextParam: contextParam}))
34-
// dispatch({
35-
// type: 'DELETE ELEMENT',
36-
// payload: id
37-
// });
30+
3831
};
3932
// filter out separator so that it will not appear on the html panel
4033
const htmlTypesToRender = state.HTMLTypes.filter(type => type.name !== 'separator');

0 commit comments

Comments
 (0)