mirror of
https://github.com/Paris-est-Ludique/intranet.git
synced 2025-09-11 05:46:28 +02:00
display assigned team in volunteers team wishes list
This commit is contained in:
@@ -3,6 +3,7 @@ import { useSelector } from "react-redux"
|
|||||||
import { createSelector } from "@reduxjs/toolkit"
|
import { createSelector } from "@reduxjs/toolkit"
|
||||||
import { selectVolunteerListAlphaSorted } from "../../store/volunteerList"
|
import { selectVolunteerListAlphaSorted } from "../../store/volunteerList"
|
||||||
import { selectTeamList } from "../../store/teamList"
|
import { selectTeamList } from "../../store/teamList"
|
||||||
|
import styles from "./styles.module.scss"
|
||||||
|
|
||||||
const selectVolunteersWithTeamWishes = createSelector(
|
const selectVolunteersWithTeamWishes = createSelector(
|
||||||
selectVolunteerListAlphaSorted,
|
selectVolunteerListAlphaSorted,
|
||||||
@@ -12,10 +13,13 @@ const selectVolunteersWithTeamWishes = createSelector(
|
|||||||
.filter((volunteer) => volunteer.teamWishes.length > 0)
|
.filter((volunteer) => volunteer.teamWishes.length > 0)
|
||||||
.map((volunteer) => ({
|
.map((volunteer) => ({
|
||||||
...volunteer,
|
...volunteer,
|
||||||
teamWishes: volunteer.teamWishes.map((wishId) => {
|
teamWishes: volunteer.teamWishes
|
||||||
|
.filter((wishId) => wishId !== volunteer.team)
|
||||||
|
.map((wishId) => {
|
||||||
const matchingTeam = teams.find((team: any) => wishId === team?.id)
|
const matchingTeam = teams.find((team: any) => wishId === team?.id)
|
||||||
return matchingTeam?.name
|
return matchingTeam?.name
|
||||||
}),
|
}),
|
||||||
|
teamObject: teams.find((team: any) => volunteer.team === team?.id),
|
||||||
}))
|
}))
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -26,12 +30,13 @@ const VolunteersWithTeamWishes: FC = (): JSX.Element => {
|
|||||||
<div>
|
<div>
|
||||||
<div>Bénévoles ayant choisi des équipes ({volunteers.length}) :</div>
|
<div>Bénévoles ayant choisi des équipes ({volunteers.length}) :</div>
|
||||||
<ul>
|
<ul>
|
||||||
{volunteers.map(({ id, lastname, firstname, teamWishes }) => (
|
{volunteers.map(({ id, lastname, firstname, teamWishes, teamObject }) => (
|
||||||
<li key={id}>
|
<li key={id}>
|
||||||
<b>
|
<span className={styles.volunteerName}>
|
||||||
{firstname} {lastname}
|
{firstname} {lastname}{" "}
|
||||||
</b>{" "}
|
</span>
|
||||||
: {teamWishes.join(", ")}
|
<span className={styles.teamActive}>{teamObject?.name} </span>
|
||||||
|
<span>{teamWishes.join(", ")}</span>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
@@ -27,6 +27,10 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.teamActive {
|
||||||
|
color: $color-orange;
|
||||||
|
}
|
||||||
|
|
||||||
.teamWishButton {
|
.teamWishButton {
|
||||||
margin: 0 2px;
|
margin: 0 2px;
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
|
Reference in New Issue
Block a user