Free & Open-Source Invoice Generator - No Sign-Up, No Ads, Instant PDF Export, 100% In-Browser, and Fully Customizable Templates.
TypeScript fintechinvoiceinvoice-generatorinvoice-pdfinvoice-templateinvoicesnextjsopen-sourcequotesreactreact-pdf-rendererself-hostedshadcn-uitailwindcsstypescript
refactor: update layout and improve accessibility in invoice-related components (#192)
Vlad Sazonau46a7fc83e218
diff --git a/src/app/(app)/components/invoice-form/sections/general-information.tsx b/src/app/(app)/components/invoice-form/sections/general-information.tsxindex 108145a..f3a157f 100644--- a/src/app/(app)/components/invoice-form/sections/general-information.tsx+++ b/src/app/(app)/components/invoice-form/sections/general-information.tsx@@ -676,7 +676,7 @@ export const GeneralInformation = memo(function GeneralInformation({)}</div>{/* Logo Upload */}- <div className="duration-500 animate-in fade-in slide-in-from-bottom-2">+ <div className=""><Label htmlFor="logoUpload" className="mb-2">Company Logo (Optional)</Label>@@ -738,7 +738,7 @@ export const GeneralInformation = memo(function GeneralInformation({{/* Pay Online URL - Only for Stripe template */}{template === "stripe" && (- <div className="duration-500 animate-in fade-in slide-in-from-bottom-2">+ <div className=""><Label htmlFor={`stripePayOnlineUrl`} className="">Payment Link URL (Optional)</Label>diff --git a/src/components/buyer-dialog.tsx b/src/components/buyer-dialog.tsxindex 9889999..bee5dba 100644--- a/src/components/buyer-dialog.tsx+++ b/src/components/buyer-dialog.tsx@@ -221,24 +221,25 @@ export function BuyerDialog({<div className="overflow-y-auto px-6 py-4">{/* Add Use Current Form Values switch */}{!isEditMode && (- <div className="mb-4 flex items-center gap-2">- <Switch- checked={shouldApplyFormValues}- onCheckedChange={setShouldApplyFormValues}- id="apply-form-values-switch"- />- <CustomTooltip- trigger={- <Label- htmlFor="apply-form-values-switch"- className="cursor-pointer"- >- Pre-fill with values from the current invoice form- </Label>- }- content="Use the buyer details already entered in the invoice form to pre-fill this dialog"- className="z-[1000]"- />+ <div className="mb-4">+ <div className="flex items-center gap-2">+ <Switch+ checked={shouldApplyFormValues}+ onCheckedChange={setShouldApplyFormValues}+ id="apply-form-values-switch"+ />+ <Label+ htmlFor="apply-form-values-switch"+ className="cursor-pointer"+ >+ Pre-fill with values from the current invoice form+ </Label>+ </div>+ <span className="mt-1.5 inline-block text-xs text-slate-500">+ When enabled, this will automatically fill in the buyer details+ dialog with the information you've already entered in your+ current invoice form.+ </span></div>)}@@ -389,7 +390,7 @@ export function BuyerDialog({{/* Notes */}<div className="space-y-4">- <div className="flex items-end justify-between">+ <div className="flex flex-col gap-4"><FormFieldcontrol={form.control}name="notes"@@ -410,7 +411,7 @@ export function BuyerDialog({/>{/* Show Notes Field in PDF */}- <div className="ml-4 flex items-center gap-2">+ <div className="flex items-center gap-2"><FormFieldcontrol={form.control}name="notesFieldIsVisible"@@ -429,7 +430,7 @@ export function BuyerDialog({<CustomTooltiptrigger={<Label htmlFor="notes-field-visibility">- Show in PDF+ Show Buyer Notes in PDF</Label>}content="Show the notes field in the PDF"@@ -447,24 +448,25 @@ export function BuyerDialog({{/* Apply to Current Invoice switch remains at bottom */}{!isEditMode && (- <div className="mt-4 flex items-center gap-2 border-t pt-4">- <Switch- checked={shouldApplyNewBuyerToInvoice}- onCheckedChange={setShouldApplyNewBuyerToInvoice}- id="apply-buyer-to-current-invoice-switch"- />- <CustomTooltip- trigger={- <Label- htmlFor="apply-buyer-to-current-invoice-switch"- className="cursor-pointer"- >- Apply to Current Invoice- </Label>- }- content="When enabled, the newly created buyer will be automatically applied to your current invoice form"- className="z-[1000]"- />+ <div className="mt-4 flex flex-col gap-1 border-t pt-4">+ <div className="flex items-center gap-2">+ <Switch+ checked={shouldApplyNewBuyerToInvoice}+ onCheckedChange={setShouldApplyNewBuyerToInvoice}+ id="apply-buyer-to-current-invoice-switch"+ />+ <Label+ htmlFor="apply-buyer-to-current-invoice-switch"+ className="cursor-pointer"+ >+ Apply to Current Invoice+ </Label>+ </div>+ <span className="mt-1.5 text-xs text-slate-500">+ When enabled, the newly created buyer will be automatically+ applied to your current invoice form and reflected in the+ generated PDF.+ </span></div>)}</div>diff --git a/src/components/buyer-management.tsx b/src/components/buyer-management.tsxindex c48bc27..f47867b 100644--- a/src/components/buyer-management.tsx+++ b/src/components/buyer-management.tsx@@ -335,7 +335,7 @@ export function BuyerManagement({className={cn(!isLocalStorageAvailable && "bg-red-50")}trigger={<Button- variant="outline"+ variant="default"size="sm"onClick={() => {if (isLocalStorageAvailable) {diff --git a/src/components/seller-dialog.tsx b/src/components/seller-dialog.tsxindex ac11eb8..4eac528 100644--- a/src/components/seller-dialog.tsx+++ b/src/components/seller-dialog.tsx@@ -229,24 +229,25 @@ export function SellerDialog({<div className="overflow-y-auto px-6 py-4">{/* Show Use Current Form Values switch only when creating new seller */}{!isEditMode && (- <div className="mb-4 flex items-center gap-2">- <Switch- checked={shouldApplyFormValues}- onCheckedChange={setShouldApplyFormValues}- id="apply-form-values-switch"- />- <CustomTooltip- trigger={- <Label- htmlFor="apply-form-values-switch"- className="cursor-pointer"- >- Pre-fill with values from the current invoice form- </Label>- }- content="Use the seller details already entered in the invoice form to pre-fill this dialog"- className="z-[1000]"- />+ <div className="mb-4">+ <div className="flex items-center gap-2">+ <Switch+ checked={shouldApplyFormValues}+ onCheckedChange={setShouldApplyFormValues}+ id="apply-form-values-switch"+ />+ <Label+ htmlFor="apply-form-values-switch"+ className="cursor-pointer"+ >+ Pre-fill with values from the current invoice form+ </Label>+ </div>+ <span className="mt-1.5 inline-block text-xs text-slate-500">+ When enabled, this will automatically fill in the seller details+ dialog with the information you've already entered in your+ current invoice form.+ </span></div>)}@@ -395,7 +396,7 @@ export function SellerDialog({{/* Account Number */}<div className="space-y-4">- <div className="flex items-end justify-between">+ <div className="flex flex-col gap-4"><FormFieldcontrol={form.control}name="accountNumber"@@ -414,7 +415,7 @@ export function SellerDialog({)}/>- <div className="ml-4 flex items-center gap-2">+ <div className="flex items-center gap-2"><FormFieldcontrol={form.control}name="accountNumberFieldIsVisible"@@ -430,7 +431,7 @@ export function SellerDialog({<CustomTooltiptrigger={<Label htmlFor="accountNumberFieldIsVisible">- Show in PDF+ Show Seller Account Number in PDF</Label>}content='Show the "Account Number" field in the PDF'@@ -444,7 +445,7 @@ export function SellerDialog({</div>{/* SWIFT/BIC */}- <div className="flex items-end justify-between">+ <div className="flex flex-col gap-4"><FormFieldcontrol={form.control}name="swiftBic"@@ -464,7 +465,7 @@ export function SellerDialog({/>{/* Show SWIFT/BIC Field in PDF */}- <div className="ml-4 flex items-center gap-2">+ <div className="flex items-center gap-2"><FormFieldcontrol={form.control}name="swiftBicFieldIsVisible"@@ -480,7 +481,7 @@ export function SellerDialog({<CustomTooltiptrigger={<Label htmlFor="swiftBicFieldIsVisible">- Show in PDF+ Show Seller SWIFT/BIC in PDF</Label>}content='Show the "SWIFT/BIC" field in the PDF'@@ -496,7 +497,7 @@ export function SellerDialog({{/* Notes */}<div className="space-y-4">- <div className="flex items-end justify-between">+ <div className="flex flex-col gap-4"><FormFieldcontrol={form.control}name="notes"@@ -517,7 +518,7 @@ export function SellerDialog({/>{/* Show Notes Field in PDF */}- <div className="ml-4 flex items-center gap-2">+ <div className="flex items-center gap-2"><FormFieldcontrol={form.control}name="notesFieldIsVisible"@@ -536,7 +537,7 @@ export function SellerDialog({<CustomTooltiptrigger={<Label htmlFor="notes-field-visibility">- Show in PDF+ Show Seller Notes in PDF</Label>}content="Show the notes field in the PDF"@@ -554,24 +555,25 @@ export function SellerDialog({{/* Apply to Current Invoice switch remains at the bottom */}{!isEditMode && (- <div className="mt-4 flex items-center gap-2 border-t pt-4">- <Switch- checked={shouldApplyNewSellerToInvoice}- onCheckedChange={setShouldApplyNewSellerToInvoice}- id="apply-seller-to-current-invoice-switch"- />- <CustomTooltip- trigger={- <Label- htmlFor="apply-seller-to-current-invoice-switch"- className="cursor-pointer"- >- Apply to Current Invoice- </Label>- }- content="When enabled, the newly created seller will be automatically applied to your current invoice form"- className="z-[1000]"- />+ <div className="mt-4 flex flex-col gap-1 border-t pt-4">+ <div className="flex items-center gap-2">+ <Switch+ checked={shouldApplyNewSellerToInvoice}+ onCheckedChange={setShouldApplyNewSellerToInvoice}+ id="apply-seller-to-current-invoice-switch"+ />+ <Label+ htmlFor="apply-seller-to-current-invoice-switch"+ className="cursor-pointer"+ >+ Apply to Current Invoice+ </Label>+ </div>+ <span className="mt-1.5 text-xs text-slate-500">+ When enabled, the newly created seller will be automatically+ applied to your current invoice form and reflected in the+ generated PDF.+ </span></div>)}</div>diff --git a/src/components/seller-management.tsx b/src/components/seller-management.tsxindex 95940c5..842a138 100644--- a/src/components/seller-management.tsx+++ b/src/components/seller-management.tsx@@ -351,7 +351,7 @@ export function SellerManagement({className={cn(!isLocalStorageAvailable && "bg-red-50")}trigger={<Button- variant="outline"+ variant="default"size="sm"onClick={() => {if (isLocalStorageAvailable) {