Skip to content

Commit

Permalink
deployed backend url is used and final changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sakshisaraswat23 committed Jan 22, 2022
1 parent dc62477 commit ff66070
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 16 deletions.
10 changes: 6 additions & 4 deletions Frontend/src/Components/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@ import Login from './Login';


function App() {
const [admin,setAdmin]=useState(false)

useEffect(() => {
if(localStorage.islogin===undefined)
if(localStorage.getItem("islogin")==null)
{
localStorage.setItem('islogin','')
}
if(localStorage.getItem("islogin")==="loggedin"){
setAdmin(true);
}
}, [])
const value= (localStorage.getItem('islogin')==='')? false : true;

const [admin,setAdmin]=useState(value)
return (
<>
<UserContext.Provider value={{admin,setAdmin}}>
Expand Down
2 changes: 1 addition & 1 deletion Frontend/src/Components/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function Login() {
<Typography variant="h4">Login</Typography>
<FormControl>
<InputLabel htmlFor="my-input">Password</InputLabel>
<Input onChange={(e) => onValueChange(e)} name='inputpassword' />
<Input type='password' onChange={(e) => onValueChange(e)} name='inputpassword' autoComplete="off" />
</FormControl>

<FormControl >
Expand Down
2 changes: 1 addition & 1 deletion Frontend/src/Components/Service/api.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios';

const PORT = process.env.PORT || 8080;
const usersUrl = `http://localhost:${PORT}/users`;
const usersUrl = "https://backendlivescore.herokuapp.com/users";

export const getUsers = async id => {
id = id || '';
Expand Down
31 changes: 24 additions & 7 deletions Frontend/src/Components/Sports/Badminton/BadmintonViewScore.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {useContext} from 'react';
import { useParams } from 'react-router-dom';
import { useState, useEffect } from 'react';
import {
Expand All @@ -14,9 +14,12 @@ import Readrow from './Readrow';
import { io } from 'socket.io-client';
import { FormGroup, FormControl, InputLabel, Input, Typography } from '@material-ui/core';
import { Button } from '@mui/material';
import { Link } from 'react-router-dom';
import { UserContext } from '../../../UserContext';

const PORT = process.env.PORT || 8080;
const socket = io(`http://localhost:${PORT}`);
const socket = io("https://backendlivescore.herokuapp.com/");




Expand Down Expand Up @@ -46,11 +49,22 @@ const useStyles = makeStyles({
fontSize: 18,
},
},
container: {
width: '50%',
margin: '5% 0 0 25%',
'& > *': {
marginTop: 20
}
}
});

function BadmintonViewScore(props) {
const [user, setUser] = useState(initialValue);
const [show, setShow] = useState(true);
const {admin,setAdmin}=useContext(UserContext)
var currentDate = new Date().toLocaleDateString('en-GB');
var matchDate = new Date(user.date).toLocaleDateString('en-GB');
const showedit = matchDate === currentDate;
const classes = useStyles();
const { id } = useParams();
socket.on('updated_badmintonScore', user => {
Expand Down Expand Up @@ -96,14 +110,15 @@ function BadmintonViewScore(props) {



<FormGroup style={{width:'30%'}}>
{/* <Typography style= {{marginTop:'5%'}} variant="h5">Winner of the match</Typography> */}
{showedit && (
<>
<FormGroup style={{width:'30%'}}>
<FormControl style={{marginLeft: '6%', marginTop: '3%'}}>
<InputLabel htmlFor="my-input">Winner</InputLabel>
<Input onChange={(e) => onValueChange(e)} name='winner' />
</FormControl>
</FormGroup>
{show ? (
{show ? (
<Button
onClick={() => editUserDetails()}
color="primary"
Expand All @@ -124,8 +139,10 @@ function BadmintonViewScore(props) {
Saved
</Button>

)}

)}
</>
)
}
</>
);
}
Expand Down
2 changes: 1 addition & 1 deletion Frontend/src/Components/Sports/Badminton/Editscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { UserContext } from '../../../UserContext';
import { Link } from 'react-router-dom';

const PORT = process.env.PORT || 8080;
const socket = io(`http://localhost:${PORT}8080`);
const socket = io("https://backendlivescore.herokuapp.com/");

const initialValue = {
title: '',
Expand Down
7 changes: 5 additions & 2 deletions Frontend/src/Components/Sports/TableTennis/TableTennis.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import React, { useState } from 'react';
import Timeline from '../../Card/Timeline';
import Button from '@mui/material/Button';
import { Link } from 'react-router-dom';
import '../../component.css';

export default function TableTennis() {
const [active, setActive] = useState('female');
return (
<div>
<Button href="/addmatch/tennis" style={{ margin: '3px 3px' }}
<Link to="/addmatch/tennis" style={{ textDecoration: 'none' }}>
<Button style={{ margin: '3px 3px' }}
variant="contained">
Add match
</Button>
</Button>
</Link>
{active === 'male' && (
<Button
onClick={() => setActive('female')}
Expand Down

0 comments on commit ff66070

Please sign in to comment.