Skip to content

Commit

Permalink
Removed frontend changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
guptakshitij2308 committed Nov 30, 2024
1 parent 322a46e commit a10ab95
Showing 1 changed file with 87 additions and 72 deletions.
159 changes: 87 additions & 72 deletions react-fm/src/pages/adminMode/addGame/AddGame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ function AddGame() {
const [endTime, setEndTime] = useState('');
const [credits, setCredits] = useState('');
const [testGame, setTestGame] = useState(false);
const [teamDivision, setTeamDivision] = useState(false);
const [team1Color, setTeam1Color] = useState('');
const [team2Color, setTeam2Color] = useState('');
// const [teamDivision, setTeamDivision] = useState(false);
// const [team1Color, setTeam1Color] = useState('');
// const [team2Color, setTeam2Color] = useState('');

// console.log(testGame);

Expand Down Expand Up @@ -262,9 +262,6 @@ function AddGame() {
waitListPlayersCount: ${parseInt(playersCount) / 2}
credits: ${Number(credits)}
testGame: ${testGame}
teamDivision: ${teamDivision}
team1Color: "${team1Color}"
team2Color: "${team2Color}"
}
) {
isSuccessful
Expand Down Expand Up @@ -437,69 +434,69 @@ function AddGame() {
</FlexBox>
);

const sectionSwitch = (usecase: 'testGame' | 'teamDivision') => (
<Box>
<FlexBox className={styles.startEndPicker}>
<Box>
<Typography className={styles.fieldTitle}>
{usecase === 'testGame' ? 'Test Game' : 'Team Division'}
</Typography>
</Box>
<Switch
className={styles.switchBtn}
checked={usecase === 'testGame' ? testGame : teamDivision}
onChange={() => {
usecase === 'testGame' ? setTestGame(!testGame) : setTeamDivision(!teamDivision);
}}
color="default"
sx={{
'& .MuiSwitch-switchBase.Mui-checked': {
color: '#4ce95a',
},
'& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track': {
backgroundColor: '#4ce95a',
},
}}
/>
</FlexBox>
</Box>
);

const sectionTeamColors = () => (
<FlexBox className={styles.sectionThird}>
<Box className={styles.dateTimePicker}>
<FlexBox className={styles.startTimePicker}>
<Box>
<Typography className={styles.fieldTitle}>Team 1</Typography>
</Box>
<TextField
fullWidth
value={team1Color}
onChange={(e) => setTeam1Color(e.target.value)}
placeholder="Team 1"
id="fullWidth"
type="text"
/>
</FlexBox>
</Box>

<Box className={styles.dateTimePicker}>
<FlexBox className={styles.startEndPicker}>
<Box>
<Typography className={styles.fieldTitle}>Team 2</Typography>
</Box>
<TextField
fullWidth
value={team2Color}
onChange={(e) => setTeam2Color(e.target.value)}
placeholder="Team 2"
id="fullWidth"
type="text"
/>
</FlexBox>
</Box>
</FlexBox>
);
// const sectionSwitch = (usecase: 'testGame' | 'teamDivision') => (
// <Box>
// <FlexBox className={styles.startEndPicker}>
// <Box>
// <Typography className={styles.fieldTitle}>
// {usecase === 'testGame' ? 'Test Game' : 'Team Division'}
// </Typography>
// </Box>
// <Switch
// className={styles.switchBtn}
// checked={usecase === 'testGame' ? testGame : teamDivision}
// onChange={() => {
// usecase === 'testGame' ? setTestGame(!testGame) : setTeamDivision(!teamDivision);
// }}
// color="default"
// sx={{
// '& .MuiSwitch-switchBase.Mui-checked': {
// color: '#4ce95a',
// },
// '& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track': {
// backgroundColor: '#4ce95a',
// },
// }}
// />
// </FlexBox>
// </Box>
// );

// const sectionTeamColors = () => (
// <FlexBox className={styles.sectionThird}>
// <Box className={styles.dateTimePicker}>
// <FlexBox className={styles.startTimePicker}>
// <Box>
// <Typography className={styles.fieldTitle}>Team 1</Typography>
// </Box>
// <TextField
// fullWidth
// value={team1Color}
// onChange={(e) => setTeam1Color(e.target.value)}
// placeholder="Team 1"
// id="fullWidth"
// type="text"
// />
// </FlexBox>
// </Box>

// <Box className={styles.dateTimePicker}>
// <FlexBox className={styles.startEndPicker}>
// <Box>
// <Typography className={styles.fieldTitle}>Team 2</Typography>
// </Box>
// <TextField
// fullWidth
// value={team2Color}
// onChange={(e) => setTeam2Color(e.target.value)}
// placeholder="Team 2"
// id="fullWidth"
// type="text"
// />
// </FlexBox>
// </Box>
// </FlexBox>
// );

const sectionFourth = () => (
<Box className={styles.sectionFourth}>
Expand Down Expand Up @@ -553,10 +550,28 @@ function AddGame() {
</FlexBox>
</Box>

{sectionSwitch('testGame')}
{sectionSwitch('teamDivision')}
<Box className={styles.dateTimePicker}>
<FlexBox className={styles.startEndPicker}>
<Box>
<Typography className={styles.fieldTitle}>Test Game</Typography>
</Box>
<Switch
className={styles.switchBtn}
checked={testGame}
onChange={() => setTestGame(!testGame)}
color="default"
sx={{
'& .MuiSwitch-switchBase.Mui-checked': {
color: '#4ce95a',
},
'& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track': {
backgroundColor: '#4ce95a',
},
}}
/>
</FlexBox>
</Box>
</FlexBox>
{teamDivision && sectionTeamColors()}

<br />
{sectionFourth()}
Expand Down

0 comments on commit a10ab95

Please sign in to comment.