mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 06:37:18 +01:00
New admin section.
This commit is contained in:
parent
cdf391d5c2
commit
b78ff3b477
28 changed files with 161 additions and 100 deletions
32
src/app/(main)/admin/users/UserAddButton.tsx
Normal file
32
src/app/(main)/admin/users/UserAddButton.tsx
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { Button, Icon, Text, Modal, DialogTrigger, Dialog, useToast } from '@umami/react-zen';
|
||||
import { UserAddForm } from './UserAddForm';
|
||||
import { useMessages, useModified } from '@/components/hooks';
|
||||
import { Plus } from '@/components/icons';
|
||||
|
||||
export function UserAddButton({ onSave }: { onSave?: () => void }) {
|
||||
const { formatMessage, labels, messages } = useMessages();
|
||||
const { toast } = useToast();
|
||||
const { touch } = useModified();
|
||||
|
||||
const handleSave = () => {
|
||||
toast(formatMessage(messages.saved));
|
||||
touch('users');
|
||||
onSave?.();
|
||||
};
|
||||
|
||||
return (
|
||||
<DialogTrigger>
|
||||
<Button variant="primary" data-test="button-create-user">
|
||||
<Icon>
|
||||
<Plus />
|
||||
</Icon>
|
||||
<Text>{formatMessage(labels.createUser)}</Text>
|
||||
</Button>
|
||||
<Modal>
|
||||
<Dialog title={formatMessage(labels.createUser)}>
|
||||
{({ close }) => <UserAddForm onSave={handleSave} onClose={close} />}
|
||||
</Dialog>
|
||||
</Modal>
|
||||
</DialogTrigger>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue