mirror of
https://github.com/Paris-est-Ludique/intranet.git
synced 2025-06-09 09:04:20 +02:00
show selected team for each candidates
This commit is contained in:
parent
7c96636477
commit
49248a4bfa
@ -54,7 +54,7 @@ type Props = {
|
|||||||
|
|
||||||
const TeamWithCandidates: FC<Props> = ({ teamId }): JSX.Element | null => {
|
const TeamWithCandidates: FC<Props> = ({ teamId }): JSX.Element | null => {
|
||||||
const teams = useSelector(selectTeamsWithVolunteersCandidates)
|
const teams = useSelector(selectTeamsWithVolunteersCandidates)
|
||||||
const team = teams.find((t) => t.id === teamId)
|
const currentTeam = teams.find((t) => t.id === teamId)
|
||||||
const [, saveTeam] = useTeamAssign()
|
const [, saveTeam] = useTeamAssign()
|
||||||
|
|
||||||
const onTeamSelected = useCallback(
|
const onTeamSelected = useCallback(
|
||||||
@ -64,37 +64,39 @@ const TeamWithCandidates: FC<Props> = ({ teamId }): JSX.Element | null => {
|
|||||||
[saveTeam]
|
[saveTeam]
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!team) return null
|
if (!currentTeam) return null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
Equipe {team.name} ({team.volunteers.length}) :
|
Equipe {currentTeam.name} ({currentTeam.volunteers.length}) :
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<ul>
|
||||||
{team.volunteers.map(({ id, lastname, firstname, teamWishes, dayWishes }) => (
|
{currentTeam.volunteers.map(
|
||||||
<li key={id}>
|
({ id, lastname, firstname, teamWishes, dayWishes, team }) => (
|
||||||
<span className={styles.volunteerName}>
|
<li key={id}>
|
||||||
{firstname} {lastname} (<DaysDisplay dayWishes={dayWishes} />)
|
<span className={styles.volunteerName}>
|
||||||
</span>
|
{firstname} {lastname} (<DaysDisplay dayWishes={dayWishes} />)
|
||||||
{teamWishes.map((teamWish) => {
|
</span>
|
||||||
const active = false
|
{teamWishes.map((teamWish) => {
|
||||||
return (
|
const active = teamWish.id === team
|
||||||
<button
|
return (
|
||||||
key={teamWish.id}
|
<button
|
||||||
type="button"
|
key={teamWish.id}
|
||||||
onClick={() => onTeamSelected(id, teamWish.id)}
|
type="button"
|
||||||
className={classnames(
|
onClick={() => onTeamSelected(id, teamWish.id)}
|
||||||
styles.teamWishButton,
|
className={classnames(
|
||||||
active && styles.teamActive
|
styles.teamWishButton,
|
||||||
)}
|
active && styles.teamActive
|
||||||
>
|
)}
|
||||||
{teamWish.name}
|
>
|
||||||
</button>
|
{teamWish.name}
|
||||||
)
|
</button>
|
||||||
})}
|
)
|
||||||
</li>
|
})}
|
||||||
))}
|
</li>
|
||||||
|
)
|
||||||
|
)}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user