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 redirectToFolder =
user && document.userId === user.id && document.folderId && document.team?.url;
const homePath = redirectToFolder
? `/t/${document.team.url}/documents/f/${document.folderId}`
: '/';
return {
isDocumentAccessValid: true,
canSignUp,
@ -92,6 +99,7 @@ export async function loader({ params, request }: Route.LoaderArgs) {
signatures,
document,
recipient,
homePath,
};
}
@ -109,6 +117,7 @@ export default function CompletedSigningPage({ loaderData }: Route.ComponentProp
document,
recipient,
recipientEmail,
homePath,
} = loaderData;
if (!isDocumentAccessValid) {
@ -226,7 +235,7 @@ export default function CompletedSigningPage({ loaderData }: Route.ComponentProp
{user && (
<Button asChild>
<Link to="/">
<Link to={homePath}>
<Trans>Go Back Home</Trans>
</Link>
</Button>

View File

@ -103,6 +103,7 @@ export const getDocumentAndSenderByToken = async ({
select: {
name: true,
teamEmail: true,
url: true,
teamGlobalSettings: {
select: {
brandingEnabled: true,

View File

@ -127,7 +127,7 @@ export const DocumentShareButton = ({
<Button
variant="outline"
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}
>
{!isLoading && <Sparkles className="mr-2 h-5 w-5" />}