-
Notifications
You must be signed in to change notification settings - Fork 75
/
AccountsIndexPage.tsx
55 lines (51 loc) · 1.42 KB
/
AccountsIndexPage.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
import React from 'react'
import { useAsync } from 'react-async'
import {
useDocumentTitle,
Loading,
AccountsDataListTable,
CreateAccountButton,
ExportAccountsButton
} from 'components'
import {
Alert,
PageSection,
TextContent,
Text,
Flex,
FlexItem
} from '@patternfly/react-core'
import { getDeveloperAccounts } from 'dal/accounts'
import { useTranslation } from 'i18n/useTranslation'
const AccountsIndexPage: React.FunctionComponent = () => {
const { data: accounts, error, isPending } = useAsync(getDeveloperAccounts)
const { t } = useTranslation('accountsIndex')
useDocumentTitle(t('title_page'))
return (
<>
<PageSection variant="light">
<Flex>
<FlexItem>
<TextContent>
<Text component="h1">{t('title_page')}</Text>
</TextContent>
</FlexItem>
<FlexItem align={{ default: 'alignRight' }}>
<CreateAccountButton />
</FlexItem>
<FlexItem>
<ExportAccountsButton data={accounts} />
</FlexItem>
</Flex>
</PageSection>
<PageSection>
{isPending && <Loading />}
{error && <Alert variant="danger" title={error.message} />}
{accounts && <AccountsDataListTable accounts={accounts} />}
</PageSection>
</>
)
}
// Default export needed for React.lazy
// eslint-disable-next-line import/no-default-export
export default AccountsIndexPage