Skip to content

Commit aa67998

Browse files
committed
Cleaned up migrated/depreciated code from navbarbutton
1 parent 47e383a commit aa67998

File tree

1 file changed

+29
-101
lines changed

1 file changed

+29
-101
lines changed

app/src/components/top/NavBarButtons.tsx

Lines changed: 29 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
import React, { Ref, useEffect, useRef } from 'react';
33
import { useDispatch, useSelector } from 'react-redux';
44
// import { Button } from '@mui/material';
5-
// import ListItem from '@mui/material/ListItem';
6-
// import List from '@mui/material/List';
7-
// import ListItemText from '@mui/material/ListItemText';
85
import Menu from '@mui/material/Menu';
96
import MenuItem from '@mui/material/MenuItem';
107
import { Link } from 'react-router-dom';
@@ -18,44 +15,32 @@ import ProjectsFolder from '../right/OpenProjects';
1815
import store, { RootState } from '../../redux/store';
1916
import SaveProjectButton from '../right/SaveProjectButton';
2017
import serverConfig from '../../serverConfig.js';
21-
// import createModal from '../right/createModal';
22-
// import { resetAllState } from '../../redux/reducers/slice/appStateSlice';
23-
// import { setStyle } from '../../redux/reducers/slice/styleSlice';
24-
// import { emitEvent } from '../../helperFunctions/socket';
25-
2618
// added imports for publish logic
2719
import { publishProject } from '../../helperFunctions/projectGetSaveDel';
28-
import {
29-
updateProjectId,
30-
updateProjectName,
31-
updateProjectPublished,
32-
toggleScreenshotTrigger
33-
} from '../../redux/reducers/slice/appStateSlice';
20+
import { updateProjectId, updateProjectName, updateProjectPublished, toggleScreenshotTrigger } from '../../redux/reducers/slice/appStateSlice';
3421

3522
const { API_BASE_URL } = serverConfig;
3623

37-
const useStyles = makeStyles((theme) =>
38-
createStyles({
39-
root: {
40-
flexGrow: 1,
41-
width: '100%'
42-
},
43-
menuButton: {
44-
marginRight: theme.spacing(1),
45-
color: 'white'
46-
},
47-
title: {
48-
flexGrow: 1,
49-
color: 'white'
50-
},
51-
manageProject: {
52-
display: 'flex',
53-
justifyContent: 'center',
54-
width: '100px',
55-
overflow: 'none'
56-
}
57-
})
58-
);
24+
const useStyles = makeStyles((theme) => createStyles({
25+
root: {
26+
flexGrow: 1,
27+
width: '100%',
28+
},
29+
menuButton: {
30+
marginRight: theme.spacing(1),
31+
color: 'white',
32+
},
33+
title: {
34+
flexGrow: 1,
35+
color: 'white',
36+
},
37+
manageProject: {
38+
display: 'flex',
39+
justifyContent: 'center',
40+
width: '100px',
41+
overflow: 'none',
42+
},
43+
}));
5944

6045
interface StyledMenuProps extends React.PropsWithChildren<{}> {
6146
id: string;
@@ -67,18 +52,18 @@ interface StyledMenuProps extends React.PropsWithChildren<{}> {
6752

6853
const StyledMenu = withStyles({
6954
paper: {
70-
border: '1px solid #d3d4d5'
71-
}
55+
border: '1px solid #d3d4d5',
56+
},
7257
})((props: StyledMenuProps) => (
7358
<Menu
7459
elevation={0}
7560
anchorOrigin={{
7661
vertical: 'bottom',
77-
horizontal: 'center'
62+
horizontal: 'center',
7863
}}
7964
transformOrigin={{
8065
vertical: 'top',
81-
horizontal: 'center'
66+
horizontal: 'center',
8267
}}
8368
open={true}
8469
{...props}
@@ -89,10 +74,10 @@ const StyledMenuItem = withStyles((theme) => ({
8974
root: {
9075
'&:focus': {
9176
'& .MuiListItemIcon-root, & .MuiListItemText-primary': {
92-
color: theme.palette.common.white
93-
}
94-
}
95-
}
77+
color: theme.palette.common.white,
78+
},
79+
},
80+
},
9681
}))(MenuItem);
9782

9883
/**
@@ -132,50 +117,6 @@ const navbarDropDown = (props): JSX.Element => {
132117
props.setDropDownMenu(true);
133118
};
134119

135-
// const clearWorkspace = () => {
136-
// // Reset state for project to initial state
137-
// const resetState = () => {
138-
// if (roomCode) emitEvent('clearCanvasAction', roomCode, userName);
139-
// else dispatch(resetAllState());
140-
// };
141-
// // Set modal options
142-
// const children = (
143-
// <List className="export-preference" style={{ zIndex: '12' }}>
144-
// <ListItem
145-
// key={'clear'}
146-
// button
147-
// onClick={resetState}
148-
// style={{
149-
// backgroundColor: '#E12D39',
150-
// borderRadius: '50px',
151-
// marginBottom: '2%',
152-
// marginTop: '5%',
153-
// }}
154-
// >
155-
// <ListItemText
156-
// primary={'Yes, delete all project data'}
157-
// style={{ textAlign: 'center' }}
158-
// onClick={closeModal}
159-
// />
160-
// </ListItem>
161-
// </List>
162-
// );
163-
164-
// // Create modal
165-
// setModal(
166-
// createModal({
167-
// closeModal,
168-
// children,
169-
// message: 'Are you sure you want to delete all data?',
170-
// primBtnLabel: null,
171-
// primBtnAction: null,
172-
// secBtnAction: null,
173-
// secBtnLabel: null,
174-
// open: true,
175-
// }),
176-
// );
177-
// };
178-
179120
// handlePublish logic
180121
const handlePublish = () => {
181122
if (!state.name) {
@@ -266,19 +207,6 @@ const navbarDropDown = (props): JSX.Element => {
266207
</svg>
267208
<span>Publish</span>
268209
</button>
269-
{/* <button onClick={() => clearWorkspace()}>
270-
<svg
271-
xmlns="http://www.w3.org/2000/svg"
272-
width="16"
273-
height="16"
274-
fill="currentColor"
275-
className="bi bi-trash3"
276-
viewBox="0 0 16 16"
277-
>
278-
<path d="M6.5 1h3a.5.5 0 0 1 .5.5v1H6v-1a.5.5 0 0 1 .5-.5ZM11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3A1.5 1.5 0 0 0 5 1.5v1H2.506a.58.58 0 0 0-.01 0H1.5a.5.5 0 0 0 0 1h.538l.853 10.66A2 2 0 0 0 4.885 16h6.23a2 2 0 0 0 1.994-1.84l.853-10.66h.538a.5.5 0 0 0 0-1h-.995a.59.59 0 0 0-.01 0H11Zm1.958 1-.846 10.58a1 1 0 0 1-.997.92h-6.23a1 1 0 0 1-.997-.92L3.042 3.5h9.916Zm-7.487 1a.5.5 0 0 1 .528.47l.5 8.5a.5.5 0 0 1-.998.06L5 5.03a.5.5 0 0 1 .47-.53Zm5.058 0a.5.5 0 0 1 .47.53l-.5 8.5a.5.5 0 1 1-.998-.06l.5-8.5a.5.5 0 0 1 .528-.47ZM8 4.5a.5.5 0 0 1 .5.5v8.5a.5.5 0 0 1-1 0V5a.5.5 0 0 1 .5-.5Z" />
279-
</svg>
280-
<span>Clear Canvas</span>
281-
</button> */}
282210
{state.isLoggedIn && (
283211
<button onClick={handleClick}>
284212
<svg

0 commit comments

Comments
 (0)