mirror of
https://github.com/umami-software/umami.git
synced 2026-02-23 14:05:35 +01:00
Settings refactor.
This commit is contained in:
parent
1b81074752
commit
c98f324c22
56 changed files with 706 additions and 348 deletions
32
src/app/(main)/settings/teams/[teamId]/TeamManage.tsx
Normal file
32
src/app/(main)/settings/teams/[teamId]/TeamManage.tsx
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { useMessages, useModified } from '@/components/hooks';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { Button, Modal, DialogTrigger, Dialog } from '@umami/react-zen';
|
||||
import { ActionForm } from '@/components/common/ActionForm';
|
||||
import { TeamDeleteForm } from './TeamDeleteForm';
|
||||
|
||||
export function TeamManage({ teamId }: { teamId: string }) {
|
||||
const { formatMessage, labels, messages } = useMessages();
|
||||
const router = useRouter();
|
||||
const { touch } = useModified();
|
||||
|
||||
const handleLeave = async () => {
|
||||
touch('teams');
|
||||
router.push('/settings/teams');
|
||||
};
|
||||
|
||||
return (
|
||||
<ActionForm
|
||||
label={formatMessage(labels.deleteTeam)}
|
||||
description={formatMessage(messages.deleteTeamWarning)}
|
||||
>
|
||||
<DialogTrigger>
|
||||
<Button variant="danger">{formatMessage(labels.delete)}</Button>
|
||||
<Modal>
|
||||
<Dialog title={formatMessage(labels.deleteTeam)}>
|
||||
{({ close }) => <TeamDeleteForm teamId={teamId} onSave={handleLeave} onClose={close} />}
|
||||
</Dialog>
|
||||
</Modal>
|
||||
</DialogTrigger>
|
||||
</ActionForm>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue