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

View File

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

View File

@ -1,4 +1,4 @@
function History() {
function Contacts() {
return (
<div>
<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 (
<div>
<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 TaskList from './TaskList';
function Tasks() {
function Inbox() {
return (
<FullWidthContainer>
<TaskList />
@ -9,4 +9,4 @@ function Tasks() {
);
}
export default Tasks;
export default Inbox;

View File

@ -7,8 +7,8 @@ export default {
component: Navbar,
};
export const NavbarOnPerformance = () => (
<MemoryRouter initialEntries={['/performances']}>
export const NavbarOnInsights = () => (
<MemoryRouter initialEntries={['/insights']}>
<Navbar />
</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 {
title: 'Tasks',
title: 'Inbox',
component: TaskList,
};

View File

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

View File

@ -1,8 +1,8 @@
import { MemoryRouter } from 'react-router-dom';
import TaskListItem from '../../../pages/tasks/TaskListItem';
import TaskListItem from '../../../pages/inbox/TaskListItem';
export default {
title: 'Tasks',
title: 'Inbox',
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 { NavbarOnPerformance } from '../../../stories/layout/navbar/Navbar.stories';
import { NavbarOnInsights } from '../../../stories/layout/navbar/Navbar.stories';
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',
'true',
);
expect(getByRole('button', { name: 'Tasks' })).toHaveAttribute(
expect(getByRole('button', { name: 'Inbox' })).toHaveAttribute(
'aria-selected',
'false',
);

View File

@ -1,9 +1,9 @@
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', () => {
const { getAllByRole } = render(<TasksDefault />);
it('Checks the Inbox page render', () => {
const { getAllByRole } = render(<InboxDefault />);
const button = getAllByRole('button');
expect(button[0]).toHaveTextContent('Sylvie Vartan');

View File

@ -1,8 +1,8 @@
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 button = getAllByRole('button');

View File

@ -1,6 +1,6 @@
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', () => {
const { getAllByText } = render(<TaskListHeaderDefault />);

View File

@ -1,6 +1,6 @@
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', () => {
const { getAllByText } = render(<TaskListItemDefault />);

2
server/.gitignore vendored
View File

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