Skip to content

Commit c342e76

Browse files
authored
Merge pull request #32 from oslabs-beta/cyrus-styling
More room entry type checking.
2 parents 4070969 + fa31cb3 commit c342e76

File tree

10 files changed

+87
-103
lines changed

10 files changed

+87
-103
lines changed

app/src/components/left/ProfilePage.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const ProfilePage = () => {
4141
}, []);
4242

4343
return (
44-
<Card sx={{ minWidth: 275, color: 'white', backgroundColor: 'black' }}>
44+
<div sx={{ minWidth: 275, color: 'white' }}>
4545
<CardContent>
4646
<Typography variant="h5" component="div" sx={{ color: '#019cde' }}>
4747
{username ? username : null}
@@ -83,7 +83,7 @@ const ProfilePage = () => {
8383
<CardActions>
8484
<Button
8585
size="small"
86-
sx={{ color: '#189bd7' }}
86+
sx={{ color: '#0671e3' }}
8787
href="https://legacy.reactjs.org/tutorial/tutorial.html"
8888
>
8989
React docs
@@ -103,22 +103,21 @@ const ProfilePage = () => {
103103
<CardActions>
104104
<Button
105105
size="small"
106-
sx={{ color: '#189bd7' }}
106+
sx={{ color: '#0671e3' }}
107107
href="https://www.mongodb.com/"
108108
>
109109
MongoDB
110110
</Button>
111111
<Button
112112
size="small"
113-
sx={{ color: '#189bd7' }}
113+
sx={{ color: '#0671e3' }}
114114
href="https://aws.amazon.com/what-is/sql/#:~:text=Structured%20query%20language%20(SQL)%20is,relationships%20between%20the%20data%20values."
115115
>
116116
AWS SQL
117117
</Button>
118118
</CardActions>
119-
120119
<Divider />
121-
</Card>
120+
</div>
122121
);
123122
};
124123

app/src/components/left/RoomsContainer.tsx

Lines changed: 58 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ const RoomsContainer = () => {
6565
const [isPasswordAttemptIncorrect, setIsPasswordAttemptIncorrect] =
6666
useState(true);
6767
const [isCollabRoomTaken, setIsCollabRoomTaken] = useState(false);
68+
const [isRoomAvailable, setIsRoomAvailable] = useState(true);
6869

6970
const dispatch = useDispatch();
7071
const roomCode = useSelector((store: RootState) => store.roomSlice.roomCode);
@@ -74,6 +75,7 @@ const RoomsContainer = () => {
7475
(store: RootState) => store.roomSlice.password
7576
);
7677

78+
7779
const userJoinCollabRoom = useSelector(
7880
(store: RootState) => store.roomSlice.userJoinCollabRoom
7981
);
@@ -118,6 +120,11 @@ const RoomsContainer = () => {
118120
socket.on('room is already taken', () => {
119121
setIsCollabRoomTaken(true);
120122
});
123+
124+
socket.on('room does not exist', () => {
125+
setIsRoomAvailable(false);
126+
127+
});
121128
//If you are the host: send current state to server when a new user joins
122129
socket.on('requesting state from host', (callback) => {
123130
const newState = store.getState(); //pull the current state
@@ -369,13 +376,18 @@ const RoomsContainer = () => {
369376
createNewCollabRoom();
370377
}
371378
};
379+
372380
const userColors = [
373-
'#FC00BD',
374-
'#D0FC00',
375-
'#00DBFC',
376-
'#FD98B8',
377-
'#FCAA00',
378-
'#9267FF'
381+
'#0671e3',
382+
'#2fd64d',
383+
'#f0c000',
384+
'#fb4c64',
385+
'#be5be8',
386+
'#fe9c06',
387+
'#f6352b',
388+
'#1667d1',
389+
'#1667d1',
390+
'#50ed6a'
379391
];
380392

381393
return (
@@ -475,20 +487,39 @@ const RoomsContainer = () => {
475487
placeholder="Nickname"
476488
onChange={(e) => dispatch(setUserName(e.target.value))}
477489
/>
478-
<TextField
479-
error={isCollabRoomTaken}
480-
fullWidth
481-
hiddenLabel={true}
482-
id="filled-hidden-label-small"
483-
variant="standard"
484-
size="small"
485-
value={roomCode}
486-
placeholder="Room Name"
487-
onChange={(e) => dispatch(setRoomCode(e.target.value))}
488-
className="enterRoomInput"
489-
onKeyDown={handleKeyDown}
490-
helperText={isCollabRoomTaken ? 'Room name already taken' : ''}
491-
/>
490+
{isJoinCallabRoom ? (
491+
<TextField
492+
error={isRoomAvailable === false}
493+
fullWidth
494+
hiddenLabel={true}
495+
id="filled-hidden-label-small"
496+
variant="standard"
497+
size="small"
498+
value={roomCode}
499+
placeholder="Room Name"
500+
onChange={(e) => dispatch(setRoomCode(e.target.value))}
501+
className="enterRoomInput"
502+
onKeyDown={handleKeyDown}
503+
helperText={
504+
isRoomAvailable === false ? `Room doesn't exist` : ''
505+
}
506+
/>
507+
) : (
508+
<TextField
509+
error={isCollabRoomTaken}
510+
fullWidth
511+
hiddenLabel={true}
512+
id="filled-hidden-label-small"
513+
variant="standard"
514+
size="small"
515+
value={roomCode}
516+
placeholder="Room Name"
517+
onChange={(e) => dispatch(setRoomCode(e.target.value))}
518+
className="enterRoomInput"
519+
onKeyDown={handleKeyDown}
520+
helperText={isCollabRoomTaken ? 'Room name already taken' : ''}
521+
/>
522+
)}
492523
{isJoinCallabRoom ? (
493524
<TextField
494525
error={isPasswordAttemptIncorrect === false}
@@ -523,11 +554,15 @@ const RoomsContainer = () => {
523554
variant="contained"
524555
disabled={checkInputField(userName, roomCode, roomCode)}
525556
fullWidth
526-
onClick={(e) =>
557+
onClick={(e) => {
527558
isJoinCallabRoom
528559
? joinExistingCollabRoom()
529-
: createNewCollabRoom()
530-
}
560+
: createNewCollabRoom();
561+
562+
setJoinedPasswordAttempt('');
563+
setIsCollabRoomTaken(false);
564+
setIsRoomAvailable(true);
565+
}}
531566
sx={{
532567
backgroundColor: '#e9e9e9',
533568
color: '#253b80',

app/src/components/left/Sidebar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ const Sidebar: React.FC<SidebarProps> = ({
2323
oldValue = newValue;
2424
};
2525

26-
//the following allows users to click on the left panel to expand and collapse.
26+
//the following allows users to click on the left panel to expand and collapse.
2727
// We decided to freeze so we've commented this and line 41 out
2828

29-
29+
3030
// const handleTabClick = (event: React.MouseEvent, oldValue: number) => {
3131
// if (activeTab === oldValue) {
3232
// setActiveTab(null);

app/src/components/main/Canvas.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,16 @@ const Canvas = forwardRef<HTMLDivElement, CanvasProps>(({ zoom }, ref) => {
307307

308308
// Array of colors that color code users as they join the room (In a set order)
309309
const userColors = [
310-
'#FC00BD',
311-
'#D0FC00',
312-
'#00DBFC',
313-
'#FD98B8',
314-
'#FCAA00',
315-
'#9267FF'
310+
'#0671e3',
311+
'#2fd64d',
312+
'#f0c000',
313+
'#fb4c64',
314+
'#be5be8',
315+
'#fe9c06',
316+
'#f6352b',
317+
'#1667d1',
318+
'#1667d1',
319+
'#50ed6a'
316320
];
317321

318322
const zoomedChildren: React.CSSProperties = {
@@ -380,7 +384,7 @@ const Canvas = forwardRef<HTMLDivElement, CanvasProps>(({ zoom }, ref) => {
380384
color: '#ffffff',
381385
backgroundColor: '#151515',
382386
zIndex: 0,
383-
border: '2px solid #354e9c',
387+
border: '2px solid #0671e3',
384388
whiteSpace: 'nowrap',
385389
cursor: 'pointer',
386390
textTransform: 'none'

app/src/components/main/CanvasContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function CanvasContainer(props: CanvasContainerProps): JSX.Element {
8888
color: '#ffffff',
8989
backgroundColor: '#151515',
9090
zIndex: 0,
91-
border: '2px solid #354e9c'
91+
border: '2px solid #0671e3'
9292
};
9393

9494
return (

app/src/components/top/NavBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,4 +269,4 @@ const NavBar: React.FC = () => {
269269
);
270270
};
271271

272-
export default NavBar;
272+
export default NavBar;

app/src/components/top/NewExportButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,4 @@ export default function NewExportButton(): React.JSX.Element {
8686
{modal}
8787
</div>
8888
);
89-
}
89+
}
37.5 KB
Loading

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>ReacType</title>
6+
<title>Reactype</title>
77
<link rel="stylesheet" type="text/css" href="./style.css" />
88
<link
99
rel="icon"
1010
type="image/x-icon"
11-
href="/app/src/public/icons/win/icon.ico"
11+
href="/app/src/public/icons/win/blue-R-white-bg.png"
1212
/>
1313
</head>
1414
<body>

server/server.ts

Lines changed: 6 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,20 @@ const { expressMiddleware } = require('@apollo/server/express4');
55
import cors from 'cors';
66
import bodyParser from 'body-parser';
77
const { json, urlencoded } = bodyParser;
8-
9-
// //possibly redundant
108
const { makeExecutableSchema } = require('@graphql-tools/schema');
119

1210
import express from 'express';
1311
import cookieParser from 'cookie-parser';
14-
1512
import config from '../config.js';
1613
const { API_BASE_URL, DEV_PORT } = config;
17-
1814
import path from 'path';
19-
2015
import userController from './controllers/userController';
2116
import cookieController from './controllers/cookieController';
2217
import sessionController from './controllers/sessionController';
2318
import projectController from './controllers/projectController';
2419
import marketplaceController from './controllers/marketplaceController';
25-
26-
// // docker stuff
2720
import { fileURLToPath } from 'url';
2821
import { dirname } from 'path';
29-
30-
// // env file
3122
import dotenv from 'dotenv';
3223
dotenv.config();
3324

@@ -40,9 +31,8 @@ const isTest = process.env.NODE_ENV === 'test';
4031

4132
app.use(express.json({ limit: '100mb' }));
4233
app.use(express.urlencoded({ limit: '100mb', extended: true }));
43-
app.use(cookieParser()); //added cookie parser
44-
// Routes
45-
// const stylesRouter = require('./routers/stylesRouter');
34+
app.use(cookieParser());
35+
4636
import stylesRouter from './routers/stylesRouter';
4737

4838
// enable cors
@@ -59,13 +49,8 @@ app.use(
5949
})
6050
);
6151

62-
// TODO: github Oauth still needs debugging
63-
// on initial login, redirect back to app is not working correctly when in production environment
64-
// subsequent logins seem to be working fine, however
65-
6652
// NOTE from v13.0 team: GitHub OAuth works fine in Electron production app and the backend for Electron production app is deployed on Heroku at https://reactype-caret.herokuapp.com/ (get credentials from instructor )
6753

68-
// V.15 Team: Github Oauth and Google Oauth works! (starts here)
6954
const passport = require('passport');
7055
const passportSetup = require('./routers/passport-setup');
7156
const session = require('express-session');
@@ -81,15 +66,11 @@ app.use(
8166
);
8267
app.use(passport.initialize());
8368
app.use(passport.session());
84-
85-
// go to other files
86-
// 8080 only for the container
8769
app.use('/auth', authRoutes);
8870

8971
import { createServer } from 'http';
9072
import { Server } from 'socket.io';
9173

92-
//creating an HTTP server and setting up socket.io
9374
const httpServer = createServer(app);
9475
const io = new Server(httpServer, {
9576
transports: ['websocket'],
@@ -130,6 +111,10 @@ io.on('connection', (client) => {
130111
io.emit('room is already taken');
131112
}
132113

114+
if (!roomLists[roomCode] && method === 'JOIN') {
115+
io.emit('room does not exist');
116+
}
117+
133118
if (!roomLists[roomCode] && method === 'CREATE') {
134119
roomLists[roomCode] = {};
135120
roomLists[roomCode].userList = {};
@@ -435,17 +420,7 @@ io.on('connection', (client) => {
435420
});
436421
});
437422

438-
//--------------------------------
439-
440-
/*
441-
GraphQl Router
442-
*/
443-
/* ******************************************************************* */
444-
445-
// Query resolvers
446423
import Query from './graphQL/resolvers/query';
447-
448-
// Mutation resolvers
449424
import Mutation from './graphQL/resolvers/mutation';
450425

451426
// package resolvers into one variable to pass to Apollo Server
@@ -460,28 +435,8 @@ app.use('/user-styles', stylesRouter);
460435
// schemas used for graphQL
461436

462437
import typeDefs from './graphQL/schema/typeDefs';
463-
464-
// instantiate Apollo server and attach to Express server, mounted at 'http://localhost:PORT/graphql'
465-
466-
//use make exacutable schema to allow schema to be passed to new server
467438
const schema = makeExecutableSchema({ typeDefs, resolvers });
468439

469-
// const server = new ApolloServer({ schema });
470-
471-
// //v4 syntax
472-
473-
// await server.start();
474-
// app.use(
475-
// '/graphql',
476-
// cors(),
477-
// json(),
478-
// expressMiddleware(server, {
479-
// context: async ({ req }) => ({ token: req.headers.token })
480-
// })
481-
// );
482-
483-
/** ****************************************************************** */
484-
485440
app.post(
486441
'/signup',
487442
userController.createUser,
@@ -594,15 +549,6 @@ app.get('/test', (req, res) => {
594549
res.send('test request is working');
595550
});
596551

597-
// only for testing purposes in the dev environment
598-
// app.get('/', function(req, res) {
599-
// res.send('Houston, Caret is in orbit!');
600-
// });
601-
602-
// app.use('http://localhost:8080/*', (req, res) => {
603-
// res.status(404).send('not a valid page (404 page)');
604-
// });
605-
// catch-all route handler
606552
app.use('/*', (req, res) => res.status(404).send('Page not found'));
607553

608554
// Global error handler

0 commit comments

Comments
 (0)