Skip to content

Commit

Permalink
Merge branch 'dev' into 6295-modale-service-près-de-moi-formulaire-de…
Browse files Browse the repository at this point in the history
…-recherche-non-accessible
  • Loading branch information
victor committed Dec 18, 2024
2 parents 1c5def0 + dc686a7 commit aa993e7
Show file tree
Hide file tree
Showing 101 changed files with 16,532 additions and 103 deletions.
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,46 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [4.168.1](https://github.com/SocialGouv/code-du-travail-numerique/compare/v4.168.0...v4.168.1) (2024-12-17)


### Bug Fixes

* **e2e:** rendre la spec brut/net non flaky ([#6371](https://github.com/SocialGouv/code-du-travail-numerique/issues/6371)) ([5098955](https://github.com/SocialGouv/code-du-travail-numerique/commit/509895594a0992e34daa0ecb4baf0f4ed439f13d))
* **fiches SP:** gérer les cas de liens sans attributs URL ([#6372](https://github.com/SocialGouv/code-du-travail-numerique/issues/6372)) ([54bcc48](https://github.com/SocialGouv/code-du-travail-numerique/commit/54bcc48eba51c5a5e3ac72f5c5ec58e0ea376df5))





# [4.168.0](https://github.com/SocialGouv/code-du-travail-numerique/compare/v4.167.2...v4.168.0) (2024-12-17)


### Bug Fixes

* **matomo:** envoyer les events de changement de pages ([#6368](https://github.com/SocialGouv/code-du-travail-numerique/issues/6368)) ([fdd8487](https://github.com/SocialGouv/code-du-travail-numerique/commit/fdd8487be4d4e970bcd0574827bda1bbbd704dc9))


### Features

* **DSFR:** migration des pages fiches service public ([#6277](https://github.com/SocialGouv/code-du-travail-numerique/issues/6277)) ([85918d7](https://github.com/SocialGouv/code-du-travail-numerique/commit/85918d7d56d2941e119701e1fbb858935f97fb73))





## [4.167.2](https://github.com/SocialGouv/code-du-travail-numerique/compare/v4.167.1...v4.167.2) (2024-12-13)


### Bug Fixes

* ajout du tracking sur outil recherche cc ([#6366](https://github.com/SocialGouv/code-du-travail-numerique/issues/6366)) ([c1fd3d8](https://github.com/SocialGouv/code-du-travail-numerique/commit/c1fd3d8ef0d153b54bc137cbe32a7915da659f72))
* **seo:** retrait des h1 dupliqués ([#6342](https://github.com/SocialGouv/code-du-travail-numerique/issues/6342)) ([26580e0](https://github.com/SocialGouv/code-du-travail-numerique/commit/26580e0abd9544c11b21c3ff9039f6391552a0f7))





## [4.167.1](https://github.com/SocialGouv/code-du-travail-numerique/compare/v4.167.0...v4.167.1) (2024-12-05)


Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
}
},
"npmClient": "yarn",
"version": "4.167.1",
"version": "4.168.1",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
40 changes: 40 additions & 0 deletions packages/code-du-travail-frontend/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,46 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [4.168.1](https://github.com/SocialGouv/code-du-travail-numerique/compare/v4.168.0...v4.168.1) (2024-12-17)


### Bug Fixes

* **e2e:** rendre la spec brut/net non flaky ([#6371](https://github.com/SocialGouv/code-du-travail-numerique/issues/6371)) ([5098955](https://github.com/SocialGouv/code-du-travail-numerique/commit/509895594a0992e34daa0ecb4baf0f4ed439f13d))
* **fiches SP:** gérer les cas de liens sans attributs URL ([#6372](https://github.com/SocialGouv/code-du-travail-numerique/issues/6372)) ([54bcc48](https://github.com/SocialGouv/code-du-travail-numerique/commit/54bcc48eba51c5a5e3ac72f5c5ec58e0ea376df5))





# [4.168.0](https://github.com/SocialGouv/code-du-travail-numerique/compare/v4.167.2...v4.168.0) (2024-12-17)


### Bug Fixes

* **matomo:** envoyer les events de changement de pages ([#6368](https://github.com/SocialGouv/code-du-travail-numerique/issues/6368)) ([fdd8487](https://github.com/SocialGouv/code-du-travail-numerique/commit/fdd8487be4d4e970bcd0574827bda1bbbd704dc9))


### Features

* **DSFR:** migration des pages fiches service public ([#6277](https://github.com/SocialGouv/code-du-travail-numerique/issues/6277)) ([85918d7](https://github.com/SocialGouv/code-du-travail-numerique/commit/85918d7d56d2941e119701e1fbb858935f97fb73))





## [4.167.2](https://github.com/SocialGouv/code-du-travail-numerique/compare/v4.167.1...v4.167.2) (2024-12-13)


### Bug Fixes

* ajout du tracking sur outil recherche cc ([#6366](https://github.com/SocialGouv/code-du-travail-numerique/issues/6366)) ([c1fd3d8](https://github.com/SocialGouv/code-du-travail-numerique/commit/c1fd3d8ef0d153b54bc137cbe32a7915da659f72))
* **seo:** retrait des h1 dupliqués ([#6342](https://github.com/SocialGouv/code-du-travail-numerique/issues/6342)) ([26580e0](https://github.com/SocialGouv/code-du-travail-numerique/commit/26580e0abd9544c11b21c3ff9039f6391552a0f7))





## [4.167.1](https://github.com/SocialGouv/code-du-travail-numerique/compare/v4.167.0...v4.167.1) (2024-12-05)


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React from "react";
import { notFound } from "next/navigation";
import { DsfrLayout } from "../../../src/modules/layout";
import { fetchFicheSP } from "../../../src/modules/fiche-service-public/queries";
import { fetchRelatedItems } from "../../../src/modules/documents";
import { generateDefaultMetadata } from "../../../src/modules/common/metas";
import { getRouteBySource, SOURCES } from "@socialgouv/cdtn-utils";
import { FicheServicePublicContainer } from "../../../src/modules/fiche-service-public/FicheServicePublicContainer";

export async function generateMetadata({ params }) {
const { title, description, url } = await getFiche(params.slug);

return generateDefaultMetadata({
title: title,
description: description,
path: `/${getRouteBySource(SOURCES.SHEET_SP)}/${params.slug}`,
overrideCanonical: url,
});
}

async function Fiche({ params }) {
const {
_id,
breadcrumbs,
date,
description,
raw,
referencedTexts,
title,
url,
} = await getFiche(params.slug);
const relatedItems = await fetchRelatedItems({ _id }, params.slug);

return (
<DsfrLayout>
<FicheServicePublicContainer
title={title}
relatedItems={relatedItems}
date={date}
url={url}
metaDescription={description}
raw={raw}
breadcrumbs={breadcrumbs}
referencedTexts={referencedTexts}
/>
</DsfrLayout>
);
}

const getFiche = async (slug: string) => {
const fiche = await fetchFicheSP(slug);

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

export default Fiche;
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
describe("Fiche Service public", () => {
it("je vois une page fiche service public", () => {
cy.visit("/fiche-service-public/salaire-primes-et-avantages");
cy.findAllByRole("heading", { level: 1 }).should(
"have.text",
"Salaire, primes et avantages"
);
cy.get("head > link[rel='canonical']")
.should("have.prop", "href")
.and(
"equal",
"https://www.service-public.fr/particuliers/vosdroits/F2301"
);

cy.contains("a", "Fiche service-public.fr")
.should("have.attr", "href")
.and(
"contain",
"https://www.service-public.fr/particuliers/vosdroits/F2301"
);
cy.get("body").should("contain", "01/11/2024");
cy.get("h2").first().should("contain", "Salaire");
});

it("je vois une fiche service public avec un accordéon ouvert", () => {
cy.visit("/fiche-service-public/salaire-primes-et-avantages#salaire");
cy.get("h2").get('[aria-expanded="true"]').should("contain", "Salaire");
});
});
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
describe("Landing pages", () => {
it("je vois une page fiche service public", () => {
cy.visit("/fiche-service-public/salaire-primes-et-avantages#salaire");
cy.get("h1").should("contain", "Salaire, primes et avantages");
cy.get("body").should("contain", "Source: Fiche service-public.fr");
cy.get("h2").first().should("contain", "Salaire");
});

it("je vois une fiche service public avec un accordéon ouvert", () => {
cy.visit("/fiche-service-public/salaire-primes-et-avantages#salaire");
cy.get("h1").should("have.text", "Salaire, primes et avantages");
cy.get('[aria-expanded="true"]').find("h2").should("contain", "Salaire");
});

it("je vois une page convention collective", () => {
cy.visit(
"/convention-collective/1686-commerces-et-services-de-laudiovisuel-de-lelectronique-et-de-lequipemen"
Expand Down
44 changes: 44 additions & 0 deletions packages/code-du-travail-frontend/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// / <reference types="next" />
// / <reference types="next/types/global" />

interface Dimensions {
dimension1?: string;
dimension2?: string;
dimension3?: string;
dimension4?: string;
dimension5?: string;
dimension6?: string;
dimension7?: string;
dimension8?: string;
dimension9?: string;
dimension10?: string;
}

interface Window {
_paq?:
| (
| Dimensions
| number[]
| string[]
| number
| string
| null
| undefined
)[][]
| null;
}
declare namespace NodeJS {
interface Global {
_paq?:
| (
| Dimensions
| number[]
| string[]
| number
| string
| null
| undefined
)[][]
| null;
}
}
2 changes: 1 addition & 1 deletion packages/code-du-travail-frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cdt/frontend",
"version": "4.167.1",
"version": "4.168.1",
"description": "Code du travail frontend",
"private": true,
"homepage": "https://code-du-travail.beta.gouv.fr/",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React from "react";
import { ServicePublicReference } from "@socialgouv/cdtn-types";
import { getRouteBySource, SOURCES } from "@socialgouv/cdtn-utils";
import { fr } from "@codegouvfr/react-dsfr";

export const ReferenceList = ({
references,
}: {
references: ServicePublicReference[];
}) => {
const formattedRefs = references
.map((ref) => {
switch (ref.type) {
case SOURCES.CDT:
return (
<a
key={ref.slug + ref.title}
href={`/${getRouteBySource(SOURCES.CDT)}/${ref.slug}`}
>{`Article ${ref.title} du Code du travail`}</a>
);
case SOURCES.CCN:
return (
<a
key={ref.slug + ref.title}
href={`/${getRouteBySource(SOURCES.CCN)}/${ref.slug}`}
>{`Convention collective: ${ref.title}`}</a>
);
case SOURCES.EXTERNALS:
return (
<a
key={ref.url + ref.title}
href={ref.url}
target="_blank"
rel="noreferer noopener"
>{`Convention collective: ${ref.title}`}</a>
);
}
})
.filter((item) => item !== null);
return (
<ul>
{formattedRefs.map((item) => {
return (
<li key={item.key}>
<p className={fr.cx("fr-mb-0")}>{item}</p>
</li>
);
})}
</ul>
);
};
Loading

0 comments on commit aa993e7

Please sign in to comment.