-
Notifications
You must be signed in to change notification settings - Fork 75
/
AccountsListingPage.tsx
62 lines (58 loc) · 1.83 KB
/
AccountsListingPage.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
import React from 'react'
import { useAsync } from 'react-async'
import { useDocumentTitle, Loading, AccountsDataListTable } from 'components'
import {
Alert,
PageSection,
TextContent,
Text,
Button,
Flex,
FlexItem,
FlexModifiers
} from '@patternfly/react-core'
import { getDeveloperAccounts } from 'dal/accounts'
import { useTranslation } from 'i18n/useTranslation'
import { PlusCircleIcon, ExportIcon } from '@patternfly/react-icons'
const AccountsListingPage: React.FunctionComponent = () => {
const { data: accounts, error, isPending } = useAsync(getDeveloperAccounts)
const { t } = useTranslation('audienceAccountsListing')
useDocumentTitle(t('title_page'))
return (
<>
<PageSection variant="light">
<Flex>
<FlexItem>
<TextContent>
<Text component="h1">{t('title_page')}</Text>
</TextContent>
</FlexItem>
<FlexItem breakpointMods={[{ modifier: FlexModifiers['align-right'] }]}>
<Button
variant="link"
icon={<PlusCircleIcon />}
aria-label={t('create_account_button_aria_label')}
>
{t('create_account_button')}
</Button>
<Button
variant="link"
icon={<ExportIcon />}
aria-label={t('export_accounts_button_aria_label')}
>
{t('export_accounts_button')}
</Button>
</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 AccountsListingPage