Skip to content

Free & Open-Source Invoice Generator - No Sign-Up, No Ads, Instant PDF Export, 100% In-Browser, and Fully Customizable Templates.

improvement: update QR code images and enhance invoice template visuals (#172)

Vlad Sazonau0192d6252883
diff --git a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-default-template-Desktop-Chrome-darwin.png b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-default-template-Desktop-Chrome-darwin.png
index 9ac230d..d97143a 100644
Binary files a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-default-template-Desktop-Chrome-darwin.png and b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-default-template-Desktop-Chrome-darwin.png differ
diff --git a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-default-template-Mobile-Chrome-darwin.png b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-default-template-Mobile-Chrome-darwin.png
index 02cd2a8..8cf85ca 100644
Binary files a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-default-template-Mobile-Chrome-darwin.png and b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-default-template-Mobile-Chrome-darwin.png differ
diff --git a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-default-template-Mobile-Safari-darwin.png b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-default-template-Mobile-Safari-darwin.png
index 08b8df7..6005bc0 100644
Binary files a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-default-template-Mobile-Safari-darwin.png and b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-default-template-Mobile-Safari-darwin.png differ
diff --git a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts
index 32883c2..488b2ab 100644
--- a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts
+++ b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts
@@ -1099,7 +1099,7 @@ test.describe("Stripe Invoice Template", () => {
// navigate back to the previous page
await page.goto("/", { waitUntil: "commit" });
- // verify that we are on the default template
+ // verify that we are on the STRIPE template
await expect(page).toHaveURL("/?template=stripe");
const newFinalSection = page.getByTestId("final-section");
@@ -1124,14 +1124,14 @@ test.describe("Stripe Invoice Template", () => {
// verify that the switch is off
await expect(newShowQrCodeSwitch).not.toBeChecked();
- // Verify QR Code Data field is empty after toggling off
+ // Verify QR Code Data field retains its value after toggling off
const newQrCodeDataTextarea = newQrCodeFieldset.getByRole("textbox", {
name: "Data",
});
await expect(newQrCodeDataTextarea).toBeVisible();
await expect(newQrCodeDataTextarea).toHaveValue(QR_CODE_TEST_DATA.data);
- // Verify QR Code Description field is empty after toggling off
+ // Verify QR Code Description field retains its value after toggling off
const newQrCodeDescriptionTextarea = newQrCodeFieldset.getByRole(
"textbox",
{
diff --git a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-stripe-template-Desktop-Chrome-darwin.png b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-stripe-template-Desktop-Chrome-darwin.png
index 25257b7..11f3df7 100644
Binary files a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-stripe-template-Desktop-Chrome-darwin.png and b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-stripe-template-Desktop-Chrome-darwin.png differ
diff --git a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-stripe-template-Mobile-Chrome-darwin.png b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-stripe-template-Mobile-Chrome-darwin.png
index 6b704a1..6fedaa2 100644
Binary files a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-stripe-template-Mobile-Chrome-darwin.png and b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-stripe-template-Mobile-Chrome-darwin.png differ
diff --git a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-stripe-template-Mobile-Safari-darwin.png b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-stripe-template-Mobile-Safari-darwin.png
index 2e61621..58cc3a8 100644
Binary files a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-stripe-template-Mobile-Safari-darwin.png and b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/displays-qr-code-in-pdf-stripe-template-Mobile-Safari-darwin.png differ
diff --git a/src/actions/fetch-github-stars.ts b/src/actions/fetch-github-stars.ts
index deacdd4..13fd5ba 100644
--- a/src/actions/fetch-github-stars.ts
+++ b/src/actions/fetch-github-stars.ts
@@ -3,6 +3,7 @@
import { env } from "@/env";
import { cache } from "react";
+import * as Sentry from "@sentry/nextjs";
/**
* Fetches the current star count for the GitHub repository.
@@ -24,6 +25,12 @@ export const fetchGithubStars = cache(async (): Promise<number> => {
);
if (!res.ok) {
+ Sentry.captureException(
+ new Error(
+ `[fetchGithubStars] Failed to fetch GitHub stars, status: ${res?.status ?? "Unknown status"}`,
+ ),
+ );
+
return 0;
}
@@ -31,7 +38,10 @@ export const fetchGithubStars = cache(async (): Promise<number> => {
return data?.stargazers_count || 0;
} catch (error) {
- console.error("Failed to fetch GitHub stars:", error);
+ console.error("[fetchGithubStars] Failed to fetch GitHub stars:", error);
+
+ Sentry.captureException(error);
+
return 0;
}
});
diff --git a/src/app/(app)/components/index.tsx b/src/app/(app)/components/index.tsx
index f4d3271..c009af7 100644
--- a/src/app/(app)/components/index.tsx
+++ b/src/app/(app)/components/index.tsx
@@ -266,7 +266,7 @@ export function InvoiceClientPage({
/>
</div>
{invoiceLastUpdatedAtFormatted && (
- <div className="relative mt-2 text-center text-xs text-slate-700 duration-500 animate-in fade-in slide-in-from-bottom-2">
+ <div className="relative mt-2 text-center text-xs text-zinc-700 duration-500 animate-in fade-in slide-in-from-bottom-2">
<span className="font-semibold">Invoice last updated:</span>{" "}
{invoiceLastUpdatedAtFormatted}
</div>
@@ -312,7 +312,7 @@ export function InvoiceClientPage({
</div>
<div className="relative col-span-8 h-[620px] w-full max-w-full 2xl:h-[700px]">
{invoiceLastUpdatedAtFormatted && (
- <div className="absolute -top-5 right-0 text-center text-xs text-slate-700 duration-500 animate-in fade-in slide-in-from-bottom-2 md:-mb-5 lg:text-right">
+ <div className="absolute -top-5 right-0 text-center text-xs text-zinc-700 duration-500 animate-in fade-in slide-in-from-bottom-2 md:-mb-5 lg:text-right">
<span className="font-semibold">Invoice last updated:</span>{" "}
{invoiceLastUpdatedAtFormatted}
</div>
diff --git a/src/app/(app)/components/invoice-templates/common/invoice-qr-code.tsx b/src/app/(app)/components/invoice-templates/common/invoice-qr-code.tsx
index c3d08e6..9083247 100644
--- a/src/app/(app)/components/invoice-templates/common/invoice-qr-code.tsx
+++ b/src/app/(app)/components/invoice-templates/common/invoice-qr-code.tsx
@@ -21,7 +21,7 @@ export function InvoiceQRCode({
minPresenceAhead={30}
>
{/* eslint-disable-next-line jsx-a11y/alt-text */}
- <Image src={qrCodeDataUrl} style={{ width: 100, height: 100 }} />
+ <Image src={qrCodeDataUrl} style={{ width: 120, height: 120 }} />
{description ? (
<Text
style={{
diff --git a/src/app/(app)/page.client.tsx b/src/app/(app)/page.client.tsx
index 3708794..cc07bd7 100644
--- a/src/app/(app)/page.client.tsx
+++ b/src/app/(app)/page.client.tsx
@@ -323,7 +323,6 @@ export function AppPageClient({
}
}, [loadFromLocalStorage, router, searchParams]);
- // IMPORTANT: πŸ”₯πŸ”₯πŸ”₯ DOUBLE check if below useEffect works as expected πŸ”₯πŸ”₯πŸ”₯
/**
* Ensures the template query parameter is present in the URL (for better user experience)
* If missing, adds it based on the current invoice data state.
@@ -588,6 +587,11 @@ export function AppPageClient({
...current,
invoiceSharedCount: (current?.invoiceSharedCount ?? 0) + 1,
}));
+
+ // show CTA toast after x seconds (after invoice link notification is shown)
+ setTimeout(() => {
+ showRandomCTAToast();
+ }, 5_500);
})
.catch((err) => {
console.error(
@@ -595,16 +599,20 @@ export function AppPageClient({
err,
);
- // dismiss all other toasts
+ // dismiss all other toasts for better UX
toast.dismiss();
- toast.error("Failed to share invoice", {
- id: "failed-to-share-invoice-error-toast",
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
- description: `Please try again. Error: ${err?.message || "Unknown error"}`,
- position: isMobile ? "top-center" : "bottom-right",
- duration: 5_000,
- });
+ // Only show error if it's not an abort error (user cancelled the share)
+ if (err instanceof Error && err?.name !== "AbortError") {
+ toast.error("Failed to share invoice", {
+ id: "failed-to-share-invoice-error-toast",
+ description: `Please try again or copy the link manually from the address bar`,
+ position: isMobile ? "top-center" : "bottom-right",
+ duration: 5_000,
+ });
+
+ Sentry.captureException(err);
+ }
});
} catch (shareError) {
console.error(
@@ -638,17 +646,17 @@ export function AppPageClient({
...current,
invoiceSharedCount: (current?.invoiceSharedCount ?? 0) + 1,
}));
+
+ // show CTA toast after x seconds (after invoice link notification is shown)
+ setTimeout(() => {
+ showRandomCTAToast();
+ }, 5_500);
})
.catch((err) => {
Sentry.captureException(err);
});
}
- // show CTA toast after x seconds (after invoice link notification is shown)
- setTimeout(() => {
- showRandomCTAToast();
- }, 5_000);
-
markCTAActionTriggered();
} catch (error) {
console.error("Failed to share invoice:", error);
diff --git a/src/app/(app)/utils/generate-qr-code-data-url.ts b/src/app/(app)/utils/generate-qr-code-data-url.ts
index 5e30fa2..09b2caf 100644
--- a/src/app/(app)/utils/generate-qr-code-data-url.ts
+++ b/src/app/(app)/utils/generate-qr-code-data-url.ts
@@ -14,8 +14,8 @@ export async function generateQrCodeDataUrl(data: string): Promise<string> {
try {
const dataUrl = await QRCode.toDataURL(data, {
errorCorrectionLevel: "M",
- margin: 1,
- width: 200, // Generate at 2x resolution for crisp rendering at 80-100px
+ margin: 2,
+ width: 200, // Generate at 2x resolution for crisp rendering
color: {
dark: "#000000",
light: "#ffffff",
diff --git a/src/app/schema/index.ts b/src/app/schema/index.ts
index 9091d5d..a0700c9 100644
--- a/src/app/schema/index.ts
+++ b/src/app/schema/index.ts
@@ -954,7 +954,7 @@ export const invoiceSchema = z.object({
*/
qrCodeData: z
.string()
- .max(2000, "QR code data must not exceed 2000 characters")
+ .max(500, "QR code data must not exceed 500 characters")
.trim()
.optional()
.default(""),