mirror of
https://github.com/documenso/documenso.git
synced 2025-11-20 19:51:32 +10:00
refactor: improve layout of completed signing page (#2209)
This commit is contained in:
@ -84,6 +84,13 @@ export async function loader({ params, request }: Route.LoaderArgs) {
|
|||||||
|
|
||||||
const canSignUp = !isExistingUser && env('NEXT_PUBLIC_DISABLE_SIGNUP') !== 'true';
|
const canSignUp = !isExistingUser && env('NEXT_PUBLIC_DISABLE_SIGNUP') !== 'true';
|
||||||
|
|
||||||
|
const canRedirectToFolder =
|
||||||
|
user && document.userId === user.id && document.folderId && document.team?.url;
|
||||||
|
|
||||||
|
const returnToHomePath = canRedirectToFolder
|
||||||
|
? `/t/${document.team.url}/documents/f/${document.folderId}`
|
||||||
|
: '/';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isDocumentAccessValid: true,
|
isDocumentAccessValid: true,
|
||||||
canSignUp,
|
canSignUp,
|
||||||
@ -92,6 +99,7 @@ export async function loader({ params, request }: Route.LoaderArgs) {
|
|||||||
signatures,
|
signatures,
|
||||||
document,
|
document,
|
||||||
recipient,
|
recipient,
|
||||||
|
returnToHomePath,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,6 +117,7 @@ export default function CompletedSigningPage({ loaderData }: Route.ComponentProp
|
|||||||
document,
|
document,
|
||||||
recipient,
|
recipient,
|
||||||
recipientEmail,
|
recipientEmail,
|
||||||
|
returnToHomePath,
|
||||||
} = loaderData;
|
} = loaderData;
|
||||||
|
|
||||||
if (!isDocumentAccessValid) {
|
if (!isDocumentAccessValid) {
|
||||||
@ -118,7 +127,7 @@ export default function CompletedSigningPage({ loaderData }: Route.ComponentProp
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
'-mx-4 flex flex-col items-center overflow-hidden px-4 pt-24 md:-mx-8 md:px-8 lg:pt-36 xl:pt-44',
|
'-mx-4 flex flex-col items-center overflow-hidden px-4 pt-16 md:-mx-8 md:px-8 lg:pt-20 xl:pt-28',
|
||||||
{ 'pt-0 lg:pt-0 xl:pt-0': canSignUp },
|
{ 'pt-0 lg:pt-0 xl:pt-0': canSignUp },
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
@ -202,8 +211,12 @@ export default function CompletedSigningPage({ loaderData }: Route.ComponentProp
|
|||||||
</p>
|
</p>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
<div className="mt-8 flex w-full max-w-sm items-center justify-center gap-4">
|
<div className="mt-8 flex w-full max-w-xs flex-col items-stretch gap-4 md:w-auto md:max-w-none md:flex-row md:items-center">
|
||||||
<DocumentShareButton documentId={document.id} token={recipient.token} />
|
<DocumentShareButton
|
||||||
|
documentId={document.id}
|
||||||
|
token={recipient.token}
|
||||||
|
className="w-full max-w-none md:flex-1"
|
||||||
|
/>
|
||||||
|
|
||||||
{isDocumentCompleted(document.status) && (
|
{isDocumentCompleted(document.status) && (
|
||||||
<EnvelopeDownloadDialog
|
<EnvelopeDownloadDialog
|
||||||
@ -212,13 +225,21 @@ export default function CompletedSigningPage({ loaderData }: Route.ComponentProp
|
|||||||
envelopeItems={document.envelopeItems}
|
envelopeItems={document.envelopeItems}
|
||||||
token={recipient?.token}
|
token={recipient?.token}
|
||||||
trigger={
|
trigger={
|
||||||
<Button type="button" variant="outline" className="flex-1">
|
<Button type="button" variant="outline" className="flex-1 md:flex-initial">
|
||||||
<DownloadIcon className="mr-2 h-5 w-5" />
|
<DownloadIcon className="mr-2 h-5 w-5" />
|
||||||
<Trans>Download</Trans>
|
<Trans>Download</Trans>
|
||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{user && (
|
||||||
|
<Button asChild>
|
||||||
|
<Link to={returnToHomePath}>
|
||||||
|
<Trans>Go Back Home</Trans>
|
||||||
|
</Link>
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -238,12 +259,6 @@ export default function CompletedSigningPage({ loaderData }: Route.ComponentProp
|
|||||||
<ClaimAccount defaultName={recipientName} defaultEmail={recipient.email} />
|
<ClaimAccount defaultName={recipientName} defaultEmail={recipient.email} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{user && (
|
|
||||||
<Link to="/" className="text-documenso-700 hover:text-documenso-600 mt-2">
|
|
||||||
<Trans>Go Back Home</Trans>
|
|
||||||
</Link>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -103,6 +103,7 @@ export const getDocumentAndSenderByToken = async ({
|
|||||||
select: {
|
select: {
|
||||||
name: true,
|
name: true,
|
||||||
teamEmail: true,
|
teamEmail: true,
|
||||||
|
url: true,
|
||||||
teamGlobalSettings: {
|
teamGlobalSettings: {
|
||||||
select: {
|
select: {
|
||||||
brandingEnabled: true,
|
brandingEnabled: true,
|
||||||
|
|||||||
@ -127,11 +127,11 @@ export const DocumentShareButton = ({
|
|||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
disabled={!token || !documentId}
|
disabled={!token || !documentId}
|
||||||
className={cn('flex-1 text-[11px]', className)}
|
className={cn('h-11 w-full max-w-lg flex-1', className)}
|
||||||
loading={isLoading}
|
loading={isLoading}
|
||||||
>
|
>
|
||||||
{!isLoading && <Sparkles className="mr-2 h-5 w-5" />}
|
{!isLoading && <Sparkles className="mr-2 h-5 w-5" />}
|
||||||
<Trans>Share Signature Card</Trans>
|
<Trans>Share</Trans>
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
|
|||||||
Reference in New Issue
Block a user