mirror of
https://github.com/umami-software/umami.git
synced 2025-12-08 05:12:36 +01:00
Refactored intl messages.
This commit is contained in:
parent
fbccf4d3af
commit
7725b5c129
44 changed files with 558 additions and 485 deletions
|
|
@ -1,13 +1,18 @@
|
|||
import { useState } from 'react';
|
||||
import { Button, Icon, Modal, useToast } from 'react-basics';
|
||||
import { Button, Icon, Modal, useToast, Icons, Text } from 'react-basics';
|
||||
import { useIntl } from 'react-intl';
|
||||
import useApi from 'hooks/useApi';
|
||||
import EmptyPlaceholder from 'components/common/EmptyPlaceholder';
|
||||
import TeamAddForm from 'components/pages/settings/teams/TeamAddForm';
|
||||
import PageHeader from 'components/layout/PageHeader';
|
||||
import TeamsTable from 'components/pages/settings/teams/TeamsTable';
|
||||
import Page from 'components/layout/Page';
|
||||
import { labels, messages } from 'components/messages';
|
||||
|
||||
const { Plus } = Icons;
|
||||
|
||||
export default function TeamsList() {
|
||||
const { formatMessage } = useIntl();
|
||||
const [edit, setEdit] = useState(false);
|
||||
const [update, setUpdate] = useState(0);
|
||||
const { get, useQuery } = useApi();
|
||||
|
|
@ -22,7 +27,7 @@ export default function TeamsList() {
|
|||
const handleSave = () => {
|
||||
setEdit(false);
|
||||
setUpdate(state => state + 1);
|
||||
showToast({ message: 'Team saved.', variant: 'success' });
|
||||
showToast({ message: formatMessage(messages.saved), variant: 'success' });
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
|
|
@ -32,21 +37,27 @@ export default function TeamsList() {
|
|||
return (
|
||||
<Page loading={isLoading} error={error}>
|
||||
{toast}
|
||||
<PageHeader title="Teams">
|
||||
<Button onClick={handleAdd}>
|
||||
<Icon icon="plus" /> Create team
|
||||
<PageHeader title={formatMessage(labels.team)}>
|
||||
<Button variant="primary" onClick={handleAdd}>
|
||||
<Icon>
|
||||
<Plus />
|
||||
</Icon>
|
||||
<Text>{formatMessage(labels.createTeam)}</Text>
|
||||
</Button>
|
||||
</PageHeader>
|
||||
{hasData && <TeamsTable data={data} />}
|
||||
{!hasData && (
|
||||
<EmptyPlaceholder message="You don't have any teams configured.">
|
||||
<EmptyPlaceholder message={formatMessage(messages.noTeams)}>
|
||||
<Button variant="primary" onClick={handleAdd}>
|
||||
<Icon icon="plus" /> Create team
|
||||
<Icon>
|
||||
<Plus />
|
||||
</Icon>
|
||||
<Text>{formatMessage(labels.createTeam)}</Text>
|
||||
</Button>
|
||||
</EmptyPlaceholder>
|
||||
)}
|
||||
{edit && (
|
||||
<Modal title="Create team" onClose={handleClose}>
|
||||
<Modal title={formatMessage(labels.createTeam)} onClose={handleClose}>
|
||||
{close => <TeamAddForm onSave={handleSave} onClose={close} />}
|
||||
</Modal>
|
||||
)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue