Add types to Dialog component

This commit is contained in:
Ephraim Atta-Duncan
2023-03-28 12:55:20 +00:00
parent a9befd342c
commit b3e89b16bc
2 changed files with 27 additions and 2 deletions

View File

@ -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 }[];
}; };

View File

@ -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;