mirror of
https://github.com/umami-software/umami.git
synced 2026-02-23 05:55:35 +01:00
Renamed (app) folder to (main).
This commit is contained in:
parent
5c15778c9b
commit
c990459238
167 changed files with 48 additions and 114 deletions
50
src/app/(main)/settings/teams/[id]/TeamWebsites.js
Normal file
50
src/app/(main)/settings/teams/[id]/TeamWebsites.js
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import { ActionForm, Button, Icon, Icons, Modal, ModalTrigger, Text } from 'react-basics';
|
||||
import TeamWebsitesTable from './TeamWebsitesTable';
|
||||
import TeamAddWebsiteForm from './TeamAddWebsiteForm';
|
||||
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';
|
||||
|
||||
export function TeamWebsites({ teamId }) {
|
||||
const { formatMessage, labels, messages } = useMessages();
|
||||
const { user } = useUser();
|
||||
const { get } = useApi();
|
||||
const { getProps, refetch } = useFilterQuery(
|
||||
['team:websites', teamId],
|
||||
params => {
|
||||
return get(`/teams/${teamId}/websites`, {
|
||||
...params,
|
||||
});
|
||||
},
|
||||
{ enabled: !!user },
|
||||
);
|
||||
|
||||
const handleWebsiteAdd = () => {
|
||||
refetch();
|
||||
};
|
||||
|
||||
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 => (
|
||||
<TeamAddWebsiteForm teamId={teamId} onSave={handleWebsiteAdd} onClose={close} />
|
||||
)}
|
||||
</Modal>
|
||||
</ModalTrigger>
|
||||
</ActionForm>
|
||||
<DataTable {...getProps()}>{({ data }) => <TeamWebsitesTable data={data} />}</DataTable>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default TeamWebsites;
|
||||
Loading…
Add table
Add a link
Reference in a new issue