Skip to content

Commit a6e835f

Browse files
committed
cleaned up code, removing console.logs and comments
co-authored-by: Chris Tang [email protected]
1 parent 5b9da19 commit a6e835f

File tree

4 files changed

+5
-18
lines changed

4 files changed

+5
-18
lines changed

app/src/components/bottom/UseStateModal.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Modal from '@material-ui/core/Modal';
33
import StateContext from '../../context/context';
44
import TableStateProps from '../right/TableStateProps';
55

6-
// TODO: typescript interface or type check
6+
77
function UseStateModal({ updateAttributeWithState, attributeToChange, childId }) {
88
const [state, dispatch] = useContext(StateContext);
99
const [open, setOpen] = useState(false);
@@ -25,8 +25,7 @@ function UseStateModal({ updateAttributeWithState, attributeToChange, childId })
2525
</button>)
2626
}
2727

28-
// return the selected state's ID back so the value of it can be updated in the customizationpanel. to the assign the value of selected state to attribute tied to useState button (currently just text)
29-
// attribute to change as parameter for
28+
// table to choose state from
3029
const body = (
3130
<div className="useState-position">
3231
<div className="useState-header">
@@ -52,15 +51,15 @@ function UseStateModal({ updateAttributeWithState, attributeToChange, childId })
5251
displayObject = {displayObject}
5352
selectHandler={(table) => {
5453
if (statePropsId < 0) setStatePropsId(table.row.id);
55-
// if object => show object table
54+
// if object or array => show sub table
5655
if (table.row.type === "object") {
5756
setStateKey(stateKey + table.row.key + '.');
5857
setDisplayObject(table.row.value);
5958
} else if (table.row.type === "array") {
6059
setStateKey(stateKey + table.row.key)
6160
setDisplayObject(table.row.value);
6261
} else {
63-
// if not object => actually update state
62+
// if not object or array => update state
6463
setDisplayObject(null);
6564
updateAttributeWithState(attributeToChange, componentProviderId, statePropsId, table.row, stateKey + table.row.key);
6665
setStateKey('')

app/src/components/right/TableStateProps.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ const getColumns = (props) => {
4646
renderCell: function renderCell(params:any) {
4747
const getIdRow = () => {
4848
const { api } = params;
49-
console.log('Line 49 params =', params);
50-
console.log('Line 50 id = ', params.id);
51-
// const fields = api.getAllColumns().map((c: any) => c.field).filter((c : any) => c !== '__check__' && !!c);
5249
return params.id;
5350

5451
// return params.getValue(fields[0]);
@@ -66,7 +63,6 @@ const getColumns = (props) => {
6663
];
6764
};
6865

69-
//, providerId=1
7066
const TableStateProps = (props) => {
7167
const classes = useStyles();
7268
const [state] = useContext(StateContext);
@@ -100,7 +96,6 @@ const TableStateProps = (props) => {
10096
rows = providerComponent.stateProps.slice();
10197
}
10298
}
103-
console.log(rows);
10499

105100
const { selectHandler } : StatePropsPanelProps = props;
106101

app/src/containers/CustomizationPanel.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,6 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
208208

209209
// function to pass into UseStateModal to use state to update attribute
210210
const updateAttributeWithState = (attributeName, componentProviderId, statePropsId, statePropsRow, stateKey='') => {
211-
212-
// get the stateProps of the componentProvider
213-
// const currentComponent = state.components[componentProviderId - 1];
214-
// const currentComponentProps = currentComponent.stateProps;
215-
// const newInput = currentComponentProps[statePropsRow.id - 1].value;
216-
217-
console.log('stateKey', stateKey);
218211
const newInput = statePropsRow.value;
219212

220213
if (attributeName === 'compText') {

app/src/interfaces/Interfaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface ChildElement {
2525
attributes?: object;
2626
children?: ChildElement[];
2727
annotations?: string;
28-
stateUsed?: object; // {compText: 'key1.key2.a', compLink: 'key3.b'}
28+
stateUsed?: object;
2929
}
3030
export interface Component {
3131
id: number;

0 commit comments

Comments
 (0)