import { useSession } from "next-auth/react"; import Head from "next/head"; import { ReactElement, useEffect, useState } from "react"; import Layout from "../components/layout"; import Settings from "../components/settings"; import Link from "next/link"; import type { NextPageWithLayout } from "./_app"; import { BellSnoozeIcon, CheckBadgeIcon, EnvelopeIcon, EyeIcon, SunIcon, XCircleIcon, } from "@heroicons/react/24/outline"; import { FormProvider, useForm } from "react-hook-form"; import Router from "next/router"; import { NEXT_PUBLIC_WEBAPP_URL } from "@documenso/lib"; type FormValues = { document: File; }; const DashboardPage: NextPageWithLayout = () => { const stats = [ { name: "Draft", stat: "0", icon: SunIcon, link: "/documents?filter=", }, { name: "Sent", stat: "0", icon: EnvelopeIcon, link: "/documents?filter=", }, { name: "Viewed", stat: "0", icon: EyeIcon, link: "/documents?filter=", }, { name: "Signed", stat: "0", icon: CheckBadgeIcon, link: "/documents?filter=", }, { name: "Expired", stat: "0", icon: BellSnoozeIcon, link: "/documents?filter=", }, { name: "Declined", stat: "0", icon: XCircleIcon, link: "/documents?filter=", }, ]; const uploadToServer = async (event: any) => { if (event.target.files && event.target.files[0]) { const body = new FormData(); const document = event.target.files[0]; body.append("document", document || ""); const response: any = await fetch("/api/documents", { method: "POST", body, }).then((response: any) => { Router.push( `${NEXT_PUBLIC_WEBAPP_URL}/documents/${ response.json().creadtedDocumentId }` ); }); } }; return ( <>