forked from finos/git-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPushRequests.tsx
More file actions
80 lines (75 loc) · 2.15 KB
/
PushRequests.tsx
File metadata and controls
80 lines (75 loc) · 2.15 KB
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
import React, { useState } from 'react';
import GridItem from '../../components/Grid/GridItem';
import GridContainer from '../../components/Grid/GridContainer';
import PushesTable from './components/PushesTable';
import CustomTabs from '../../components/CustomTabs/CustomTabs';
import Danger from '../../components/Typography/Danger';
import { Visibility, CheckCircle, Cancel, Block, Error, List } from '@material-ui/icons';
import { TabItem } from '../../components/CustomTabs/CustomTabs';
const Dashboard: React.FC = () => {
const [errorMessage, setErrorMessage] = useState<string | null>(null);
const handlePushTableError = (errorMessage: string) => {
setErrorMessage(errorMessage);
};
const tabs: TabItem[] = [
{
tabName: 'All',
tabIcon: List,
tabContent: <PushesTable handleError={handlePushTableError} />,
},
{
tabName: 'Pending',
tabIcon: Visibility,
tabContent: (
<PushesTable blocked={true} authorised={false} rejected={false} canceled={false} />
),
},
{
tabName: 'Approved',
tabIcon: CheckCircle,
tabContent: <PushesTable authorised={true} handleError={handlePushTableError} />,
},
{
tabName: 'Canceled',
tabIcon: Cancel,
tabContent: (
<PushesTable
authorised={false}
rejected={false}
canceled={true}
handleError={handlePushTableError}
/>
),
},
{
tabName: 'Rejected',
tabIcon: Block,
tabContent: (
<PushesTable
authorised={false}
rejected={true}
canceled={false}
handleError={handlePushTableError}
/>
),
},
{
tabName: 'Error',
tabIcon: Error,
tabContent: <PushesTable error={true} handleError={handlePushTableError} />,
},
];
return (
<div>
{errorMessage && <Danger>{errorMessage}</Danger>}
{!errorMessage && (
<GridContainer>
<GridItem xs={12} sm={12} md={12}>
<CustomTabs headerColor='primary' tabs={tabs} defaultTab={1} />
</GridItem>
</GridContainer>
)}
</div>
);
};
export default Dashboard;