Skip to content

Commit

Permalink
feat(619) : Reword établissement en voeu
Browse files Browse the repository at this point in the history
  • Loading branch information
aureliadelzottoOCTO authored and Maxgux committed Nov 29, 2024
1 parent 4a5f9b3 commit 2e19ce7
Show file tree
Hide file tree
Showing 32 changed files with 342 additions and 366 deletions.
6 changes: 3 additions & 3 deletions app/front/src/configuration/constantes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ export const constantes = {
},
FICHE_FORMATION: {
POURCENTAGE_MIN_AFFICHAGE_CRITÈRES: 15,
RAYONS_RECHERCHE_ÉTABLISSEMENTS: [10, 20, 50],
RAYONS_RECHERCHE_VOEUX: [10, 20, 50],
TAILLE_BOUTONS_ACTIONS: "grand",
NB_MÉTIERS_À_AFFICHER: 10,
NB_CARACTÈRES_MAX_COMMENTAIRE: 4_000,
},
FICHE_MÉTIER: {
NB_FORMATIONS_À_AFFICHER: 5,
},
ÉTABLISSEMENTS: {
VOEUX: {
NB_CARACTÈRES_MIN_RECHERCHE: 3,
PAGINATION_ÉTABLISSEMENTS: 5,
NB_VOEUX_PAR_PAGE: 5,
},
COMMUNES: {
NB_CARACTÈRES_MIN_RECHERCHE: 3,
Expand Down
10 changes: 5 additions & 5 deletions app/front/src/configuration/i18n/locales/localeFR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const localeFR = {
MOYENNE_SUITE: ", la moitié avait une moyenne au bac dans l’intervalle",
EXPLICATION_CALCUL: "Détails du calcul du score (mode expert)",
},
VOEUX: {
CHOIX: {
TITRE: "Dis-nous en plus sur ce choix",
AMBITIONS: {
LÉGENDE: "Je dirais que c’est un choix ...",
Expand All @@ -126,7 +126,7 @@ export const localeFR = {
EMOJI: "🙏",
},
},
ÉTABLISSEMENTS: {
VOEUX: {
LÉGENDE: "Établissements pour lesquels je souhaite candidater",
LIENS: {
PARCOURSUP: "Carte Parcoursup",
Expand All @@ -135,8 +135,8 @@ export const localeFR = {
PAR_COMMUNE: {
RAYON: "Dans un rayon de",
VOIR_PLUS: "établissements dans ce rayon, retrouve toute l’offre de formation sur la",
AUCUN_ÉTABLISSEMENT_À_PROXIMITÉ: "Il n’existe pas d’offres dans un rayon de",
AUCUN_ÉTABLISSEMENT_À_PROXIMITÉ_SUITE:
AUCUN_VOEU_À_PROXIMITÉ: "Il n’existe pas d’offres dans un rayon de",
AUCUN_VOEU_À_PROXIMITÉ_SUITE:
'km autour de cette ville, consulte la carte des formations Parcoursup ou l’onglet "Toutes les villes"',
},
TOUTES_LES_COMMUNES: {
Expand Down Expand Up @@ -477,7 +477,7 @@ export const localeFR = {
VOUS_ÊTES_ICI: "Vous êtes ici :",
MENU_PRINCIPAL: "Menu principal",
ONGLETS_FORMATION: "Détails sur la formation",
ONGLETS_VOEUX_ÉTABLISSEMENTS: "Établissements par ville",
ONGLETS_VOEUX: "Établissements par ville",
VERSION_TEXTE_GRAPHIQUE: "Version texte du graphique",
FERMER_MODALE: "Fermer la fenêtre modale",
CONTENU: "Contenu",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ export type Formation = {
};
formationsAssociées: string[];
critèresAnalyse: Array<{ nom: string; pourcentage: number }>;
établissements: Array<{
voeux: Array<{
id: string;
nom: string;
commune: {
nom: string;
code: string;
};
}>;
établissementsParCommuneFavorites: Array<{
voeuxParCommuneFavorites: Array<{
commune: {
nom: string;
code: string;
};
établissements: Array<{
voeux: Array<{
id: string;
nom: string;
distanceEnKm: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,20 @@ export class formationHttpRepository implements FormationRepository {
nom: critère.nom,
pourcentage: critère.pourcentage,
})),
établissements: formationHttp.formation.voeux.map((établissement) => ({
id: établissement.id,
nom: établissement.nom,
commune: { nom: établissement.commune.nom, code: établissement.commune.codeInsee },
voeux: formationHttp.formation.voeux.map((voeu) => ({
id: voeu.id,
nom: voeu.nom,
commune: { nom: voeu.commune.nom, code: voeu.commune.codeInsee },
})),
établissementsParCommuneFavorites: formationHttp.formation.communesFavoritesAvecLeursVoeux.map((commune) => ({
voeuxParCommuneFavorites: formationHttp.formation.communesFavoritesAvecLeursVoeux.map((commune) => ({
commune: {
code: commune.commune.codeInsee,
nom: commune.commune.nom,
},
établissements: commune.voeuxAvecDistance.map((établissement) => ({
id: établissement.voeu.id,
nom: établissement.voeu.nom,
distanceEnKm: établissement.distanceKm,
voeux: commune.voeuxAvecDistance.map((voeu) => ({
id: voeu.voeu.id,
nom: voeu.voeu.nom,
distanceEnKm: voeu.distanceKm,
})),
})),
communesProposantLaFormation: formationHttp.formation.communes.map((commune) => commune.nom),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export class formationInMemoryRepository implements FormationRepository {
estEnAlternance: true,
liens: [],
communesProposantLaFormation: [],
établissements: [],
établissementsParCommuneFavorites: [],
voeux: [],
voeuxParCommuneFavorites: [],
admis: {
moyenneGénérale: {
idBac: null,
Expand All @@ -38,8 +38,8 @@ export class formationInMemoryRepository implements FormationRepository {
estEnAlternance: false,
liens: [],
communesProposantLaFormation: [],
établissements: [],
établissementsParCommuneFavorites: [],
voeux: [],
voeuxParCommuneFavorites: [],
admis: {
moyenneGénérale: {
idBac: null,
Expand All @@ -63,8 +63,8 @@ export class formationInMemoryRepository implements FormationRepository {
estEnAlternance: true,
liens: [],
communesProposantLaFormation: [],
établissements: [],
établissementsParCommuneFavorites: [],
voeux: [],
voeuxParCommuneFavorites: [],
admis: {
moyenneGénérale: {
idBac: null,
Expand All @@ -88,8 +88,8 @@ export class formationInMemoryRepository implements FormationRepository {
estEnAlternance: true,
liens: [],
communesProposantLaFormation: [],
établissements: [],
établissementsParCommuneFavorites: [],
voeux: [],
voeuxParCommuneFavorites: [],
admis: {
moyenneGénérale: {
idBac: null,
Expand All @@ -113,8 +113,8 @@ export class formationInMemoryRepository implements FormationRepository {
estEnAlternance: true,
liens: [],
communesProposantLaFormation: [],
établissements: [],
établissementsParCommuneFavorites: [],
voeux: [],
voeuxParCommuneFavorites: [],
admis: {
moyenneGénérale: {
idBac: null,
Expand All @@ -138,8 +138,8 @@ export class formationInMemoryRepository implements FormationRepository {
liens: [],
estEnAlternance: true,
communesProposantLaFormation: [],
établissements: [],
établissementsParCommuneFavorites: [],
voeux: [],
voeuxParCommuneFavorites: [],
admis: {
moyenneGénérale: {
idBac: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import useBoutonsActionsFicheFormation from "./useBoutonsActionsFicheFormation";
import Bouton from "@/components/Bouton/Bouton";
import { constantes } from "@/configuration/constantes";
import { i18n } from "@/configuration/i18n/i18n";
import VoeuxFicheFormation from "@/features/formation/ui/FicheFormation/Voeux/Voeux";
import VoeuxFicheFormation from "@/features/formation/ui/FicheFormation/ChoixFormation/ChoixFormation.tsx";

const BoutonsActionsFicheFormation = ({ formation }: BoutonsActionsFicheFormationProps) => {
const {
Expand Down Expand Up @@ -77,7 +77,7 @@ const BoutonsActionsFicheFormation = ({ formation }: BoutonsActionsFicheFormatio
className="fr-accordion__btn"
type="button"
>
{i18n.PAGE_FORMATION.VOEUX.TITRE}
{i18n.PAGE_FORMATION.CHOIX.TITRE}
</button>
</h2>
<div
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { type Formation } from "@/features/formation/domain/formation.interface";
import { type FormationFavorite } from "@/features/élève/domain/élève.interface";

export type AmbitionVoeuxProps = {
export type AmbitionProps = {
ambitionActuelle: FormationFavorite["niveauAmbition"] | undefined;
formationId: Formation["id"];
};

export type useAmbitionVoeuxArgs = {
export type useAmbitionArgs = {
formationId: Formation["id"];
};
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { type AmbitionVoeuxProps } from "./AmbitionVoeux.interface";
import useAmbitionVoeux from "./useAmbitionVoeux";
import { type AmbitionProps } from "./Ambition.interface.tsx";
import useAmbition from "./useAmbition.tsx";
import TagFiltreAvecEmoji from "@/components/TagFiltreAvecEmoji/TagFiltreAvecEmoji";
import { i18n } from "@/configuration/i18n/i18n";

const AmbitionVoeux = ({ ambitionActuelle, formationId }: AmbitionVoeuxProps) => {
const { ambitions, mettreAJourAmbition, key } = useAmbitionVoeux({ formationId });
const Ambition = ({ ambitionActuelle, formationId }: AmbitionProps) => {
const { ambitions, mettreAJourAmbition, key } = useAmbition({ formationId });

return (
<div>
<p className="mb-4 font-medium text-[--text-label-grey]">{i18n.PAGE_FORMATION.VOEUX.AMBITIONS.LÉGENDE}</p>
<p className="mb-4 font-medium text-[--text-label-grey]">{i18n.PAGE_FORMATION.CHOIX.AMBITIONS.LÉGENDE}</p>
<ul className="m-0 flex list-none flex-wrap justify-start gap-4 p-0">
{ambitions.map((ambition) => (
<li key={ambition.niveau}>
Expand All @@ -27,4 +27,4 @@ const AmbitionVoeux = ({ ambitionActuelle, formationId }: AmbitionVoeuxProps) =>
);
};

export default AmbitionVoeux;
export default Ambition;
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import { type useAmbitionVoeuxArgs } from "./AmbitionVoeux.interface";
import { type useAmbitionArgs } from "./Ambition.interface.tsx";
import { i18n } from "@/configuration/i18n/i18n";
import { type FormationFavorite } from "@/features/élève/domain/élève.interface";
import useÉlève from "@/features/élève/ui/hooks/useÉlève/useÉlève";

export default function useAmbitionVoeux({ formationId }: useAmbitionVoeuxArgs) {
export default function useAmbition({ formationId }: useAmbitionArgs) {
const { mettreÀJourUneFormationFavorite, élève } = useÉlève({});

const ambitions: Array<{ niveau: NonNullable<FormationFavorite["niveauAmbition"]>; emoji: string; libellé: string }> =
[
{
niveau: 1,
emoji: i18n.PAGE_FORMATION.VOEUX.AMBITIONS.PLAN_B.EMOJI,
libellé: i18n.PAGE_FORMATION.VOEUX.AMBITIONS.PLAN_B.LABEL,
emoji: i18n.PAGE_FORMATION.CHOIX.AMBITIONS.PLAN_B.EMOJI,
libellé: i18n.PAGE_FORMATION.CHOIX.AMBITIONS.PLAN_B.LABEL,
},
{
niveau: 2,
emoji: i18n.PAGE_FORMATION.VOEUX.AMBITIONS.RÉALISTE.EMOJI,
libellé: i18n.PAGE_FORMATION.VOEUX.AMBITIONS.RÉALISTE.LABEL,
emoji: i18n.PAGE_FORMATION.CHOIX.AMBITIONS.RÉALISTE.EMOJI,
libellé: i18n.PAGE_FORMATION.CHOIX.AMBITIONS.RÉALISTE.LABEL,
},
{
niveau: 3,
emoji: i18n.PAGE_FORMATION.VOEUX.AMBITIONS.AMBITIEUX.EMOJI,
libellé: i18n.PAGE_FORMATION.VOEUX.AMBITIONS.AMBITIEUX.LABEL,
emoji: i18n.PAGE_FORMATION.CHOIX.AMBITIONS.AMBITIEUX.EMOJI,
libellé: i18n.PAGE_FORMATION.CHOIX.AMBITIONS.AMBITIEUX.LABEL,
},
];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type Formation } from "@/features/formation/domain/formation.interface";

export type VoeuxProps = {
export type ChoixFormationProps = {
formation: Formation;
};
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import AmbitionVoeux from "./AmbitionVoeux/AmbitionVoeux";
import CommentaireVoeux from "./CommentaireVoeux/CommentaireVoeux";
import { type VoeuxProps } from "./Voeux.interface";
import ÉtablissementsVoeux from "./ÉtablissementsVoeux/ÉtablissementsVoeux";
import { type ChoixFormationProps } from "./ChoixFormation.interface.tsx";
import Voeux from "./Voeux/Voeux";
import Titre from "@/components/Titre/Titre";
import { i18n } from "@/configuration/i18n/i18n";
import Ambition from "@/features/formation/ui/FicheFormation/ChoixFormation/Ambition/Ambition.tsx";
import Commentaire from "@/features/formation/ui/FicheFormation/ChoixFormation/Commentaire/Commentaire.tsx";
import { élèveQueryOptions } from "@/features/élève/ui/élèveQueries";
import { useQuery } from "@tanstack/react-query";

const Voeux = ({ formation }: VoeuxProps) => {
const ChoixFormation = ({ formation }: ChoixFormationProps) => {
const { data: élève } = useQuery(élèveQueryOptions);

if (!élève) return null;
Expand All @@ -21,19 +21,19 @@ const Voeux = ({ formation }: VoeuxProps) => {
niveauDeTitre="h2"
styleDeTitre="h4"
>
{i18n.PAGE_FORMATION.VOEUX.TITRE}
{i18n.PAGE_FORMATION.CHOIX.TITRE}
</Titre>
</div>
<AmbitionVoeux
<Ambition
ambitionActuelle={détailFavori?.niveauAmbition}
formationId={formation.id}
/>
<hr className="pb-[1px]" />
<ÉtablissementsVoeux formation={formation} />
<Voeux formation={formation} />
<hr className="pb-[1px]" />
<CommentaireVoeux formationId={formation.id} />
<Commentaire formationId={formation.id} />
</div>
);
};

export default Voeux;
export default ChoixFormation;
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { type Formation } from "@/features/formation/domain/formation.interface";

export type CommentaireProps = {
formationId: Formation["id"];
};

export type UseCommentaireArgs = {
formationId: CommentaireProps["formationId"];
};

interface FormElements extends HTMLFormControlsCollection {
commentaire: HTMLTextAreaElement;
}
export interface CommentaireFormElement extends HTMLFormElement {
readonly elements: FormElements;
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { type CommentaireVoeuxProps } from "./CommentaireVoeux.interface";
import useCommentaireVoeux from "./useCommentaireVoeux";
import { type CommentaireProps } from "./Commentaire.interface.tsx";
import useCommentaire from "./useCommentaire.tsx";
import Bouton from "@/components/Bouton/Bouton";
import ChampZoneDeTexte from "@/components/ChampZoneDeTexte/ChampZoneDeTexte";
import { i18n } from "@/configuration/i18n/i18n";

const CommentaireVoeux = ({ formationId }: CommentaireVoeuxProps) => {
const { enregistrerLeCommentaire, commentaireParDéfaut, status } = useCommentaireVoeux({ formationId });
const Commentaire = ({ formationId }: CommentaireProps) => {
const { enregistrerLeCommentaire, commentaireParDéfaut, status } = useCommentaire({ formationId });

return (
<form
Expand All @@ -14,15 +14,15 @@ const CommentaireVoeux = ({ formationId }: CommentaireVoeuxProps) => {
>
<ChampZoneDeTexte
entête={{
label: i18n.PAGE_FORMATION.VOEUX.COMMENTAIRE.LABEL,
label: i18n.PAGE_FORMATION.CHOIX.COMMENTAIRE.LABEL,
}}
id="commentairevoeux"
id="commentaire"
status={status}
valeurParDéfaut={commentaireParDéfaut}
/>
<div className="sm:mt-7">
<Bouton
label={i18n.PAGE_FORMATION.VOEUX.COMMENTAIRE.BOUTON}
label={i18n.PAGE_FORMATION.CHOIX.COMMENTAIRE.BOUTON}
type="submit"
variante="tertiaire"
/>
Expand All @@ -31,4 +31,4 @@ const CommentaireVoeux = ({ formationId }: CommentaireVoeuxProps) => {
);
};

export default CommentaireVoeux;
export default Commentaire;
Loading

0 comments on commit 2e19ce7

Please sign in to comment.