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 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>
|
||||||
|
|||||||
@ -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,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" />}
|
||||||
|
|||||||
Reference in New Issue
Block a user