Skip to content

Commit cbcac1f

Browse files
authored
Merge pull request #46 from oslabs-beta/liam/screenshots
Liam/screenshots
2 parents af1d057 + 036f634 commit cbcac1f

File tree

17 files changed

+116
-33
lines changed

17 files changed

+116
-33
lines changed

app/src/components/App.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,14 @@ export const App = (): JSX.Element => {
3232

3333
// following useEffect runs on first mount
3434
useEffect(() => {
35-
console.log('state.isLoggedIn', state.isLoggedIn)
3635
// console.log('cookies.get in App', Cookies.get())
3736
// if user is a guest, see if a project exists in localforage and retrieve it
3837
// v17 May not currently work yet
3938
if (!state.isLoggedIn) {
40-
console.log('not state.islogged in')
4139
localforage.getItem('guestProject').then((project) => {
4240
// if project exists, use dispatch to set initial state to that project
43-
console.log('guestProject', project)
4441
if (project) {
4542
dispatch(setInitialState(project));
46-
console.log('project', project)
4743
}
4844
});
4945
} else {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ const CreateContainer = () => {
8282
setCurrentContext('');
8383
};
8484

85-
console.log('state.allContext', state.allContext);
8685
return (
8786
<>
8887
<Grid container display="flex" justifyContent="space-evenly">

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ const AddContextForm = ({
2323
setErrorStatus
2424
}) => {
2525
const { allContext } = contextStore;
26-
console.log('all contexts', allContext);
2726
const [btnDisabled, setBtnDisabled] = useState(false);
2827
const [open, setOpen] = useState(false);
2928
const { state, isDarkMode } = useSelector((store: RootState) => ({

app/src/components/StateManagement/CreateTab/components/StatePropsPanel.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ const StatePropsPanel = ({ isThemeLight, data }): JSX.Element => {
6262
try{
6363
let retVal = JSON.parse(value);
6464
if(Array.isArray(retVal)){
65-
console.log('is this an array still', retVal)
6665
setInputTypeError('');
6766
return retVal
6867
}else{
@@ -195,7 +194,6 @@ const StatePropsPanel = ({ isThemeLight, data }): JSX.Element => {
195194
if (exists) {
196195
setInputKey(table.row.key);
197196
setInputType(table.row.type);
198-
console.log("tablerowvalue", table.row.value);
199197
setInputValue(table.row.value ? JSON.stringify(table.row.value) : '');
200198
} else clearForm();
201199
};
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
import React from 'react';
2+
import Table from '@mui/material/Table';
3+
import TableBody from '@mui/material/TableBody';
4+
import TableContainer from '@mui/material/TableContainer';
5+
import TableHead from '@mui/material/TableHead';
6+
import TableRow from '@mui/material/TableRow';
7+
import Paper from '@mui/material/Paper';
8+
import { styled } from '@mui/material/styles';
9+
import TableCell, { tableCellClasses } from '@mui/material/TableCell';
10+
import { useSelector } from 'react-redux';
11+
import { RootState } from '../../../redux/store'
12+
13+
const StyledTableCell = styled(TableCell)(({ theme }) => ({
14+
[`&.${tableCellClasses.head}`]: {
15+
backgroundColor: theme.palette.common.black,
16+
color: theme.palette.common.white,
17+
},
18+
[`&.${tableCellClasses.body}`]: {
19+
color: theme.palette.common.black,
20+
fontSize: 14,
21+
},
22+
}));
23+
24+
const StyledTableRow = styled(TableRow)(({ theme }) => ({
25+
'&:nth-of-type(odd)': {
26+
backgroundColor: theme.palette.action.hover
27+
},
28+
// hide last border
29+
'&:last-child td, &:last-child th': {
30+
border: 0,
31+
},
32+
}));
33+
34+
export default function DataTable(props) {
35+
const {
36+
currComponentState, parentProps, clickedComp, data,
37+
} = props;
38+
const state = useSelector((store:RootState) => store.appState)
39+
40+
// determine if the current component is a root component
41+
let isRoot = false;
42+
43+
for (let i = 0; i < data.length; i++) {
44+
if (data[i].name === clickedComp) {
45+
if (state.rootComponents.includes(data[i].id)) isRoot = true;
46+
}
47+
}
48+
49+
return (
50+
<TableContainer component={Paper} sx={{ maxHeight: '350px' }}>
51+
<Table
52+
sx={{ width: '510px' }}
53+
aria-label="customized table"
54+
stickyHeader
55+
>
56+
57+
{/* we are checking if the clicked component is a root component-- if yes, it doesn't have any parents so don't need passed-in props table */}
58+
{(!isRoot
59+
&& (
60+
<>
61+
<TableHead>
62+
<TableRow>
63+
<StyledTableCell align="center" colSpan={3}>
64+
Props Passed in from Parent:
65+
</StyledTableCell>
66+
</TableRow>
67+
</TableHead>
68+
<TableBody>
69+
<StyledTableRow>
70+
<StyledTableCell component="th" scope="row"><b>Key</b></StyledTableCell>
71+
<StyledTableCell align="right"><b>Type</b></StyledTableCell>
72+
<StyledTableCell align="right"><b>Initial Value</b></StyledTableCell>
73+
</StyledTableRow>
74+
{parentProps ? parentProps.map((data, index) => (
75+
<StyledTableRow key={index}>
76+
<StyledTableCell component="th" scope="row">{data.key}</StyledTableCell>
77+
<StyledTableCell align="right">{data.type}</StyledTableCell>
78+
<StyledTableCell align="right">{data.value}</StyledTableCell>
79+
</StyledTableRow>
80+
)) : ''}
81+
</TableBody>
82+
</>
83+
)
84+
)}
85+
86+
{/* The below table will contain the state initialized within the clicked component */}
87+
<TableHead>
88+
<TableRow>
89+
<StyledTableCell align="center" colSpan={3}>
90+
State Initialized in Current Component:
91+
</StyledTableCell>
92+
</TableRow>
93+
</TableHead>
94+
<TableBody>
95+
<StyledTableRow>
96+
<StyledTableCell component="th" scope="row"><b>Key</b></StyledTableCell>
97+
<StyledTableCell align="right"><b>Type</b></StyledTableCell>
98+
<StyledTableCell align="right"><b>Initial Value</b></StyledTableCell>
99+
</StyledTableRow>
100+
{currComponentState ? currComponentState.map((data, index) => (
101+
<StyledTableRow key={index}>
102+
<StyledTableCell component="th" scope="row">{data.key}</StyledTableCell>
103+
<StyledTableCell align="right">{data.type}</StyledTableCell>
104+
<StyledTableCell align="right">{data.value}</StyledTableCell>
105+
</StyledTableRow>
106+
)) : ''}
107+
</TableBody>
108+
</Table>
109+
</TableContainer>
110+
);
111+
}

app/src/components/left/RoomsContainer.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ const RoomsContainer = () => {
6262
if (currentStore !== event) {
6363
currentStore = JSON.parse(currentStore);
6464
event = JSON.parse(event);
65-
console.log('stores do not match');
6665
if (currentStore.darkMode.isDarkMode !== event.darkMode.isDarkMode) {
6766
store.dispatch(toggleDarkMode());
6867
} else if (currentStore.appState !== event.appState) {
@@ -75,7 +74,6 @@ const RoomsContainer = () => {
7574
store.dispatch(cooperativeStyle(event.styleSlice));
7675
}
7776
}
78-
console.log('updated user Store from another user: ', store.getState());
7977
});
8078
}
8179

@@ -84,7 +82,6 @@ const RoomsContainer = () => {
8482
}
8583

8684
function joinRoom() {
87-
console.log(roomCode);
8885
dispatch(changeRoom(roomCode));
8986
setConfirmRoom((confirmRoom) => roomCode);
9087

app/src/components/left/Sidebar.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@ const Sidebar: React.FC<SidebarProps> = ({
2222
setActiveTab(newValue);
2323
toggleVisibility(true);// Show the left-container when a different tab is clicked
2424
oldValue = newValue;//setting the oldvalue to match the new tab
25-
console.log('oldValue change', oldValue)
2625
};
2726

2827
const handleTabClick = (event: React.MouseEvent, oldValue: number) => {
2928
if (activeTab === oldValue) { //if the person is clicking the same tab, oldValue should match activeTab since it did not trigger an onChange
30-
console.log('handleTabChange null', oldValue)
3129
setActiveTab(null);
3230
toggleVisibility(false); // Hide the left-container when the same tab is clicked again
3331
}

app/src/components/marketplace/MarketplaceCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ const MarketplaceCard = ({ proj }: { proj: Project }) => {
5858
try {
5959
const objId: string = proj._id.toString();
6060
// the below functions are commented out as not to incur too many charges
61-
// const response: string = await Storage.get(objId);
61+
const response: string = await Storage.get(objId);
6262
// const response: string = await Storage.get('test');
63-
// setS3ImgURL(response);
63+
setS3ImgURL(response);
6464
} catch (error) {
6565
console.error(`Error fetching image preview for ${proj._id}: `, error);
6666
}

app/src/components/right/DeleteProjects.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ function ProjectsDialog(props: ProjectDialogProps) {
4444
const selectedProject = projects.filter(
4545
(project: any) => project._id === value
4646
)[0];
47-
console.log('deleting this one', selectedProject)
4847
deleteProject(selectedProject);
4948
localforage.removeItem(window.localStorage.getItem('ssid'));
5049
dispatch(setInitialState(initialState))

app/src/components/right/OpenProjects.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ function ProjectsDialog(props: ProjectDialogProps) {
3737
(project: any) => project._id === value
3838
)[0];
3939
// dispatch({ type: 'OPEN PROJECT', payload: selectedProject });
40-
console.log(selectedProject);
4140
dispatch(openProject(selectedProject))
4241
openAlert()
4342
onClose();

0 commit comments

Comments
 (0)