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,19 +15,9 @@ 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
@@ -130,54 +117,10 @@ const navbarDropDown = (props): JSX.Element => {
130
117
props . setDropDownMenu ( true ) ;
131
118
} ;
132
119
133
- // const clearWorkspace = () => {
134
- // // Reset state for project to initial state
135
- // const resetState = () => {
136
- // if (roomCode) emitEvent('clearCanvasAction', roomCode, userName);
137
- // else dispatch(resetAllState());
138
- // };
139
- // // Set modal options
140
- // const children = (
141
- // <List className="export-preference" style={{ zIndex: '12' }}>
142
- // <ListItem
143
- // key={'clear'}
144
- // button
145
- // onClick={resetState}
146
- // style={{
147
- // backgroundColor: '#E12D39',
148
- // borderRadius: '50px',
149
- // marginBottom: '2%',
150
- // marginTop: '5%',
151
- // }}
152
- // >
153
- // <ListItemText
154
- // primary={'Yes, delete all project data'}
155
- // style={{ textAlign: 'center' }}
156
- // onClick={closeModal}
157
- // />
158
- // </ListItem>
159
- // </List>
160
- // );
161
-
162
- // // Create modal
163
- // setModal(
164
- // createModal({
165
- // closeModal,
166
- // children,
167
- // message: 'Are you sure you want to delete all data?',
168
- // primBtnLabel: null,
169
- // primBtnAction: null,
170
- // secBtnAction: null,
171
- // secBtnLabel: null,
172
- // open: true,
173
- // }),
174
- // );
175
- // };
176
-
177
120
// handlePublish logic
178
121
const handlePublish = ( ) => {
179
122
if ( ! state . name ) {
180
- console . log ( { state} ) ;
123
+ console . log ( { state } ) ;
181
124
console . error ( 'Project name cannot be empty' ) ;
182
125
return ;
183
126
}
@@ -247,33 +190,23 @@ const navbarDropDown = (props): JSX.Element => {
247
190
< span > Tutorial</ span >
248
191
</ button >
249
192
</ Link >
250
- < button onClick = { handlePublish } style = { { backgroundColor : '#0671E3' , color : 'white' } } >
251
- < svg
252
- xmlns = "http://www.w3.org/2000/svg"
253
- width = "16"
254
- height = "16"
255
- fill = "currentColor"
256
- className = "bi bi-upload"
257
- viewBox = "0 0 16 16"
258
- >
259
- < path d = "M.5 9.5a.5.5 0 0 0 .5.5h3v5a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-5h3a.5.5 0 0 0 .5-.5v-4a.5.5 0 0 0-.5-.5H10V1.5a.5.5 0 0 0-1 0v3H7V1.5a.5.5 0 0 0-1 0v3H.5a.5.5 0 0 0-.5.5v4z" />
260
- < path d = "M7 6v6h2V6H7z" />
261
- </ svg >
262
- < span > Publish</ span >
263
- </ button >
264
- { /* <button onClick={() => clearWorkspace()}>
193
+ < button
194
+ onClick = { handlePublish }
195
+ style = { { textDecoration : 'none' } }
196
+ >
265
197
< svg
266
198
xmlns = "http://www.w3.org/2000/svg"
267
199
width = "16"
268
200
height = "16"
269
201
fill = "currentColor"
270
- className="bi bi-trash3 "
202
+ className = "bi bi-upload "
271
203
viewBox = "0 0 16 16"
272
204
>
273
- <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" />
205
+ < path d = "M.5 9.5a.5.5 0 0 0 .5.5h3v5a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-5h3a.5.5 0 0 0 .5-.5v-4a.5.5 0 0 0-.5-.5H10V1.5a.5.5 0 0 0-1 0v3H7V1.5a.5.5 0 0 0-1 0v3H.5a.5.5 0 0 0-.5.5v4z" />
206
+ < path d = "M7 6v6h2V6H7z" />
274
207
</ svg >
275
- <span>Clear Canvas </span>
276
- </button> */ }
208
+ < span > Publish </ span >
209
+ </ button >
277
210
{ state . isLoggedIn && (
278
211
< button onClick = { handleClick } >
279
212
< svg
0 commit comments