From 078e60b728936cf77708058ef364f395cbe27f09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Rialland?= Date: Tue, 15 Mar 2022 13:12:27 +0100 Subject: [PATCH] Place des entreprises (#2034) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * WIP Place des entreprises * Fix Emoji waning * WIP Place des entreprises * Ajout de PdE dans les CSP directive * Ajout de l'option small sur la popover * Style de l'iframe place des entreprises * ⬆ Update react-aria button, dialog and overlays * Amélioration du composant PlaceDesEntreprises * Empêche l'event "click" apres un event "touch" sur mobile (fix #2020) * Clean commentaire * Fix des erreurs de dom * Ajout des fonctions isProduction, isStaging et isDevelopment * Ajout des url de staging place des entreprises * Refacto du texte * Ajout des traduction * Ajout du staging de PdE dans le cors * Modification du lien storybook EN * Ajout de dépréciation sur les var d'env MODE, DEV et PROD * Ajout du siret pour PdE dans Gérer * Ajout d'un scrollToTop sur l'onLoad de l'iframe * Fix css de la popover sur mobile * Fix css des bar de pourcentage sur tablet --- .github/workflows/deploy.yaml | 2 +- site/netlify.toml | 2 +- site/package.json | 8 +- site/source/components/CompanyDetails.tsx | 2 +- site/source/components/Distribution.css | 4 - site/source/components/Feedback/index.tsx | 1 + site/source/components/LegalNotice.tsx | 1 + .../source/components/PlaceDesEntreprises.tsx | 126 ++++++++++++++++++ site/source/components/SearchButton.tsx | 1 + .../ShareSimulationBanner/index.tsx | 13 +- .../conversation/SeeAnswersButton.tsx | 1 + .../Footer/InscriptionBetaTesteur/index.tsx | 1 + .../components/layout/Footer/Privacy.tsx | 1 + site/source/components/utils/Emoji.tsx | 2 +- site/source/design-system/Popover.tsx | 34 +++-- .../design-system/PopoverWithTrigger.tsx | 15 ++- site/source/design-system/buttons/Button.tsx | 7 +- .../design-system/buttons/ButtonHelp.tsx | 1 + site/source/design-system/card/Card.tsx | 5 +- .../source/hooks/usePreventClickAfterTouch.ts | 19 +++ site/source/locales/ui-en.yaml | 59 ++++---- site/source/locales/ui-fr.yaml | 17 ++- .../pages/Gerer/DemandeMobilite/EndBlock.tsx | 2 + site/source/pages/Gerer/Home.tsx | 16 ++- .../pages/Landing/ContinueWithCompany.tsx | 1 + site/source/pages/Simulateurs/Page/index.tsx | 3 + site/source/pages/Simulateurs/metadata.tsx | 29 ++++ site/source/pages/integration/Iframe.tsx | 1 + site/source/sentry.ts | 25 +--- site/source/types/app-env.d.ts | 13 ++ site/source/types/iframe-resizer.d.ts | 5 + site/source/utils.ts | 36 +++++ yarn.lock | 28 ++-- 33 files changed, 378 insertions(+), 103 deletions(-) create mode 100644 site/source/components/PlaceDesEntreprises.tsx create mode 100644 site/source/hooks/usePreventClickAfterTouch.ts diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 9f3964131..7fb8b2489 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -199,7 +199,7 @@ jobs: - mon-entreprise : ${{ needs.deploy-context.outputs.fr_url }} - mycompanyinfrance : ${{ needs.deploy-context.outputs.en_url }} - - storybook : ${{ needs.deploy-context.outputs.fr_url }}/dev/storybook/ or ${{ needs.deploy-context.outputs.en_url }}/dev/storybook/ + - storybook : ${{ needs.deploy-context.outputs.fr_url }}/dev/storybook/ ([version EN](${{ needs.deploy-context.outputs.en_url }}/dev/storybook/)) e2e-test-preview: env: diff --git a/site/netlify.toml b/site/netlify.toml index 25d03de10..90b19ed88 100644 --- a/site/netlify.toml +++ b/site/netlify.toml @@ -1,7 +1,7 @@ [[headers]] for = "/*" [headers.values] -Content-Security-Policy = "default-src 'self' mon-entreprise.fr; style-src 'self' 'unsafe-inline' mon-entreprise.zammad.com; connect-src 'self' *.sentry.io raw.githubusercontent.com *.xiti.com mon-entreprise.zammad.com api.recherche-entreprises.fabrique.social.gouv.fr geo.api.gouv.fr *.algolianet.com; form-action 'self' *.sibforms.com *.sentry.io mon-entreprise.zammad.com; script-src 'self' 'unsafe-inline' 'unsafe-eval' *.xiti.com stonly.com code.jquery.com mon-entreprise.zammad.com polyfill.io; img-src 'self' data: *.xiti.com user-images.githubusercontent.com; frame-src 'self' https://www.youtube-nocookie.com https://codesandbox.io" +Content-Security-Policy = "default-src 'self' mon-entreprise.fr; style-src 'self' 'unsafe-inline' mon-entreprise.zammad.com; connect-src 'self' *.sentry.io raw.githubusercontent.com *.xiti.com mon-entreprise.zammad.com api.recherche-entreprises.fabrique.social.gouv.fr geo.api.gouv.fr *.algolianet.com; form-action 'self' *.sibforms.com *.sentry.io mon-entreprise.zammad.com; script-src 'self' 'unsafe-inline' 'unsafe-eval' *.xiti.com stonly.com code.jquery.com mon-entreprise.zammad.com polyfill.io; img-src 'self' data: *.xiti.com user-images.githubusercontent.com; frame-src 'self' https://www.youtube-nocookie.com https://codesandbox.io https://place-des-entreprises.beta.gouv.fr https://reso-staging.osc-fr1.scalingo.io" ## Twemoji proxy for client privacy #1219 [[redirects]] diff --git a/site/package.json b/site/package.json index 099280026..9ff268893 100644 --- a/site/package.json +++ b/site/package.json @@ -54,12 +54,12 @@ "@internationalized/number": "^3.0.3", "@mui/material": "^5.0.4", "@mui/styled-engine": "npm:@mui/styled-engine-sc@latest", - "@react-aria/button": "^3.3.4", + "@react-aria/button": "^3.4.1", "@react-aria/checkbox": "^3.2.3", - "@react-aria/dialog": "^3.1.4", + "@react-aria/dialog": "^3.1.6", "@react-aria/i18n": "^3.3.2", "@react-aria/numberfield": "^3.1.0", - "@react-aria/overlays": "^3.7.2", + "@react-aria/overlays": "^3.7.5", "@react-aria/progress": "^3.1.3", "@react-aria/radio": "^3.1.5", "@react-aria/searchfield": "^3.2.0", @@ -75,6 +75,7 @@ "@sentry/tracing": "^6.18.1", "algoliasearch": "^4.10.2", "fuse.js": "^6.4.6", + "iframe-resizer": "^4.3.2", "markdown-to-jsx": "^7.1.5", "modele-social": "^0.6.0", "publicodes": "^1.0.0-beta.32", @@ -111,7 +112,6 @@ "@storybook/addon-links": "^6.5.0-alpha.40", "@storybook/react": "^6.5.0-alpha.40", "@storybook/testing-library": "^0.0.9", - "@types/iframe-resizer": "^3.5.7", "@types/ramda": "^0.26.43", "@types/react": "^17.0.0", "@types/react-color": "^3.0.1", diff --git a/site/source/components/CompanyDetails.tsx b/site/source/components/CompanyDetails.tsx index 222c40f4e..24c90c15f 100644 --- a/site/source/components/CompanyDetails.tsx +++ b/site/source/components/CompanyDetails.tsx @@ -56,7 +56,7 @@ export default function CompanyDetails({ {' '} - + {dateCreationUniteLegale && (
Crée le{' '} diff --git a/site/source/components/Distribution.css b/site/source/components/Distribution.css index 12791fd2e..04e5b9fa9 100644 --- a/site/source/components/Distribution.css +++ b/site/source/components/Distribution.css @@ -32,10 +32,6 @@ flex: 1; } -.distribution-chart__counterparts { - width: 35em; -} - @media not print { @media (max-width: 600px) { .distribution-chart__legend { diff --git a/site/source/components/Feedback/index.tsx b/site/source/components/Feedback/index.tsx index 08739f7d1..bf06f382a 100644 --- a/site/source/components/Feedback/index.tsx +++ b/site/source/components/Feedback/index.tsx @@ -160,6 +160,7 @@ export default function PageFeedback({ customMessage }: PageFeedbackProps) { title="Votre avis nous interesse" isDismissable onClose={() => setState({ showThanks: true, showForm: false })} + small >
diff --git a/site/source/components/LegalNotice.tsx b/site/source/components/LegalNotice.tsx index 2ac4a4f2e..3def200a2 100644 --- a/site/source/components/LegalNotice.tsx +++ b/site/source/components/LegalNotice.tsx @@ -14,6 +14,7 @@ export default function LegalNotice() { )} title={t('legalNotice.title', 'Mentions légales')} + small >

Editeur diff --git a/site/source/components/PlaceDesEntreprises.tsx b/site/source/components/PlaceDesEntreprises.tsx new file mode 100644 index 000000000..a63258c27 --- /dev/null +++ b/site/source/components/PlaceDesEntreprises.tsx @@ -0,0 +1,126 @@ +import { lazy, ReactEventHandler, Suspense, useEffect, useRef } from 'react' +import styled from 'styled-components' +import Emoji from './utils/Emoji' +import { iframeResize } from 'iframe-resizer' +import { PopoverWithTrigger } from '@/design-system' +import { Button } from '@/design-system/buttons' +import { Loader } from '@/design-system/icons/Loader' +import { Body } from '@/design-system/typography/paragraphs' +import { Trans, useTranslation } from 'react-i18next' +import { isProduction } from '@/utils' + +const Iframe = styled.iframe` + width: 1px; + min-width: 100%; + height: 80vh; +` + +const IframeContainer = styled.div` + margin: 0 -3rem; +` + +export const PlacesDesEntreprisesIframe = ({ + src, + onLoad, +}: { + src: string + onLoad?: ReactEventHandler +}) => { + useEffect(() => { + iframeResize({}, '#pdeIframe') + }, []) + + return ( + +