Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2785 - Diagoriente par défaut dans la recherche #2950

Merged
merged 2 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions front/scalingo/nginx.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ location /aide {
location = /etablissement {
return 301 $scheme://$http_host/accueil-entreprises;
}

location = /recherche-diagoriente {
return 301 $scheme://$http_host/recherche;
}
Comment on lines +31 to +33
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tu veux pas le faire simplement coté front ? 

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ben j'aime autant que ce soit le serveur qui fasse la redirection direct, sans rentrer jusqu'au front.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

et puis là, le serveur va renvoyer un code 301, propre, le client ne retournera plus sur recherche-diagoriente

Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ export const AppellationAutocomplete = ({
debounceSearchTerm: string;
searchTerm: string;
}) => {
if (!searchTerm) return "Saisissez un métier";
if (!searchTerm)
return useNaturalLanguage
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

est-ce que ce booléan est toujours utile ? 

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oui, je me disais, au cas où, pour rollback

? "Saisissez un métier ou une compétence"
: "Saisissez un métier";
if (searchTerm.length < ROME_AND_APPELLATION_MIN_SEARCH_TEXT_LENGTH)
return "Saisissez au moins 2 caractères";
if (isSearching || searchTerm !== debounceSearchTerm) return "...";
Expand All @@ -103,7 +106,8 @@ export const AppellationAutocomplete = ({
inputValue: searchTerm,
noOptionsMessage: () =>
noOptionText({ isSearching, debounceSearchTerm, searchTerm }),
placeholder: "Ex : Boulanger, styliste, etc.",
placeholder:
props.selectProps?.placeholder ?? "Ex : Boulanger, styliste, etc.",
onChange: (searchResult, actionMeta) => {
if (
actionMeta.action === "clear" ||
Expand Down
4 changes: 0 additions & 4 deletions front/src/app/contents/breadcrumbs/breadcrumbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ export const breadcrumbs: Breadcrumbs<FrontRouteKeys> = {
label: "Recherche",
route: routes.search(),
},
searchDiagoriente: {
label: "Recherche (langage naturel)",
route: routes.searchDiagoriente(),
},
beneficiaryDashboard: {
label: "Tableau de bord",
route: routes.beneficiaryDashboard(),
Expand Down
6 changes: 0 additions & 6 deletions front/src/app/contents/meta/metaContents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,6 @@ export const defaultPageMetaContents: Partial<
title: "Offre d'immersion (PMSMP)",
description: "Fiche présentant une offre d'immersion (PMSMP)",
},
searchDiagoriente: {
title:
"Rechercher une entreprise pour réaliser une immersion professionnelle",
description:
"Utilisez notre moteur de recherche pour trouver une entreprise accueillante d'Immersions Professionnelles ou PMSMP",
},
conventionDocument: {
title: "Document de convention d'immersion (PMSMP) finalisé",
description: "Document de convention d'immersion (PMSMP) finalisé",
Expand Down
4 changes: 1 addition & 3 deletions front/src/app/hooks/search.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ export const encodedSearchUriParams = [
"place",
] satisfies (keyof SearchPageParams)[];

type SearchRoute = Route<
typeof routes.search | typeof routes.searchDiagoriente
>;
type SearchRoute = Route<typeof routes.search>;

const filterUrlsParamsAndUpdateUrl = ({
values,
Expand Down
2 changes: 1 addition & 1 deletion front/src/app/pages/search/SearchPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const SearchPage = ({
route,
useNaturalLanguageForAppellations,
}: {
route: Route<typeof routes.search | typeof routes.searchDiagoriente>;
route: Route<typeof routes.search>;
useNaturalLanguageForAppellations?: boolean;
}) => {
const { cx } = useStyles();
Expand Down
3 changes: 1 addition & 2 deletions front/src/app/routes/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ const getPageByRouteName: {
openApiDoc: () => <OpenApiDocPage />,
manageEstablishmentAdmin: () => <ManageEstablishmentAdminPage />,
renewConventionMagicLink: (route) => <RenewExpiredLinkPage route={route} />,
search: (route) => <SearchPage route={route} />,
searchDiagoriente: (route) => (
search: (route) => (
<SearchPage route={route} useNaturalLanguageForAppellations />
),
standard: (route) =>
Expand Down
4 changes: 0 additions & 4 deletions front/src/app/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,6 @@ export const { RouteProvider, useRoute, routes } = createRouter({
() => `/${frontRoutes.magicLinkRenewal}`,
),
search: defineRoute(searchParams, () => `/${frontRoutes.search}`),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pour avoir le redirect ici (pour éviter les config nginx), on peut faire :

Suggested change
search: defineRoute(searchParams, () => `/${frontRoutes.search}`),
search: defineRoute(searchParams, () => [`/${frontRoutes.search}`, "/recheche-diagoriente"]),

(pas de préférence, je te laisse le choix)

searchDiagoriente: defineRoute(
searchParams,
() => `/${frontRoutes.searchDiagoriente}`,
),
standard: defineRoute(
{ pagePath: param.path.ofType(standardPagesSerializer) },
(params) => `/${frontRoutes.standard}/${params.pagePath}`,
Expand Down
2 changes: 1 addition & 1 deletion front/src/app/utils/breadcrumbs.type.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ getTestBreadcrumbs({

getTestBreadcrumbs({
// deep level
currentRouteKey: "searchDiagoriente",
currentRouteKey: "search",
});
15 changes: 1 addition & 14 deletions front/src/app/utils/breadcrumbs.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe("makeBreadcrumbsSegments", () => {
});
it("should returns segments for a route at a deep level", () => {
const segments = getTestBreadcrumbs({
currentRouteKey: "searchDiagoriente",
currentRouteKey: "search",
});
expect(segments).toEqual([
{
Expand All @@ -63,13 +63,6 @@ describe("makeBreadcrumbsSegments", () => {
onClick: expect.any(Function),
},
},
{
label: "Recherche (langage naturel)",
linkProps: {
href: "/searchDiagoriente",
onClick: expect.any(Function),
},
},
]);
});

Expand Down Expand Up @@ -111,12 +104,6 @@ const testBreadcrumbsSet = {
search: {
label: "Recherche",
route: makeFakeRoute("search"),
children: {
searchDiagoriente: {
label: "Recherche (langage naturel)",
route: makeFakeRoute("searchDiagoriente"),
},
},
},

beneficiaryDashboard: {
Expand Down
Loading