feat: update completed signing page to redirect to folder when possible

This commit is contained in:
Catalin Pit
2025-11-19 13:30:18 +02:00
parent d4e259a9a7
commit 0705228609
3 changed files with 12 additions and 2 deletions

View File

@ -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 redirectToFolder =
user && document.userId === user.id && document.folderId && document.team?.url;
const homePath = redirectToFolder
? `/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,
homePath,
}; };
} }
@ -109,6 +117,7 @@ export default function CompletedSigningPage({ loaderData }: Route.ComponentProp
document, document,
recipient, recipient,
recipientEmail, recipientEmail,
homePath,
} = loaderData; } = loaderData;
if (!isDocumentAccessValid) { if (!isDocumentAccessValid) {
@ -226,7 +235,7 @@ export default function CompletedSigningPage({ loaderData }: Route.ComponentProp
{user && ( {user && (
<Button asChild> <Button asChild>
<Link to="/"> <Link to={homePath}>
<Trans>Go Back Home</Trans> <Trans>Go Back Home</Trans>
</Link> </Link>
</Button> </Button>

View File

@ -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,

View File

@ -127,7 +127,7 @@ export const DocumentShareButton = ({
<Button <Button
variant="outline" variant="outline"
disabled={!token || !documentId} disabled={!token || !documentId}
className={cn('w-full max-w-lg 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" />}