Skip to content

Commit 5f06d7a

Browse files
authored
Merge pull request #4 from oslabs-beta/spencer
Spencer
2 parents a0b9607 + aa67998 commit 5f06d7a

File tree

3 files changed

+16
-83
lines changed

3 files changed

+16
-83
lines changed

app/src/components/main/CanvasContainer.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ import { DeveloperMode, ZoomIn, ZoomOut } from '@mui/icons-material';
99
import Canvas from './Canvas';
1010
import { RootState } from '../../redux/store';
1111
import CodePreview from '../bottom/CodePreview';
12-
import { toggleCodePreview } from '../../redux/reducers/slice/appStateSlice';
12+
import { toggleCodePreview, resetAllState } from '../../redux/reducers/slice/appStateSlice';
1313
import createModal from '../right/createModal';
14-
import { resetAllState } from '../../redux/reducers/slice/appStateSlice';
1514
import { emitEvent } from '../../helperFunctions/socket';
1615

1716
interface CanvasContainerProps {
@@ -169,8 +168,8 @@ function CanvasContainer(props: CanvasContainerProps): JSX.Element {
169168
<Button style={{ ...buttonStyle, ...lastButtonStyle }} onClick={() => clearWorkspace()}>
170169
<svg
171170
xmlns="http://www.w3.org/2000/svg"
172-
width="16"
173-
height="16"
171+
width="24"
172+
height="24"
174173
fill="currentColor"
175174
className="bi bi-trash3"
176175
viewBox="0 0 16 16"
@@ -191,6 +190,7 @@ function CanvasContainer(props: CanvasContainerProps): JSX.Element {
191190
) : (
192191
<Canvas zoom={zoom} ref={containerRef} />
193192
)}
193+
{modal}
194194
</div>
195195
);
196196
}

app/src/components/top/NavBarButtons.tsx

Lines changed: 11 additions & 78 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,19 +15,9 @@ 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

@@ -130,54 +117,10 @@ const navbarDropDown = (props): JSX.Element => {
130117
props.setDropDownMenu(true);
131118
};
132119

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-
177120
// handlePublish logic
178121
const handlePublish = () => {
179122
if (!state.name) {
180-
console.log({state});
123+
console.log({ state });
181124
console.error('Project name cannot be empty');
182125
return;
183126
}
@@ -247,33 +190,23 @@ const navbarDropDown = (props): JSX.Element => {
247190
<span>Tutorial</span>
248191
</button>
249192
</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+
>
265197
<svg
266198
xmlns="http://www.w3.org/2000/svg"
267199
width="16"
268200
height="16"
269201
fill="currentColor"
270-
className="bi bi-trash3"
202+
className="bi bi-upload"
271203
viewBox="0 0 16 16"
272204
>
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" />
274207
</svg>
275-
<span>Clear Canvas</span>
276-
</button> */}
208+
<span>Publish</span>
209+
</button>
277210
{state.isLoggedIn && (
278211
<button onClick={handleClick}>
279212
<svg

app/src/containers/MainContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ const MainContainer = (props): JSX.Element => {
9696
//Logic to close the bottompanel when clicking outside of it
9797
const useOutsideClick = () => {
9898
const bottomPanelRef = useRef(null);
99-
99+
100100
useEffect(() => {
101101
const handleClick = (event) => {
102102
if (

0 commit comments

Comments
 (0)