Rename tabs to Inbox, Contacts, Insights

This commit is contained in:
Charles Bochet 2022-12-05 21:47:11 +01:00
parent dcfc4c9e45
commit 92267701ff
20 changed files with 52 additions and 52 deletions

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import Tasks from './pages/tasks/Tasks'; import Inbox from './pages/inbox/Inbox';
import History from './pages/History'; import Contacts from './pages/Contacts';
import Performances from './pages/Performances'; import Insights from './pages/Insights';
import AppLayout from './layout/AppLayout'; import AppLayout from './layout/AppLayout';
import { Routes, Route } from 'react-router-dom'; import { Routes, Route } from 'react-router-dom';
@ -9,9 +9,9 @@ function App() {
return ( return (
<AppLayout> <AppLayout>
<Routes> <Routes>
<Route path="/" element={<Tasks />} /> <Route path="/" element={<Inbox />} />
<Route path="/history" element={<History />} /> <Route path="/contacts" element={<Contacts />} />
<Route path="/performances" element={<Performances />} /> <Route path="/insights" element={<Insights />} />
</Routes> </Routes>
</AppLayout> </AppLayout>
); );

View File

@ -16,7 +16,7 @@ function Navbar() {
<> <>
<NavbarContainer> <NavbarContainer>
<NavItem <NavItem
label="Tasks" label="Inbox"
to="/" to="/"
active={ active={
!!useMatch({ !!useMatch({
@ -26,21 +26,21 @@ function Navbar() {
} }
/> />
<NavItem <NavItem
label="History" label="Contacts"
to="/history" to="/contacts"
active={ active={
!!useMatch({ !!useMatch({
path: useResolvedPath('/history').pathname, path: useResolvedPath('/contacts').pathname,
end: true, end: true,
}) })
} }
/> />
<NavItem <NavItem
label="Performances" label="Insights"
to="/performances" to="/insights"
active={ active={
!!useMatch({ !!useMatch({
path: useResolvedPath('/performances').pathname, path: useResolvedPath('/insights').pathname,
end: true, end: true,
}) })
} }

View File

@ -1,4 +1,4 @@
function History() { function Contacts() {
return ( return (
<div> <div>
<h1>This is the history page</h1> <h1>This is the history page</h1>
@ -6,4 +6,4 @@ function History() {
); );
} }
export default History; export default Contacts;

View File

@ -1,4 +1,4 @@
function Performances() { function Insights() {
return ( return (
<div> <div>
<h1>This is the performances page</h1> <h1>This is the performances page</h1>
@ -6,4 +6,4 @@ function Performances() {
); );
} }
export default Performances; export default Insights;

View File

@ -1,7 +1,7 @@
import FullWidthContainer from '../../layout/containers/FullWidthContainer'; import FullWidthContainer from '../../layout/containers/FullWidthContainer';
import TaskList from './TaskList'; import TaskList from './TaskList';
function Tasks() { function Inbox() {
return ( return (
<FullWidthContainer> <FullWidthContainer>
<TaskList /> <TaskList />
@ -9,4 +9,4 @@ function Tasks() {
); );
} }
export default Tasks; export default Inbox;

View File

@ -7,8 +7,8 @@ export default {
component: Navbar, component: Navbar,
}; };
export const NavbarOnPerformance = () => ( export const NavbarOnInsights = () => (
<MemoryRouter initialEntries={['/performances']}> <MemoryRouter initialEntries={['/insights']}>
<Navbar /> <Navbar />
</MemoryRouter> </MemoryRouter>
); );

View File

@ -0,0 +1,13 @@
import { MemoryRouter } from 'react-router-dom';
import Inbox from '../../../pages/inbox/Inbox';
export default {
title: 'Inbox',
component: Inbox,
};
export const InboxDefault = () => (
<MemoryRouter>
<Inbox />
</MemoryRouter>
);

View File

@ -1,7 +1,7 @@
import TaskList from '../../../pages/tasks/TaskList'; import TaskList from '../../../pages/inbox/TaskList';
export default { export default {
title: 'Tasks', title: 'Inbox',
component: TaskList, component: TaskList,
}; };

View File

@ -1,8 +1,8 @@
import { MemoryRouter } from 'react-router-dom'; import { MemoryRouter } from 'react-router-dom';
import TaskListHeader from '../../../pages/tasks/TaskListHeader'; import TaskListHeader from '../../../pages/inbox/TaskListHeader';
export default { export default {
title: 'Tasks', title: 'Inbox',
component: TaskListHeader, component: TaskListHeader,
}; };

View File

@ -1,8 +1,8 @@
import { MemoryRouter } from 'react-router-dom'; import { MemoryRouter } from 'react-router-dom';
import TaskListItem from '../../../pages/tasks/TaskListItem'; import TaskListItem from '../../../pages/inbox/TaskListItem';
export default { export default {
title: 'Tasks', title: 'Inbox',
component: TaskListItem, component: TaskListItem,
}; };

View File

@ -1,13 +0,0 @@
import { MemoryRouter } from 'react-router-dom';
import Tasks from '../../../pages/tasks/Tasks';
export default {
title: 'Tasks',
component: Tasks,
};
export const TasksDefault = () => (
<MemoryRouter>
<Tasks />
</MemoryRouter>
);

View File

@ -1,16 +1,16 @@
import { render } from '@testing-library/react'; import { render } from '@testing-library/react';
import { NavbarOnPerformance } from '../../../stories/layout/navbar/Navbar.stories'; import { NavbarOnInsights } from '../../../stories/layout/navbar/Navbar.stories';
it('Checks the NavItem renders', () => { it('Checks the NavItem renders', () => {
const { getByRole } = render(<NavbarOnPerformance />); const { getByRole } = render(<NavbarOnInsights />);
expect(getByRole('button', { name: 'Performances' })).toHaveAttribute( expect(getByRole('button', { name: 'Insights' })).toHaveAttribute(
'aria-selected', 'aria-selected',
'true', 'true',
); );
expect(getByRole('button', { name: 'Tasks' })).toHaveAttribute( expect(getByRole('button', { name: 'Inbox' })).toHaveAttribute(
'aria-selected', 'aria-selected',
'false', 'false',
); );

View File

@ -1,9 +1,9 @@
import { render } from '@testing-library/react'; import { render } from '@testing-library/react';
import { TasksDefault } from '../../../stories/pages/tasks/Tasks.stories'; import { InboxDefault } from '../../../stories/pages/inbox/Inbox.stories';
it('Checks the Tasks page render', () => { it('Checks the Inbox page render', () => {
const { getAllByRole } = render(<TasksDefault />); const { getAllByRole } = render(<InboxDefault />);
const button = getAllByRole('button'); const button = getAllByRole('button');
expect(button[0]).toHaveTextContent('Sylvie Vartan'); expect(button[0]).toHaveTextContent('Sylvie Vartan');

View File

@ -1,8 +1,8 @@
import { render } from '@testing-library/react'; import { render } from '@testing-library/react';
import { TaskListDefault } from '../../../stories/pages/tasks/TaskList.stories'; import { TaskListDefault } from '../../../stories/pages/inbox/TaskList.stories';
it('Checks the Tasks page render', () => { it('Checks the task list render', () => {
const { getAllByRole } = render(<TaskListDefault />); const { getAllByRole } = render(<TaskListDefault />);
const button = getAllByRole('button'); const button = getAllByRole('button');

View File

@ -1,6 +1,6 @@
import { render } from '@testing-library/react'; import { render } from '@testing-library/react';
import { TaskListHeaderDefault } from '../../../stories/pages/tasks/TaskListHeader.stories'; import { TaskListHeaderDefault } from '../../../stories/pages/inbox/TaskListHeader.stories';
it('Checks the TaskListHeader render', () => { it('Checks the TaskListHeader render', () => {
const { getAllByText } = render(<TaskListHeaderDefault />); const { getAllByText } = render(<TaskListHeaderDefault />);

View File

@ -1,6 +1,6 @@
import { render } from '@testing-library/react'; import { render } from '@testing-library/react';
import { TaskListItemDefault } from '../../../stories/pages/tasks/TaskListItem.stories'; import { TaskListItemDefault } from '../../../stories/pages/inbox/TaskListItem.stories';
it('Checks the TaskListItem render', () => { it('Checks the TaskListItem render', () => {
const { getAllByText } = render(<TaskListItemDefault />); const { getAllByText } = render(<TaskListItemDefault />);

2
server/.gitignore vendored
View File

@ -30,6 +30,6 @@ lerna-debug.log*
# IDE - VSCode # IDE - VSCode
.vscode/* .vscode/*
!.vscode/settings.json !.vscode/settings.json
!.vscode/tasks.json !.vscode/inbox.json
!.vscode/launch.json !.vscode/launch.json
!.vscode/extensions.json !.vscode/extensions.json