-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
front-end: ability to delete a player via settings button
- Loading branch information
Teun van Dalen
committed
Nov 30, 2023
1 parent
b7d79eb
commit 579e12f
Showing
4 changed files
with
102 additions
and
53 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
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,30 @@ | ||
import { useNameContext } from "../../context/NamesContext"; | ||
import { useRoom } from "../../context/RoomContext"; | ||
|
||
function Settings() { | ||
|
||
const { roomDTO } = useRoom(); | ||
const { nameMap } = useNameContext(); | ||
|
||
const handleRemovePlayer = (e: React.SyntheticEvent) => { | ||
e.preventDefault(); | ||
} | ||
|
||
return ( | ||
<div className="fixed-badge"> | ||
<div className="dropdown"> | ||
<button className="btn btn-secondary dropdown-toggle text-primary fs-3" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false"> | ||
<i className="bi bi-sliders"></i> | ||
</button> | ||
<ul className="dropdown-menu" aria-labelledby="dropdownMenuButton1"> | ||
<li><h6 className="dropdown-header">Remove player: </h6></li> | ||
{roomDTO!.playerIDs.map((playerID) => ( | ||
<li key={playerID}><button className="dropdown-item player-item" onClick={handleRemovePlayer}>{nameMap.get(playerID) || playerID}</button></li> | ||
))} | ||
</ul> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default Settings; |
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
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