From 4ec6e40fa2c1b3c7febc8cc6bc409478ee8d7616 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Mon, 29 Jul 2024 12:26:04 +0200 Subject: [PATCH 1/2] :sparkles: Legal pages working --- .../classes.module.scss | 4 ++ .../DefaultDashboardWithList/index.tsx | 14 +++- .../DefaultLegalDashboard/index.tsx | 64 +++++++++++++++++++ .../DefaultNotaryDashboard/index.tsx | 13 ++-- .../LegalInformations/classes.module.scss | 31 +++++++++ .../Layouts/Legal/LegalInformations/index.tsx | 23 +++++++ .../Layouts/Legal/classes.module.scss | 17 +++++ src/front/Components/Layouts/Legal/index.tsx | 26 ++++++++ src/front/Config/Module/development.json | 16 +++++ src/front/Config/Module/preprod.json | 16 +++++ src/front/Config/Module/production.json | 16 +++++ src/front/Config/Module/staging.json | 16 +++++ src/pages/legal/[legalUid]/index.tsx | 5 ++ src/pages/legal/index.tsx | 5 ++ 14 files changed, 255 insertions(+), 11 deletions(-) create mode 100644 src/front/Components/LayoutTemplates/DefaultLegalDashboard/index.tsx create mode 100644 src/front/Components/Layouts/Legal/LegalInformations/classes.module.scss create mode 100644 src/front/Components/Layouts/Legal/LegalInformations/index.tsx create mode 100644 src/front/Components/Layouts/Legal/classes.module.scss create mode 100644 src/front/Components/Layouts/Legal/index.tsx create mode 100644 src/pages/legal/[legalUid]/index.tsx create mode 100644 src/pages/legal/index.tsx diff --git a/src/front/Components/LayoutTemplates/DefaultDashboardWithList/classes.module.scss b/src/front/Components/LayoutTemplates/DefaultDashboardWithList/classes.module.scss index 882a9394..1f508b61 100644 --- a/src/front/Components/LayoutTemplates/DefaultDashboardWithList/classes.module.scss +++ b/src/front/Components/LayoutTemplates/DefaultDashboardWithList/classes.module.scss @@ -15,6 +15,10 @@ overflow-y: auto; padding: var(--spacing-lg, 24px); + &[data-no-padding] { + padding: 0; + } + @media (max-width: $screen-m) { width: 100%; } diff --git a/src/front/Components/LayoutTemplates/DefaultDashboardWithList/index.tsx b/src/front/Components/LayoutTemplates/DefaultDashboardWithList/index.tsx index 91919c77..84d8e187 100644 --- a/src/front/Components/LayoutTemplates/DefaultDashboardWithList/index.tsx +++ b/src/front/Components/LayoutTemplates/DefaultDashboardWithList/index.tsx @@ -13,19 +13,29 @@ export type IPropsDashboardWithList = { backArrowUrl?: string; mobileBackText?: string; headerConnected?: boolean; + noPadding?: boolean; }; type IProps = IPropsDashboardWithList & ISearchBlockListProps; export default function DefaultDashboardWithList(props: IProps) { - const { hasBackArrow, backArrowUrl, children, blocks, onSelectedBlock, headerConnected = true, bottomButton } = props; + const { + hasBackArrow, + backArrowUrl, + children, + blocks, + onSelectedBlock, + headerConnected = true, + bottomButton, + noPadding = false, + } = props; return (
-
+
{hasBackArrow && (
diff --git a/src/front/Components/LayoutTemplates/DefaultLegalDashboard/index.tsx b/src/front/Components/LayoutTemplates/DefaultLegalDashboard/index.tsx new file mode 100644 index 00000000..080ea25f --- /dev/null +++ b/src/front/Components/LayoutTemplates/DefaultLegalDashboard/index.tsx @@ -0,0 +1,64 @@ +import { IBlock } from "@Front/Components/DesignSystem/SearchBlockList/BlockList/Block"; +import { useRouter } from "next/router"; +import DefaultDashboardWithList, { IPropsDashboardWithList } from "../DefaultDashboardWithList"; +import { useMemo } from "react"; +import Module from "@Front/Config/Module"; + +type IProps = IPropsDashboardWithList; + +export enum ELegalOptions { + LEGAL_MENTIONS = "mentions-legales", + CGU = "cgu", + CGS = "cgs", + POLITIQUE_DE_CONFIDENTIALITE = "politique-de-confidentialite", + POLITIQUE_DE_GESTION_DES_COOKIES = "politique-de-gestion-des-cookies", +} + +export default function DefaultLegalDashboard(props: IProps) { + const router = useRouter(); + const { legalUid } = router.query; + + const onSelectedBlock = (block: IBlock) => { + router.push(Module.getInstance().get().modules.pages.Legal.pages.LegalInformations.props.path.replace("[legalUid]", block.id)); + }; + + const blocks: IBlock[] = useMemo( + () => [ + { + id: ELegalOptions.LEGAL_MENTIONS, + primaryText: "Mentions légales", + isActive: legalUid === ELegalOptions.LEGAL_MENTIONS, + }, + { + id: ELegalOptions.CGU, + primaryText: "CGU", + isActive: legalUid === ELegalOptions.CGU, + }, + { + id: ELegalOptions.CGS, + primaryText: "CGS", + isActive: legalUid === ELegalOptions.CGS, + }, + { + id: ELegalOptions.POLITIQUE_DE_CONFIDENTIALITE, + primaryText: "Politique de confidentialité", + isActive: legalUid === ELegalOptions.POLITIQUE_DE_CONFIDENTIALITE, + }, + { + id: ELegalOptions.POLITIQUE_DE_GESTION_DES_COOKIES, + primaryText: "Politique de gestion des cookies", + isActive: legalUid === ELegalOptions.POLITIQUE_DE_GESTION_DES_COOKIES, + }, + ], + [legalUid], + ); + + if (!legalUid) { + router.push( + Module.getInstance() + .get() + .modules.pages.Legal.pages.LegalInformations.props.path.replace("[legalUid]", ELegalOptions.LEGAL_MENTIONS), + ); + } + return ; +} diff --git a/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/index.tsx b/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/index.tsx index a65da789..190dc803 100644 --- a/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/index.tsx +++ b/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/index.tsx @@ -1,21 +1,16 @@ import Folders, { IGetFoldersParams } from "@Front/Api/LeCoffreApi/Notary/Folders/Folders"; import EFolderStatus from "le-coffre-resources/dist/Customer/EFolderStatus"; import { OfficeFolder } from "le-coffre-resources/dist/Notary"; -import React, { ReactNode, useCallback, useEffect } from "react"; +import React, { useCallback, useEffect } from "react"; import { EDocumentStatus } from "le-coffre-resources/dist/Notary/Document"; import Module from "@Front/Config/Module"; import { IBlock } from "@Front/Components/DesignSystem/SearchBlockList/BlockList/Block"; import { useRouter } from "next/router"; -import DefaultDashboardWithList from "../DefaultDashboardWithList"; +import DefaultDashboardWithList, { IPropsDashboardWithList } from "../DefaultDashboardWithList"; -type IProps = { - title: string; - children?: ReactNode; - isArchived?: boolean; - hasBackArrow?: boolean; - backArrowUrl?: string; - mobileBackText?: string; +type IProps = IPropsDashboardWithList & { + isArchived: boolean; }; export default function DefaultNotaryDashboard(props: IProps) { diff --git a/src/front/Components/Layouts/Legal/LegalInformations/classes.module.scss b/src/front/Components/Layouts/Legal/LegalInformations/classes.module.scss new file mode 100644 index 00000000..2eb0753b --- /dev/null +++ b/src/front/Components/Layouts/Legal/LegalInformations/classes.module.scss @@ -0,0 +1,31 @@ +@import "@Themes/constants.scss"; + +.root { + .subtitle { + margin-top: 32px; + } + + .rights-container { + margin-top: 32px; + padding: 32px 16px; + border: 1px solid gray; + .select-all-container { + margin-top: 32px; + } + + .rights { + margin-top: 32px; + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 32px; + + @media (max-width: $screen-m) { + grid-template-columns: 1fr; + } + } + + .save-container { + margin-top: 32px; + } + } +} diff --git a/src/front/Components/Layouts/Legal/LegalInformations/index.tsx b/src/front/Components/Layouts/Legal/LegalInformations/index.tsx new file mode 100644 index 00000000..42d7f7ef --- /dev/null +++ b/src/front/Components/Layouts/Legal/LegalInformations/index.tsx @@ -0,0 +1,23 @@ +import { useRouter } from "next/router"; +import React from "react"; + +import DefaultLegalDashboard, { ELegalOptions } from "@Front/Components/LayoutTemplates/DefaultLegalDashboard"; + +const pdfLinks: Record = { + "mentions-legales": "https://s3.fr-par.scw.cloud/lecoffre.io-bucket/footer/mentions_legales.pdf", + "politique-de-confidentialite": "https://s3.fr-par.scw.cloud/lecoffre.io-bucket/footer/politique_confidentialite.pdf", + "politique-de-gestion-des-cookies": "https://s3.fr-par.scw.cloud/lecoffre.io-bucket/footer/politique_cookies.pdf", + cgs: "https://s3.fr-par.scw.cloud/lecoffre.io-bucket/footer/cgs.pdf", + cgu: "https://s3.fr-par.scw.cloud/lecoffre.io-bucket/footer/cgu.pdf", +}; + +export default function LegalInformations() { + const router = useRouter(); + let { legalUid } = router.query; + const legalUidTyped = legalUid as ELegalOptions; + return ( + + + + ); +} diff --git a/src/front/Components/Layouts/Legal/classes.module.scss b/src/front/Components/Layouts/Legal/classes.module.scss new file mode 100644 index 00000000..4eca97a6 --- /dev/null +++ b/src/front/Components/Layouts/Legal/classes.module.scss @@ -0,0 +1,17 @@ +@import "@Themes/constants.scss"; + +.root { + display: flex; + align-items: center; + flex-direction: column; + min-height: 100%; + + .no-role-selected { + width: 100%; + + .choose-a-role { + margin-top: 96px; + text-align: center; + } + } +} diff --git a/src/front/Components/Layouts/Legal/index.tsx b/src/front/Components/Layouts/Legal/index.tsx new file mode 100644 index 00000000..1eb64384 --- /dev/null +++ b/src/front/Components/Layouts/Legal/index.tsx @@ -0,0 +1,26 @@ +import Typography, { ETypo, ETypoColor } from "@Front/Components/DesignSystem/Typography"; + +import BasePage from "../Base"; +import classes from "./classes.module.scss"; +import DefaultLegalDashboard from "@Front/Components/LayoutTemplates/DefaultLegalDashboard"; + +type IProps = {}; +type IState = {}; +export default class Collaborators extends BasePage { + public override render(): JSX.Element { + return ( + +
+
+ Gestion des pages légales +
+ + Sélectionnez un rôle + +
+
+
+
+ ); + } +} diff --git a/src/front/Config/Module/development.json b/src/front/Config/Module/development.json index 20bc04c8..253742bf 100644 --- a/src/front/Config/Module/development.json +++ b/src/front/Config/Module/development.json @@ -390,6 +390,22 @@ } } } + }, + "Legal": { + "enabled": true, + "props": { + "path": "/legal", + "labelKey": "legal" + }, + "pages": { + "LegalInformations": { + "enabled": true, + "props": { + "path": "/legal/[legalUid]", + "labelKey": "legal_informations" + } + } + } } } } diff --git a/src/front/Config/Module/preprod.json b/src/front/Config/Module/preprod.json index 20bc04c8..253742bf 100644 --- a/src/front/Config/Module/preprod.json +++ b/src/front/Config/Module/preprod.json @@ -390,6 +390,22 @@ } } } + }, + "Legal": { + "enabled": true, + "props": { + "path": "/legal", + "labelKey": "legal" + }, + "pages": { + "LegalInformations": { + "enabled": true, + "props": { + "path": "/legal/[legalUid]", + "labelKey": "legal_informations" + } + } + } } } } diff --git a/src/front/Config/Module/production.json b/src/front/Config/Module/production.json index 20bc04c8..253742bf 100644 --- a/src/front/Config/Module/production.json +++ b/src/front/Config/Module/production.json @@ -390,6 +390,22 @@ } } } + }, + "Legal": { + "enabled": true, + "props": { + "path": "/legal", + "labelKey": "legal" + }, + "pages": { + "LegalInformations": { + "enabled": true, + "props": { + "path": "/legal/[legalUid]", + "labelKey": "legal_informations" + } + } + } } } } diff --git a/src/front/Config/Module/staging.json b/src/front/Config/Module/staging.json index 20bc04c8..253742bf 100644 --- a/src/front/Config/Module/staging.json +++ b/src/front/Config/Module/staging.json @@ -390,6 +390,22 @@ } } } + }, + "Legal": { + "enabled": true, + "props": { + "path": "/legal", + "labelKey": "legal" + }, + "pages": { + "LegalInformations": { + "enabled": true, + "props": { + "path": "/legal/[legalUid]", + "labelKey": "legal_informations" + } + } + } } } } diff --git a/src/pages/legal/[legalUid]/index.tsx b/src/pages/legal/[legalUid]/index.tsx new file mode 100644 index 00000000..58da8f23 --- /dev/null +++ b/src/pages/legal/[legalUid]/index.tsx @@ -0,0 +1,5 @@ +import LegalInformations from "@Front/Components/Layouts/Legal/LegalInformations"; + +export default function Route() { + return ; +} diff --git a/src/pages/legal/index.tsx b/src/pages/legal/index.tsx new file mode 100644 index 00000000..fb7e17c9 --- /dev/null +++ b/src/pages/legal/index.tsx @@ -0,0 +1,5 @@ +import Legal from "@Front/Components/Layouts/Legal"; + +export default function Route() { + return ; +} From d01984dd4863337a5b9b50fc2bed9fdb061e204a Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Mon, 29 Jul 2024 12:39:46 +0200 Subject: [PATCH 2/2] :sparkles: Legal pages working --- .../DefaultLegalDashboard/index.tsx | 7 --- .../LegalInformations/classes.module.scss | 36 ++++------------ .../Layouts/Legal/LegalInformations/index.tsx | 15 ++++++- .../Layouts/Legal/classes.module.scss | 17 -------- src/front/Components/Layouts/Legal/index.tsx | 43 +++++++++---------- 5 files changed, 41 insertions(+), 77 deletions(-) delete mode 100644 src/front/Components/Layouts/Legal/classes.module.scss diff --git a/src/front/Components/LayoutTemplates/DefaultLegalDashboard/index.tsx b/src/front/Components/LayoutTemplates/DefaultLegalDashboard/index.tsx index 080ea25f..10a0acd0 100644 --- a/src/front/Components/LayoutTemplates/DefaultLegalDashboard/index.tsx +++ b/src/front/Components/LayoutTemplates/DefaultLegalDashboard/index.tsx @@ -53,12 +53,5 @@ export default function DefaultLegalDashboard(props: IProps) { [legalUid], ); - if (!legalUid) { - router.push( - Module.getInstance() - .get() - .modules.pages.Legal.pages.LegalInformations.props.path.replace("[legalUid]", ELegalOptions.LEGAL_MENTIONS), - ); - } return ; } diff --git a/src/front/Components/Layouts/Legal/LegalInformations/classes.module.scss b/src/front/Components/Layouts/Legal/LegalInformations/classes.module.scss index 2eb0753b..351451a0 100644 --- a/src/front/Components/Layouts/Legal/LegalInformations/classes.module.scss +++ b/src/front/Components/Layouts/Legal/LegalInformations/classes.module.scss @@ -1,31 +1,11 @@ -@import "@Themes/constants.scss"; +.pdf-viewer { + width: 100%; + height: 100%; + min-height: 100%; + min-width: 100%; -.root { - .subtitle { - margin-top: 32px; - } - - .rights-container { - margin-top: 32px; - padding: 32px 16px; - border: 1px solid gray; - .select-all-container { - margin-top: 32px; - } - - .rights { - margin-top: 32px; - display: grid; - grid-template-columns: repeat(2, 1fr); - gap: 32px; - - @media (max-width: $screen-m) { - grid-template-columns: 1fr; - } - } - - .save-container { - margin-top: 32px; - } + .no-pdf-text { + padding: 16px; + text-align: center; } } diff --git a/src/front/Components/Layouts/Legal/LegalInformations/index.tsx b/src/front/Components/Layouts/Legal/LegalInformations/index.tsx index 42d7f7ef..b7a6d200 100644 --- a/src/front/Components/Layouts/Legal/LegalInformations/index.tsx +++ b/src/front/Components/Layouts/Legal/LegalInformations/index.tsx @@ -1,7 +1,9 @@ import { useRouter } from "next/router"; import React from "react"; - +import classes from "./classes.module.scss"; import DefaultLegalDashboard, { ELegalOptions } from "@Front/Components/LayoutTemplates/DefaultLegalDashboard"; +import Typography, { ETypo, ETypoColor } from "@Front/Components/DesignSystem/Typography"; +import Link from "next/link"; const pdfLinks: Record = { "mentions-legales": "https://s3.fr-par.scw.cloud/lecoffre.io-bucket/footer/mentions_legales.pdf", @@ -17,7 +19,16 @@ export default function LegalInformations() { const legalUidTyped = legalUid as ELegalOptions; return ( - + + + Votre navigateur ne prend pas en charge l'affichage des pdf  + + + cliquez ici pour télécharger le pdf. + + + + ); } diff --git a/src/front/Components/Layouts/Legal/classes.module.scss b/src/front/Components/Layouts/Legal/classes.module.scss deleted file mode 100644 index 4eca97a6..00000000 --- a/src/front/Components/Layouts/Legal/classes.module.scss +++ /dev/null @@ -1,17 +0,0 @@ -@import "@Themes/constants.scss"; - -.root { - display: flex; - align-items: center; - flex-direction: column; - min-height: 100%; - - .no-role-selected { - width: 100%; - - .choose-a-role { - margin-top: 96px; - text-align: center; - } - } -} diff --git a/src/front/Components/Layouts/Legal/index.tsx b/src/front/Components/Layouts/Legal/index.tsx index 1eb64384..f2b9961b 100644 --- a/src/front/Components/Layouts/Legal/index.tsx +++ b/src/front/Components/Layouts/Legal/index.tsx @@ -1,26 +1,23 @@ -import Typography, { ETypo, ETypoColor } from "@Front/Components/DesignSystem/Typography"; - -import BasePage from "../Base"; -import classes from "./classes.module.scss"; -import DefaultLegalDashboard from "@Front/Components/LayoutTemplates/DefaultLegalDashboard"; +import DefaultLegalDashboard, { ELegalOptions } from "@Front/Components/LayoutTemplates/DefaultLegalDashboard"; +import { useRouter } from "next/router"; +import Module from "@Front/Config/Module"; +import { useEffect } from "react"; type IProps = {}; -type IState = {}; -export default class Collaborators extends BasePage { - public override render(): JSX.Element { - return ( - -
-
- Gestion des pages légales -
- - Sélectionnez un rôle - -
-
-
-
- ); - } + +export default function Legal(props: IProps) { + const router = useRouter(); + const { legalUid } = router.query; + + useEffect(() => { + if (!legalUid && router.isReady) { + router.push( + Module.getInstance() + .get() + .modules.pages.Legal.pages.LegalInformations.props.path.replace("[legalUid]", ELegalOptions.LEGAL_MENTIONS), + ); + } + }, [legalUid, router]); + + return ; }