correction ressource list, clean composant

This commit is contained in:
trochas
2026-01-08 12:41:25 +01:00
parent 7c6ee6b65f
commit be4ab7d7cf
16 changed files with 491 additions and 228 deletions

View File

@@ -1,4 +1,5 @@
import { Athlete, Activite, Coach, Session, Ligne } from "../classes";
import ObjectSession from "./object/session";
type AthleteListProps = { athletes: Athlete[] };
type ActiviteListProps = { activites: Activite[] };
@@ -6,6 +7,9 @@ type CoachListProps = { coachs: Coach[] };
type SessionListProps = { sessions: Session[]};
type LigneListProps = { lignes: Ligne[]};
function AthleteList({ athletes }: AthleteListProps) {
return (
<ul className="AthleteList">
@@ -56,28 +60,12 @@ function CoachList({ coachs }: CoachListProps) {
function SessionList({ sessions }: SessionListProps) {
return (
<ul className="SessionList">
{sessions.map((sessions) => (
<li key={sessions.id}>
<div>
<strong>Nom:</strong> {sessions.name}
</div>
<div>
<strong>Groupe:</strong> {sessions.groupe}
</div>
<div>
<strong>Recurrent:</strong> {sessions.isRecurrent ? "Oui" : "Non"}
</div>
<div>
<strong>Coach:</strong> {sessions.coach ? sessions.coach.nom : "Pas de coach sur la séance"}
</div>
<div>
<strong>Ligne:</strong> {sessions.ligne ? sessions.ligne.map(ligne => ligne.nom).join(", ") : "Pas de ligne sur la séance"}
</div>
</li>
<div className="list_object">
{sessions.map((session) => (
<ObjectSession session={session}/>
))}
</ul>
</div>
);
}