mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 16:23:06 +10:00
Add types to Dialog component
This commit is contained in:
@ -22,7 +22,7 @@ import { createOrUpdateRecipient, deleteRecipient, sendSigningRequests } from "@
|
|||||||
|
|
||||||
import { FormProvider, useFieldArray, useForm, useWatch } from "react-hook-form";
|
import { FormProvider, useFieldArray, useForm, useWatch } from "react-hook-form";
|
||||||
|
|
||||||
type FormValues = {
|
export type FormValues = {
|
||||||
signers: { id: number; email: string; name: string }[];
|
signers: { id: number; email: string; name: string }[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -3,8 +3,33 @@ import { Transition, Dialog as DialogComponent } from "@headlessui/react";
|
|||||||
import { Fragment } from "react";
|
import { Fragment } from "react";
|
||||||
import { Button } from "@documenso/ui";
|
import { Button } from "@documenso/ui";
|
||||||
import { sendSigningRequests } from "@documenso/lib/api";
|
import { sendSigningRequests } from "@documenso/lib/api";
|
||||||
|
import { Document as PrismaDocument } from "@prisma/client";
|
||||||
|
|
||||||
export function Dialog({ title, open, setOpen, document, formValues, setLoading, icon }: any) {
|
type FormValue = {
|
||||||
|
id: number;
|
||||||
|
email: string;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type DialogProps = {
|
||||||
|
title: string;
|
||||||
|
open: boolean;
|
||||||
|
setOpen: (open: boolean) => void;
|
||||||
|
document: PrismaDocument;
|
||||||
|
formValues: FormValue[];
|
||||||
|
setLoading: (loading: boolean) => void;
|
||||||
|
icon: React.ReactNode;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function Dialog({
|
||||||
|
title,
|
||||||
|
open,
|
||||||
|
setOpen,
|
||||||
|
document,
|
||||||
|
formValues,
|
||||||
|
setLoading,
|
||||||
|
icon,
|
||||||
|
}: DialogProps) {
|
||||||
const unsentEmailsLength = formValues.filter(
|
const unsentEmailsLength = formValues.filter(
|
||||||
(s: any) => s.email && s.sendStatus != "SENT"
|
(s: any) => s.email && s.sendStatus != "SENT"
|
||||||
).length;
|
).length;
|
||||||
|
|||||||
Reference in New Issue
Block a user