mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
Merge branch 'main' into 404
This commit is contained in:
@ -17,5 +17,3 @@ Documenso aims to be the world's most trusted document signing tool. This trust
|
|||||||
- Set DATABASE_URL and SENDGRID_API_KEY values in .env file
|
- Set DATABASE_URL and SENDGRID_API_KEY values in .env file
|
||||||
- Run <code>npm run dev</code> root directory to start
|
- Run <code>npm run dev</code> root directory to start
|
||||||
- Register a new user at http://localhost:3000/signup
|
- Register a new user at http://localhost:3000/signup
|
||||||
|
|
||||||
test
|
|
||||||
|
|||||||
@ -22,8 +22,6 @@ export default function Field(props: FieldPropsType) {
|
|||||||
props.field.position || { x: 0, y: -842 }
|
props.field.position || { x: 0, y: -842 }
|
||||||
);
|
);
|
||||||
const nodeRef = React.createRef<HTMLDivElement>();
|
const nodeRef = React.createRef<HTMLDivElement>();
|
||||||
console.log(props.field);
|
|
||||||
|
|
||||||
const onControlledDrag = (e: any, position: any) => {
|
const onControlledDrag = (e: any, position: any) => {
|
||||||
const { x, y } = position;
|
const { x, y } = position;
|
||||||
setPosition({ x, y });
|
setPosition({ x, y });
|
||||||
|
|||||||
19
apps/web/components/editor/pdf-editor.tsx
Normal file
19
apps/web/components/editor/pdf-editor.tsx
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { NEXT_PUBLIC_WEBAPP_URL } from "@documenso/lib/constants";
|
||||||
|
import { useRouter } from "next/router";
|
||||||
|
import dynamic from "next/dynamic";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
const PDFViewer = dynamic(() => import("./pdf-viewer"), {
|
||||||
|
ssr: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default function PDFEditor(props: any) {
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PDFViewer
|
||||||
|
document={props.document}
|
||||||
|
pdfUrl={`${NEXT_PUBLIC_WEBAPP_URL}/api/documents/${router.query.id}`}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import { Fragment, useState } from "react";
|
import { Fragment, useState } from "react";
|
||||||
import { Document, Page } from "react-pdf/dist/esm/entry.webpack5";
|
import { Document, Page } from "react-pdf/dist/esm/entry.webpack5";
|
||||||
import Field from "./editor/field";
|
import Field from "./field";
|
||||||
import short from "short-uuid";
|
import short from "short-uuid";
|
||||||
import { Button } from "@documenso/ui";
|
import { Button } from "@documenso/ui";
|
||||||
const stc = require("string-to-color");
|
const stc = require("string-to-color");
|
||||||
10
apps/web/pages/500.jsx
Normal file
10
apps/web/pages/500.jsx
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import Link from "next/link";
|
||||||
|
|
||||||
|
export default function FiveUhOh() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<h1>500 - Something went wrong.</h1>
|
||||||
|
<Link href="/">Go back home</Link>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -16,10 +16,7 @@ import { getDocument } from "@documenso/lib/query";
|
|||||||
import { Document as PrismaDocument } from "@prisma/client";
|
import { Document as PrismaDocument } from "@prisma/client";
|
||||||
import { Button, Breadcrumb } from "@documenso/ui";
|
import { Button, Breadcrumb } from "@documenso/ui";
|
||||||
import short from "short-uuid";
|
import short from "short-uuid";
|
||||||
|
import PDFEditor from "../../../components/editor/pdf-editor";
|
||||||
const PDFViewer = dynamic(() => import("../../../components/pdf-viewer"), {
|
|
||||||
ssr: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
const DocumentsDetailPage: NextPageWithLayout = (props: any) => {
|
const DocumentsDetailPage: NextPageWithLayout = (props: any) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@ -94,10 +91,7 @@ const DocumentsDetailPage: NextPageWithLayout = (props: any) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="mx-auto w-fit">
|
<div className="mx-auto w-fit">
|
||||||
<PDFViewer
|
<PDFEditor document={props.document} />
|
||||||
document={props.document}
|
|
||||||
pdfUrl={`${NEXT_PUBLIC_WEBAPP_URL}/api/documents/${router.query.id}`}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -131,6 +125,12 @@ export async function getServerSideProps(context: any) {
|
|||||||
// todo optimize querys
|
// todo optimize querys
|
||||||
// todo no intersection groups
|
// todo no intersection groups
|
||||||
|
|
||||||
|
if (!document) {
|
||||||
|
return {
|
||||||
|
notFound: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
document: document,
|
document: document,
|
||||||
|
|||||||
@ -2,8 +2,7 @@ import toast from "react-hot-toast";
|
|||||||
|
|
||||||
export const updateUser = async (user: any) => {
|
export const updateUser = async (user: any) => {
|
||||||
if (!user) return;
|
if (!user) return;
|
||||||
toast
|
toast.promise(
|
||||||
.promise(
|
|
||||||
fetch("/api/users", {
|
fetch("/api/users", {
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
headers: {
|
headers: {
|
||||||
@ -16,8 +15,5 @@ export const updateUser = async (user: any) => {
|
|||||||
success: `Saved!`,
|
success: `Saved!`,
|
||||||
error: "Changes could not save user :/",
|
error: "Changes could not save user :/",
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
.then(() => {
|
|
||||||
// location.reload();
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -12,7 +12,7 @@ export const getDocument = async (
|
|||||||
if (!documentId) Promise.reject("No documentId");
|
if (!documentId) Promise.reject("No documentId");
|
||||||
if (!req || !res) Promise.reject("No res or req");
|
if (!req || !res) Promise.reject("No res or req");
|
||||||
|
|
||||||
const document: PrismaDocument = await prisma.document.findFirstOrThrow({
|
const document: PrismaDocument = await prisma.document.findFirst({
|
||||||
where: {
|
where: {
|
||||||
id: documentId,
|
id: documentId,
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
|
|||||||
@ -35,6 +35,7 @@ export function Button(props: any) {
|
|||||||
) : (
|
) : (
|
||||||
<button
|
<button
|
||||||
id={props.id}
|
id={props.id}
|
||||||
|
type="button"
|
||||||
className={classNames(
|
className={classNames(
|
||||||
baseStyles,
|
baseStyles,
|
||||||
color === "primary" ? primaryStyles : secondaryStyles,
|
color === "primary" ? primaryStyles : secondaryStyles,
|
||||||
|
|||||||
Reference in New Issue
Block a user