Skip to content

Commit 7acb126

Browse files
committed
Merge branch 'dev' into Rick/backend
2 parents f8dfbb0 + acba201 commit 7acb126

File tree

5 files changed

+34
-33
lines changed

5 files changed

+34
-33
lines changed

app/src/components/left/RoomsContainer.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import store from '../../redux/store';
1616
//pasted from navbarbuttons
1717
import debounce from '../../../../node_modules/lodash/debounce.js';
1818

19-
// for websockets
20-
// Part - join room and room code functionality
19+
// // for websockets
20+
// // Part - join room and room code functionality
2121
let socket;
2222
const { API_BASE_URL } = config;
2323
const RoomsContainer = () => {
@@ -29,11 +29,12 @@ const RoomsContainer = () => {
2929
joinedRoom: store.roomCodeSlice.roomCode
3030
}));
3131
React.useEffect(() => {
32-
console.log('joinedRoom: ', joinedRoom);
32+
console.log('You Joined Room: ', joinedRoom);
3333
}, [joinedRoom]);
3434

3535
function initSocketConnection(roomCode) {
3636
if (socket) {
37+
//edge case check if socket connection existed
3738
socket.disconnect();
3839
}
3940

@@ -79,9 +80,9 @@ const RoomsContainer = () => {
7980
function handleUserEnteredRoom(roomCode) {
8081
initSocketConnection(roomCode);
8182
}
82-
//line 83-113 was pasted in from NavBarButtons
83-
let previousState = store.getState();
8483

84+
let previousState = store.getState();
85+
// console.log('Store States: ', store.getState);
8586
// sending info to backend whenever the redux store changes
8687
const handleStoreChange = debounce(() => {
8788
const newState = store.getState();
@@ -113,7 +114,6 @@ const RoomsContainer = () => {
113114
function joinRoom() {
114115
dispatch(changeRoom(roomCode));
115116
setConfirmRoom((confirmRoom) => roomCode);
116-
117117
// Call handleUserEnteredRoom when joining a room
118118
handleUserEnteredRoom(roomCode);
119119
}
@@ -129,6 +129,9 @@ const RoomsContainer = () => {
129129
}}
130130
>
131131
{' '}
132+
<Typography variant="h6" color={'white'}>
133+
Live Room: {joinedRoom}
134+
</Typography>
132135
<TextField
133136
hiddenLabel
134137
id="filled-hidden-label-small"
@@ -162,9 +165,6 @@ const RoomsContainer = () => {
162165
>
163166
Join Room
164167
</Button>
165-
<Typography variant="h6" color={'white'}>
166-
In Room: {joinedRoom}
167-
</Typography>
168168
</Stack>
169169
{/* <button onClick={() => joinRoom()}>Join Room</button> */}
170170
</div>

app/src/components/top/NavBarButtons.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,14 @@ function navbarDropDown(props) {
327327
<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" />
328328
</svg>
329329
</button>
330+
<<<<<<< HEAD
331+
{/* {<ExportButton />} */}
332+
{/*
333+
<button onClick={handleDarkModeToggle}>
334+
{isDarkMode ? 'Light' : 'Dark'} Mode {switchDark}
335+
</button> */}
336+
=======
337+
>>>>>>> dev
330338
{state.isLoggedIn && (
331339
<button onClick={handleClick}>
332340
Manage Project

config.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@ const config = {
33
DEV_PORT: 5656,
44
API_BASE_URL: isProduction
55
? 'https://app.reactype.dev'
6-
//: 'http://localhost:8080',
7-
<<<<<<< HEAD
8-
: 'http://localhost:5656',
9-
=======
10-
:'http://localhost:5656',
11-
>>>>>>> dev
6+
: 'http://localhost:5656',
7+
// : 'http://localhost:8080',
128
API_BASE_URL2: isProduction
139
? 'https://app.reactype.dev'
14-
: 'http://localhost:8080',
10+
: 'http://localhost:8080'
1511
};
1612
module.exports = config;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "17.0.0 by Victor Martins, Liam Roh, Denton Wong, Ahnaf Khan, Hernan Damazo",
44
"description": "Prototyping tool for React/Typescript Applications.",
55
"private": true,
6-
"main": "app/electron/main.js",
6+
"main": "app/.electron/main.js",
77
"author": "OS Labs",
88
"contributors": [
99
"Victor Martins",

server/server.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const isTest = process.env.NODE_ENV === 'test';
4141

4242
app.use(express.json({ limit: '100mb' }));
4343
app.use(express.urlencoded({ limit: '100mb', extended: true }));
44-
app.use(cookieParser());//added cookie parser
44+
app.use(cookieParser()); //added cookie parser
4545
// Routes
4646
// const stylesRouter = require('./routers/stylesRouter');
4747
import stylesRouter from './routers/stylesRouter';
@@ -96,9 +96,9 @@ const io = new Server(httpServer, {
9696
});
9797

9898
io.on('connection', (socket) => {
99-
console.log(socket.id);
99+
console.log('Socket ID: -----', socket.id);
100100
socket.on('custom-event', (string, redux_store, room) => {
101-
console.log(room);
101+
console.log('Room Code', room);
102102
if (room) {
103103
socket.to(room).emit('receive message', redux_store);
104104
} else {
@@ -173,17 +173,16 @@ app.post(
173173
);
174174

175175
//confirming whether user is logged in for index.tsx rendering
176-
app.get(
177-
'/loggedIn',
178-
sessionController.isLoggedIn,
179-
(req, res) => res.status(200).json(res.locals.loggedIn)
180-
)
176+
app.get('/loggedIn', sessionController.isLoggedIn, (req, res) =>
177+
res.status(200).json(res.locals.loggedIn)
178+
);
181179

182-
app.get('/logout',
183-
cookieController.deleteCookies,
184-
sessionController.endSession,
185-
(req,res) => res.status(200).json(res.locals.deleted)
186-
)
180+
app.get(
181+
'/logout',
182+
cookieController.deleteCookies,
183+
sessionController.endSession,
184+
(req, res) => res.status(200).json(res.locals.deleted)
185+
);
187186

188187
// user must be logged in to get or save projects, otherwise they will be redirected to login page
189188
app.post(
@@ -193,7 +192,6 @@ app.post(
193192
(req, res) => res.status(200).json(res.locals.savedProject)
194193
);
195194

196-
197195
app.post(
198196
'/getProjects',
199197
sessionController.isLoggedIn,
@@ -236,7 +234,7 @@ app.get(
236234
app.get(
237235
'/cloneProject/:docId',
238236
sessionController.isLoggedIn,
239-
marketplaceController.cloneProject,
237+
marketplaceController.cloneProject,
240238
(req, res) => res.status(200).json(res.locals.clonedProject)
241239
);
242240

@@ -266,7 +264,6 @@ if (isDocker) {
266264
});
267265
}
268266

269-
270267
app.get('/test', (req, res) => {
271268
res.send('test request is working');
272269
});

0 commit comments

Comments
 (0)