chore: add move to folder option to dropdown
This commit is contained in:
@@ -48,9 +48,13 @@ export type DocumentsTableActionDropdownProps = {
|
|||||||
recipients: Recipient[];
|
recipients: Recipient[];
|
||||||
team: Pick<Team, 'id' | 'url'> | null;
|
team: Pick<Team, 'id' | 'url'> | null;
|
||||||
};
|
};
|
||||||
|
onMoveDocument?: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DocumentsTableActionDropdown = ({ row }: DocumentsTableActionDropdownProps) => {
|
export const DocumentsTableActionDropdown = ({
|
||||||
|
row,
|
||||||
|
onMoveDocument,
|
||||||
|
}: DocumentsTableActionDropdownProps) => {
|
||||||
const { user } = useSession();
|
const { user } = useSession();
|
||||||
const team = useOptionalCurrentTeam();
|
const team = useOptionalCurrentTeam();
|
||||||
|
|
||||||
@@ -165,6 +169,13 @@ export const DocumentsTableActionDropdown = ({ row }: DocumentsTableActionDropdo
|
|||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{onMoveDocument && (
|
||||||
|
<DropdownMenuItem onClick={onMoveDocument} onSelect={(e) => e.preventDefault()}>
|
||||||
|
<MoveRight className="mr-2 h-4 w-4" />
|
||||||
|
<Trans>Move to Folder</Trans>
|
||||||
|
</DropdownMenuItem>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* No point displaying this if there's no functionality. */}
|
{/* No point displaying this if there's no functionality. */}
|
||||||
{/* <DropdownMenuItem disabled>
|
{/* <DropdownMenuItem disabled>
|
||||||
<XCircle className="mr-2 h-4 w-4" />
|
<XCircle className="mr-2 h-4 w-4" />
|
||||||
|
|||||||
@@ -29,11 +29,17 @@ export type DocumentsTableProps = {
|
|||||||
data?: TFindDocumentsResponse;
|
data?: TFindDocumentsResponse;
|
||||||
isLoading?: boolean;
|
isLoading?: boolean;
|
||||||
isLoadingError?: boolean;
|
isLoadingError?: boolean;
|
||||||
|
onMoveDocument?: (documentId: number) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
type DocumentsTableRow = TFindDocumentsResponse['data'][number];
|
type DocumentsTableRow = TFindDocumentsResponse['data'][number];
|
||||||
|
|
||||||
export const DocumentsTable = ({ data, isLoading, isLoadingError }: DocumentsTableProps) => {
|
export const DocumentsTable = ({
|
||||||
|
data,
|
||||||
|
isLoading,
|
||||||
|
isLoadingError,
|
||||||
|
onMoveDocument,
|
||||||
|
}: DocumentsTableProps) => {
|
||||||
const { _, i18n } = useLingui();
|
const { _, i18n } = useLingui();
|
||||||
|
|
||||||
const team = useOptionalCurrentTeam();
|
const team = useOptionalCurrentTeam();
|
||||||
@@ -80,12 +86,15 @@ export const DocumentsTable = ({ data, isLoading, isLoadingError }: DocumentsTab
|
|||||||
(!row.original.deletedAt || isDocumentCompleted(row.original.status)) && (
|
(!row.original.deletedAt || isDocumentCompleted(row.original.status)) && (
|
||||||
<div className="flex items-center gap-x-4">
|
<div className="flex items-center gap-x-4">
|
||||||
<DocumentsTableActionButton row={row.original} />
|
<DocumentsTableActionButton row={row.original} />
|
||||||
<DocumentsTableActionDropdown row={row.original} />
|
<DocumentsTableActionDropdown
|
||||||
|
row={row.original}
|
||||||
|
onMoveDocument={onMoveDocument ? () => onMoveDocument(row.original.id) : undefined}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
] satisfies DataTableColumnDef<DocumentsTableRow>[];
|
] satisfies DataTableColumnDef<DocumentsTableRow>[];
|
||||||
}, [team]);
|
}, [team, onMoveDocument, _, i18n]);
|
||||||
|
|
||||||
const onPaginationChange = (page: number, perPage: number) => {
|
const onPaginationChange = (page: number, perPage: number) => {
|
||||||
startTransition(() => {
|
startTransition(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user