Compare commits

...
Author SHA1 Message Date
Catalin Pit 2bc44cf479 fix: keep the fix in the UI 2026-09-21 10:13:42 +03:00
Catalin Pit 3d37d93aa0 fix: use envelope title for single-item document downloads 2026-09-17 15:55:15 +03:00
13 changed files with 25 additions and 4 deletions
@@ -36,6 +36,12 @@ type EnvelopeDownloadDialogProps = {
isLegacy?: boolean;
envelopeItems?: EnvelopeItemToDownload[];
/**
* Used as the display/download name for single-item envelopes, since item titles
* are never updated when the envelope is renamed.
*/
envelopeTitle: string;
/**
* The recipient token to download the document.
*
@@ -50,6 +56,7 @@ export const EnvelopeDownloadDialog = ({
envelopeStatus,
isLegacy,
envelopeItems: initialEnvelopeItems,
envelopeTitle,
token,
trigger,
}: EnvelopeDownloadDialogProps) => {
@@ -104,6 +111,8 @@ export const EnvelopeDownloadDialog = ({
const envelopeItems = envelopeItemsPayload?.data || [];
const getItemTitle = (item: EnvelopeItemToDownload) => (envelopeItems.length === 1 ? envelopeTitle : item.title);
const onDownload = async (envelopeItem: EnvelopeItemToDownload, version: 'original' | 'signed' | 'pending') => {
const { id: envelopeItemId } = envelopeItem;
@@ -120,7 +129,7 @@ export const EnvelopeDownloadDialog = ({
await downloadPDF({
envelopeItem,
token,
fileName: envelopeItem.title,
fileName: getItemTitle(envelopeItem),
version,
});
@@ -186,8 +195,8 @@ export const EnvelopeDownloadDialog = ({
<div className="min-w-0 flex-1">
{/* Todo: Envelopes - Fix overflow */}
<h4 className="truncate font-medium text-foreground text-sm" title={item.title}>
{item.title}
<h4 className="truncate font-medium text-foreground text-sm" title={getItemTitle(item)}>
{getItemTitle(item)}
</h4>
<p className="mt-0.5 text-muted-foreground text-xs">
<Trans>PDF Document</Trans>
@@ -171,7 +171,7 @@ export const EnvelopesBulkDownloadDialog = ({
const { filename, blob } = await fetchPDF({
envelopeItem,
token: undefined,
fileName: envelopeItem.title,
fileName: envelopeItems.length === 1 ? envelope.title : envelopeItem.title,
version: downloadVersion,
});
@@ -184,6 +184,7 @@ export const DocumentSigningPageViewV2 = () => {
envelopeId={envelope.id}
envelopeStatus={envelope.status}
envelopeItems={envelope.envelopeItems}
envelopeTitle={envelope.title}
token={recipient.token}
trigger={
<Button variant="ghost" size="sm" className="w-full justify-start">
@@ -135,6 +135,7 @@ export const DocumentCertificateQRView = ({
envelopeId={envelopeItems[0].envelopeId}
envelopeStatus={DocumentStatus.COMPLETED}
envelopeItems={envelopeItems}
envelopeTitle={title}
token={token}
trigger={
<Button type="button" variant="outline" className="w-fit">
@@ -195,6 +196,7 @@ const DocumentCertificateQrV2 = ({ title, recipientCount, formattedDate, token }
envelopeId={envelopeItems[0].envelopeId}
envelopeStatus={DocumentStatus.COMPLETED}
envelopeItems={envelopeItems}
envelopeTitle={title}
token={token}
trigger={
<Button type="button" variant="outline" className="w-fit">
@@ -73,6 +73,7 @@ export const DocumentPageViewButton = ({ envelope }: DocumentPageViewButtonProps
envelopeId={envelope.id}
envelopeStatus={envelope.status}
envelopeItems={envelope.envelopeItems}
envelopeTitle={envelope.title}
token={recipient?.token}
trigger={
<Button className="w-full">
@@ -101,6 +101,7 @@ export const DocumentPageViewDropdown = ({ envelope }: DocumentPageViewDropdownP
isLegacy={envelope.internalVersion === 1}
token={canManageDocument ? undefined : recipient?.token}
envelopeItems={envelope.envelopeItems}
envelopeTitle={envelope.title}
trigger={
<DropdownMenuItem asChild onSelect={(e) => e.preventDefault()}>
<div>
@@ -440,6 +440,7 @@ export const EnvelopeEditor = () => {
envelopeStatus={envelope.status}
isLegacy={envelope.internalVersion === 1}
envelopeItems={envelope.envelopeItems}
envelopeTitle={envelope.title}
trigger={
<Button variant="ghost" size="sm" className="w-full justify-start" title={t(msg`Download PDF`)}>
<DownloadCloudIcon className="h-4 w-4" />
@@ -102,6 +102,7 @@ const MobileDropdownMenu = () => {
envelopeId={envelope.id}
envelopeStatus={envelope.status}
envelopeItems={envelope.envelopeItems}
envelopeTitle={envelope.title}
token={recipient.token}
trigger={
<DropdownMenuItem asChild onSelect={(e) => e.preventDefault()}>
@@ -99,6 +99,7 @@ export const DocumentsTableActionButton = ({ row }: DocumentsTableActionButtonPr
<EnvelopeDownloadDialog
envelopeId={row.envelopeId}
envelopeStatus={row.status}
envelopeTitle={row.title}
token={recipient?.token}
trigger={
<Button className="w-32">
@@ -154,6 +154,7 @@ export const DocumentsTableActionDropdown = ({ row, onMoveDocument }: DocumentsT
<EnvelopeDownloadDialog
envelopeId={row.envelopeId}
envelopeStatus={row.status}
envelopeTitle={row.title}
isLegacy={row.internalVersion === 1}
token={canManageDocument ? undefined : recipient?.token}
trigger={
@@ -248,6 +248,7 @@ export const InboxTableActionButton = ({ row }: InboxTableActionButtonProps) =>
<EnvelopeDownloadDialog
envelopeId={row.envelopeId}
envelopeStatus={row.status}
envelopeTitle={row.title}
token={recipient?.token}
trigger={
<Button className="w-32">
@@ -66,6 +66,7 @@ export const TemplatesTableActionDropdown = ({
<EnvelopeDownloadDialog
envelopeId={row.envelopeId}
envelopeStatus={DocumentStatus.DRAFT}
envelopeTitle={row.title}
trigger={
<DropdownMenuItem asChild onSelect={(e) => e.preventDefault()}>
<div>
@@ -260,6 +260,7 @@ export default function CompletedSigningPage({ loaderData }: Route.ComponentProp
envelopeId={document.envelopeId}
envelopeStatus={document.status}
envelopeItems={document.envelopeItems}
envelopeTitle={document.title}
token={recipient?.token}
trigger={
<Button type="button" variant="outline" className="flex-1 md:flex-initial">