-
Notifications
You must be signed in to change notification settings - Fork 3
/
CollectionsLandingPage.tsx
110 lines (105 loc) · 2.74 KB
/
CollectionsLandingPage.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import React from 'react';
import { Route, Switch, useRouteMatch } from 'react-router-dom';
import { ApolloProvider } from '@apollo/client';
import { client } from '../../../api/client';
import {
HeaderConnector,
MenuLink,
PageNotFound,
} from '../../../_shared/components';
import { StyledContainer } from '../../../_shared/styled';
import {
AddAuthorPage,
AddCollectionPage,
AddPartnerPage,
AuthorListPage,
AuthorPage,
CollectionListPage,
CollectionPage,
CollectionSearchPage,
CollectionsHomePage,
LabelListPage,
PartnerListPage,
PartnerPage,
} from '../';
/**
* Collections landing page
*/
export const CollectionsLandingPage = (): JSX.Element => {
// Get the base path (/collections)
const { path } = useRouteMatch();
const menuLinks: MenuLink[] = [
{
text: 'Collections',
url: `${path}/collections/drafts/`,
},
{
text: 'Authors',
url: `${path}/authors/`,
},
{
text: 'Labels',
url: `${path}/labels/`,
},
{
text: 'Partners',
url: `${path}/partners/`,
},
{
text: 'Search',
url: `${path}/search/`,
},
];
return (
<ApolloProvider client={client}>
<HeaderConnector
productName="Collections"
productLink="/collections"
menuLinks={menuLinks}
/>
<StyledContainer maxWidth="xl" disableGutters>
<Switch>
<Route exact path={path}>
<CollectionsHomePage />
</Route>
<Route exact path={`${path}/authors/`}>
<AuthorListPage />
</Route>
<Route exact path={`${path}/authors/add/`}>
<AddAuthorPage />
</Route>
<Route exact path={`${path}/authors/:id/`}>
<AuthorPage />
</Route>
<Route exact path={`${path}/collections/add/`}>
<AddCollectionPage />
</Route>
<Route
path={`${path}/collections/:status(drafts|review|published|archived)/`}
>
<CollectionListPage />
</Route>
<Route exact path={`${path}/collections/:id/`}>
<CollectionPage />
</Route>
<Route exact path={`${path}/labels/`}>
<LabelListPage />
</Route>
<Route exact path={`${path}/partners/`}>
<PartnerListPage />
</Route>
<Route exact path={`${path}/partners/add/`}>
<AddPartnerPage />
</Route>
<Route exact path={`${path}/partners/:id`}>
<PartnerPage />
</Route>
<Route exact path={`${path}/search/`}>
<CollectionSearchPage />
</Route>
<Route component={PageNotFound} />
</Switch>
</StyledContainer>
</ApolloProvider>
);
};