2
2
import React , { Ref , useEffect , useRef } from 'react' ;
3
3
import { useDispatch , useSelector } from 'react-redux' ;
4
4
// 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';
8
5
import Menu from '@mui/material/Menu' ;
9
6
import MenuItem from '@mui/material/MenuItem' ;
10
7
import { Link } from 'react-router-dom' ;
@@ -18,44 +15,32 @@ import ProjectsFolder from '../right/OpenProjects';
18
15
import store , { RootState } from '../../redux/store' ;
19
16
import SaveProjectButton from '../right/SaveProjectButton' ;
20
17
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
-
26
18
// added imports for publish logic
27
19
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' ;
34
21
35
22
const { API_BASE_URL } = serverConfig ;
36
23
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
+ } ) ) ;
59
44
60
45
interface StyledMenuProps extends React . PropsWithChildren < { } > {
61
46
id : string ;
@@ -67,18 +52,18 @@ interface StyledMenuProps extends React.PropsWithChildren<{}> {
67
52
68
53
const StyledMenu = withStyles ( {
69
54
paper : {
70
- border : '1px solid #d3d4d5'
71
- }
55
+ border : '1px solid #d3d4d5' ,
56
+ } ,
72
57
} ) ( ( props : StyledMenuProps ) => (
73
58
< Menu
74
59
elevation = { 0 }
75
60
anchorOrigin = { {
76
61
vertical : 'bottom' ,
77
- horizontal : 'center'
62
+ horizontal : 'center' ,
78
63
} }
79
64
transformOrigin = { {
80
65
vertical : 'top' ,
81
- horizontal : 'center'
66
+ horizontal : 'center' ,
82
67
} }
83
68
open = { true }
84
69
{ ...props }
@@ -89,10 +74,10 @@ const StyledMenuItem = withStyles((theme) => ({
89
74
root : {
90
75
'&:focus' : {
91
76
'& .MuiListItemIcon-root, & .MuiListItemText-primary' : {
92
- color : theme . palette . common . white
93
- }
94
- }
95
- }
77
+ color : theme . palette . common . white ,
78
+ } ,
79
+ } ,
80
+ } ,
96
81
} ) ) ( MenuItem ) ;
97
82
98
83
/**
@@ -132,50 +117,6 @@ const navbarDropDown = (props): JSX.Element => {
132
117
props . setDropDownMenu ( true ) ;
133
118
} ;
134
119
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
-
179
120
// handlePublish logic
180
121
const handlePublish = ( ) => {
181
122
if ( ! state . name ) {
@@ -266,19 +207,6 @@ const navbarDropDown = (props): JSX.Element => {
266
207
</ svg >
267
208
< span > Publish</ span >
268
209
</ 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> */ }
282
210
{ state . isLoggedIn && (
283
211
< button onClick = { handleClick } >
284
212
< svg
0 commit comments