feat: affiche les anciens résistants en dernier
parent
be6194ad1f
commit
365ddaf7d4
|
@ -18,3 +18,6 @@ export const isAncienResistant = (resistant: Resistant): boolean =>
|
|||
Boolean(
|
||||
resistant.date_fin_resistance && resistant.date_fin_resistance !== ""
|
||||
);
|
||||
|
||||
export const isResistantActif = (resistant: Resistant): boolean =>
|
||||
!isAncienResistant(resistant);
|
||||
|
|
|
@ -17,6 +17,7 @@ import { ResistantsThumbs } from "./Thumbs/ResistantsThumbs";
|
|||
import { FiltreDepartement } from "./FiltreDepartement";
|
||||
import { ResistantRow } from "./List/ResistantRow";
|
||||
import { HomeContext } from "../../context/HomeContext";
|
||||
import { isAncienResistant, isResistantActif } from "../../Resistant";
|
||||
|
||||
const normalize = (text: string) =>
|
||||
(text || "")
|
||||
|
@ -46,7 +47,12 @@ export const ListeResistants = () => {
|
|||
)
|
||||
.filter(
|
||||
(r) => !academie || normalize(r.academie).includes(normalize(academie))
|
||||
);
|
||||
)
|
||||
.sort((r1, r2) => {
|
||||
if (isResistantActif(r1) && isAncienResistant(r2)) return -1;
|
||||
if (isAncienResistant(r1) && isResistantActif(r2)) return 1;
|
||||
return 0;
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
Loading…
Reference in New Issue