feat: wip

This commit is contained in:
David Nguyen
2023-12-27 16:05:05 +11:00
parent f4309c1c83
commit ca703fc221
9 changed files with 14 additions and 13 deletions

View File

@ -7,6 +7,7 @@ import { useSession } from 'next-auth/react';
import { match } from 'ts-pattern';
import { getFile } from '@documenso/lib/universal/upload/get-file';
import { formatDocumentsPath } from '@documenso/lib/utils/teams';
import type { Document, Recipient, User } from '@documenso/prisma/client';
import { DocumentStatus, SigningStatus } from '@documenso/prisma/client';
import type { DocumentWithData } from '@documenso/prisma/types/document-with-data';
@ -39,8 +40,7 @@ export const DataTableActionButton = ({ row, teamUrl }: DataTableActionButtonPro
const isComplete = row.status === DocumentStatus.COMPLETED;
const isSigned = recipient?.signingStatus === SigningStatus.SIGNED;
// Todo: Teams - Extract calculation.
const documentsPath = teamUrl ? `/t/${teamUrl}/documents` : '/documents';
const documentsPath = formatDocumentsPath(teamUrl);
const onDownloadClick = async () => {
try {

View File

@ -18,6 +18,7 @@ import {
import { useSession } from 'next-auth/react';
import { getFile } from '@documenso/lib/universal/upload/get-file';
import { formatDocumentsPath } from '@documenso/lib/utils/teams';
import type { Document, Recipient, User } from '@documenso/prisma/client';
import { DocumentStatus } from '@documenso/prisma/client';
import type { DocumentWithData } from '@documenso/prisma/types/document-with-data';
@ -63,7 +64,7 @@ export const DataTableActionDropdown = ({ row, teamUrl }: DataTableActionDropdow
// const isSigned = recipient?.signingStatus === SigningStatus.SIGNED;
const isDocumentDeletable = isOwner;
const documentsPath = teamUrl ? `/t/${teamUrl}/documents` : '/documents';
const documentsPath = formatDocumentsPath(teamUrl);
const onDownloadClick = async () => {
let document: DocumentWithData | null = null;

View File

@ -1,5 +1,6 @@
import { useRouter } from 'next/navigation';
import { formatDocumentsPath } from '@documenso/lib/utils/teams';
import { trpc as trpcReact } from '@documenso/trpc/react';
import { Button } from '@documenso/ui/primitives/button';
import {
@ -39,7 +40,7 @@ export const DuplicateDocumentDialog = ({
}
: undefined;
const documentsPath = teamUrl ? `/t/${teamUrl}/documents` : '/documents';
const documentsPath = formatDocumentsPath(teamUrl);
const { mutateAsync: duplicateDocument, isLoading: isDuplicateLoading } =
trpcReact.document.duplicateDocument.useMutation({

View File

@ -38,7 +38,6 @@ export const MobileNav = ({ className, ...props }: MobileNavProps) => {
</Button>
</Link>
{/* Todo: Teams */}
<Link href="/settings/teams">
<Button
variant="ghost"

View File

@ -126,10 +126,9 @@ export default function TeamBillingInvoicesDataTable({
rows: 3,
component: (
<>
{/* Todo: Teams */}
<TableCell className="w-1/3 py-4 pr-4">
<div className="flex w-full flex-row items-center">
<Skeleton className="h-12 w-12 flex-shrink-0 rounded-full" />
<Skeleton className="h-7 w-7 flex-shrink-0 rounded" />
<div className="ml-2 flex flex-grow flex-col">
<Skeleton className="h-4 w-1/2 max-w-[8rem]" />

View File

@ -38,7 +38,6 @@ export const findTeamMemberInvites = async ({
userId,
},
},
// Todo: Teams - Should only certain roles be able to find members?
},
});

View File

@ -1,9 +1,10 @@
import { P, match } from 'ts-pattern';
import { prisma } from '@documenso/prisma';
import { Prisma, TeamMember } from '@documenso/prisma/client';
import type { TeamMember } from '@documenso/prisma/client';
import { Prisma } from '@documenso/prisma/client';
import { FindResultSet } from '../../types/find-result-set';
import type { FindResultSet } from '../../types/find-result-set';
export interface FindTeamMembersOptions {
userId: number;
@ -37,7 +38,6 @@ export const findTeamMembers = async ({
userId,
},
},
// Todo: Teams - Should only certain roles be able to find members?
},
});

View File

@ -53,8 +53,6 @@ export const transferTeamOwnership = async ({ token }: TransferTeamOwnershipOpti
);
}
// Todo: Teams - Add billing message in email indicating that billing will be passed on when transferring a team.
await tx.team.update({
where: {
id: team.id,

View File

@ -5,3 +5,7 @@ export const formatTeamUrl = (teamUrl: string, baseUrl?: string) => {
return `${formattedBaseUrl}/t/${teamUrl}`;
};
export const formatDocumentsPath = (teamUrl?: string) => {
return teamUrl ? `/t/${teamUrl}/documents` : '/documents';
};