diff options
| author | Fuwn <[email protected]> | 2026-01-24 13:09:50 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-01-24 13:09:50 +0000 |
| commit | 396acf3bbbe00a192cb0ea0a9ccf91b1d8d2850b (patch) | |
| tree | b9df4ca6a70db45cfffbae6fdd7252e20fb8e93c /src/app/(main)/websites/WebsiteAddButton.tsx | |
| download | umami-main.tar.xz umami-main.zip | |
Created from https://vercel.com/new
Diffstat (limited to 'src/app/(main)/websites/WebsiteAddButton.tsx')
| -rw-r--r-- | src/app/(main)/websites/WebsiteAddButton.tsx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/app/(main)/websites/WebsiteAddButton.tsx b/src/app/(main)/websites/WebsiteAddButton.tsx new file mode 100644 index 0000000..76710ab --- /dev/null +++ b/src/app/(main)/websites/WebsiteAddButton.tsx @@ -0,0 +1,28 @@ +import { useToast } from '@umami/react-zen'; +import { useMessages, useModified } from '@/components/hooks'; +import { Plus } from '@/components/icons'; +import { DialogButton } from '@/components/input/DialogButton'; +import { WebsiteAddForm } from './WebsiteAddForm'; + +export function WebsiteAddButton({ teamId, onSave }: { teamId: string; onSave?: () => void }) { + const { formatMessage, labels, messages } = useMessages(); + const { toast } = useToast(); + const { touch } = useModified(); + + const handleSave = async () => { + toast(formatMessage(messages.saved)); + touch('websites'); + onSave?.(); + }; + + return ( + <DialogButton + icon={<Plus />} + label={formatMessage(labels.addWebsite)} + variant="primary" + width="400px" + > + {({ close }) => <WebsiteAddForm teamId={teamId} onSave={handleSave} onClose={close} />} + </DialogButton> + ); +} |