mirror of
https://github.com/documenso/documenso.git
synced 2025-11-19 03:01:59 +10:00
## Description Add support for teams which will allow users to collaborate on documents. Teams features allows users to: - Create, manage and transfer teams - Manage team members - Manage team emails - Manage a shared team inbox and documents These changes do NOT include the following, which are planned for a future release: - Team templates - Team API - Search menu integration ## Testing Performed - Added E2E tests for general team management - Added E2E tests to validate document counts ## Checklist - [X] I have tested these changes locally and they work as expected. - [X] I have added/updated tests that prove the effectiveness of these changes. - [ ] I have updated the documentation to reflect these changes, if applicable. - [X] I have followed the project's coding style guidelines.
46 lines
1.0 KiB
TypeScript
46 lines
1.0 KiB
TypeScript
'use client';
|
|
|
|
import { trpc } from '@documenso/trpc/react';
|
|
import { Button } from '@documenso/ui/primitives/button';
|
|
import { useToast } from '@documenso/ui/primitives/use-toast';
|
|
|
|
export type AcceptTeamInvitationButtonProps = {
|
|
teamId: number;
|
|
};
|
|
|
|
export const AcceptTeamInvitationButton = ({ teamId }: AcceptTeamInvitationButtonProps) => {
|
|
const { toast } = useToast();
|
|
|
|
const {
|
|
mutateAsync: acceptTeamInvitation,
|
|
isLoading,
|
|
isSuccess,
|
|
} = trpc.team.acceptTeamInvitation.useMutation({
|
|
onSuccess: () => {
|
|
toast({
|
|
title: 'Success',
|
|
description: 'Accepted team invitation',
|
|
duration: 5000,
|
|
});
|
|
},
|
|
onError: () => {
|
|
toast({
|
|
title: 'Something went wrong',
|
|
variant: 'destructive',
|
|
duration: 10000,
|
|
description: 'Unable to join this team at this time.',
|
|
});
|
|
},
|
|
});
|
|
|
|
return (
|
|
<Button
|
|
onClick={async () => acceptTeamInvitation({ teamId })}
|
|
loading={isLoading}
|
|
disabled={isLoading || isSuccess}
|
|
>
|
|
Accept
|
|
</Button>
|
|
);
|
|
};
|