-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
66bd59c
commit 61d3df1
Showing
3 changed files
with
158 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
@import "~/styles/variables.scss"; | ||
@import "~/styles/mixins.scss"; | ||
|
||
.modal { | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
width: 60%; | ||
background-image: $dialog-container-gradient; | ||
box-shadow: $dialog-container-box-shadow; | ||
backdrop-filter: blur(4px); | ||
padding: 2em; | ||
display: flex; | ||
align-items: center; | ||
flex-direction: column; | ||
max-height: 80%; | ||
overflow: auto; | ||
} | ||
|
||
.statusLabel { | ||
font-weight: bold; | ||
} | ||
|
||
.icon { | ||
height: 2rem; | ||
} | ||
|
||
|
||
#save_button { | ||
float: left; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { | ||
Box, | ||
CircularProgress, | ||
Collapse, | ||
TextField, | ||
Button, | ||
Typography | ||
} from "@mui/material" | ||
import { Cancel, Check, OpenInNew } from "@mui/icons-material" | ||
import { Status } from "enums/Status" | ||
import React, { useState } from "react" | ||
import { useDispatch, useSelector } from "react-redux" | ||
import actions from "src/actions" | ||
import { Team } from "types/Team" | ||
import styles from "./index.module.scss" | ||
|
||
const EditTeam = ({ team }: { team: Team }) => { | ||
const dispatch = useDispatch() | ||
const [loading, setLoading] = useState(false) | ||
|
||
const [name, setName] = useState(team.name) | ||
const [desc, setDesc] = useState(team.description) | ||
|
||
const handleSubmit = async (e: Event) => { | ||
e.preventDefault() | ||
setLoading(true) | ||
try { | ||
await dispatch(actions.teams.editTeamInfo(name, desc)) | ||
} catch (err) { | ||
console.error("Error setting team info: " + err) | ||
} finally { | ||
setLoading(false) | ||
} | ||
} | ||
return ( | ||
<Box className={styles.modal} component="form" onSubmit={handleSubmit}> | ||
<Typography variant="h5">Team Information</Typography> | ||
<TextField | ||
label="Team Name" | ||
variant="outlined" | ||
fullWidth | ||
margin="normal" | ||
value={name} | ||
onChange={(e) => setName(e.target.value)} | ||
/> | ||
|
||
<TextField | ||
label="Team Description" | ||
variant="outlined" | ||
fullWidth | ||
margin="normal" | ||
value={desc} | ||
onChange={(e) => setDesc(e.target.value)} | ||
/> | ||
|
||
<Button | ||
variant="outlined" | ||
id="save_button" | ||
type="submit" | ||
disabled={loading} | ||
> | ||
{loading ? ( | ||
<Collapse in={loading}> | ||
<CircularProgress /> | ||
</Collapse> | ||
) : ( | ||
"Save" | ||
)} | ||
</Button> | ||
</Box> | ||
) | ||
} | ||
export default EditTeam |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters