🔥(frontend) remove temporarily team feature

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.
This commit is contained in:
Anthony LC
2024-08-08 15:55:31 +02:00
committed by Anthony LC
parent 7916f7d7d0
commit 733a1d8861
6 changed files with 61 additions and 16 deletions

View File

@@ -1 +1,2 @@
NEXT_PUBLIC_API_ORIGIN=http://localhost:8071
NEXT_PUBLIC_FEATURE_TEAM=true

View File

@@ -1 +1,2 @@
NEXT_PUBLIC_API_ORIGIN=http://test.jest
NEXT_PUBLIC_FEATURE_TEAM=true

View File

@@ -11,7 +11,7 @@ export function MainLayout({ children }: PropsWithChildren) {
<Box $height="100vh">
<Header />
<Box $css="flex: 1;" $direction="row">
<Menu />
{process.env.NEXT_PUBLIC_FEATURE_TEAM === 'true' && <Menu />}
<Box
as="main"
$height={`calc(100vh - ${HEADER_HEIGHT})`}

View File

@@ -0,0 +1,47 @@
import '@testing-library/jest-dom';
import { render, screen } from '@testing-library/react';
import { AppWrapper } from '@/tests/utils';
import { MainLayout } from '../MainLayout';
jest.mock('next/navigation', () => ({
...jest.requireActual('next/navigation'),
usePathname: () => '/',
}));
describe('MainLayout', () => {
it('checks menu rendering', () => {
render(<MainLayout />, { 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(<MainLayout />, { wrapper: AppWrapper });
expect(
screen.queryByRole('button', {
name: /Teams button/i,
}),
).not.toBeInTheDocument();
expect(
screen.queryByRole('button', {
name: /Mail Domains button/i,
}),
).not.toBeInTheDocument();
});
});

View File

@@ -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}
>
<IconOpenClose width={24} height={24} aria-hidden="true" />
</BoxButton>

View File

@@ -1,16 +1,6 @@
import type { ReactElement } from 'react';
import MailDomains from './mail-domains';
import Teams from './teams';
import { TeamLayout } from '@/features/teams/team-management';
import { NextPageWithLayout } from '@/types/next';
import Teams from './teams/';
const Page: NextPageWithLayout = () => {
return <Teams />;
};
Page.getLayout = function getLayout(page: ReactElement) {
return <TeamLayout>{page}</TeamLayout>;
};
export default Page;
export default process.env.NEXT_PUBLIC_FEATURE_TEAM === 'true'
? Teams
: MailDomains;