Skip to content

The Open Source DocuSign Alternative.

🧹🚧DOC-97 DOC-19

Timur Ercan2176511ef766
diff --git a/apps/web/components/editor/editable-field.tsx b/apps/web/components/editor/editable-field.tsx
index b6ef8ad71..b78e442da 100644
--- a/apps/web/components/editor/editable-field.tsx
+++ b/apps/web/components/editor/editable-field.tsx
@@ -1,10 +1,7 @@
-import { ResizableBox, ResizeCallbackData } from "react-resizable";
-import React, { SyntheticEvent, useEffect, useState } from "react";
+import React, { useState } from "react";
import Draggable from "react-draggable";
-import { CircleStackIcon, TrashIcon } from "@heroicons/react/24/solid";
import Logo from "../logo";
import { IconButton } from "@documenso/ui";
-import toast from "react-hot-toast";
import { XCircleIcon } from "@heroicons/react/20/solid";
const stc = require("string-to-color");
@@ -20,6 +17,7 @@ type FieldPropsType = {
};
onPositionChanged: any;
onDelete: any;
+ hidden: boolean;
};
export default function EditableField(props: FieldPropsType) {
@@ -52,6 +50,7 @@ export default function EditableField(props: FieldPropsType) {
cancel="strong"
>
<div
+ hidden={props.hidden}
ref={nodeRef}
className="cursor-move opacity-80 p-2 m-auto w-auto flex-row-reverse text-lg font-bold text-center absolute top-0 left-0 select-none"
style={{
diff --git a/apps/web/components/editor/pdf-editor.tsx b/apps/web/components/editor/pdf-editor.tsx
index 57f5ea72b..22392e78f 100644
--- a/apps/web/components/editor/pdf-editor.tsx
+++ b/apps/web/components/editor/pdf-editor.tsx
@@ -37,7 +37,6 @@ export default function PDFEditor(props: any) {
function onDeleteHandler(id: any) {
const field = fields.find((e) => e.id == id);
const fieldIndex = fields.map((item) => item.id).indexOf(id);
- console.log(fieldIndex);
if (fieldIndex > -1) {
const fieldWithoutRemoved = [...fields];
const removedField = fieldWithoutRemoved.splice(fieldIndex, 1);
diff --git a/apps/web/components/editor/pdf-viewer.jsx b/apps/web/components/editor/pdf-viewer.jsx
index c68bd161f..39bbf6de4 100644
--- a/apps/web/components/editor/pdf-viewer.jsx
+++ b/apps/web/components/editor/pdf-viewer.jsx
@@ -71,6 +71,7 @@ export default function PDFViewer(props) {
></ReadOnlyField>
) : (
<EditableField
+ hidden={item.Signature}
key={item.id}
field={item}
className="absolute"
diff --git a/apps/web/pages/documents.tsx b/apps/web/pages/documents.tsx
index db608d055..d1ebbfe46 100644
--- a/apps/web/pages/documents.tsx
+++ b/apps/web/pages/documents.tsx
@@ -7,18 +7,14 @@ import {
CheckIcon,
DocumentPlusIcon,
EnvelopeIcon,
- EyeIcon,
PlusIcon,
- SunIcon,
TrashIcon,
} from "@heroicons/react/24/outline";
-import Link from "next/link";
import { useRouter } from "next/router";
import { uploadDocument } from "@documenso/features";
import { DocumentStatus } from "@prisma/client";
import { Tooltip as ReactTooltip } from "react-tooltip";
-import { getDocumentsForUserFromToken } from "@documenso/lib/query";
-import { Button } from "@documenso/ui";
+import { Button, IconButton } from "@documenso/ui";
const DocumentsPage: NextPageWithLayout = (props: any) => {
const router = useRouter();
@@ -44,7 +40,7 @@ const DocumentsPage: NextPageWithLayout = (props: any) => {
}, []);
function showDocument(documentId: number) {
- router.push(`/documents/${documentId}`);
+ router.push(`/documents/${documentId}/recipients`);
}
return (
@@ -227,11 +223,11 @@ const DocumentsPage: NextPageWithLayout = (props: any) => {
</p>
</td>
<td className="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
- <Link href={"/documents/" + document.id}>
- <TrashIcon
+ <div>
+ <IconButton
+ icon={TrashIcon}
className="flex-shrink-0 -ml-1 mr-3 h-6 w-6 inline text-neon"
- aria-hidden="true"
- onClick={(event) => {
+ onClick={(event: any) => {
event.preventDefault();
event.stopPropagation();
if (
@@ -259,9 +255,9 @@ const DocumentsPage: NextPageWithLayout = (props: any) => {
});
}
}}
- />
+ ></IconButton>
<span className="sr-only">, {document.name}</span>
- </Link>
+ </div>
</td>
</tr>
))}
diff --git a/apps/web/pages/documents/[id]/index.tsx b/apps/web/pages/documents/[id]/index.tsx
index d28fed69d..c0c6ca213 100644
--- a/apps/web/pages/documents/[id]/index.tsx
+++ b/apps/web/pages/documents/[id]/index.tsx
@@ -9,7 +9,6 @@ import { DocumentStatus } from "@prisma/client";
import {
InformationCircleIcon,
PaperAirplaneIcon,
- UserPlusIcon,
UsersIcon,
} from "@heroicons/react/24/outline";
import { getDocument } from "@documenso/lib/query";
@@ -126,7 +125,7 @@ export async function getServerSideProps(context: any) {
return {
props: {
- document: document,
+ document: JSON.parse(JSON.stringify(document)),
},
};
} catch (error) {
diff --git a/apps/web/pages/documents/[id]/recipients.tsx b/apps/web/pages/documents/[id]/recipients.tsx
index 72eda2377..e12f351cb 100644
--- a/apps/web/pages/documents/[id]/recipients.tsx
+++ b/apps/web/pages/documents/[id]/recipients.tsx
@@ -69,7 +69,7 @@ const RecipientsPage: NextPageWithLayout = (props: any) => {
className="mr-2"
href={breadcrumbItems[1].href}
>
- Customize Document
+ Edit Document
</Button>
<Button
className="min-w-[125px]"
@@ -431,7 +431,7 @@ export async function getServerSideProps(context: any) {
return {
props: {
- document: document,
+ document: JSON.parse(JSON.stringify(document)),
},
};
}
diff --git a/packages/lib/query/getDocument.ts b/packages/lib/query/getDocument.ts
index e75e89d0d..9e61ae8ea 100644
--- a/packages/lib/query/getDocument.ts
+++ b/packages/lib/query/getDocument.ts
@@ -19,7 +19,7 @@ export const getDocument = async (
},
include: {
Recipient: true,
- Field: { include: { Recipient: true } },
+ Field: { include: { Recipient: true, Signature: true } },
},
});