From 2a448fe06d29d4a98bbada9d4c373d3ade1c210e Mon Sep 17 00:00:00 2001 From: Ashraf Date: Wed, 20 Dec 2023 17:08:09 +0800 Subject: [PATCH 01/16] fix: fixed the recipients viewing issue on touch screens --- .../app/(dashboard)/documents/[id]/page.tsx | 6 +- .../app/(dashboard)/documents/data-table.tsx | 6 +- .../avatar/stack-avatars-component.tsx | 71 +++++++++++++ .../avatar/stack-avatars-with-tooltip.tsx | 99 ------------------- .../avatar/stack-avatars-with-ui.tsx | 51 ++++++++++ 5 files changed, 127 insertions(+), 106 deletions(-) create mode 100644 apps/web/src/components/(dashboard)/avatar/stack-avatars-component.tsx delete mode 100644 apps/web/src/components/(dashboard)/avatar/stack-avatars-with-tooltip.tsx create mode 100644 apps/web/src/components/(dashboard)/avatar/stack-avatars-with-ui.tsx diff --git a/apps/web/src/app/(dashboard)/documents/[id]/page.tsx b/apps/web/src/app/(dashboard)/documents/[id]/page.tsx index b26b6308c..ce18f27b8 100644 --- a/apps/web/src/app/(dashboard)/documents/[id]/page.tsx +++ b/apps/web/src/app/(dashboard)/documents/[id]/page.tsx @@ -11,7 +11,7 @@ import { DocumentStatus as InternalDocumentStatus } from '@documenso/prisma/clie import { LazyPDFViewer } from '@documenso/ui/primitives/lazy-pdf-viewer'; import { EditDocumentForm } from '~/app/(dashboard)/documents/[id]/edit-document'; -import { StackAvatarsWithTooltip } from '~/components/(dashboard)/avatar/stack-avatars-with-tooltip'; +import { StackAvatarsWithUI } from '~/components/(dashboard)/avatar/stack-avatars-with-ui'; import { DocumentStatus } from '~/components/formatter/document-status'; export type DocumentPageProps = { @@ -71,9 +71,9 @@ export default async function DocumentPage({ params }: DocumentPageProps) {
- + {recipients.length} Recipient(s) - +
)} diff --git a/apps/web/src/app/(dashboard)/documents/data-table.tsx b/apps/web/src/app/(dashboard)/documents/data-table.tsx index c8adb1422..a0cc4b8e8 100644 --- a/apps/web/src/app/(dashboard)/documents/data-table.tsx +++ b/apps/web/src/app/(dashboard)/documents/data-table.tsx @@ -12,7 +12,7 @@ import { ExtendedDocumentStatus } from '@documenso/prisma/types/extended-documen import { DataTable } from '@documenso/ui/primitives/data-table'; import { DataTablePagination } from '@documenso/ui/primitives/data-table-pagination'; -import { StackAvatarsWithTooltip } from '~/components/(dashboard)/avatar/stack-avatars-with-tooltip'; +import { StackAvatarsWithUI } from '~/components/(dashboard)/avatar/stack-avatars-with-ui'; import { DocumentStatus } from '~/components/formatter/document-status'; import { LocaleDate } from '~/components/formatter/locale-date'; @@ -64,9 +64,7 @@ export const DocumentsDataTable = ({ results }: DocumentsDataTableProps) => { { header: 'Recipient', accessorKey: 'recipient', - cell: ({ row }) => { - return ; - }, + cell: ({ row }) => , }, { header: 'Status', diff --git a/apps/web/src/components/(dashboard)/avatar/stack-avatars-component.tsx b/apps/web/src/components/(dashboard)/avatar/stack-avatars-component.tsx new file mode 100644 index 000000000..d7f3106e6 --- /dev/null +++ b/apps/web/src/components/(dashboard)/avatar/stack-avatars-component.tsx @@ -0,0 +1,71 @@ +import { getRecipientType } from '@documenso/lib/client-only/recipient-type'; +import { recipientAbbreviation } from '@documenso/lib/utils/recipient-formatter'; +import type { Recipient } from '@documenso/prisma/client'; + +import { AvatarWithRecipient } from './avatar-with-recipient'; +import { StackAvatar } from './stack-avatar'; + +export const StackAvatarsComponent = ({ recipients }: { recipients: Recipient[] }) => { + const waitingRecipients = recipients.filter( + (recipient) => getRecipientType(recipient) === 'waiting', + ); + + const openedRecipients = recipients.filter( + (recipient) => getRecipientType(recipient) === 'opened', + ); + + const completedRecipients = recipients.filter( + (recipient) => getRecipientType(recipient) === 'completed', + ); + + const uncompletedRecipients = recipients.filter( + (recipient) => getRecipientType(recipient) === 'unsigned', + ); + return ( +
+ {completedRecipients.length > 0 && ( +
+

Completed

+ {completedRecipients.map((recipient: Recipient) => ( +
+ + {recipient.email} +
+ ))} +
+ )} + + {waitingRecipients.length > 0 && ( +
+

Waiting

+ {waitingRecipients.map((recipient: Recipient) => ( + + ))} +
+ )} + + {openedRecipients.length > 0 && ( +
+

Opened

+ {openedRecipients.map((recipient: Recipient) => ( + + ))} +
+ )} + + {uncompletedRecipients.length > 0 && ( +
+

Uncompleted

+ {uncompletedRecipients.map((recipient: Recipient) => ( + + ))} +
+ )} +
+ ); +}; diff --git a/apps/web/src/components/(dashboard)/avatar/stack-avatars-with-tooltip.tsx b/apps/web/src/components/(dashboard)/avatar/stack-avatars-with-tooltip.tsx deleted file mode 100644 index 7429d8ee5..000000000 --- a/apps/web/src/components/(dashboard)/avatar/stack-avatars-with-tooltip.tsx +++ /dev/null @@ -1,99 +0,0 @@ -import { getRecipientType } from '@documenso/lib/client-only/recipient-type'; -import { recipientAbbreviation } from '@documenso/lib/utils/recipient-formatter'; -import type { Recipient } from '@documenso/prisma/client'; -import { - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger, -} from '@documenso/ui/primitives/tooltip'; - -import { AvatarWithRecipient } from './avatar-with-recipient'; -import { StackAvatar } from './stack-avatar'; -import { StackAvatars } from './stack-avatars'; - -export type StackAvatarsWithTooltipProps = { - recipients: Recipient[]; - position?: 'top' | 'bottom'; - children?: React.ReactNode; -}; - -export const StackAvatarsWithTooltip = ({ - recipients, - position, - children, -}: StackAvatarsWithTooltipProps) => { - const waitingRecipients = recipients.filter( - (recipient) => getRecipientType(recipient) === 'waiting', - ); - - const openedRecipients = recipients.filter( - (recipient) => getRecipientType(recipient) === 'opened', - ); - - const completedRecipients = recipients.filter( - (recipient) => getRecipientType(recipient) === 'completed', - ); - - const uncompletedRecipients = recipients.filter( - (recipient) => getRecipientType(recipient) === 'unsigned', - ); - - return ( - - - - {children || } - - - -
- {completedRecipients.length > 0 && ( -
-

Completed

- {completedRecipients.map((recipient: Recipient) => ( -
- - {recipient.email} -
- ))} -
- )} - - {waitingRecipients.length > 0 && ( -
-

Waiting

- {waitingRecipients.map((recipient: Recipient) => ( - - ))} -
- )} - - {openedRecipients.length > 0 && ( -
-

Opened

- {openedRecipients.map((recipient: Recipient) => ( - - ))} -
- )} - - {uncompletedRecipients.length > 0 && ( -
-

Uncompleted

- {uncompletedRecipients.map((recipient: Recipient) => ( - - ))} -
- )} -
-
-
-
- ); -}; diff --git a/apps/web/src/components/(dashboard)/avatar/stack-avatars-with-ui.tsx b/apps/web/src/components/(dashboard)/avatar/stack-avatars-with-ui.tsx new file mode 100644 index 000000000..5d5f24413 --- /dev/null +++ b/apps/web/src/components/(dashboard)/avatar/stack-avatars-with-ui.tsx @@ -0,0 +1,51 @@ +'use client'; + +import { useWindowSize } from '@documenso/lib/client-only/hooks/use-window-size'; +import type { Recipient } from '@documenso/prisma/client'; +import { Popover, PopoverContent, PopoverTrigger } from '@documenso/ui/primitives/popover'; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from '@documenso/ui/primitives/tooltip'; + +import { StackAvatars } from './stack-avatars'; +import { StackAvatarsComponent } from './stack-avatars-component'; + +export type StackAvatarsWithUIProps = { + recipients: Recipient[]; + position?: 'top' | 'bottom'; + children?: React.ReactNode; +}; + +export const StackAvatarsWithUI = ({ recipients, position, children }: StackAvatarsWithUIProps) => { + const size = useWindowSize(); + return ( + <> + {size.width > 1050 ? ( + + + + {children || } + + + + + + + + ) : ( + + + {children || } + + + + + + + )} + + ); +}; From ce67de9a1cb1ddb5db8092814c08de8f644fe65d Mon Sep 17 00:00:00 2001 From: Ashraf Date: Fri, 29 Dec 2023 19:29:13 +0800 Subject: [PATCH 02/16] refactor: changed component name for better readability --- apps/web/src/app/(dashboard)/documents/[id]/page.tsx | 6 +++--- apps/web/src/app/(dashboard)/documents/data-table.tsx | 4 ++-- .../{stack-avatars-with-ui.tsx => stack-avatars-ui.tsx} | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) rename apps/web/src/components/(dashboard)/avatar/{stack-avatars-with-ui.tsx => stack-avatars-ui.tsx} (91%) diff --git a/apps/web/src/app/(dashboard)/documents/[id]/page.tsx b/apps/web/src/app/(dashboard)/documents/[id]/page.tsx index ce18f27b8..708746af1 100644 --- a/apps/web/src/app/(dashboard)/documents/[id]/page.tsx +++ b/apps/web/src/app/(dashboard)/documents/[id]/page.tsx @@ -11,7 +11,7 @@ import { DocumentStatus as InternalDocumentStatus } from '@documenso/prisma/clie import { LazyPDFViewer } from '@documenso/ui/primitives/lazy-pdf-viewer'; import { EditDocumentForm } from '~/app/(dashboard)/documents/[id]/edit-document'; -import { StackAvatarsWithUI } from '~/components/(dashboard)/avatar/stack-avatars-with-ui'; +import { StackAvatarsUI } from '~/components/(dashboard)/avatar/stack-avatars-ui'; import { DocumentStatus } from '~/components/formatter/document-status'; export type DocumentPageProps = { @@ -71,9 +71,9 @@ export default async function DocumentPage({ params }: DocumentPageProps) {
- + {recipients.length} Recipient(s) - +
)} diff --git a/apps/web/src/app/(dashboard)/documents/data-table.tsx b/apps/web/src/app/(dashboard)/documents/data-table.tsx index a0cc4b8e8..ca2da02d3 100644 --- a/apps/web/src/app/(dashboard)/documents/data-table.tsx +++ b/apps/web/src/app/(dashboard)/documents/data-table.tsx @@ -12,7 +12,7 @@ import { ExtendedDocumentStatus } from '@documenso/prisma/types/extended-documen import { DataTable } from '@documenso/ui/primitives/data-table'; import { DataTablePagination } from '@documenso/ui/primitives/data-table-pagination'; -import { StackAvatarsWithUI } from '~/components/(dashboard)/avatar/stack-avatars-with-ui'; +import { StackAvatarsUI } from '~/components/(dashboard)/avatar/stack-avatars-ui'; import { DocumentStatus } from '~/components/formatter/document-status'; import { LocaleDate } from '~/components/formatter/locale-date'; @@ -64,7 +64,7 @@ export const DocumentsDataTable = ({ results }: DocumentsDataTableProps) => { { header: 'Recipient', accessorKey: 'recipient', - cell: ({ row }) => , + cell: ({ row }) => , }, { header: 'Status', diff --git a/apps/web/src/components/(dashboard)/avatar/stack-avatars-with-ui.tsx b/apps/web/src/components/(dashboard)/avatar/stack-avatars-ui.tsx similarity index 91% rename from apps/web/src/components/(dashboard)/avatar/stack-avatars-with-ui.tsx rename to apps/web/src/components/(dashboard)/avatar/stack-avatars-ui.tsx index 5d5f24413..c1c44836a 100644 --- a/apps/web/src/components/(dashboard)/avatar/stack-avatars-with-ui.tsx +++ b/apps/web/src/components/(dashboard)/avatar/stack-avatars-ui.tsx @@ -13,14 +13,15 @@ import { import { StackAvatars } from './stack-avatars'; import { StackAvatarsComponent } from './stack-avatars-component'; -export type StackAvatarsWithUIProps = { +export type StackAvatarsUIProps = { recipients: Recipient[]; position?: 'top' | 'bottom'; children?: React.ReactNode; }; -export const StackAvatarsWithUI = ({ recipients, position, children }: StackAvatarsWithUIProps) => { +export const StackAvatarsUI = ({ recipients, position, children }: StackAvatarsUIProps) => { const size = useWindowSize(); + return ( <> {size.width > 1050 ? ( From 58f4b729398d5a9f21769c8857ae445fe21bf8a4 Mon Sep 17 00:00:00 2001 From: apoorv taneja Date: Thu, 8 Feb 2024 13:31:38 +0530 Subject: [PATCH 03/16] added fixed width for status col --- apps/web/src/app/(dashboard)/documents/data-table.tsx | 1 + packages/ui/primitives/data-table.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/web/src/app/(dashboard)/documents/data-table.tsx b/apps/web/src/app/(dashboard)/documents/data-table.tsx index c8adb1422..a1bc76b1d 100644 --- a/apps/web/src/app/(dashboard)/documents/data-table.tsx +++ b/apps/web/src/app/(dashboard)/documents/data-table.tsx @@ -72,6 +72,7 @@ export const DocumentsDataTable = ({ results }: DocumentsDataTableProps) => { header: 'Status', accessorKey: 'status', cell: ({ row }) => , + size: 140, }, { header: 'Actions', diff --git a/packages/ui/primitives/data-table.tsx b/packages/ui/primitives/data-table.tsx index 9cc14a684..55895e08f 100644 --- a/packages/ui/primitives/data-table.tsx +++ b/packages/ui/primitives/data-table.tsx @@ -115,7 +115,12 @@ export function DataTable({ table.getRowModel().rows.map((row) => ( {row.getVisibleCells().map((cell) => ( - + {flexRender(cell.column.columnDef.cell, cell.getContext())} ))} From d694f4a17bf5b8b978d3ab223f0aae163473877b Mon Sep 17 00:00:00 2001 From: Rohit Saluja Date: Thu, 7 Mar 2024 18:48:23 +0530 Subject: [PATCH 04/16] fix: show close icon on notification inmobile --- packages/ui/primitives/toast.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ui/primitives/toast.tsx b/packages/ui/primitives/toast.tsx index b42cadc27..bddf33165 100644 --- a/packages/ui/primitives/toast.tsx +++ b/packages/ui/primitives/toast.tsx @@ -79,7 +79,7 @@ const ToastClose = React.forwardRef< Date: Fri, 8 Mar 2024 12:21:32 +0000 Subject: [PATCH 05/16] fix: revert api change and use mouseenter/mouseleave --- .../app/(dashboard)/documents/[id]/page.tsx | 6 +- .../app/(dashboard)/documents/data-table.tsx | 4 +- .../avatar/stack-avatars-component.tsx | 71 --------- .../(dashboard)/avatar/stack-avatars-ui.tsx | 52 ------- .../avatar/stack-avatars-with-tooltip.tsx | 140 ++++++++++++++++++ 5 files changed, 145 insertions(+), 128 deletions(-) delete mode 100644 apps/web/src/components/(dashboard)/avatar/stack-avatars-component.tsx delete mode 100644 apps/web/src/components/(dashboard)/avatar/stack-avatars-ui.tsx create mode 100644 apps/web/src/components/(dashboard)/avatar/stack-avatars-with-tooltip.tsx diff --git a/apps/web/src/app/(dashboard)/documents/[id]/page.tsx b/apps/web/src/app/(dashboard)/documents/[id]/page.tsx index bf58ae36a..44f3991d8 100644 --- a/apps/web/src/app/(dashboard)/documents/[id]/page.tsx +++ b/apps/web/src/app/(dashboard)/documents/[id]/page.tsx @@ -13,7 +13,7 @@ import { DocumentStatus as InternalDocumentStatus } from '@documenso/prisma/clie import { LazyPDFViewer } from '@documenso/ui/primitives/lazy-pdf-viewer'; import { EditDocumentForm } from '~/app/(dashboard)/documents/[id]/edit-document'; -import { StackAvatarsUI } from '~/components/(dashboard)/avatar/stack-avatars-ui'; +import { StackAvatarsWithTooltip } from '~/components/(dashboard)/avatar/stack-avatars-with-tooltip'; import { DocumentStatus } from '~/components/formatter/document-status'; export type DocumentPageProps = { @@ -90,9 +90,9 @@ export default async function DocumentPage({ params }: DocumentPageProps) {
- + {recipients.length} Recipient(s) - +
)} diff --git a/apps/web/src/app/(dashboard)/documents/data-table.tsx b/apps/web/src/app/(dashboard)/documents/data-table.tsx index ca2da02d3..72787714f 100644 --- a/apps/web/src/app/(dashboard)/documents/data-table.tsx +++ b/apps/web/src/app/(dashboard)/documents/data-table.tsx @@ -12,7 +12,7 @@ import { ExtendedDocumentStatus } from '@documenso/prisma/types/extended-documen import { DataTable } from '@documenso/ui/primitives/data-table'; import { DataTablePagination } from '@documenso/ui/primitives/data-table-pagination'; -import { StackAvatarsUI } from '~/components/(dashboard)/avatar/stack-avatars-ui'; +import { StackAvatarsWithTooltip } from '~/components/(dashboard)/avatar/stack-avatars-with-tooltip'; import { DocumentStatus } from '~/components/formatter/document-status'; import { LocaleDate } from '~/components/formatter/locale-date'; @@ -64,7 +64,7 @@ export const DocumentsDataTable = ({ results }: DocumentsDataTableProps) => { { header: 'Recipient', accessorKey: 'recipient', - cell: ({ row }) => , + cell: ({ row }) => , }, { header: 'Status', diff --git a/apps/web/src/components/(dashboard)/avatar/stack-avatars-component.tsx b/apps/web/src/components/(dashboard)/avatar/stack-avatars-component.tsx deleted file mode 100644 index d7f3106e6..000000000 --- a/apps/web/src/components/(dashboard)/avatar/stack-avatars-component.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import { getRecipientType } from '@documenso/lib/client-only/recipient-type'; -import { recipientAbbreviation } from '@documenso/lib/utils/recipient-formatter'; -import type { Recipient } from '@documenso/prisma/client'; - -import { AvatarWithRecipient } from './avatar-with-recipient'; -import { StackAvatar } from './stack-avatar'; - -export const StackAvatarsComponent = ({ recipients }: { recipients: Recipient[] }) => { - const waitingRecipients = recipients.filter( - (recipient) => getRecipientType(recipient) === 'waiting', - ); - - const openedRecipients = recipients.filter( - (recipient) => getRecipientType(recipient) === 'opened', - ); - - const completedRecipients = recipients.filter( - (recipient) => getRecipientType(recipient) === 'completed', - ); - - const uncompletedRecipients = recipients.filter( - (recipient) => getRecipientType(recipient) === 'unsigned', - ); - return ( -
- {completedRecipients.length > 0 && ( -
-

Completed

- {completedRecipients.map((recipient: Recipient) => ( -
- - {recipient.email} -
- ))} -
- )} - - {waitingRecipients.length > 0 && ( -
-

Waiting

- {waitingRecipients.map((recipient: Recipient) => ( - - ))} -
- )} - - {openedRecipients.length > 0 && ( -
-

Opened

- {openedRecipients.map((recipient: Recipient) => ( - - ))} -
- )} - - {uncompletedRecipients.length > 0 && ( -
-

Uncompleted

- {uncompletedRecipients.map((recipient: Recipient) => ( - - ))} -
- )} -
- ); -}; diff --git a/apps/web/src/components/(dashboard)/avatar/stack-avatars-ui.tsx b/apps/web/src/components/(dashboard)/avatar/stack-avatars-ui.tsx deleted file mode 100644 index c1c44836a..000000000 --- a/apps/web/src/components/(dashboard)/avatar/stack-avatars-ui.tsx +++ /dev/null @@ -1,52 +0,0 @@ -'use client'; - -import { useWindowSize } from '@documenso/lib/client-only/hooks/use-window-size'; -import type { Recipient } from '@documenso/prisma/client'; -import { Popover, PopoverContent, PopoverTrigger } from '@documenso/ui/primitives/popover'; -import { - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger, -} from '@documenso/ui/primitives/tooltip'; - -import { StackAvatars } from './stack-avatars'; -import { StackAvatarsComponent } from './stack-avatars-component'; - -export type StackAvatarsUIProps = { - recipients: Recipient[]; - position?: 'top' | 'bottom'; - children?: React.ReactNode; -}; - -export const StackAvatarsUI = ({ recipients, position, children }: StackAvatarsUIProps) => { - const size = useWindowSize(); - - return ( - <> - {size.width > 1050 ? ( - - - - {children || } - - - - - - - - ) : ( - - - {children || } - - - - - - - )} - - ); -}; diff --git a/apps/web/src/components/(dashboard)/avatar/stack-avatars-with-tooltip.tsx b/apps/web/src/components/(dashboard)/avatar/stack-avatars-with-tooltip.tsx new file mode 100644 index 000000000..51fd9c8cd --- /dev/null +++ b/apps/web/src/components/(dashboard)/avatar/stack-avatars-with-tooltip.tsx @@ -0,0 +1,140 @@ +import { useRef, useState } from 'react'; + +import { getRecipientType } from '@documenso/lib/client-only/recipient-type'; +import { recipientAbbreviation } from '@documenso/lib/utils/recipient-formatter'; +import type { Recipient } from '@documenso/prisma/client'; +import { Popover, PopoverContent, PopoverTrigger } from '@documenso/ui/primitives/popover'; + +import { AvatarWithRecipient } from './avatar-with-recipient'; +import { StackAvatar } from './stack-avatar'; +import { StackAvatars } from './stack-avatars'; + +export type StackAvatarsWithTooltipProps = { + recipients: Recipient[]; + position?: 'top' | 'bottom'; + children?: React.ReactNode; +}; + +export const StackAvatarsWithTooltip = ({ + recipients, + position, + children, +}: StackAvatarsWithTooltipProps) => { + const [open, setOpen] = useState(false); + + const isControlled = useRef(false); + const isMouseOverTimeout = useRef(null); + + const waitingRecipients = recipients.filter( + (recipient) => getRecipientType(recipient) === 'waiting', + ); + + const openedRecipients = recipients.filter( + (recipient) => getRecipientType(recipient) === 'opened', + ); + + const completedRecipients = recipients.filter( + (recipient) => getRecipientType(recipient) === 'completed', + ); + + const uncompletedRecipients = recipients.filter( + (recipient) => getRecipientType(recipient) === 'unsigned', + ); + + const onMouseEnter = () => { + if (isMouseOverTimeout.current) { + clearTimeout(isMouseOverTimeout.current); + } + + if (isControlled.current) { + return; + } + + isMouseOverTimeout.current = setTimeout(() => { + setOpen((o) => (!o ? true : o)); + }, 200); + }; + + const onMouseLeave = () => { + if (isMouseOverTimeout.current) { + clearTimeout(isMouseOverTimeout.current); + } + + if (isControlled.current) { + return; + } + + setTimeout(() => { + setOpen((o) => (o ? false : o)); + }, 200); + }; + + const onOpenChange = (newOpen: boolean) => { + isControlled.current = newOpen; + + setOpen(newOpen); + }; + + return ( + + + {children || } + + + + {completedRecipients.length > 0 && ( +
+

Completed

+ {completedRecipients.map((recipient: Recipient) => ( +
+ + {recipient.email} +
+ ))} +
+ )} + + {waitingRecipients.length > 0 && ( +
+

Waiting

+ {waitingRecipients.map((recipient: Recipient) => ( + + ))} +
+ )} + + {openedRecipients.length > 0 && ( +
+

Opened

+ {openedRecipients.map((recipient: Recipient) => ( + + ))} +
+ )} + + {uncompletedRecipients.length > 0 && ( +
+

Uncompleted

+ {uncompletedRecipients.map((recipient: Recipient) => ( + + ))} +
+ )} +
+
+ ); +}; From 40343d1c7241861ccc59788fef3f47c3b0680f27 Mon Sep 17 00:00:00 2001 From: Lucas Smith Date: Fri, 8 Mar 2024 12:34:49 +0000 Subject: [PATCH 06/16] fix: add use client directive --- .../(dashboard)/avatar/stack-avatars-with-tooltip.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/web/src/components/(dashboard)/avatar/stack-avatars-with-tooltip.tsx b/apps/web/src/components/(dashboard)/avatar/stack-avatars-with-tooltip.tsx index 0e6aa0ac8..10f7d1e6a 100644 --- a/apps/web/src/components/(dashboard)/avatar/stack-avatars-with-tooltip.tsx +++ b/apps/web/src/components/(dashboard)/avatar/stack-avatars-with-tooltip.tsx @@ -1,3 +1,5 @@ +'use client'; + import { useRef, useState } from 'react'; import { getRecipientType } from '@documenso/lib/client-only/recipient-type'; From 3b5f8d149af7d65a08fb972f997e44dce725ad14 Mon Sep 17 00:00:00 2001 From: Rohit Saluja Date: Fri, 8 Mar 2024 21:14:37 +0530 Subject: [PATCH 07/16] fix: eslint config file parseOptions.project path is updated --- packages/eslint-config/index.cjs | 2 +- tsconfig.eslint.json | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 tsconfig.eslint.json diff --git a/packages/eslint-config/index.cjs b/packages/eslint-config/index.cjs index 57cecf40d..aef6a944e 100644 --- a/packages/eslint-config/index.cjs +++ b/packages/eslint-config/index.cjs @@ -20,7 +20,7 @@ module.exports = { parserOptions: { tsconfigRootDir: __dirname, - project: ['../../apps/*/tsconfig.json', '../../packages/*/tsconfig.json'], + project: ['../../tsconfig.eslint.json'], ecmaVersion: 2022, ecmaFeatures: { jsx: true, diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json new file mode 100644 index 000000000..9974f0b6a --- /dev/null +++ b/tsconfig.eslint.json @@ -0,0 +1,4 @@ +{ + "extends": "./packages/tsconfig/base.json", + "include": ["packages/**/*", "apps/**/*"] +} From 415f79f82184ab21e6cbcc64cdd5541e3ccc3145 Mon Sep 17 00:00:00 2001 From: Mythie Date: Sun, 10 Mar 2024 11:13:05 +1100 Subject: [PATCH 08/16] fix: update docker docs and compose files --- .env.example | 10 ++++++++++ docker/README.md | 16 +++++++++++++++- docker/production/compose.yml | 3 +++ docker/testing/compose.yml | 2 ++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index c482c128e..20e1ae2ae 100644 --- a/.env.example +++ b/.env.example @@ -27,6 +27,16 @@ E2E_TEST_AUTHENTICATE_USERNAME="Test User" E2E_TEST_AUTHENTICATE_USER_EMAIL="testuser@mail.com" E2E_TEST_AUTHENTICATE_USER_PASSWORD="test_Password123" +# [[SIGNING]] +# OPTIONAL: Defines the signing transport to use. Available options: local (default) +NEXT_PRIVATE_SIGNING_TRANSPORT="local" +# OPTIONAL: Defines the passphrase for the signing certificate. +NEXT_PRIVATE_SIGNING_PASSPHRASE= +# OPTIONAL: Defines the file contents for the signing certificate as a base64 encoded string. +NEXT_PRIVATE_SIGNING_LOCAL_FILE_CONTENTS= +# OPTIONAL: Defines the file path for the signing certificate. defaults to ./example/cert.p12 +NEXT_PRIVATE_SIGNING_LOCAL_FILE_PATH= + # [[STORAGE]] # OPTIONAL: Defines the storage transport to use. Available options: database (default) | s3 NEXT_PUBLIC_UPLOAD_TRANSPORT="database" diff --git a/docker/README.md b/docker/README.md index ba942ac1c..bda1638a2 100644 --- a/docker/README.md +++ b/docker/README.md @@ -29,7 +29,16 @@ NEXT_PRIVATE_SMTP_USERNAME="" NEXT_PRIVATE_SMTP_PASSWORD="" ``` -4. Run the following command to start the containers: +4. Update the volume binding for the cert file in the `compose.yml` file to point to your own key file: + +Since the `cert.p12` file is required for signing and encrypting documents, you will need to provide your own key file. Update the volume binding in the `compose.yml` file to point to your key file: + +```yaml +volumes: + - /path/to/your/keyfile.p12:/opt/documenso/cert.p12 +``` + +1. Run the following command to start the containers: ``` docker-compose --env-file ./.env -d up @@ -70,6 +79,7 @@ docker run -d \ -e NEXT_PRIVATE_SMTP_TRANSPORT="" -e NEXT_PRIVATE_SMTP_FROM_NAME="" -e NEXT_PRIVATE_SMTP_FROM_ADDRESS="" + -v /path/to/your/keyfile.p12:/opt/documenso/cert.p12 documenso/documenso ``` @@ -99,6 +109,10 @@ Here's a markdown table documenting all the provided environment variables: | `NEXT_PUBLIC_WEBAPP_URL` | The URL for the web application. | | `NEXT_PRIVATE_DATABASE_URL` | The URL for the primary database connection (with connection pooling). | | `NEXT_PRIVATE_DIRECT_DATABASE_URL` | The URL for the direct database connection (without connection pooling). | +| `NEXT_PRIVATE_SIGNING_TRANSPORT` | The signing transport to use. Available options: local (default) | +| `NEXT_PRIVATE_SIGNING_PASSPHRASE` | The passphrase for the key file. | +| `NEXT_PRIVATE_SIGNING_LOCAL_FILE_CONTENTS` | The base64-encoded contents of the key file, will be used instead of file path. | +| `NEXT_PRIVATE_SIGNING_LOCAL_FILE_PATH` | The path to the key file, default `/opt/documenso/cert.p12`. | | `NEXT_PUBLIC_UPLOAD_TRANSPORT` | The transport to use for file uploads (database or s3). | | `NEXT_PRIVATE_UPLOAD_ENDPOINT` | The endpoint for the S3 storage transport (for third-party S3-compatible providers). | | `NEXT_PRIVATE_UPLOAD_REGION` | The region for the S3 storage transport (defaults to us-east-1). | diff --git a/docker/production/compose.yml b/docker/production/compose.yml index 08abcf050..02acc655d 100644 --- a/docker/production/compose.yml +++ b/docker/production/compose.yml @@ -57,8 +57,11 @@ services: - NEXT_PUBLIC_DOCUMENT_SIZE_UPLOAD_LIMIT=${NEXT_PUBLIC_DOCUMENT_SIZE_UPLOAD_LIMIT} - NEXT_PUBLIC_POSTHOG_KEY=${NEXT_PUBLIC_POSTHOG_KEY} - NEXT_PUBLIC_DISABLE_SIGNUP=${NEXT_PUBLIC_DISABLE_SIGNUP} + - NEXT_PRIVATE_SIGNING_LOCAL_FILE_PATH=${NEXT_PRIVATE_SIGNING_LOCAL_FILE_PATH?:-/opt/documenso/cert.p12} ports: - ${PORT:-3000}:${PORT:-3000} + volumes: + - /opt/documenso/cert.p12:/opt/documenso/cert.p12 volumes: database: diff --git a/docker/testing/compose.yml b/docker/testing/compose.yml index cecb5bf14..de4a71fea 100644 --- a/docker/testing/compose.yml +++ b/docker/testing/compose.yml @@ -49,3 +49,5 @@ services: - NEXT_PRIVATE_SMTP_FROM_ADDRESS=noreply@documenso.com ports: - 3000:3000 + volumes: + - ../../apps/web/example/cert.p12:/opt/documenso/cert.p12 From 608e622f69a7520a1d70941b2f47547e3a384634 Mon Sep 17 00:00:00 2001 From: Mythie Date: Sun, 10 Mar 2024 13:48:09 +1100 Subject: [PATCH 09/16] fix: update testing compose config --- docker/testing/compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/testing/compose.yml b/docker/testing/compose.yml index de4a71fea..28ec055c1 100644 --- a/docker/testing/compose.yml +++ b/docker/testing/compose.yml @@ -47,6 +47,7 @@ services: - NEXT_PRIVATE_SMTP_PASSWORD=password - NEXT_PRIVATE_SMTP_FROM_NAME="No Reply @ Documenso" - NEXT_PRIVATE_SMTP_FROM_ADDRESS=noreply@documenso.com + - NEXT_PRIVATE_SIGNING_LOCAL_FILE_PATH=/opt/documenso/cert.p12 ports: - 3000:3000 volumes: From 9e1b2e5cc3ca51e96fee68578675ee9e483a23c5 Mon Sep 17 00:00:00 2001 From: Mythie Date: Sun, 10 Mar 2024 13:48:25 +1100 Subject: [PATCH 10/16] fix: update sharp dependency --- apps/marketing/package.json | 2 +- apps/web/package.json | 2 +- package-lock.json | 121 ++++++++++++------------------------ 3 files changed, 43 insertions(+), 82 deletions(-) diff --git a/apps/marketing/package.json b/apps/marketing/package.json index 1cfb7337f..f6af3a9ff 100644 --- a/apps/marketing/package.json +++ b/apps/marketing/package.json @@ -36,7 +36,7 @@ "react-hook-form": "^7.43.9", "react-icons": "^4.11.0", "recharts": "^2.7.2", - "sharp": "0.33.1", + "sharp": "^0.33.1", "typescript": "5.2.2", "zod": "^3.22.4" }, diff --git a/apps/web/package.json b/apps/web/package.json index 41caec804..e72f4898a 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -43,7 +43,7 @@ "react-icons": "^4.11.0", "react-rnd": "^10.4.1", "remeda": "^1.27.1", - "sharp": "0.33.1", + "sharp": "^0.33.1", "ts-pattern": "^5.0.5", "ua-parser-js": "^1.0.37", "uqr": "^0.1.2", diff --git a/package-lock.json b/package-lock.json index 72d06b98a..d7615e179 100644 --- a/package-lock.json +++ b/package-lock.json @@ -58,7 +58,7 @@ "react-hook-form": "^7.43.9", "react-icons": "^4.11.0", "recharts": "^2.7.2", - "sharp": "0.33.1", + "sharp": "^0.33.1", "typescript": "5.2.2", "zod": "^3.22.4" }, @@ -74,45 +74,6 @@ "integrity": "sha512-O+z53uwx64xY7D6roOi4+jApDGFg0qn6WHcxe5QeqjMaTezBO/mxdfFXIVAVVyNWKx84OmPB3L8kbVYOTeN34A==", "dev": true }, - "apps/marketing/node_modules/sharp": { - "version": "0.33.1", - "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.1.tgz", - "integrity": "sha512-iAYUnOdTqqZDb3QjMneBKINTllCJDZ3em6WaWy7NPECM4aHncvqHRm0v0bN9nqJxMiwamv5KIdauJ6lUzKDpTQ==", - "hasInstallScript": true, - "dependencies": { - "color": "^4.2.3", - "detect-libc": "^2.0.2", - "semver": "^7.5.4" - }, - "engines": { - "libvips": ">=8.15.0", - "node": "^18.17.0 || ^20.3.0 || >=21.0.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-darwin-arm64": "0.33.1", - "@img/sharp-darwin-x64": "0.33.1", - "@img/sharp-libvips-darwin-arm64": "1.0.0", - "@img/sharp-libvips-darwin-x64": "1.0.0", - "@img/sharp-libvips-linux-arm": "1.0.0", - "@img/sharp-libvips-linux-arm64": "1.0.0", - "@img/sharp-libvips-linux-s390x": "1.0.0", - "@img/sharp-libvips-linux-x64": "1.0.0", - "@img/sharp-libvips-linuxmusl-arm64": "1.0.0", - "@img/sharp-libvips-linuxmusl-x64": "1.0.0", - "@img/sharp-linux-arm": "0.33.1", - "@img/sharp-linux-arm64": "0.33.1", - "@img/sharp-linux-s390x": "0.33.1", - "@img/sharp-linux-x64": "0.33.1", - "@img/sharp-linuxmusl-arm64": "0.33.1", - "@img/sharp-linuxmusl-x64": "0.33.1", - "@img/sharp-wasm32": "0.33.1", - "@img/sharp-win32-ia32": "0.33.1", - "@img/sharp-win32-x64": "0.33.1" - } - }, "apps/marketing/node_modules/typescript": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", @@ -159,7 +120,7 @@ "react-icons": "^4.11.0", "react-rnd": "^10.4.1", "remeda": "^1.27.1", - "sharp": "0.33.1", + "sharp": "^0.33.1", "ts-pattern": "^5.0.5", "ua-parser-js": "^1.0.37", "uqr": "^0.1.2", @@ -182,45 +143,6 @@ "integrity": "sha512-O+z53uwx64xY7D6roOi4+jApDGFg0qn6WHcxe5QeqjMaTezBO/mxdfFXIVAVVyNWKx84OmPB3L8kbVYOTeN34A==", "dev": true }, - "apps/web/node_modules/sharp": { - "version": "0.33.1", - "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.1.tgz", - "integrity": "sha512-iAYUnOdTqqZDb3QjMneBKINTllCJDZ3em6WaWy7NPECM4aHncvqHRm0v0bN9nqJxMiwamv5KIdauJ6lUzKDpTQ==", - "hasInstallScript": true, - "dependencies": { - "color": "^4.2.3", - "detect-libc": "^2.0.2", - "semver": "^7.5.4" - }, - "engines": { - "libvips": ">=8.15.0", - "node": "^18.17.0 || ^20.3.0 || >=21.0.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-darwin-arm64": "0.33.1", - "@img/sharp-darwin-x64": "0.33.1", - "@img/sharp-libvips-darwin-arm64": "1.0.0", - "@img/sharp-libvips-darwin-x64": "1.0.0", - "@img/sharp-libvips-linux-arm": "1.0.0", - "@img/sharp-libvips-linux-arm64": "1.0.0", - "@img/sharp-libvips-linux-s390x": "1.0.0", - "@img/sharp-libvips-linux-x64": "1.0.0", - "@img/sharp-libvips-linuxmusl-arm64": "1.0.0", - "@img/sharp-libvips-linuxmusl-x64": "1.0.0", - "@img/sharp-linux-arm": "0.33.1", - "@img/sharp-linux-arm64": "0.33.1", - "@img/sharp-linux-s390x": "0.33.1", - "@img/sharp-linux-x64": "0.33.1", - "@img/sharp-linuxmusl-arm64": "0.33.1", - "@img/sharp-linuxmusl-x64": "0.33.1", - "@img/sharp-wasm32": "0.33.1", - "@img/sharp-win32-ia32": "0.33.1", - "@img/sharp-win32-x64": "0.33.1" - } - }, "apps/web/node_modules/typescript": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", @@ -18560,6 +18482,45 @@ "sha.js": "bin.js" } }, + "node_modules/sharp": { + "version": "0.33.1", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.1.tgz", + "integrity": "sha512-iAYUnOdTqqZDb3QjMneBKINTllCJDZ3em6WaWy7NPECM4aHncvqHRm0v0bN9nqJxMiwamv5KIdauJ6lUzKDpTQ==", + "hasInstallScript": true, + "dependencies": { + "color": "^4.2.3", + "detect-libc": "^2.0.2", + "semver": "^7.5.4" + }, + "engines": { + "libvips": ">=8.15.0", + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.33.1", + "@img/sharp-darwin-x64": "0.33.1", + "@img/sharp-libvips-darwin-arm64": "1.0.0", + "@img/sharp-libvips-darwin-x64": "1.0.0", + "@img/sharp-libvips-linux-arm": "1.0.0", + "@img/sharp-libvips-linux-arm64": "1.0.0", + "@img/sharp-libvips-linux-s390x": "1.0.0", + "@img/sharp-libvips-linux-x64": "1.0.0", + "@img/sharp-libvips-linuxmusl-arm64": "1.0.0", + "@img/sharp-libvips-linuxmusl-x64": "1.0.0", + "@img/sharp-linux-arm": "0.33.1", + "@img/sharp-linux-arm64": "0.33.1", + "@img/sharp-linux-s390x": "0.33.1", + "@img/sharp-linux-x64": "0.33.1", + "@img/sharp-linuxmusl-arm64": "0.33.1", + "@img/sharp-linuxmusl-x64": "0.33.1", + "@img/sharp-wasm32": "0.33.1", + "@img/sharp-win32-ia32": "0.33.1", + "@img/sharp-win32-x64": "0.33.1" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", From f646fa29d7c1c9240810e50d9d8e72e255958be3 Mon Sep 17 00:00:00 2001 From: Brayden Brayden Date: Sun, 10 Mar 2024 07:01:18 +0000 Subject: [PATCH 11/16] fix: ensure password input is cleared when 2fa enable dialog is closed --- .../forms/2fa/enable-authenticator-app-dialog.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/forms/2fa/enable-authenticator-app-dialog.tsx b/apps/web/src/components/forms/2fa/enable-authenticator-app-dialog.tsx index 27560c073..e3120141a 100644 --- a/apps/web/src/components/forms/2fa/enable-authenticator-app-dialog.tsx +++ b/apps/web/src/components/forms/2fa/enable-authenticator-app-dialog.tsx @@ -197,7 +197,14 @@ export const EnableAuthenticatorAppDialog = ({ /> - From 6f958b9320a389f92fc9c16dc7244d666752db4f Mon Sep 17 00:00:00 2001 From: Brayden Brayden Date: Sun, 10 Mar 2024 09:28:08 +0000 Subject: [PATCH 12/16] fix: update the dialog cancel to reset --- .../forms/2fa/enable-authenticator-app-dialog.tsx | 2 +- .../components/forms/2fa/view-recovery-codes-dialog.tsx | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/forms/2fa/enable-authenticator-app-dialog.tsx b/apps/web/src/components/forms/2fa/enable-authenticator-app-dialog.tsx index e3120141a..487ebfc32 100644 --- a/apps/web/src/components/forms/2fa/enable-authenticator-app-dialog.tsx +++ b/apps/web/src/components/forms/2fa/enable-authenticator-app-dialog.tsx @@ -202,7 +202,7 @@ export const EnableAuthenticatorAppDialog = ({ variant="secondary" onClick={() => { onOpenChange(false); - setupTwoFactorAuthenticationForm.setValue('password', ''); + setupTwoFactorAuthenticationForm.reset(); }} > Cancel diff --git a/apps/web/src/components/forms/2fa/view-recovery-codes-dialog.tsx b/apps/web/src/components/forms/2fa/view-recovery-codes-dialog.tsx index 376a8939c..649cbd11c 100644 --- a/apps/web/src/components/forms/2fa/view-recovery-codes-dialog.tsx +++ b/apps/web/src/components/forms/2fa/view-recovery-codes-dialog.tsx @@ -138,7 +138,14 @@ export const ViewRecoveryCodesDialog = ({ open, onOpenChange }: ViewRecoveryCode /> - From afe99e5ec90dd1cc781280c2ad2b702be24e13fc Mon Sep 17 00:00:00 2001 From: Brayden Brayden Date: Sun, 10 Mar 2024 09:36:54 +0000 Subject: [PATCH 13/16] fix: revert reset changes, reset on open state change instead --- .../2fa/enable-authenticator-app-dialog.tsx | 16 +++++++--------- .../forms/2fa/view-recovery-codes-dialog.tsx | 16 +++++++--------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/apps/web/src/components/forms/2fa/enable-authenticator-app-dialog.tsx b/apps/web/src/components/forms/2fa/enable-authenticator-app-dialog.tsx index 487ebfc32..cb4cd60e1 100644 --- a/apps/web/src/components/forms/2fa/enable-authenticator-app-dialog.tsx +++ b/apps/web/src/components/forms/2fa/enable-authenticator-app-dialog.tsx @@ -1,4 +1,4 @@ -import { useMemo } from 'react'; +import { useEffect, useMemo } from 'react'; import { zodResolver } from '@hookform/resolvers/zod'; import { useForm } from 'react-hook-form'; @@ -149,6 +149,11 @@ export const EnableAuthenticatorAppDialog = ({ } }; + useEffect(() => { + // Reset the form when the Dialog open state changes + setupTwoFactorAuthenticationForm.reset(); + }, [open, setupTwoFactorAuthenticationForm]); + return ( @@ -197,14 +202,7 @@ export const EnableAuthenticatorAppDialog = ({ /> - diff --git a/apps/web/src/components/forms/2fa/view-recovery-codes-dialog.tsx b/apps/web/src/components/forms/2fa/view-recovery-codes-dialog.tsx index 649cbd11c..2a83e6499 100644 --- a/apps/web/src/components/forms/2fa/view-recovery-codes-dialog.tsx +++ b/apps/web/src/components/forms/2fa/view-recovery-codes-dialog.tsx @@ -1,4 +1,4 @@ -import { useMemo } from 'react'; +import { useEffect, useMemo } from 'react'; import { zodResolver } from '@hookform/resolvers/zod'; import { useForm } from 'react-hook-form'; @@ -92,6 +92,11 @@ export const ViewRecoveryCodesDialog = ({ open, onOpenChange }: ViewRecoveryCode } }; + useEffect(() => { + // Reset the form when the Dialog open state changes + viewRecoveryCodesForm.reset(); + }, [open, viewRecoveryCodesForm]); + return ( @@ -138,14 +143,7 @@ export const ViewRecoveryCodesDialog = ({ open, onOpenChange }: ViewRecoveryCode /> - From c744482b844e8d8068489267b9256b3e321cf495 Mon Sep 17 00:00:00 2001 From: Lucas Smith Date: Mon, 11 Mar 2024 10:55:46 +1100 Subject: [PATCH 14/16] fix: add conditional to useEffects --- .../forms/2fa/enable-authenticator-app-dialog.tsx | 6 ++++-- .../src/components/forms/2fa/view-recovery-codes-dialog.tsx | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/web/src/components/forms/2fa/enable-authenticator-app-dialog.tsx b/apps/web/src/components/forms/2fa/enable-authenticator-app-dialog.tsx index cb4cd60e1..d7a8f6553 100644 --- a/apps/web/src/components/forms/2fa/enable-authenticator-app-dialog.tsx +++ b/apps/web/src/components/forms/2fa/enable-authenticator-app-dialog.tsx @@ -150,8 +150,10 @@ export const EnableAuthenticatorAppDialog = ({ }; useEffect(() => { - // Reset the form when the Dialog open state changes - setupTwoFactorAuthenticationForm.reset(); + // Reset the form when the Dialog closes + if (!open) { + setupTwoFactorAuthenticationForm.reset(); + } }, [open, setupTwoFactorAuthenticationForm]); return ( diff --git a/apps/web/src/components/forms/2fa/view-recovery-codes-dialog.tsx b/apps/web/src/components/forms/2fa/view-recovery-codes-dialog.tsx index 2a83e6499..48e343e8d 100644 --- a/apps/web/src/components/forms/2fa/view-recovery-codes-dialog.tsx +++ b/apps/web/src/components/forms/2fa/view-recovery-codes-dialog.tsx @@ -93,8 +93,10 @@ export const ViewRecoveryCodesDialog = ({ open, onOpenChange }: ViewRecoveryCode }; useEffect(() => { - // Reset the form when the Dialog open state changes - viewRecoveryCodesForm.reset(); + // Reset the form when the Dialog closes + if (!open) { + viewRecoveryCodesForm.reset(); + } }, [open, viewRecoveryCodesForm]); return ( From 7f31ab1ce39f6fa8a150b0484d8f9c85dbee8ca0 Mon Sep 17 00:00:00 2001 From: Lucas Smith Date: Mon, 11 Mar 2024 00:52:56 +0000 Subject: [PATCH 15/16] fix: add scrollbar gutter property --- packages/ui/primitives/data-table.tsx | 2 +- packages/ui/styles/theme.css | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/ui/primitives/data-table.tsx b/packages/ui/primitives/data-table.tsx index 55895e08f..0d8556d89 100644 --- a/packages/ui/primitives/data-table.tsx +++ b/packages/ui/primitives/data-table.tsx @@ -118,7 +118,7 @@ export function DataTable({ {flexRender(cell.column.columnDef.cell, cell.getContext())} diff --git a/packages/ui/styles/theme.css b/packages/ui/styles/theme.css index 8e488ad95..70a06ad15 100644 --- a/packages/ui/styles/theme.css +++ b/packages/ui/styles/theme.css @@ -81,7 +81,7 @@ --ring: 95.08 71.08% 67.45%; --radius: 0.5rem; - + --warning: 54 96% 45%; } } @@ -91,6 +91,11 @@ @apply border-border; } + html, + body { + scrollbar-gutter: stable; + } + body { @apply bg-background text-foreground; font-feature-settings: 'rlig' 1, 'calt' 1; From c2cf25b13835fe8260444a34c0337d8d775343eb Mon Sep 17 00:00:00 2001 From: Lucas Smith Date: Mon, 11 Mar 2024 01:46:19 +0000 Subject: [PATCH 16/16] fix: templates incorrectly linking when in a team --- .../templates/data-table-templates.tsx | 6 +++++- .../(dashboard)/templates/data-table-title.tsx | 18 +++++++++++++++--- .../lib/server-only/template/find-templates.ts | 6 ++++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/apps/web/src/app/(dashboard)/templates/data-table-templates.tsx b/apps/web/src/app/(dashboard)/templates/data-table-templates.tsx index e878d8df2..cb00ef6f6 100644 --- a/apps/web/src/app/(dashboard)/templates/data-table-templates.tsx +++ b/apps/web/src/app/(dashboard)/templates/data-table-templates.tsx @@ -25,7 +25,11 @@ type TemplateWithRecipient = Template & { }; type TemplatesDataTableProps = { - templates: TemplateWithRecipient[]; + templates: Array< + TemplateWithRecipient & { + team: { id: number; url: string } | null; + } + >; perPage: number; page: number; totalPages: number; diff --git a/apps/web/src/app/(dashboard)/templates/data-table-title.tsx b/apps/web/src/app/(dashboard)/templates/data-table-title.tsx index 31e1011be..69855ca1e 100644 --- a/apps/web/src/app/(dashboard)/templates/data-table-title.tsx +++ b/apps/web/src/app/(dashboard)/templates/data-table-title.tsx @@ -1,23 +1,35 @@ +'use client'; + import Link from 'next/link'; import { useSession } from 'next-auth/react'; -import { Template } from '@documenso/prisma/client'; +import { formatTemplatesPath } from '@documenso/lib/utils/teams'; +import type { Template } from '@documenso/prisma/client'; + +import { useOptionalCurrentTeam } from '~/providers/team'; export type DataTableTitleProps = { - row: Template; + row: Template & { + team: { id: number; url: string } | null; + }; }; export const DataTableTitle = ({ row }: DataTableTitleProps) => { const { data: session } = useSession(); + const team = useOptionalCurrentTeam(); if (!session) { return null; } + const isCurrentTeamTemplate = team?.url && row.team?.url === team?.url; + + const templatesPath = formatTemplatesPath(isCurrentTeamTemplate ? team?.url : undefined); + return ( {row.title} diff --git a/packages/lib/server-only/template/find-templates.ts b/packages/lib/server-only/template/find-templates.ts index 69b43f9b9..9252d32ea 100644 --- a/packages/lib/server-only/template/find-templates.ts +++ b/packages/lib/server-only/template/find-templates.ts @@ -37,6 +37,12 @@ export const findTemplates = async ({ where: whereFilter, include: { templateDocumentData: true, + team: { + select: { + id: true, + url: true, + }, + }, Field: true, Recipient: true, },