From 813d02d36b49c33b16d6ac5ea0f37bc081254837 Mon Sep 17 00:00:00 2001 From: Catalin Pit Date: Fri, 21 Mar 2025 13:59:54 +0200 Subject: [PATCH] chore: add move to folder option to dropdown --- .../tables/documents-table-action-dropdown.tsx | 13 ++++++++++++- .../app/components/tables/documents-table.tsx | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/apps/remix/app/components/tables/documents-table-action-dropdown.tsx b/apps/remix/app/components/tables/documents-table-action-dropdown.tsx index ea0f11fc1..a914203b6 100644 --- a/apps/remix/app/components/tables/documents-table-action-dropdown.tsx +++ b/apps/remix/app/components/tables/documents-table-action-dropdown.tsx @@ -48,9 +48,13 @@ export type DocumentsTableActionDropdownProps = { recipients: Recipient[]; team: Pick | null; }; + onMoveDocument?: () => void; }; -export const DocumentsTableActionDropdown = ({ row }: DocumentsTableActionDropdownProps) => { +export const DocumentsTableActionDropdown = ({ + row, + onMoveDocument, +}: DocumentsTableActionDropdownProps) => { const { user } = useSession(); const team = useOptionalCurrentTeam(); @@ -165,6 +169,13 @@ export const DocumentsTableActionDropdown = ({ row }: DocumentsTableActionDropdo )} + {onMoveDocument && ( + e.preventDefault()}> + + Move to Folder + + )} + {/* No point displaying this if there's no functionality. */} {/* diff --git a/apps/remix/app/components/tables/documents-table.tsx b/apps/remix/app/components/tables/documents-table.tsx index 4f6dc0050..fe1187b74 100644 --- a/apps/remix/app/components/tables/documents-table.tsx +++ b/apps/remix/app/components/tables/documents-table.tsx @@ -29,11 +29,17 @@ export type DocumentsTableProps = { data?: TFindDocumentsResponse; isLoading?: boolean; isLoadingError?: boolean; + onMoveDocument?: (documentId: number) => void; }; type DocumentsTableRow = TFindDocumentsResponse['data'][number]; -export const DocumentsTable = ({ data, isLoading, isLoadingError }: DocumentsTableProps) => { +export const DocumentsTable = ({ + data, + isLoading, + isLoadingError, + onMoveDocument, +}: DocumentsTableProps) => { const { _, i18n } = useLingui(); const team = useOptionalCurrentTeam(); @@ -80,12 +86,15 @@ export const DocumentsTable = ({ data, isLoading, isLoadingError }: DocumentsTab (!row.original.deletedAt || isDocumentCompleted(row.original.status)) && (
- + onMoveDocument(row.original.id) : undefined} + />
), }, ] satisfies DataTableColumnDef[]; - }, [team]); + }, [team, onMoveDocument, _, i18n]); const onPaginationChange = (page: number, perPage: number) => { startTransition(() => {