Compare commits
32 Commits
authentica
...
userdash-f
Author | SHA1 | Date | |
---|---|---|---|
1e62ba70d1 | |||
fba8212aeb | |||
5c7e26a1a9 | |||
|
e773477fb0 | ||
|
196c36444d | ||
6a9e677043 | |||
|
329cc7c74f | ||
|
30c407563d | ||
|
4f338a2005 | ||
|
b717c94e4e | ||
caed17bc8e | |||
|
c7cd9481f3 | ||
d402a67266 | |||
|
340acfa2ed | ||
c1fe10ddc8 | |||
|
532b5d3876 | ||
38d9267bff | |||
|
528cb80c1f | ||
|
a1ed8d14fa | ||
|
641eca074f | ||
|
ae1c05c944 | ||
|
7ea36e01e5 | ||
|
9c583ce5e0 | ||
|
61c138f5c3 | ||
|
d9b0c827c8 | ||
|
0a1323da8a | ||
|
7e17e1c9e9 | ||
|
ab80301f31 | ||
|
c332594b40 | ||
|
fa8c2e7cf9 | ||
ffe8dad9ff | |||
1e0f79387a |
20
README.md
20
README.md
@@ -1 +1,21 @@
|
|||||||
# team58
|
# team58
|
||||||
|
|
||||||
|
Sports Matcher is an application that allows users to connect with other athletes, schedule sports meets, and rent sports equipment!
|
||||||
|
|
||||||
|
**Built Using**
|
||||||
|
|
||||||
|
It is built using the React framework and the Material UI and React Bootstrap libraries.
|
||||||
|
|
||||||
|
**Instructions**
|
||||||
|
|
||||||
|
To use Sports Matcher, navigate to the sports-matcher directory in the repository and run the commands `npm i` and `npm start` in order. This should launch a localhost window in your browser which shows the homepage.
|
||||||
|
|
||||||
|
From here you can Sign In to your account using the username "admin" and password "admin" OR using the username "user" and password "user" as specified in the handout.
|
||||||
|
|
||||||
|
Signing in as 'admin' will take you to the admin page. You will be able to see a list of current matches, users and suspended users. You will need to click the appropriate button for the correct table to appear.
|
||||||
|
|
||||||
|
Every page has a navbar at the top. There is a chat and profile icon. Clicking on the chat icon will take you to the chat page. From the profile icon you can sign out.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
2
sports-matcher/.gitignore
vendored
2
sports-matcher/.gitignore
vendored
@@ -21,3 +21,5 @@
|
|||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
|
|
||||||
|
package-lock.json
|
27566
sports-matcher/package-lock.json
generated
27566
sports-matcher/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
BIN
sports-matcher/public/chief.jpg
Normal file
BIN
sports-matcher/public/chief.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 244 KiB |
BIN
sports-matcher/public/freeman.jpg
Normal file
BIN
sports-matcher/public/freeman.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 69 KiB |
BIN
sports-matcher/public/shogun.jpg
Normal file
BIN
sports-matcher/public/shogun.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
8
sports-matcher/src/Admin.css
Normal file
8
sports-matcher/src/Admin.css
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
.MainTable {
|
||||||
|
padding : 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.Title {
|
||||||
|
margin-top: 40px;
|
||||||
|
}
|
258
sports-matcher/src/Admin.js
Normal file
258
sports-matcher/src/Admin.js
Normal file
@@ -0,0 +1,258 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import './Admin.css';
|
||||||
|
import Button from '@mui/material/Button';
|
||||||
|
import Typography from '@mui/material/Typography';
|
||||||
|
import Container from '@mui/material/Container';
|
||||||
|
import { TableContainer, TableCell, Table, TableBody, TableRow, TableHead, Paper } from '@mui/material';
|
||||||
|
import Navbar from './Navbar';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class AdminTable extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
users: [
|
||||||
|
{ id: 1, username: 'username1', name: 'name1', email: 'user1@email.com', phone: '123-456-7890' },
|
||||||
|
{ id: 2, username: 'username2', name: 'name2', email: 'user2@email.com', phone: '123-456-7890' },
|
||||||
|
{ id: 3, username: 'username3', name: 'name3', email: 'user3@email.com', phone: '123-456-7890' },
|
||||||
|
{ id: 4, username: 'username4', name: 'name4', email: 'user4@email.com', phone: '123-456-7890' }
|
||||||
|
],
|
||||||
|
suspendedUsers: [
|
||||||
|
{ id: 1, username: 'suspended1', name: 's1', email: 's1@email.com', phone: '123-456-7890' },
|
||||||
|
{ id: 2, username: 'suspended2', name: 's2', email: 's2@email.com', phone: '123-456-7890' },
|
||||||
|
{ id: 3, username: 'suspended3', name: 's3', email: 's3@email.com', phone: '123-456-7890' },
|
||||||
|
{ id: 4, username: 'suspended4', name: 's4', email: 's4@email.com', phone: '123-456-7890' }
|
||||||
|
],
|
||||||
|
matches: [
|
||||||
|
{ id: 1, sport: "Tennis", date: '08/08/2021', location: 'toronto', description: 'Tennis match' },
|
||||||
|
{ id: 2, sport: "Basketball", date: '09/09/2021', location: 'toronto', description: 'Basketball match' }
|
||||||
|
],
|
||||||
|
buttonColors: ['black', '', '']
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
editButton() {
|
||||||
|
return <Button onClick={() => {
|
||||||
|
alert('clicked');
|
||||||
|
}} variant="contained">Edit</Button>;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteButtonClick() {
|
||||||
|
return (
|
||||||
|
<Container component="main" maxWidth="xs">
|
||||||
|
|
||||||
|
<Typography>Are you sure you want to delete this user?</Typography>
|
||||||
|
<Button onClick={() => {
|
||||||
|
alert('User deleted');
|
||||||
|
}} variant="contained">Yes</Button>
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
newDeleteButtonClick() {
|
||||||
|
return (<form onsubmit="console.log('You clicked submit.'); return false">
|
||||||
|
<button type="submit">Submit</button>
|
||||||
|
</form>)
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteButton() {
|
||||||
|
return <Button onClick={() => {
|
||||||
|
alert('User deleted.');
|
||||||
|
}} variant="contained">Delete</Button>;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
matchDeleteButton() {
|
||||||
|
return <Button onClick={() => {
|
||||||
|
alert('Match deleted.');
|
||||||
|
}} variant="contained">Delete</Button>;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pardonButton() {
|
||||||
|
return <Button onClick={() => {
|
||||||
|
alert('User pardoned.');
|
||||||
|
}} variant="contained">Pardon</Button>;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
userTableData() {
|
||||||
|
return this.state.users.map((user) => {
|
||||||
|
const { id, username, name, email, phone } = user;
|
||||||
|
return (
|
||||||
|
<TableRow>
|
||||||
|
<TableCell>{id}</TableCell>
|
||||||
|
<TableCell>{username}</TableCell>
|
||||||
|
<TableCell>{name}</TableCell>
|
||||||
|
<TableCell>{email}</TableCell>
|
||||||
|
<TableCell>{phone}</TableCell>
|
||||||
|
<TableCell>{this.deleteButton()}</TableCell>
|
||||||
|
<TableCell>{this.editButton()}</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
suspendedUserTableData() {
|
||||||
|
return this.state.suspendedUsers.map((user) => {
|
||||||
|
const { id, username, name, email, phone } = user
|
||||||
|
return (
|
||||||
|
<TableRow>
|
||||||
|
<TableCell>{id}</TableCell>
|
||||||
|
<TableCell>{username}</TableCell>
|
||||||
|
<TableCell>{name}</TableCell>
|
||||||
|
<TableCell>{email}</TableCell>
|
||||||
|
<TableCell>{phone}</TableCell>
|
||||||
|
<TableCell>{this.deleteButton()}</TableCell>
|
||||||
|
<TableCell>{this.editButton()}</TableCell>
|
||||||
|
<TableCell>{this.pardonButton()}</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
matchTableData() {
|
||||||
|
return this.state.matches.map((match) => {
|
||||||
|
const { id, sport, date, location, description } = match
|
||||||
|
return (
|
||||||
|
<TableRow>
|
||||||
|
<TableCell>{id}</TableCell>
|
||||||
|
<TableCell>{sport}</TableCell>
|
||||||
|
<TableCell>{date}</TableCell>
|
||||||
|
<TableCell>{location}</TableCell>
|
||||||
|
<TableCell>{description}</TableCell>
|
||||||
|
<TableCell>{this.matchDeleteButton()}</TableCell>
|
||||||
|
<TableCell>{this.editButton()}</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
matchTableHead() {
|
||||||
|
return (
|
||||||
|
<TableHead>
|
||||||
|
<TableRow>
|
||||||
|
<TableCell>ID</TableCell>
|
||||||
|
<TableCell>Sport</TableCell>
|
||||||
|
<TableCell>Date</TableCell>
|
||||||
|
<TableCell>Location</TableCell>
|
||||||
|
<TableCell>Description</TableCell>
|
||||||
|
<TableCell></TableCell>
|
||||||
|
<TableCell></TableCell>
|
||||||
|
</TableRow>
|
||||||
|
</TableHead>
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
suspendedUserTableHead() {
|
||||||
|
return (
|
||||||
|
<TableHead>
|
||||||
|
<TableRow>
|
||||||
|
<TableCell>ID</TableCell>
|
||||||
|
<TableCell>Username</TableCell>
|
||||||
|
<TableCell>Name</TableCell>
|
||||||
|
<TableCell>Email</TableCell>
|
||||||
|
<TableCell>Phone</TableCell>
|
||||||
|
<TableCell></TableCell>
|
||||||
|
<TableCell></TableCell>
|
||||||
|
<TableCell></TableCell>
|
||||||
|
</TableRow>
|
||||||
|
</TableHead>
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
userTableHead() {
|
||||||
|
return (
|
||||||
|
<TableHead>
|
||||||
|
<TableRow>
|
||||||
|
<TableCell>ID</TableCell>
|
||||||
|
<TableCell>Username</TableCell>
|
||||||
|
<TableCell>Name</TableCell>
|
||||||
|
<TableCell>Email</TableCell>
|
||||||
|
<TableCell>Phone</TableCell>
|
||||||
|
<TableCell></TableCell>
|
||||||
|
<TableCell></TableCell>
|
||||||
|
</TableRow>
|
||||||
|
</TableHead>
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
selectTable() {
|
||||||
|
this.setState({ buttonColors: ['', '', ''] });
|
||||||
|
}
|
||||||
|
|
||||||
|
renderTableHead() {
|
||||||
|
if (this.state.buttonColors[0] === 'black') {
|
||||||
|
return this.matchTableHead();
|
||||||
|
} else if (this.state.buttonColors[1] === 'black') {
|
||||||
|
return this.userTableHead();
|
||||||
|
} else {
|
||||||
|
return this.suspendedUserTableHead();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderTableData() {
|
||||||
|
if (this.state.buttonColors[0] === 'black') {
|
||||||
|
return this.matchTableData();
|
||||||
|
} else if (this.state.buttonColors[1] === 'black') {
|
||||||
|
return this.userTableData();
|
||||||
|
} else {
|
||||||
|
return this.suspendedUserTableData();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Navbar></Navbar>
|
||||||
|
<h1 className='Title'>Administration</h1>
|
||||||
|
<div className='ButtonList'>
|
||||||
|
<Button onClick={() => {
|
||||||
|
this.setState({ buttonColors: ['black', '', ''] });
|
||||||
|
}} sx={{
|
||||||
|
margin: 3,
|
||||||
|
backgroundColor: this.state.buttonColors[0],
|
||||||
|
}} variant="outlined">Matches</Button>
|
||||||
|
<Button onClick={() => {
|
||||||
|
this.setState({ buttonColors: ['', 'black', ''] });
|
||||||
|
}} sx={{
|
||||||
|
margin: 3,
|
||||||
|
backgroundColor: this.state.buttonColors[1],
|
||||||
|
}} variant="outlined">Users</Button>
|
||||||
|
<Button onClick={() => {
|
||||||
|
this.setState({ buttonColors: ['', '', 'black'] });
|
||||||
|
}} sx={{
|
||||||
|
margin: 3,
|
||||||
|
backgroundColor: this.state.buttonColors[2],
|
||||||
|
}} variant="outlined">Suspended Users</Button></div>
|
||||||
|
<div className='MainTable'>
|
||||||
|
<TableContainer
|
||||||
|
component={Paper}
|
||||||
|
variant="outlined"
|
||||||
|
>
|
||||||
|
<Table>
|
||||||
|
{this.renderTableHead()}
|
||||||
|
<TableBody>
|
||||||
|
{this.renderTableData()}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</TableContainer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AdminTable
|
@@ -2,14 +2,21 @@ import './App.css';
|
|||||||
import { Routes, Route, Link } from "react-router-dom";
|
import { Routes, Route, Link } from "react-router-dom";
|
||||||
import SignIn from './SignIn';
|
import SignIn from './SignIn';
|
||||||
import SignUp from './SignUp';
|
import SignUp from './SignUp';
|
||||||
|
import Admin from './Admin';
|
||||||
import Home from './Home';
|
import Home from './Home';
|
||||||
|
import ChatWindow from './ChatWindow';
|
||||||
|
import UserDashboard from "./UserDashboard";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
<div className="App">
|
<div className="App">
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="" element={<Home />} />
|
<Route path="" element={<Home />} />
|
||||||
|
<Route path="dashboard" element={<UserDashboard />} />
|
||||||
<Route path="sign-in" element={<SignIn />} />
|
<Route path="sign-in" element={<SignIn />} />
|
||||||
<Route path="sign-up" element={<SignUp />} />
|
<Route path="sign-up" element={<SignUp />} />
|
||||||
|
<Route path="admin" element={<Admin />} />
|
||||||
|
<Route path="chat-window" element={<ChatWindow />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
20
sports-matcher/src/CardSuggestedMatches.js
Normal file
20
sports-matcher/src/CardSuggestedMatches.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { Stack, Typography } from "@mui/material";
|
||||||
|
import MatchInfo from "./matchinfo";
|
||||||
|
|
||||||
|
export default function CardSuggestedMatches() {
|
||||||
|
return (
|
||||||
|
<div style={{ padding: 25 }}>
|
||||||
|
<Typography variant="h4" component="div">
|
||||||
|
Suggested
|
||||||
|
</Typography>
|
||||||
|
<Stack sx={{ margin: 2 }} direction="row" spacing={2}>
|
||||||
|
<MatchInfo>
|
||||||
|
</MatchInfo>
|
||||||
|
<MatchInfo>
|
||||||
|
</MatchInfo>
|
||||||
|
<MatchInfo>
|
||||||
|
</MatchInfo>
|
||||||
|
</Stack >
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
18
sports-matcher/src/Chat.js
Normal file
18
sports-matcher/src/Chat.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/* Please direct questions to Hansi Xu (Wallace LaWall on Discord) */
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import './chats.css'
|
||||||
|
|
||||||
|
class Chat extends React.Component {
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div class="chatbubble-container">
|
||||||
|
<div class= {this.props.side === "left" ? "chatbubble left": "chatbubble right"}>
|
||||||
|
{this.props.message}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Chat;
|
115
sports-matcher/src/ChatWindow.js
Normal file
115
sports-matcher/src/ChatWindow.js
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
/* Please direct questions to Hansi Xu (Wallace LaWall on Discord) */
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import './chats.css'
|
||||||
|
import Chat from './Chat'
|
||||||
|
import Contact from './Contact'
|
||||||
|
import { useState } from "react";
|
||||||
|
import Navbar from './Navbar';
|
||||||
|
|
||||||
|
class ChatWindow extends React.Component {
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div class="chatcomponent">
|
||||||
|
<Navbar></Navbar>
|
||||||
|
<UserList />
|
||||||
|
<MessageList />
|
||||||
|
<ChatInput />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class UserList extends React.Component {
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div class="contactlist">
|
||||||
|
<Contact pfpsrc="./chief.jpg" name="Master Chief"/>
|
||||||
|
<Contact pfpsrc="./freeman.jpg" name="Gordon Freeman" />
|
||||||
|
<Contact pfpsrc="./shogun.jpg" name="Raiden Shogun" selected="true" />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MessageList extends React.Component {
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div class="messagelist">
|
||||||
|
<Chat message="Got time for tennis this week, Raiden?" side="right"/>
|
||||||
|
<Chat message="Foolish question. If I do not even have free time, How am I to pursue eternity and fulfill my promise to the people of Inazuma?" side="left" />
|
||||||
|
<Chat message="Aiight, see you at 4" side="right" />
|
||||||
|
<Chat message="As you wish." side="left" />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// class ChatWindow extends React.Component {
|
||||||
|
// render() {
|
||||||
|
// return (
|
||||||
|
// <div>
|
||||||
|
// <ChatUserList />
|
||||||
|
// {/* <MessageList /> */}
|
||||||
|
// </div>
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
const ChatInput = () => {
|
||||||
|
const [message, setMessage] = useState( '' );
|
||||||
|
|
||||||
|
// const onKeyPress = (e) => {
|
||||||
|
// // if(e.key === 'Enter'){
|
||||||
|
// // e.preventDefault(); // Ensure it is only this code that runs
|
||||||
|
// // setMessage("")
|
||||||
|
// // }
|
||||||
|
// }
|
||||||
|
|
||||||
|
const onKeyDown = (e) => {
|
||||||
|
const keyCode = e.which || e.keyCode;
|
||||||
|
|
||||||
|
// 13 represents the Enter key
|
||||||
|
if (keyCode === 13 && !e.shiftKey) {
|
||||||
|
e.preventDefault();
|
||||||
|
setMessage("")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
// onKeyPress={(e) => onKeyPress(e)}
|
||||||
|
<div>
|
||||||
|
<textarea
|
||||||
|
class="chatinput"
|
||||||
|
value={message}
|
||||||
|
placeholder="Press ENTER to send, SHIFT + ENTER for new line"
|
||||||
|
onChange={e => setMessage(e.target.value)}
|
||||||
|
|
||||||
|
onKeyDown={onKeyDown}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
class ChatInput2 extends React.Component {
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props)
|
||||||
|
this.setState({inputVal : ""})
|
||||||
|
}
|
||||||
|
|
||||||
|
handleUserInput(e) {
|
||||||
|
this.setState(this.setState({inputVal : e.target.value}));
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (<textarea class="chatinput" placeholder="Press ENTER to send, Ctrl + ENTER for new line"
|
||||||
|
onKeyPress={(e)=>this.onKeyPress(e)} value="" onChange={(e) => this.handleUserInput(e)} />)
|
||||||
|
|
||||||
|
}
|
||||||
|
onKeyPress(e) {
|
||||||
|
if(e.key === 'Enter'){
|
||||||
|
e.preventDefault(); // Ensure it is only this code that runs
|
||||||
|
this.setState({inputVal : ""});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export default ChatWindow;
|
38
sports-matcher/src/Contact.js
Normal file
38
sports-matcher/src/Contact.js
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/* Please direct questions to Hansi Xu (Wallace LaWall on Discord) */
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import './chats.css';
|
||||||
|
|
||||||
|
class Contact extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props)
|
||||||
|
this.state = {
|
||||||
|
selected : this.props.selected
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onClick() {
|
||||||
|
// This toggling of the contact selection is for demo purposes only
|
||||||
|
// Once backend is implemented, only one contact can be selected
|
||||||
|
if (this.state.selected === "false") {
|
||||||
|
this.setState({selected : "true"})
|
||||||
|
} else {
|
||||||
|
this.setState({selected : "false"})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div class={this.state.selected === "true" ? "contact dark" : "contact"}>
|
||||||
|
<div class="profilepiccontainer">
|
||||||
|
<img src={this.props.pfpsrc} class="profilepic" onClick={() => this.onClick()}
|
||||||
|
alt="profile" />
|
||||||
|
</div>
|
||||||
|
<div class="profilenamecontainer">
|
||||||
|
<div class="profilename" onClick={() => this.onClick()}>{this.props.name}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Contact;
|
65
sports-matcher/src/Filter.js
Normal file
65
sports-matcher/src/Filter.js
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
import { InputLabel, MenuItem, Select, TextField, FormControl } from "@mui/material";
|
||||||
|
|
||||||
|
export default function Filter() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<FormControl sx={{ margin: 2 }}>
|
||||||
|
<InputLabel id="skill-level-label">Sport</InputLabel>
|
||||||
|
<Select
|
||||||
|
labelId="skill-level-label"
|
||||||
|
id="skill-level"
|
||||||
|
label="Skill level"
|
||||||
|
sx={{ width: 100 }}
|
||||||
|
>
|
||||||
|
<MenuItem value={-10}>Tennis</MenuItem>
|
||||||
|
<MenuItem value={10}>Soccer</MenuItem>
|
||||||
|
<MenuItem value={20}>Golf</MenuItem>
|
||||||
|
<MenuItem value={30}>Basketball</MenuItem>
|
||||||
|
</Select>
|
||||||
|
</FormControl>
|
||||||
|
<FormControl sx={{ margin: 2 }}>
|
||||||
|
<InputLabel id="skill-level-label">Level</InputLabel>
|
||||||
|
<Select
|
||||||
|
labelId="skill-level-label"
|
||||||
|
id="skill-level"
|
||||||
|
label="Skill level"
|
||||||
|
sx={{ width: 100 }}
|
||||||
|
>
|
||||||
|
<MenuItem value={-10}>Everyone</MenuItem>
|
||||||
|
<MenuItem value={10}>Beginner</MenuItem>
|
||||||
|
<MenuItem value={20}>Intermediate</MenuItem>
|
||||||
|
<MenuItem value={30}>Professional</MenuItem>
|
||||||
|
</Select>
|
||||||
|
</FormControl>
|
||||||
|
<FormControl sx={{ margin: 2 }}>
|
||||||
|
<InputLabel id="skill-level-label">Level</InputLabel>
|
||||||
|
<Select
|
||||||
|
labelId="skill-level-label"
|
||||||
|
id="skill-level"
|
||||||
|
label="Skill level"
|
||||||
|
sx={{ width: 100 }}
|
||||||
|
>
|
||||||
|
<MenuItem value={-10}>Everyone</MenuItem>
|
||||||
|
<MenuItem value={10}>Beginner</MenuItem>
|
||||||
|
<MenuItem value={20}>Intermediate</MenuItem>
|
||||||
|
<MenuItem value={30}>Professional</MenuItem>
|
||||||
|
</Select>
|
||||||
|
</FormControl>
|
||||||
|
<FormControl sx={{ margin: 2 }}>
|
||||||
|
<TextField id="outlined-basic" label="Date" variant="outlined" />
|
||||||
|
</FormControl>
|
||||||
|
|
||||||
|
<FormControl sx={{ margin: 2 }}>
|
||||||
|
<TextField id="outlined-basic" label="Time" variant="outlined" />
|
||||||
|
</FormControl>
|
||||||
|
|
||||||
|
<FormControl sx={{ margin: 2 }}>
|
||||||
|
<TextField id="outlined-basic" label="Location" variant="outlined" />
|
||||||
|
</FormControl>
|
||||||
|
|
||||||
|
<FormControl sx={{ margin: 2 }}>
|
||||||
|
<TextField id="outlined-basic" label="Radius" variant="outlined" />
|
||||||
|
</FormControl>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
31
sports-matcher/src/ListSuggestedMatch.js
Normal file
31
sports-matcher/src/ListSuggestedMatch.js
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import ListItem from '@mui/material/ListItem';
|
||||||
|
import ListItemText from '@mui/material/ListItemText';
|
||||||
|
import Typography from '@mui/material/Typography';
|
||||||
|
import SportsTennisIcon from '@mui/icons-material/SportsTennis';
|
||||||
|
import { Button, ListItemIcon } from '@mui/material';
|
||||||
|
|
||||||
|
export default function ListSuggestedMatch() {
|
||||||
|
return (<ListItem alignItems="flex-start">
|
||||||
|
<ListItemIcon>
|
||||||
|
<SportsTennisIcon />
|
||||||
|
</ListItemIcon>
|
||||||
|
<ListItemText
|
||||||
|
primary="Tennis - King of The Court"
|
||||||
|
secondary={
|
||||||
|
<React.Fragment>
|
||||||
|
<Typography
|
||||||
|
sx={{ display: 'inline' }}
|
||||||
|
component="span"
|
||||||
|
variant="body2"
|
||||||
|
color="text.primary"
|
||||||
|
>
|
||||||
|
12:30PM - 123 Alphabet St. Toronto ON.
|
||||||
|
</Typography>
|
||||||
|
{" — John Smith, Alfred Baker, and Samantha Wright"}
|
||||||
|
<Button size="Medium">Participate</Button>
|
||||||
|
</React.Fragment>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</ListItem>);
|
||||||
|
}
|
19
sports-matcher/src/MatchesList.js
Normal file
19
sports-matcher/src/MatchesList.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import List from '@mui/material/List';
|
||||||
|
import Divider from '@mui/material/Divider';
|
||||||
|
import ListSuggestedMatch from './ListSuggestedMatch';
|
||||||
|
|
||||||
|
export default function MatchesList() {
|
||||||
|
return (
|
||||||
|
<List sx={{ width: '100%' }}>
|
||||||
|
<ListSuggestedMatch></ListSuggestedMatch>
|
||||||
|
<Divider variant="inset" component="li" />
|
||||||
|
<ListSuggestedMatch></ListSuggestedMatch>
|
||||||
|
<Divider variant="inset" component="li" />
|
||||||
|
<ListSuggestedMatch></ListSuggestedMatch>
|
||||||
|
<Divider variant="inset" component="li" />
|
||||||
|
<ListSuggestedMatch></ListSuggestedMatch>
|
||||||
|
<Divider variant="inset" component="li" />
|
||||||
|
</List>
|
||||||
|
);
|
||||||
|
}
|
@@ -16,7 +16,7 @@ import { useNavigate } from 'react-router-dom';
|
|||||||
|
|
||||||
const pages = ['Dashboard'];
|
const pages = ['Dashboard'];
|
||||||
|
|
||||||
export default function Navbar(){
|
export default function Navbar() {
|
||||||
const [anchorElNav, setAnchorElNav] = React.useState(null);
|
const [anchorElNav, setAnchorElNav] = React.useState(null);
|
||||||
const [anchorElUser, setAnchorElUser] = React.useState(null);
|
const [anchorElUser, setAnchorElUser] = React.useState(null);
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ export default function Navbar(){
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppBar position="static" sx={{background: '#00226D'}}>
|
<AppBar position="static" sx={{ background: '#00226D' }}>
|
||||||
<Container maxWidth="xl">
|
<Container maxWidth="xl">
|
||||||
<Toolbar disableGutters>
|
<Toolbar disableGutters>
|
||||||
<Typography
|
<Typography
|
||||||
@@ -95,28 +95,25 @@ export default function Navbar(){
|
|||||||
Sports Matcher
|
Sports Matcher
|
||||||
</Typography>
|
</Typography>
|
||||||
<Box sx={{ flexGrow: 1, display: { xs: 'none', md: 'flex' }, marginLeft: '2%' }}>
|
<Box sx={{ flexGrow: 1, display: { xs: 'none', md: 'flex' }, marginLeft: '2%' }}>
|
||||||
{pages.map((page) => (
|
|
||||||
<Button
|
<Button
|
||||||
key={page}
|
onClick={() => { navigate("/dashboard") }}
|
||||||
onClick={handleCloseNavMenu}
|
sx={{ my: 2, color: 'white', display: 'block', textTransform: 'none', fontSize: '100%' }}
|
||||||
sx={{ my: 2, color: 'white', display: 'block', textTransform: 'none', fontSize: '100%'}}
|
|
||||||
>
|
>
|
||||||
{page}
|
Dashboard
|
||||||
</Button>
|
</Button>
|
||||||
))}
|
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Box sx={{ flexGrow: 0, marginRight: '1%'}}>
|
<Box sx={{ flexGrow: 0, marginRight: '1%' }}>
|
||||||
<Tooltip title="Chats">
|
<Tooltip title="Chats">
|
||||||
<IconButton sx={{ p: 0}}>
|
<IconButton onClick={() => { navigate('/chat-window') }} sx={{ p: 0 }}>
|
||||||
<ForumIcon sx={{color: 'white'}}></ForumIcon>
|
<ForumIcon sx={{ color: 'white' }}></ForumIcon>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Box>
|
</Box>
|
||||||
<Box sx={{ flexGrow: 0 }}>
|
<Box sx={{ flexGrow: 0 }}>
|
||||||
<Tooltip title="Settings">
|
<Tooltip title="Settings">
|
||||||
<IconButton onClick={handleOpenUserMenu} sx={{ p: 0}}>
|
<IconButton onClick={handleOpenUserMenu} sx={{ p: 0 }}>
|
||||||
<AccountCircle sx={{color: 'white'}}></AccountCircle>
|
<AccountCircle sx={{ color: 'white' }}></AccountCircle>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Menu
|
<Menu
|
||||||
@@ -141,7 +138,7 @@ export default function Navbar(){
|
|||||||
<MenuItem onClick={handleCloseUserMenu}>
|
<MenuItem onClick={handleCloseUserMenu}>
|
||||||
<Typography textAlign="center">Account</Typography>
|
<Typography textAlign="center">Account</Typography>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem onClick={() => navigate('sign-in')}>
|
<MenuItem onClick={() => navigate('/sign-in')}>
|
||||||
<Typography textAlign="center">Sign Out</Typography>
|
<Typography textAlign="center">Sign Out</Typography>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
21
sports-matcher/src/ReportForm.js
Normal file
21
sports-matcher/src/ReportForm.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import FormControl from "@mui/material/FormControl";
|
||||||
|
import OutlinedInput from "@mui/material/OutlinedInput";
|
||||||
|
import TextField from "@mui/material/TextField";
|
||||||
|
|
||||||
|
export default function ReportForm() {
|
||||||
|
return (
|
||||||
|
<FormControl sx={{ width: '80%' }}>
|
||||||
|
<OutlinedInput
|
||||||
|
sx={{ margin: 1 }}
|
||||||
|
placeholder="Please enter user email." />
|
||||||
|
<TextField
|
||||||
|
id="outlined-multiline-static"
|
||||||
|
label="Multiline"
|
||||||
|
multiline
|
||||||
|
rows={5}
|
||||||
|
sx={{ margin: 1 }}
|
||||||
|
defaultValue="Reason for suspension..."
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
);
|
||||||
|
}
|
10
sports-matcher/src/SearchBar.js
Normal file
10
sports-matcher/src/SearchBar.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { Button, TextField } from "@mui/material";
|
||||||
|
|
||||||
|
export default function SearchBar() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<TextField sx={{ margin: 1 }} id="standard-basic" label="Search" variant="outlined" />
|
||||||
|
<Button sx={{ margin: 1 }} variant="outlined">Search</Button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
@@ -14,10 +14,14 @@ export default function SignIn() {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const handleSubmit = (event) => {
|
const handleSubmit = (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
// For Phase 1, we have hardcoded the usernames and passwords as specified in the handout
|
||||||
|
// For the upcoming phases, this will be changed to secure authentication
|
||||||
const data = new FormData(event.currentTarget);
|
const data = new FormData(event.currentTarget);
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
if(data.get('username') == "admin" && data.get('password') == "admin"){
|
if (data.get('username') === "admin" && data.get('password') === "admin") {
|
||||||
navigate('/');
|
navigate('/admin');
|
||||||
|
} else if (data.get('username') === "user" && data.get('password') === "user") {
|
||||||
|
navigate('/chat-window')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
@@ -72,4 +76,5 @@ export default function SignIn() {
|
|||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Container>
|
</Container>
|
||||||
)}
|
)
|
||||||
|
}
|
27
sports-matcher/src/UserDashboard.js
Normal file
27
sports-matcher/src/UserDashboard.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import Avatar from '@mui/material/Avatar';
|
||||||
|
import Button from '@mui/material/Button';
|
||||||
|
import CssBaseline from '@mui/material/CssBaseline';
|
||||||
|
import TextField from '@mui/material/TextField';
|
||||||
|
import Box from '@mui/material/Box';
|
||||||
|
import Typography from '@mui/material/Typography';
|
||||||
|
import Container from '@mui/material/Container';
|
||||||
|
import { Link } from '@mui/material';
|
||||||
|
import AccountCircleIcon from '@mui/icons-material/AccountCircle';
|
||||||
|
import Filter from "./Filter";
|
||||||
|
import SearchBar from "./SearchBar";
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
import MatchesList from './MatchesList';
|
||||||
|
import Navbar from './Navbar';
|
||||||
|
|
||||||
|
export default function UserDashboard() {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Navbar></Navbar>
|
||||||
|
<SearchBar></SearchBar>
|
||||||
|
<Filter></Filter>
|
||||||
|
<MatchesList></MatchesList>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
109
sports-matcher/src/chats.css
Normal file
109
sports-matcher/src/chats.css
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
/* Please direct questions to Hansi Xu (Wallace LaWall on Discord) */
|
||||||
|
|
||||||
|
.chatcomponent > * {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
.contact {
|
||||||
|
border-style: solid;
|
||||||
|
border-width: 1px;
|
||||||
|
border-bottom: 1px;
|
||||||
|
border-color:rgb(75, 75, 75);
|
||||||
|
|
||||||
|
background-color: rgb(80, 80, 80);
|
||||||
|
height: 80px;
|
||||||
|
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
.contact.dark {
|
||||||
|
background-color: black;
|
||||||
|
}
|
||||||
|
.contactlist {
|
||||||
|
height: 90%;
|
||||||
|
width: 13%;
|
||||||
|
top: 10%;
|
||||||
|
left: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-radius: 2%;
|
||||||
|
background: rgb(48, 45, 45);
|
||||||
|
overflow-y: scroll;
|
||||||
|
overflow-x: hidden;
|
||||||
|
|
||||||
|
position: absolute;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.messagelist {
|
||||||
|
height: 70%;
|
||||||
|
width: 87%;
|
||||||
|
top: 10%;
|
||||||
|
left: 13%;
|
||||||
|
|
||||||
|
position: absolute;
|
||||||
|
background-color: rgb(80, 80, 80);
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
.messagelist > * {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.profilepiccontainer {
|
||||||
|
height: 60px;
|
||||||
|
width: 60px;
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-left: 10px;
|
||||||
|
margin-right: 10px;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.profilepic {
|
||||||
|
border-radius: 50%;
|
||||||
|
height: 50px;
|
||||||
|
width: 50px;
|
||||||
|
}
|
||||||
|
.profilenamecontainer {
|
||||||
|
text-align: center;
|
||||||
|
padding: 7%;
|
||||||
|
}
|
||||||
|
.profilename {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.chatbubble {
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-left: 20px;
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
padding: 10px;
|
||||||
|
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
.left {
|
||||||
|
background-color: rgba(0, 57, 163, 0.637);
|
||||||
|
margin-left: 20px;
|
||||||
|
color: white;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.right {
|
||||||
|
background-color: khaki;
|
||||||
|
color: black;
|
||||||
|
margin-right: 20px;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.chatbubble-container {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.chatinput {
|
||||||
|
background-color: rgb(75, 75, 75);
|
||||||
|
top: 80%;
|
||||||
|
left: 13%;
|
||||||
|
position: absolute;
|
||||||
|
|
||||||
|
height: 20%;
|
||||||
|
width: 87%;
|
||||||
|
|
||||||
|
color: antiquewhite;
|
||||||
|
|
||||||
|
border-width: 2px;
|
||||||
|
border-color: rgb(48, 45, 45);
|
||||||
|
}
|
54
sports-matcher/src/matchinfo.js
Normal file
54
sports-matcher/src/matchinfo.js
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import Card from '@mui/material/Card';
|
||||||
|
import { List, ListItemAvatar } from '@mui/material';
|
||||||
|
import { ListItem } from '@mui/material';
|
||||||
|
import { ListItemText } from '@mui/material';
|
||||||
|
import PeopleIcon from '@mui/icons-material/People';
|
||||||
|
import SportsIcon from '@mui/icons-material/Sports';
|
||||||
|
import MapIcon from '@mui/icons-material/Map';
|
||||||
|
import EventIcon from '@mui/icons-material/Event';
|
||||||
|
import CardActions from '@mui/material/CardActions';
|
||||||
|
import CardContent from '@mui/material/CardContent';
|
||||||
|
import Button from '@mui/material/Button';
|
||||||
|
import Typography from '@mui/material/Typography';
|
||||||
|
|
||||||
|
export default function MatchInfo() {
|
||||||
|
return (
|
||||||
|
<Card sx={{ maxWidth: 400 }}>
|
||||||
|
<CardContent>
|
||||||
|
<Typography sx={{ fontSize: 24 }} component="div">
|
||||||
|
King of the Court!
|
||||||
|
</Typography>
|
||||||
|
<List>
|
||||||
|
<ListItem>
|
||||||
|
<ListItemAvatar>
|
||||||
|
<SportsIcon />
|
||||||
|
</ListItemAvatar>
|
||||||
|
<ListItemText primary="Sport" secondary="Tennis" />
|
||||||
|
</ListItem>
|
||||||
|
<ListItem>
|
||||||
|
<ListItemAvatar>
|
||||||
|
<PeopleIcon />
|
||||||
|
</ListItemAvatar>
|
||||||
|
<ListItemText primary="Participants" secondary="John Smith, Bob Williams, and Candice Baker" />
|
||||||
|
</ListItem>
|
||||||
|
<ListItem>
|
||||||
|
<ListItemAvatar>
|
||||||
|
<MapIcon />
|
||||||
|
</ListItemAvatar>
|
||||||
|
<ListItemText primary="Location" secondary="Athletic Center - 55 Harbord St, Toronto, ON M5S 2W6" />
|
||||||
|
</ListItem>
|
||||||
|
<ListItem>
|
||||||
|
<ListItemAvatar>
|
||||||
|
<EventIcon />
|
||||||
|
</ListItemAvatar>
|
||||||
|
<ListItemText primary="Time" secondary="1:00PM Tomorrow (January 13th)" />
|
||||||
|
</ListItem>
|
||||||
|
</List>
|
||||||
|
</CardContent>
|
||||||
|
<CardActions>
|
||||||
|
<Button size="Medium">Participate</Button>
|
||||||
|
</CardActions>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
Reference in New Issue
Block a user