From 733a1d8861e57876e0e37f303092021348d4a480 Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Thu, 8 Aug 2024 15:55:31 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5(frontend)=20remove=20temporarily?= =?UTF-8?q?=20team=20feature?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We want to make a first realease, but the team feature is not ready yet. So we will hide it for now by hiding the menu. We will still let the feature in dev environment. --- src/frontend/apps/desk/.env.development | 1 + src/frontend/apps/desk/.env.test | 1 + .../apps/desk/src/core/MainLayout.tsx | 2 +- .../src/core/__tests__/MainLayout.test.tsx | 47 +++++++++++++++++++ .../mail-domains/components/panel/Panel.tsx | 6 +++ src/frontend/apps/desk/src/pages/index.tsx | 20 ++------ 6 files changed, 61 insertions(+), 16 deletions(-) create mode 100644 src/frontend/apps/desk/src/core/__tests__/MainLayout.test.tsx diff --git a/src/frontend/apps/desk/.env.development b/src/frontend/apps/desk/.env.development index 45ee232..4cb4d49 100644 --- a/src/frontend/apps/desk/.env.development +++ b/src/frontend/apps/desk/.env.development @@ -1 +1,2 @@ NEXT_PUBLIC_API_ORIGIN=http://localhost:8071 +NEXT_PUBLIC_FEATURE_TEAM=true diff --git a/src/frontend/apps/desk/.env.test b/src/frontend/apps/desk/.env.test index 9a4d514..026733c 100644 --- a/src/frontend/apps/desk/.env.test +++ b/src/frontend/apps/desk/.env.test @@ -1 +1,2 @@ NEXT_PUBLIC_API_ORIGIN=http://test.jest +NEXT_PUBLIC_FEATURE_TEAM=true diff --git a/src/frontend/apps/desk/src/core/MainLayout.tsx b/src/frontend/apps/desk/src/core/MainLayout.tsx index 617e004..88b6ccf 100644 --- a/src/frontend/apps/desk/src/core/MainLayout.tsx +++ b/src/frontend/apps/desk/src/core/MainLayout.tsx @@ -11,7 +11,7 @@ export function MainLayout({ children }: PropsWithChildren) {
- + {process.env.NEXT_PUBLIC_FEATURE_TEAM === 'true' && } ({ + ...jest.requireActual('next/navigation'), + usePathname: () => '/', +})); + +describe('MainLayout', () => { + it('checks menu rendering', () => { + render(, { wrapper: AppWrapper }); + + expect( + screen.getByRole('button', { + name: /Teams button/i, + }), + ).toBeInTheDocument(); + + expect( + screen.getByRole('button', { + name: /Mail Domains button/i, + }), + ).toBeInTheDocument(); + }); + + it('checks menu rendering without team feature', () => { + process.env.NEXT_PUBLIC_FEATURE_TEAM = 'false'; + + render(, { wrapper: AppWrapper }); + + expect( + screen.queryByRole('button', { + name: /Teams button/i, + }), + ).not.toBeInTheDocument(); + + expect( + screen.queryByRole('button', { + name: /Mail Domains button/i, + }), + ).not.toBeInTheDocument(); + }); +}); diff --git a/src/frontend/apps/desk/src/features/mail-domains/components/panel/Panel.tsx b/src/frontend/apps/desk/src/features/mail-domains/components/panel/Panel.tsx index 7f1c13b..8c009f3 100644 --- a/src/frontend/apps/desk/src/features/mail-domains/components/panel/Panel.tsx +++ b/src/frontend/apps/desk/src/features/mail-domains/components/panel/Panel.tsx @@ -21,6 +21,11 @@ export const Panel = () => { $minWidth: '0', }; + const styleNoTeam = process.env.NEXT_PUBLIC_FEATURE_TEAM !== 'true' && { + $display: 'none', + tabIndex: -1, + }; + const transition = 'all 0.5s ease-in-out'; return ( @@ -52,6 +57,7 @@ export const Panel = () => { transition: ${transition}; `} onClick={() => setIsOpen(!isOpen)} + {...styleNoTeam} >