forked from opencollective/opencollective-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorders.js
51 lines (45 loc) · 1.5 KB
/
orders.js
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
import React from 'react';
import PropTypes from 'prop-types';
import { addCollectiveNavbarData } from '../lib/graphql/queries';
import CollectiveNavbar from '../components/collective-navbar';
import Container from '../components/Container';
import { Box } from '../components/Grid';
import OrdersWithData from '../components/orders/OrdersWithData';
import Page from '../components/Page';
import { withUser } from '../components/UserProvider';
class OrdersPage extends React.Component {
static getInitialProps({ query: { collectiveSlug, filter, value } }) {
return { slug: collectiveSlug, filter, value };
}
static propTypes = {
slug: PropTypes.string, // for addCollectiveNavbarData
filter: PropTypes.string,
value: PropTypes.string,
data: PropTypes.shape({
account: PropTypes.object,
loading: PropTypes.bool,
}).isRequired, // from withData
LoggedInUser: PropTypes.object,
};
render() {
const { slug, data, LoggedInUser } = this.props;
const collective = data?.account;
return (
<Page>
{(data?.loading || data?.account) && (
<Container mb={4}>
<CollectiveNavbar
isLoading={data.loading}
collective={data.account}
isAdmin={LoggedInUser?.canEditCollective(collective)}
/>
</Container>
)}
<Box py={4}>
<OrdersWithData accountSlug={slug} />
</Box>
</Page>
);
}
}
export default withUser(addCollectiveNavbarData(OrdersPage));