mirror of
https://github.com/documenso/documenso.git
synced 2025-11-10 04:22:32 +10:00
Compare commits
2 Commits
v1.13.2
...
feat/updat
| Author | SHA1 | Date | |
|---|---|---|---|
| dc035ed08c | |||
| fb2fd17ad8 |
@ -2,10 +2,8 @@
|
|||||||
|
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
|
|
||||||
import Image from 'next/image';
|
|
||||||
import { usePathname } from 'next/navigation';
|
import { usePathname } from 'next/navigation';
|
||||||
|
|
||||||
import launchWeekTwoImage from '@documenso/assets/images/background-lw-2.png';
|
|
||||||
import { useFeatureFlags } from '@documenso/lib/client-only/providers/feature-flag';
|
import { useFeatureFlags } from '@documenso/lib/client-only/providers/feature-flag';
|
||||||
import { NEXT_PUBLIC_WEBAPP_URL } from '@documenso/lib/constants/app';
|
import { NEXT_PUBLIC_WEBAPP_URL } from '@documenso/lib/constants/app';
|
||||||
import { cn } from '@documenso/ui/lib/utils';
|
import { cn } from '@documenso/ui/lib/utils';
|
||||||
@ -48,16 +46,8 @@ export default function MarketingLayout({ children }: MarketingLayoutProps) {
|
|||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{showProfilesAnnouncementBar && (
|
{showProfilesAnnouncementBar && (
|
||||||
<div className="relative inline-flex w-full items-center justify-center overflow-hidden px-4 py-2.5">
|
<div className="relative inline-flex w-full items-center justify-center overflow-hidden bg-[#e7f3df] px-4 py-2.5">
|
||||||
<div className="absolute inset-0 -z-[1]">
|
<div className="text-foreground text-center text-sm font-medium">
|
||||||
<Image
|
|
||||||
src={launchWeekTwoImage}
|
|
||||||
className="h-full w-full object-cover"
|
|
||||||
alt="Launch Week 2"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="text-background text-center text-sm text-white">
|
|
||||||
Claim your documenso public profile username now!{' '}
|
Claim your documenso public profile username now!{' '}
|
||||||
<span className="hidden font-semibold md:inline">documenso.com/u/yourname</span>
|
<span className="hidden font-semibold md:inline">documenso.com/u/yourname</span>
|
||||||
<div className="mt-1.5 block md:ml-4 md:mt-0 md:inline-block">
|
<div className="mt-1.5 block md:ml-4 md:mt-0 md:inline-block">
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import React, { useId, useMemo, useState } from 'react';
|
|||||||
import { zodResolver } from '@hookform/resolvers/zod';
|
import { zodResolver } from '@hookform/resolvers/zod';
|
||||||
import { motion } from 'framer-motion';
|
import { motion } from 'framer-motion';
|
||||||
import { InfoIcon, Plus, Trash } from 'lucide-react';
|
import { InfoIcon, Plus, Trash } from 'lucide-react';
|
||||||
|
import { useSession } from 'next-auth/react';
|
||||||
import { useFieldArray, useForm } from 'react-hook-form';
|
import { useFieldArray, useForm } from 'react-hook-form';
|
||||||
|
|
||||||
import { useLimits } from '@documenso/ee/server-only/limits/provider/client';
|
import { useLimits } from '@documenso/ee/server-only/limits/provider/client';
|
||||||
@ -60,6 +61,9 @@ export const AddSignersFormPartial = ({
|
|||||||
}: AddSignersFormProps) => {
|
}: AddSignersFormProps) => {
|
||||||
const { toast } = useToast();
|
const { toast } = useToast();
|
||||||
const { remaining } = useLimits();
|
const { remaining } = useLimits();
|
||||||
|
const { data: session } = useSession();
|
||||||
|
const user = session?.user;
|
||||||
|
const [selfSignerFormId, setSelfSignerFormId] = useState<string | undefined>(undefined);
|
||||||
|
|
||||||
const initialId = useId();
|
const initialId = useId();
|
||||||
|
|
||||||
@ -135,6 +139,20 @@ export const AddSignersFormPartial = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onAddSelfSigner = () => {
|
||||||
|
const newSelfSignerId = nanoid(12);
|
||||||
|
|
||||||
|
appendSigner({
|
||||||
|
formId: newSelfSignerId,
|
||||||
|
name: user?.name ?? '',
|
||||||
|
email: user?.email ?? '',
|
||||||
|
role: RecipientRole.SIGNER,
|
||||||
|
actionAuth: undefined,
|
||||||
|
});
|
||||||
|
|
||||||
|
setSelfSignerFormId(newSelfSignerId);
|
||||||
|
};
|
||||||
|
|
||||||
const onAddSigner = () => {
|
const onAddSigner = () => {
|
||||||
appendSigner({
|
appendSigner({
|
||||||
formId: nanoid(12),
|
formId: nanoid(12),
|
||||||
@ -158,6 +176,10 @@ export const AddSignersFormPartial = ({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (signer.formId === selfSignerFormId) {
|
||||||
|
setSelfSignerFormId(undefined);
|
||||||
|
}
|
||||||
|
|
||||||
removeSigner(index);
|
removeSigner(index);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -209,8 +231,13 @@ export const AddSignersFormPartial = ({
|
|||||||
<Input
|
<Input
|
||||||
type="email"
|
type="email"
|
||||||
placeholder="Email"
|
placeholder="Email"
|
||||||
disabled={isSubmitting || hasBeenSentToRecipientId(signer.nativeId)}
|
|
||||||
{...field}
|
{...field}
|
||||||
|
disabled={
|
||||||
|
isSubmitting ||
|
||||||
|
hasBeenSentToRecipientId(signer.nativeId) ||
|
||||||
|
signer.formId === selfSignerFormId ||
|
||||||
|
signers[index].email === user?.email
|
||||||
|
}
|
||||||
onKeyDown={onKeyDown}
|
onKeyDown={onKeyDown}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -237,8 +264,13 @@ export const AddSignersFormPartial = ({
|
|||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
placeholder="Name"
|
placeholder="Name"
|
||||||
disabled={isSubmitting || hasBeenSentToRecipientId(signer.nativeId)}
|
|
||||||
{...field}
|
{...field}
|
||||||
|
disabled={
|
||||||
|
isSubmitting ||
|
||||||
|
hasBeenSentToRecipientId(signer.nativeId) ||
|
||||||
|
signer.formId === selfSignerFormId ||
|
||||||
|
signers[index].email === user?.email
|
||||||
|
}
|
||||||
onKeyDown={onKeyDown}
|
onKeyDown={onKeyDown}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -258,7 +290,12 @@ export const AddSignersFormPartial = ({
|
|||||||
<Select
|
<Select
|
||||||
{...field}
|
{...field}
|
||||||
onValueChange={field.onChange}
|
onValueChange={field.onChange}
|
||||||
disabled={isSubmitting || hasBeenSentToRecipientId(signer.nativeId)}
|
disabled={
|
||||||
|
isSubmitting ||
|
||||||
|
hasBeenSentToRecipientId(signer.nativeId) ||
|
||||||
|
signer.formId === selfSignerFormId ||
|
||||||
|
signers[index].email === user?.email
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<SelectTrigger className="bg-background text-muted-foreground">
|
<SelectTrigger className="bg-background text-muted-foreground">
|
||||||
<SelectValue placeholder="Inherit authentication method" />
|
<SelectValue placeholder="Inherit authentication method" />
|
||||||
@ -330,7 +367,12 @@ export const AddSignersFormPartial = ({
|
|||||||
<Select
|
<Select
|
||||||
{...field}
|
{...field}
|
||||||
onValueChange={field.onChange}
|
onValueChange={field.onChange}
|
||||||
disabled={isSubmitting || hasBeenSentToRecipientId(signer.nativeId)}
|
disabled={
|
||||||
|
isSubmitting ||
|
||||||
|
hasBeenSentToRecipientId(signer.nativeId) ||
|
||||||
|
signer.formId === selfSignerFormId ||
|
||||||
|
signers[index].email === user?.email
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<SelectTrigger className="bg-background w-[60px]">
|
<SelectTrigger className="bg-background w-[60px]">
|
||||||
{/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions */}
|
{/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions */}
|
||||||
@ -403,12 +445,28 @@ export const AddSignersFormPartial = ({
|
|||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
className="flex-1"
|
||||||
disabled={isSubmitting || signers.length >= remaining.recipients}
|
disabled={isSubmitting || signers.length >= remaining.recipients}
|
||||||
onClick={() => onAddSigner()}
|
onClick={() => onAddSigner()}
|
||||||
>
|
>
|
||||||
<Plus className="-ml-1 mr-2 h-5 w-5" />
|
<Plus className="-ml-1 mr-2 h-5 w-5" />
|
||||||
Add Signer
|
Add Signer
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="secondary"
|
||||||
|
className="dark:bg-muted dark:hover:bg-muted/80 bg-black/5 hover:bg-black/10"
|
||||||
|
disabled={
|
||||||
|
isSubmitting ||
|
||||||
|
signers.length >= remaining.recipients ||
|
||||||
|
!!selfSignerFormId ||
|
||||||
|
signers.some((signer) => signer.email === user?.email)
|
||||||
|
}
|
||||||
|
onClick={() => onAddSelfSigner()}
|
||||||
|
>
|
||||||
|
<Plus className="-ml-1 mr-2 h-5 w-5" />
|
||||||
|
Add myself
|
||||||
|
</Button>
|
||||||
|
|
||||||
{!alwaysShowAdvancedSettings && isDocumentEnterprise && (
|
{!alwaysShowAdvancedSettings && isDocumentEnterprise && (
|
||||||
<div className="flex flex-row items-center">
|
<div className="flex flex-row items-center">
|
||||||
|
|||||||
Reference in New Issue
Block a user