mirror of
https://github.com/documenso/documenso.git
synced 2025-11-20 03:32:14 +10:00
feat: update completed signing page to redirect to folder when possible
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 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>
|
||||
|
||||
@ -103,6 +103,7 @@ export const getDocumentAndSenderByToken = async ({
|
||||
select: {
|
||||
name: true,
|
||||
teamEmail: true,
|
||||
url: true,
|
||||
teamGlobalSettings: {
|
||||
select: {
|
||||
brandingEnabled: true,
|
||||
|
||||
@ -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" />}
|
||||
|
||||
Reference in New Issue
Block a user