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();

app/src/components/top/NavBar.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const NavBar = () => {
4040
}, [state.name])//update the ProjectName after state.name changes due to loading projects
4141

4242
const deleteAlertOpen = () => {
43-
console.log("I am hit")
4443
setDeleteAlert(true);
4544
}
4645

@@ -92,7 +91,6 @@ const NavBar = () => {
9291

9392
publishProject(projectName, state)
9493
.then((newProject: State) => {
95-
console.log('Project published successfully', newProject);
9694
setPublishModalOpen(false);
9795
dispatch(updateProjectId(newProject._id));
9896
dispatch(updateProjectName(newProject.name));
@@ -109,7 +107,6 @@ const NavBar = () => {
109107
const handleUnpublish = () => {
110108
unpublishProject(state)
111109
.then((unpublishedProject: State) => {
112-
console.log('Project unpublished successfully', unpublishedProject);
113110
dispatch(updateProjectPublished(false));
114111
setAlertOpen2(true);
115112
})

app/src/components/top/NavBarButtons.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ function initSocketConnection(roomCode) {
6767
if (currentStore !== event) {
6868
currentStore = JSON.parse(currentStore);
6969
event = JSON.parse(event);
70-
console.log('stores do not match');
7170
if (currentStore.darkMode.isDarkMode !== event.darkMode.isDarkMode) {
7271
store.dispatch(toggleDarkMode());
7372
} else if (currentStore.appState !== event.appState) {
@@ -260,7 +259,6 @@ function navbarDropDown(props) {
260259
}, [joinedRoom]);
261260

262261
function joinRoom() {
263-
console.log(roomCode);
264262
dispatch(changeRoom(roomCode));
265263
setConfirmRoom((confirmRoom) => roomCode);
266264

app/src/containers/CustomizationPanel.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,6 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
394394
// UNDO/REDO functionality--onClick these functions will be invoked.
395395
const handleUndo = () => {
396396
dispatch(undo({ contextParam }));
397-
console.log(contextParam);
398397
};
399398
const handleRedo = () => {
400399
dispatch(redo({ contextParam }));
@@ -475,7 +474,6 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
475474
const keyBindedFunc = useCallback((e) => {
476475
// the || is for either Mac or Windows OS
477476
// Undo
478-
console.log('keydown');
479477
(e.key === 'z' && e.metaKey && !e.shiftKey) ||
480478
(e.key === 'z' && e.ctrlKey && !e.shiftKey)
481479
? handleUndo()

app/src/containers/MainContainer.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ const MainContainer = (props): JSX.Element => {
4747

4848
async function checkStorageConnection() {
4949
try {
50-
await Storage.list(''); // This is just a test operation
51-
console.log('Connected to AWS S3 successfully.');
50+
// await Storage.list(''); // This is just a test operation
51+
// console.log('Connected to AWS S3 successfully.');
5252
} catch (error) {
5353
console.error('Error connecting to AWS S3:', error);
5454
}
@@ -60,7 +60,6 @@ const MainContainer = (props): JSX.Element => {
6060
await Storage.put(id, imgBuffer, {
6161
contentType: 'image/png',
6262
});
63-
console.log('Screenshot uploaded to S3');
6463
} catch (error) {
6564
alert('Error uploading screenshot: ' + error);
6665
}

app/src/helperFunctions/cssRefresh.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// this is not currently being used for the website version
33
const cssRefresher = () => {
44
const oldStylesheet = document.getElementById('stylesheet');
5-
console.log(oldStylesheet);
65
if (oldStylesheet !== null) oldStylesheet.remove();
76
// const rando = Math.random() * 100000;
87
const newStylesheet = document.createElement('LINK');
@@ -11,6 +10,5 @@ const cssRefresher = () => {
1110
newStylesheet.setAttribute('href', 'fake.css');
1211
newStylesheet.setAttribute('id', 'stylesheet');
1312
document.getElementById('renderFocus').append(newStylesheet);
14-
console.log(newStylesheet);
1513
};
1614
export default cssRefresher;

app/src/helperFunctions/projectGetSaveDel.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ export const publishProject = (
8686
const publishedProject = response
8787
.then((res) => res.json())
8888
.then((data) => {
89-
console.log({_id: data._id, name: data.name, published:data.published, ...data.project});
9089
return {_id: data._id, name: data.name, published:data.published, ...data.project};
9190
})
9291
.catch((err) => {
@@ -117,7 +116,6 @@ export const unpublishProject = (
117116
const unpublishedProject = response
118117
.then((res) => res.json())
119118
.then((data) => {
120-
console.log({_id: data._id, name: data.name, published:data.published, ...data.project});
121119
return {_id: data._id, name: data.name, published:data.published, ...data.project};
122120
})
123121
.catch((err) => {
@@ -142,7 +140,7 @@ export const deleteProject = (project: any): Promise<Object> => {
142140
body
143141
})
144142
.then((res) => res.json())
145-
.then((data) => { console.log(data)
143+
.then((data) => {
146144
return {_id: data._id, name: data.name, published:data.published, ...data.project};
147145
})
148146
.catch((err) => console.log(`Error deleting project ${err}`));

server/controllers/marketplaceController.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ const marketplaceController: MarketplaceController = {
6464
delete noId.published;
6565
const publishedProject = await Projects.create( { project: noId, createdAt, published: true, comments, name, userId, username })
6666
res.locals.publishedProject = publishedProject.toObject({ minimize: false });
67-
console.log('published backend new', res.locals.publishedProject)
6867
return next();
6968
}
7069
}

0 commit comments

Comments
 (0)