From c23f4d81ec918ed9b41235fe5c4391fd61b92ecb Mon Sep 17 00:00:00 2001 From: Pontus Abrahamsson Date: Thu, 7 Nov 2024 17:49:31 +0100 Subject: [PATCH 1/2] Initial data --- .../src/components/invoice/customer-details.tsx | 3 +++ .../src/components/invoice/from-details.tsx | 5 ++++- .../src/components/invoice/note-details.tsx | 5 ++++- .../src/components/invoice/payment-details.tsx | 5 ++++- packages/invoice/src/templates/pdf/index.tsx | 16 ---------------- packages/ui/src/components/editor/index.tsx | 6 ------ 6 files changed, 15 insertions(+), 25 deletions(-) diff --git a/apps/dashboard/src/components/invoice/customer-details.tsx b/apps/dashboard/src/components/invoice/customer-details.tsx index 8a4c2b72f2..3d9d56052b 100644 --- a/apps/dashboard/src/components/invoice/customer-details.tsx +++ b/apps/dashboard/src/components/invoice/customer-details.tsx @@ -36,6 +36,7 @@ export function CustomerDetails({ customers }: CustomerDetailsProps) { const updateInvoiceTemplate = useAction(updateInvoiceTemplateAction); const content = watch("customer_details"); + const id = watch("id"); const handleLabelSave = (value: string) => { updateInvoiceTemplate.execute({ customer_label: value }); @@ -87,6 +88,8 @@ export function CustomerDetails({ customers }: CustomerDetailsProps) { control={control} render={({ field }) => ( ( { diff --git a/apps/dashboard/src/components/invoice/note-details.tsx b/apps/dashboard/src/components/invoice/note-details.tsx index 2f9acf24be..5f5f70cde5 100644 --- a/apps/dashboard/src/components/invoice/note-details.tsx +++ b/apps/dashboard/src/components/invoice/note-details.tsx @@ -7,7 +7,8 @@ import { Controller, useFormContext } from "react-hook-form"; import { LabelInput } from "./label-input"; export function NoteDetails() { - const { control } = useFormContext(); + const { control, watch } = useFormContext(); + const id = watch("id"); const updateInvoiceTemplate = useAction(updateInvoiceTemplateAction); @@ -29,6 +30,8 @@ export function NoteDetails() { render={({ field }) => { return ( ( { diff --git a/packages/invoice/src/templates/pdf/index.tsx b/packages/invoice/src/templates/pdf/index.tsx index 51bd2f85da..69a179d34f 100644 --- a/packages/invoice/src/templates/pdf/index.tsx +++ b/packages/invoice/src/templates/pdf/index.tsx @@ -1,4 +1,3 @@ -// import { getCdnUrl } from "@midday/utils/envs"; import { Document, Image, Page, Text, View } from "@react-pdf/renderer"; import QRCodeUtil from "qrcode"; import type { TemplateProps } from "../types"; @@ -10,20 +9,6 @@ import { PaymentDetails } from "./components/payment-details"; import { QRCode } from "./components/qr-code"; import { Summary } from "./components/summary"; -// Font.register({ -// family: "GeistMono", -// fonts: [ -// { -// src: `${getCdnUrl()}/fonts/GeistMono/ttf/GeistMono-Regular.ttf`, -// fontWeight: 400, -// }, -// { -// src: `${getCdnUrl()}/fonts/GeistMono/ttf/GeistMono-Medium.ttf`, -// fontWeight: 500, -// }, -// ], -// }); - export async function PdfTemplate({ invoice_number, issue_date, @@ -59,7 +44,6 @@ export async function PdfTemplate({ style={{ padding: 20, backgroundColor: "#fff", - // fontFamily: "GeistMono", color: "#000", }} > diff --git a/packages/ui/src/components/editor/index.tsx b/packages/ui/src/components/editor/index.tsx index 56a00d15a7..1b6b804f2a 100644 --- a/packages/ui/src/components/editor/index.tsx +++ b/packages/ui/src/components/editor/index.tsx @@ -40,12 +40,6 @@ export function Editor({ }, }); - useEffect(() => { - if (initialContent) { - editor?.commands.setContent(initialContent); - } - }, []); - if (!editor) return null; return ( From e693642877e4d9b54d26108227204e1e0fffc0cf Mon Sep 17 00:00:00 2001 From: Pontus Abrahamsson Date: Thu, 7 Nov 2024 17:59:11 +0100 Subject: [PATCH 2/2] Fix note and payment info --- apps/dashboard/src/components/invoice/customer-details.tsx | 3 --- apps/dashboard/src/components/invoice/from-details.tsx | 5 +---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/apps/dashboard/src/components/invoice/customer-details.tsx b/apps/dashboard/src/components/invoice/customer-details.tsx index 3d9d56052b..8a4c2b72f2 100644 --- a/apps/dashboard/src/components/invoice/customer-details.tsx +++ b/apps/dashboard/src/components/invoice/customer-details.tsx @@ -36,7 +36,6 @@ export function CustomerDetails({ customers }: CustomerDetailsProps) { const updateInvoiceTemplate = useAction(updateInvoiceTemplateAction); const content = watch("customer_details"); - const id = watch("id"); const handleLabelSave = (value: string) => { updateInvoiceTemplate.execute({ customer_label: value }); @@ -88,8 +87,6 @@ export function CustomerDetails({ customers }: CustomerDetailsProps) { control={control} render={({ field }) => ( ( {