Skip to content

Commit

Permalink
feat: module trouver sa cc (#6267)
Browse files Browse the repository at this point in the history
* fix: dsfr

* fix: dsfr

* fix: dsfr

* fix: tests

* fix: build

* fix: build

* fix: build

* feat(dsfr): ajout du footer (#6079)

* feat: add code

* fix: tests

* fix: tests

* fix: tests

* fix: tests

* fix: tests

* fix: dernier titi

* fix: autoclick

* fix: bug

* feat(css): ajout de la lib `panda-css` (zero-runtime) (#6085)

* fix: pandacss

* fix: build

* fix: build

* feat(dsfr): ajout de la page stats (#6090)

* fix: pandacss

* fix: build

* fix: build

* fix(stats): add page

* fix: stats

* fix: tests

* fix: tests

* Update packages/code-du-travail-frontend/src/modules/mentions-legales/index.tsx

Co-authored-by: Martial Maillot <[email protected]>

* fix(recherche): remonter les pré-qualifiés dans la recherche (#6082)

* chore(release): version 4.151.1

* fix(csp): remove reporting on sentry (#6092)

* fix: config

* fix: config

* fix: config

* empty

* fix: config

* empty

* Update packages/code-du-travail-frontend/src/modules/mentions-legales/index.tsx

Co-authored-by: Martial Maillot <[email protected]>

* Update packages/code-du-travail-frontend/src/modules/mentions-legales/index.tsx

Co-authored-by: Martial Maillot <[email protected]>

* fix: config

* chore(dsfr): mise à jour de la version DSFR

* fix(dsfr): ignore les exceptions d'hydratation

* feat(tests): ajout du module de testing (#6096)

* fix: tests

* fix: tests

* fix: command

* fix: merge date

* fix: tests

* fix: tests

* fix: tests

* fix: tests

* fix(dsfr): ignore les exceptions d'hydratation

* fix: readme

* feat(DSFR): migration de la page article du code du travail (#6099)

* feat: 6093 dsfr page politique de confidentialit (#6094)

* feat: implémentation page politique confidentialité dsfr

* chore: clean

* fix: iframe dark mode

* chore: refacto + e2e test

* feat: convert a to Link

* chore: review

* chore: rename test

---------

Co-authored-by: victor <[email protected]>

* feat(dsfr): ajout des liens d'évitement (#6120)

* feat(dsfr): migration de la page plan du site (#6097)

* feat(dsfr): mise à jour des snapshots

* feat(dsfr): mise à jour des snapshots

* chore(dsfr): mise à jour de la lib DSFR

* feat(dsfr): ajout du composant "Avez-vous trouvé une réponse à votre question" (#6121)

* fix: merge date

* fix: satisfaction

* fix: retours preavis

* fix: retours preavis

* fix: tests

* move feedback component to the page articleCodeDuTravail.tsx

* clean-up css

* fix: feedback

* fix: feedback

* fix: tests

* fix: tests

* feat(dsfr): création du composant "Besoin de plus d'information" (#6135)

* fix: ui

* fix: composant

---------

Co-authored-by: carolineBda <[email protected]>
Co-authored-by: Martial Maillot <[email protected]>

* fix: retours

* fix: tests

* feat: nouvelle API pour les articles du code du travail (#6132)

Co-authored-by: carolineBda <[email protected]>

* fix(spec) : fix de la spec article-code-du-travail.spec.ts

* fix(dsfr): ajout de la config pour supprimer le `insafe-inline` des `scripts` dans les `csp` (#6151)

* feat(dsfr): ajout de matomo pour tracker les events (#6157)

* fix: matomo

* fix: matomo

---------

Co-authored-by: Martial Maillot <[email protected]>

* fix(feedback): ajout d'une logique de caractères restants (#6156)

* fix: tests

* feat: limiter à 500 caractères la saisie

* feat: limiter à 500 caractères la saisie

---------

Co-authored-by: Martial Maillot <[email protected]>

* feat(dsfr): ajout du nouveau logo (#6159)

* feat(dsfr): ajout des pages d'erreurs (404 + 500) (#6146)

* fix: pages

* fix: 404

* fix: tests

* fix: tests

* fix: tests

* fix: lint

* test error

* fix errors

* Fix spec

* add button to test error page

* feat: force error 500 for testing purpose

* feat: revert errors

---------

Co-authored-by: carolineBda <[email protected]>
Co-authored-by: Martial Maillot <[email protected]>

* feat: séparation des anciennes API et des nouvelles (#6183)

* fix(article code du travail): retrait du tag Code du travail (#6182)

* feat(config): correction de `husky`, ajout de `prettier` pour le formattage et de `lint-staged` pour runner le formattage au `precommit` (#6192)

* fix: prettier

* fix: prettier

* fix: readme

* fix: readme

* fix: bug

* fix: prettier

* fix: prettier

* fix: tests

* fix: tests

* fix: prettier

* fix: prettier

* fix: branch

* merge dev

* feat: implémentation simulateur brut net

* chore: fix ts

* chore: snap

* chore: clean

* chore: clean

* chore: clean

* chore: review

* feat: update responsive

* Revert "Merge branch 'dev' into simulateur-brut-net-dsfr"

This reverts commit 0748928, reversing
changes made to cd15bc7.

* chore: clean

* feat: chore clean

* chore: clean

* chore: remove undesired files

* chore: remove undesired files

* chore: clean

* feat: implementation page convention collective

* feat: update button link

* fix: meta description share

* feat: switch simu brut net couleur par defaut

* feat: ajout de l'icone

* feat: update svg

* fix: ts

* fix: bug load

* chore: review

* fix: mobile display

* chore: review

* chore: review

* chore: review

* feat: implémentation trouver cc

* feat: implementation trouver CC

* chore: common style

* feat: add error alert entreprise search

* feat: disable card

* feat: ajout TU + fix

* chore: clean

* fix: e2e tests

* chore: clean

* fix: widget

* fix: error

* feat: info bulle

* fix: widget

* fix: home fetch agreement

* feat: add postmessage searchCC

* fix: home cc

* feat: change contenu lié search cc

* fix: related items

* fix: message erreur lors de la recherche

* fix: error message

* fix: relatedItems

* chore: add TU

* refactor: move files to folders

* fix: build

* chore: review

* chore: clean

* fix: ajout des canonicals

* fix: input info

* fix: canonicals

* feat: ajout d'un spinner

* fix: tests

* chore: review

* feat: add spinner to enterprise search

* fix: load on select item autocomplete

* fix: bug widget selection entreprise

* fix: disabled rule

* chore: review

* chore: review

* chore: review

* chore: review

* chore: review

* chore: review

* chore: review

* fix: garder la recherche entrerprise au click precedent

* chore: review

* chore: review

* fix: TU + some styles

* fix: e2e

* refactor

* fix: TU

* fix: TU

* chore: review

* chore: review

* chore: review

* chore: review postalcode

* chore: review

* chore: review

* fix: cypress test

* chore: add widgetMode TU

* chore: fix test

* fix: cypress test

* fix: cypress test

* chore: cy

* chore: fix cy

* refactor

* refactor

* chore: review

* chore: clean

* chore: review

* fix: largeur champs recherche entreprise

* feat: ajout d'un message d'erreur pour les codes naf

* feat: update design

* chore: clean

* chore: design review

* chore: review

* chore: test noindex

* chore: nbsp

* chore: review

* chore: review

* chore: fix test e2e

---------

Co-authored-by: maxgfr <[email protected]>
Co-authored-by: Caroline <[email protected]>
Co-authored-by: Martial Maillot <[email protected]>
Co-authored-by: Social Groovy Bot <[email protected]>
Co-authored-by: victor <[email protected]>
Co-authored-by: carolineBda <[email protected]>
  • Loading branch information
7 people authored Dec 4, 2024
1 parent b345f9f commit 847861b
Show file tree
Hide file tree
Showing 71 changed files with 2,554 additions and 115 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"url": "https://github.com/SocialGouv/code-du-travail-numerique/issues"
},
"devDependencies": {
"cypress-iframe": "^1.0.1",
"husky": "^9.1.6",
"lerna": "8.1.8"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,30 @@ import {
Agreements,
AgreementsPerLetter,
} from "../../src/modules/convention-collective/Agreements";
import { fetchAgreements } from "../../src/modules/convention-collective";
import { fetchAllAgreements } from "../../src/modules/convention-collective";
import { generateDefaultMetadata } from "../../src/modules/common/metas";
import { notFound } from "next/navigation";
import { SITE_URL } from "../../src/config";

export const metadata = generateDefaultMetadata({
title: "Votre convention collective",
description:
"Retrouvez les questions/réponses fréquentes organisées par thème pour votre convention collective",
path: "/convention-collective",
overrideCanonical: `{${SITE_URL}/outils/convention-collective}`,
});

const removeAccents = (text: string) =>
text.normalize("NFD").replace(/[\u0300-\u036f]/g, "");

async function AgreementPage() {
const agreements = await fetchAgreements(
["slug", "shortTitle"],
"shortTitle"
);
const agreements = await fetchAllAgreements({
fields: ["slug", "shortTitle"],
sortBy: "shortTitle",
});
if (!agreements.length) {
return notFound();
}
const firstLettersAgreements = agreements.reduce<AgreementsPerLetter>(
(agreementPerletter, agreement) => {
const { shortTitle } = agreement;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { DsfrLayout } from "../../../../src/modules/layout";
import { DocumentElasticResult } from "../../../../src/modules/documents";
import { fetchTool, FindAgreementLayout } from "../../../../src/modules/outils";
import { notFound } from "next/navigation";
import { generateDefaultMetadata } from "../../../../src/modules/common/metas";
import { ElasticTool } from "../../../../src/modules/outils/type";
import { AgreementSearch } from "../../../../src/modules/convention-collective";
import { agreementRelatedItems } from "../../../../src/modules/convention-collective/agreementRelatedItems";
import { SITE_URL } from "../../../../src/config";

export async function generateMetadata() {
const { title, description } = await getTool();

return generateDefaultMetadata({
title: `Simulateur - ${title}`,
description: description,
path: `${SITE_URL}/outils/convention-collective/convention`,
overrideCanonical: `${SITE_URL}/outils/convention-collective`,
});
}

async function FindAgreementByNamePage() {
const tool = await getTool();
return (
<DsfrLayout>
<FindAgreementLayout
relatedItems={agreementRelatedItems}
description={tool.description}
>
<AgreementSearch />
</FindAgreementLayout>
</DsfrLayout>
);
}

const getTool = async () => {
const tool = await fetchTool("convention-collective");

if (!tool) {
return notFound();
}
return tool;
};

export default FindAgreementByNamePage;
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { DsfrLayout } from "../../../../../src/modules/layout";
import { DocumentElasticResult } from "../../../../../src/modules/documents";
import {
fetchTool,
FindAgreementLayout,
} from "../../../../../src/modules/outils";
import { notFound } from "next/navigation";
import { generateDefaultMetadata } from "../../../../../src/modules/common/metas";
import { ElasticTool } from "../../../../../src/modules/outils/type";
import { EnterpriseAgreementSelection } from "../../../../../src/modules/enterprise";
import { searchEnterprises } from "../../../../../src/modules/enterprise/queries";
import { agreementRelatedItems } from "../../../../../src/modules/convention-collective/agreementRelatedItems";
import { SITE_URL } from "../../../../../src/config";

export async function generateMetadata({ params }) {
const { title, description } = await getTool();

return generateDefaultMetadata({
title: `Simulateur - ${title}`,
description: description,
path: `${SITE_URL}/outils/convention-collective/selection/${params.slug}`,
overrideCanonical: `${SITE_URL}/outils/convention-collective`,
});
}

async function AgreementSelectionPage({ params }) {
const [enterprise] = await searchEnterprises({
query: params.slug,
});
if (!enterprise) {
return notFound();
}
const tool = await getTool();
return (
<DsfrLayout>
<meta name="robots" content="noindex,nofollow" />
<FindAgreementLayout
relatedItems={agreementRelatedItems}
description={tool.description}
>
<EnterpriseAgreementSelection enterprise={enterprise} />
</FindAgreementLayout>
</DsfrLayout>
);
}

const getTool = async () => {
const tool: DocumentElasticResult<ElasticTool> = await fetchTool(
"convention-collective"
);

if (!tool) {
return notFound();
}
return tool;
};

export default AgreementSelectionPage;
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { DsfrLayout } from "../../../../src/modules/layout";
import { DocumentElasticResult } from "../../../../src/modules/documents";
import { fetchTool, FindAgreementLayout } from "../../../../src/modules/outils";
import { notFound } from "next/navigation";
import { generateDefaultMetadata } from "../../../../src/modules/common/metas";
import { ElasticTool } from "../../../../src/modules/outils/type";
import { EnterpriseAgreementSearch } from "../../../../src/modules/enterprise";
import { agreementRelatedItems } from "../../../../src/modules/convention-collective/agreementRelatedItems";
import { SITE_URL } from "../../../../src/config";

export async function generateMetadata() {
const { title, description } = await getTool();

return generateDefaultMetadata({
title: `Simulateur - ${title}`,
description: description,
path: `${SITE_URL}/outils/convention-collective/entreprise`,
overrideCanonical: `${SITE_URL}/outils/convention-collective`,
});
}

async function FindAgreementByEnterprisePage() {
const tool = await getTool();
return (
<DsfrLayout>
<FindAgreementLayout
relatedItems={agreementRelatedItems}
description={tool.description}
>
<EnterpriseAgreementSearch />
</FindAgreementLayout>
</DsfrLayout>
);
}

const getTool = async () => {
const tool: DocumentElasticResult<ElasticTool> = await fetchTool(
"convention-collective"
);

if (!tool) {
return notFound();
}
return tool;
};

export default FindAgreementByEnterprisePage;
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { DsfrLayout } from "../../../src/modules/layout";
import { DocumentElasticResult } from "../../../src/modules/documents";
import { fetchTool, FindAgreementLayout } from "../../../src/modules/outils";
import { notFound } from "next/navigation";
import { generateDefaultMetadata } from "../../../src/modules/common/metas";
import { ElasticTool } from "../../../src/modules/outils/type";
import { AgreementSearchIntro } from "../../../src/modules/convention-collective";
import { agreementRelatedItems } from "../../../src/modules/convention-collective/agreementRelatedItems";
import { SITE_URL } from "../../../src/config";

export async function generateMetadata() {
const { title, description } = await getTool();

return generateDefaultMetadata({
title: `Simulateur - ${title}`,
description: description,
path: `/outils/convention-collective`,
overrideCanonical: `${SITE_URL}/outils/convention-collective`,
});
}

async function FindAgreementPage() {
const tool = await getTool();
return (
<DsfrLayout>
<FindAgreementLayout
relatedItems={agreementRelatedItems}
description={tool.description}
>
<AgreementSearchIntro />
</FindAgreementLayout>
</DsfrLayout>
);
}

const getTool = async () => {
const tool: DocumentElasticResult<ElasticTool> = await fetchTool(
"convention-collective"
);

if (!tool) {
return notFound();
}
return tool;
};

export default FindAgreementPage;
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { DocumentElasticResult } from "../../../../../src/modules/documents";
import {
fetchTool,
FindAgreementWidgetLayout,
} from "../../../../../src/modules/outils";
import { notFound } from "next/navigation";
import { generateDefaultMetadata } from "../../../../../src/modules/common/metas";
import { ElasticTool } from "../../../../../src/modules/outils/type";
import { EnterpriseAgreementSelection } from "../../../../../src/modules/enterprise";
import { searchEnterprises } from "../../../../../src/modules/enterprise/queries";
import { SITE_URL } from "../../../../../src/config";

export async function generateMetadata({ params }) {
const { title, description } = await getTool();

return generateDefaultMetadata({
title: `Simulateur - ${title}`,
description: description,
path: `${SITE_URL}/widgets/convention-collective/selection/${params.slug}`,
overrideCanonical: `${SITE_URL}/outils/convention-collective`,
});
}

async function AgreementSelectionPage({ params }) {
const [enterprise] = await searchEnterprises({
query: params.slug,
});
return (
<FindAgreementWidgetLayout>
<EnterpriseAgreementSelection enterprise={enterprise} widgetMode />
</FindAgreementWidgetLayout>
);
}

const getTool = async () => {
const tool: DocumentElasticResult<ElasticTool> = await fetchTool(
"convention-collective"
);

if (!tool) {
return notFound();
}
return tool;
};

export default AgreementSelectionPage;
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { DocumentElasticResult } from "../../../src/modules/documents";
import {
fetchTool,
FindAgreementWidgetLayout,
} from "../../../src/modules/outils";
import { notFound } from "next/navigation";
import { generateDefaultMetadata } from "../../../src/modules/common/metas";
import { ElasticTool } from "../../../src/modules/outils/type";
import { EnterpriseAgreementSearch } from "../../../src/modules/enterprise";
import { SITE_URL } from "../../../src/config";

export async function generateMetadata() {
const { title, description } = await getTool();

return generateDefaultMetadata({
title: `Simulateur - ${title}`,
description: description,
path: `${SITE_URL}/widgets/convention-collective`,
overrideCanonical: `${SITE_URL}/outils/convention-collective`,
});
}

async function FindAgreementByEnterprisePage() {
return (
<FindAgreementWidgetLayout>
<EnterpriseAgreementSearch widgetMode />
</FindAgreementWidgetLayout>
);
}

const getTool = async () => {
const tool: DocumentElasticResult<ElasticTool> = await fetchTool(
"convention-collective"
);

if (!tool) {
return notFound();
}
return tool;
};

export default FindAgreementByEnterprisePage;
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
Cypress.Commands.add("getIframe" as any, () => {
return cy
.get("iframe")
.its("0.contentDocument.body")
.should("not.be.empty")
.then(cy.wrap);
});

describe("Pages integration convention collective", () => {
it("should display iframe convention collective", () => {
cy.visit("/integration/convention-collective", {
Expand All @@ -14,17 +6,25 @@ describe("Pages integration convention collective", () => {
},
});

// @ts-ignore
cy.getIframe().as("iframe");
cy.frameLoaded({ url: "/widgets/convention-collective" });

cy.iframe()
.findByRole("heading", { level: 1 })
.should("have.text", "Trouver sa convention collective")
.click();

cy.iframe()
// @ts-ignore
.findByLabel("Nom de votre entreprise ou numéro Siren/Siret")
.as("inputSiret");

cy.get("@inputSiret").type("carrefour", { force: true });

cy.get("@iframe").contains("Trouver sa convention collective");
cy.get("@iframe").find("#enterprise-search").as("entreprise-search");
cy.get("@entreprise-search").type("carrefour");
cy.get("@iframe").find("button[type=submit]").as("button-submit");
cy.get("@button-submit").click();
cy.get("@iframe").contains("CARREFOUR HYPERMARCHES").as("entreprise");
cy.get("@entreprise").click();
cy.get("@iframe").contains("Conventions collectives").as("cc");
cy.iframe().find("button[type=submit]").contains("Rechercher").click();
cy.iframe().contains("CARREFOUR HYPERMARCHES").click();
cy.iframe()
.contains("Commerce de détail et de gros à prédominance alimentaire")
.as("cc");
cy.get("@cc").click();
cy.get("@postMessage")
.should("have.been.calledOnce")
Expand Down
Loading

0 comments on commit 847861b

Please sign in to comment.