mirror of
https://github.com/umami-software/umami.git
synced 2026-02-22 13:35:35 +01:00
Refactor of team websites.
This commit is contained in:
parent
2552e1d495
commit
dc3818baaa
22 changed files with 61 additions and 208 deletions
|
|
@ -1,15 +1,11 @@
|
|||
import { ActionForm, Button, Icon, Icons, Modal, ModalTrigger, Text } from 'react-basics';
|
||||
import TeamWebsitesTable from './TeamWebsitesTable';
|
||||
import TeamWebsiteAddForm from './TeamWebsiteAddForm';
|
||||
import useApi from 'components/hooks/useApi';
|
||||
import useMessages from 'components/hooks/useMessages';
|
||||
import useUser from 'components/hooks/useUser';
|
||||
import useFilterQuery from 'components/hooks/useFilterQuery';
|
||||
import DataTable from 'components/common/DataTable';
|
||||
import useCache from 'store/cache';
|
||||
|
||||
export function TeamWebsites({ teamId, readOnly }: { teamId: string; readOnly: boolean }) {
|
||||
const { formatMessage, labels, messages } = useMessages();
|
||||
const { user } = useUser();
|
||||
const { get } = useApi();
|
||||
const modified = useCache(state => state?.['team:websites']);
|
||||
|
|
@ -28,26 +24,9 @@ export function TeamWebsites({ teamId, readOnly }: { teamId: string; readOnly: b
|
|||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<ActionForm description={formatMessage(messages.teamWebsitesInfo)}>
|
||||
<ModalTrigger>
|
||||
<Button variant="primary">
|
||||
<Icon>
|
||||
<Icons.Plus />
|
||||
</Icon>
|
||||
<Text>{formatMessage(labels.addWebsite)}</Text>
|
||||
</Button>
|
||||
<Modal title={formatMessage(labels.addWebsite)}>
|
||||
{close => <TeamWebsiteAddForm teamId={teamId} onSave={handleChange} onClose={close} />}
|
||||
</Modal>
|
||||
</ModalTrigger>
|
||||
</ActionForm>
|
||||
<DataTable queryResult={queryResult}>
|
||||
{({ data }) => (
|
||||
<TeamWebsitesTable data={data} onRemove={handleChange} readOnly={readOnly} />
|
||||
)}
|
||||
</DataTable>
|
||||
</>
|
||||
<DataTable queryResult={queryResult}>
|
||||
{({ data }) => <TeamWebsitesTable data={data} onRemove={handleChange} readOnly={readOnly} />}
|
||||
</DataTable>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue