From 94018daa25001d934e8ff8a2eb9ceb92fee6e1cf Mon Sep 17 00:00:00 2001 From: Nicolas KOKLA Date: Mon, 4 Nov 2024 14:45:50 +0100 Subject: [PATCH 1/4] Update URL for page of ressources and documentation --- next.config.mjs | 5 +++++ src/layouts/Header.tsx | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/next.config.mjs b/next.config.mjs index 8116d67b5..b08c6fbaf 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -27,6 +27,11 @@ const withBundleAnalyzer = NextBundleAnalyzer({ }) const redirects = async () => [ + { + source: '/ressources', + destination: '/ressources-et-documentations', + permanent: true, + }, { source: '/gerer-mes-adresses', destination: '/programme-bal', diff --git a/src/layouts/Header.tsx b/src/layouts/Header.tsx index ccaccf356..91a50f105 100644 --- a/src/layouts/Header.tsx +++ b/src/layouts/Header.tsx @@ -45,8 +45,7 @@ export const navEntries: MainNavigationProps.Item[] = [ linkProps: { href: '/decouvrir-la-BAN' }, }, { text: 'Utiliser la BAN', linkProps: { href: '/utiliser-la-ban' } }, - { text: 'Documentation', linkProps: { href: '/ressources' } }, - // {text: 'Documentation technique',linkProps: { href: '#' }, }, + { text: 'Documentation', linkProps: { href: '/ressources-et-documentations' } }, { text: 'État du déploiement', linkProps: { href: '/deploiement-bal' } }, { text: 'Statistiques', linkProps: { href: '/stats' } }, ], @@ -173,7 +172,7 @@ export default function Header() { { iconId: 'fr-icon-book-2-fill', linkProps: { - href: '#', + href: '/ressources-et-documentations', }, text: 'Documentation', }, From 7379b9a8c2e282117705da93434565c9145dbfb9 Mon Sep 17 00:00:00 2001 From: Nicolas KOKLA Date: Mon, 4 Nov 2024 14:47:04 +0100 Subject: [PATCH 2/4] Add 'La Carte' to site Header --- src/layouts/Header.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/layouts/Header.tsx b/src/layouts/Header.tsx index 91a50f105..01335a31f 100644 --- a/src/layouts/Header.tsx +++ b/src/layouts/Header.tsx @@ -170,25 +170,25 @@ export default function Header() { }} quickAccessItems={[ { - iconId: 'fr-icon-book-2-fill', + iconId: 'fr-icon-road-map-fill', linkProps: { - href: '/ressources-et-documentations', + href: '/carte-base-adresse-nationale', }, - text: 'Documentation', + text: 'La Carte', }, { - iconId: 'ri-quill-pen-fill', + iconId: 'fr-icon-book-2-fill', linkProps: { - href: '/blog', + href: '/ressources-et-documentations', }, - text: 'Blog', + text: 'La Documentation', }, { - iconId: 'fr-icon-message-2-fill', + iconId: 'ri-quill-pen-fill', linkProps: { - href: '/nous-contacter', + href: '/blog', }, - text: 'Nous contacter', + text: 'Le Blog', }, ]} navigation={selectedNavigationLinks as MainNavigationProps.Item[]} From 9891c84383b57a6a7b6a563366fe3bd61825378f Mon Sep 17 00:00:00 2001 From: Nicolas KOKLA Date: Mon, 4 Nov 2024 14:48:57 +0100 Subject: [PATCH 3/4] Update deps React-DSFR to 1.14.1 --- package-lock.json | 6 ++++-- package.json | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index dc3860bb9..e6f5407a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "dependencies": { "@aws-sdk/client-s3": "^3.645.0", "@ban-team/validateur-bal": "^2.19.1", - "@codegouvfr/react-dsfr": "^1.10.11", + "@codegouvfr/react-dsfr": "^1.14.1", "@etalab/decoupage-administratif": "^4.0.0", "@next/bundle-analyzer": "^14.2.13", "@socialgouv/matomo-next": "^1.9.0", @@ -3046,7 +3046,9 @@ } }, "node_modules/@codegouvfr/react-dsfr": { - "version": "1.13.2", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@codegouvfr/react-dsfr/-/react-dsfr-1.14.1.tgz", + "integrity": "sha512-ncoVbN6PSQVXbyu/KgkRSOfKiHxOLEEfJW9Z8rdVBBDnQuYpYCE91NVlRC27YdrXy1Kklf0MTYWEoO7hgpE7VQ==", "license": "MIT", "dependencies": { "tsafe": "^1.7.2", diff --git a/package.json b/package.json index d1b57cac0..ea7122bf2 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "dependencies": { "@aws-sdk/client-s3": "^3.645.0", "@ban-team/validateur-bal": "^2.19.1", - "@codegouvfr/react-dsfr": "^1.10.11", + "@codegouvfr/react-dsfr": "^1.14.1", "@etalab/decoupage-administratif": "^4.0.0", "@next/bundle-analyzer": "^14.2.13", "@socialgouv/matomo-next": "^1.9.0", @@ -39,12 +39,12 @@ "getconfig": "^4.5.0", "gray-matter": "^4.0.3", "http-proxy-middleware": "^3.0.2", + "https-proxy-agent": "^7.0.5", "lodash": "^4.17.21", "maplibre-gl": "^4.7.1", - "https-proxy-agent": "^7.0.5", "next": "14.2.5", - "prop-types": "^15.8.1", "node-fetch": "^3.3.2", + "prop-types": "^15.8.1", "react": "^18", "react-chartjs-2": "^5.2.0", "react-confetti": "^6.1.0", @@ -52,15 +52,15 @@ "react-dropzone": "^14.2.3", "react-map-gl": "^7.1.7", "react-pin-field": "^3.1.5", + "recharts": "^2.8.0", "remark": "^15.0.1", "remark-heading-id": "^1.0.1", "remark-html": "^16.0.1", "send": "^0.18.0", "sharp": "^0.33.5", "styled-components": "^6.1.12", - "vt-pbf": "^3.1.3", "swr": "^2.2.4", - "recharts": "^2.8.0" + "vt-pbf": "^3.1.3" }, "devDependencies": { "@chromatic-com/storybook": "^1.6.1", From c869ba3b00c11228973a03ba913489819170d191 Mon Sep 17 00:00:00 2001 From: Nicolas KOKLA Date: Mon, 4 Nov 2024 14:50:37 +0100 Subject: [PATCH 4/4] Add Mastodon to social network links --- .env.default | 3 +- .../blog/[slug]/components/AsideContent.tsx | 8 ++- src/components/SharingBlock/SharingBlock.tsx | 50 +++++++++++++++++-- src/layouts/Footer.tsx | 21 ++++++-- 4 files changed, 74 insertions(+), 8 deletions(-) diff --git a/.env.default b/.env.default index 1002d0e1a..4e3c83855 100644 --- a/.env.default +++ b/.env.default @@ -84,6 +84,7 @@ S3_CONFIG_ENDPOINT=YOUR_S3_ENDPOINT_HERE # ------------------------------- NEXT_PUBLIC_SOCIAL_NETWORKS_URL_XCOM=https://x.com/adressedatagouv +NEXT_PUBLIC_SOCIAL_NETWORKS_URL_MASTODON=https://social.numerique.gouv.fr/@adressedatagouv/ NEXT_PUBLIC_SOCIAL_NETWORKS_URL_FACEBOOK=https://www.facebook.com/BasesAdressesLocales NEXT_PUBLIC_SOCIAL_NETWORKS_URL_LINKEDIN=https://www.linkedin.com/company/base-adresse-nationale/ NEXT_PUBLIC_SOCIAL_NETWORKS_URL_GITHUB=https://github.com/BaseAdresseNationale @@ -94,4 +95,4 @@ NEXT_PUBLIC_SOCIAL_NETWORKS_URL_GITHUB=https://github.com/BaseAdresseNationale NEXT_PUBLIC_CLIENT_GUICHET_ADRESSE= NEXT_PUBLIC_CLIENT_MES_ADRESSE= -NEXT_PUBLIC_CLIENT_FORMULAIRE_PUBLICATION= \ No newline at end of file +NEXT_PUBLIC_CLIENT_FORMULAIRE_PUBLICATION= diff --git a/src/app/blog/[slug]/components/AsideContent.tsx b/src/app/blog/[slug]/components/AsideContent.tsx index 13b8281f1..3219fb714 100644 --- a/src/app/blog/[slug]/components/AsideContent.tsx +++ b/src/app/blog/[slug]/components/AsideContent.tsx @@ -6,6 +6,7 @@ import { AsideLinkList, AsideFollowList } from './AsideContent.styled' const { NEXT_PUBLIC_SOCIAL_NETWORKS_URL_XCOM: SOCIAL_NETWORKS_URL_XCOM, + NEXT_PUBLIC_SOCIAL_NETWORKS_URL_MASTODON: SOCIAL_NETWORKS_URL_MASTODON, NEXT_PUBLIC_SOCIAL_NETWORKS_URL_FACEBOOK: SOCIAL_NETWORKS_URL_FACEBOOK, NEXT_PUBLIC_SOCIAL_NETWORKS_URL_LINKEDIN: SOCIAL_NETWORKS_URL_LINKEDIN, } = process.env @@ -28,9 +29,14 @@ async function AsideContent() {
  • LinkedIn
  • X.com
  • -
  • Facebook
  • +
  • Mastodon
  • Newsletter
  • +
    +
    A voir egalement
    + +
  • Page Facebook du programme BAL
  • +
    ) } diff --git a/src/components/SharingBlock/SharingBlock.tsx b/src/components/SharingBlock/SharingBlock.tsx index 4c7eef2a9..f81ee69cf 100644 --- a/src/components/SharingBlock/SharingBlock.tsx +++ b/src/components/SharingBlock/SharingBlock.tsx @@ -4,6 +4,40 @@ import Button from '@codegouvfr/react-dsfr/Button' import type { ButtonProps } from '@codegouvfr/react-dsfr/Button' import { SharingDefList } from './SharingBlock.styled' +import { Tooltip } from '@codegouvfr/react-dsfr/Tooltip' + +interface MastodonShareEvent extends Event { + target: EventTarget & { + getAttribute(attributeName: string): string | null + } +} + +function MastodonShare(content: string, navigatorPageName = 'mastodon') { + try { + // Controle if content is not empty + if (!content) { + throw new Error('Content is empty') + } + + // Get the Mastodon domain + // TODO: Prefer DSFR Modal for the prompt + const mastodonDomain = prompt('Votre Domain Mastodon ?', 'mastodon.social') + + // TODO: Add a check for the Mastodon domain + if (!mastodonDomain) { + return + } + + // Build the sharing URL + const url = `https://${mastodonDomain}/share?text=${content}` + + // Open a window on the share page + window.open(url, navigatorPageName) + } + catch (error) { + console.error(error) + } +} const ShareButton = (buttonProps: ButtonProps) => (