Skip to content

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

feat: enhance contacts backup functionality and error tracking (#277)

Vlad Sazonau6f308b781b07
diff --git a/.gitignore b/.gitignore
index 4aa9350..171d9a6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -47,6 +47,8 @@ node_modules/
/playwright-output/
/playwright-test-downloads/
+.playwright-mcp
+
# oxlint / oxfmt
.oxlintcache
diff --git a/e2e/contacts-backup.test.ts b/e2e/contacts-backup.test.ts
index ebecf29..23cd260 100644
--- a/e2e/contacts-backup.test.ts
+++ b/e2e/contacts-backup.test.ts
@@ -93,7 +93,7 @@ test.describe("Sellers & buyers backup", () => {
const download = await downloadPromise;
expect(download.suggestedFilename()).toMatch(
- /^easyinvoicepdf-contacts-\d{4}-\d{2}-\d{2}\.json$/,
+ /^easyinvoicepdf-contacts-\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}\.json$/,
);
const backupPath = path.join(downloadDir, download.suggestedFilename());
diff --git a/src/app/(main)/(app)/components/invoice-form/sections/__tests__/general-information.test.tsx b/src/app/(main)/(app)/components/invoice-form/sections/__tests__/general-information.test.tsx
index ab36b96..91ce6df 100644
--- a/src/app/(main)/(app)/components/invoice-form/sections/__tests__/general-information.test.tsx
+++ b/src/app/(main)/(app)/components/invoice-form/sections/__tests__/general-information.test.tsx
@@ -246,6 +246,26 @@ describe("GeneralInformation date helper texts", () => {
expect(getPreserveNumberFormatSwitch()).not.toBeChecked();
});
+ it("says under the switch whether the format follows the language", async () => {
+ const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime });
+
+ renderGeneralInformation();
+
+ expect(
+ screen.getByText(
+ "By default, the number format follows the PDF language",
+ ),
+ ).toBeInTheDocument();
+
+ await user.click(getPreserveNumberFormatSwitch());
+
+ expect(
+ screen.getByText(
+ "The number format stays as it is when you switch the PDF language",
+ ),
+ ).toBeInTheDocument();
+ });
+
/**
* No `aria-label` overriding it, so what a screen reader announces is the text on
* screen -- which is what lets someone say "keep format when language changes" to a
diff --git a/src/app/(main)/(app)/components/invoice-form/sections/components/__tests__/contacts-backup-menu.test.tsx b/src/app/(main)/(app)/components/invoice-form/sections/components/__tests__/contacts-backup-menu.test.tsx
index 7df3a1f..c163eb6 100644
--- a/src/app/(main)/(app)/components/invoice-form/sections/components/__tests__/contacts-backup-menu.test.tsx
+++ b/src/app/(main)/(app)/components/invoice-form/sections/components/__tests__/contacts-backup-menu.test.tsx
@@ -9,6 +9,7 @@ import {
BUYERS_LOCAL_STORAGE_KEY,
SELLERS_LOCAL_STORAGE_KEY,
} from "@/app/schema";
+import { umamiTrackEvent } from "@/lib/umami-analytics-track-event";
import "@testing-library/jest-dom/vitest";
vi.mock("sonner", () => {
@@ -177,4 +178,36 @@ describe("ContactsBackupMenu import", () => {
expect(buyers[0]?.id).toBeTruthy();
expect(buyers[0]?.id).not.toBe(buyers[1]?.id);
});
+
+ it("tracks the preview and the import", async () => {
+ render(<ContactsBackupMenu isMobile={false} />);
+
+ await importBackup({
+ sellers: [{ name: "Acme", address: "1 Main St" }],
+ buyers: [{ name: "Globex" }],
+ });
+
+ const trackedEvents = vi.mocked(umamiTrackEvent).mock.calls;
+
+ expect(
+ trackedEvents.map(([eventName]) => {
+ return eventName;
+ }),
+ ).toEqual([
+ "contacts_backup_menu_opened",
+ "import_contacts_dialog_opened",
+ "import_contacts_file_picked",
+ "import_contacts_preview_shown",
+ "import_contacts_success",
+ ]);
+ expect(trackedEvents[3]?.[1]).toEqual({
+ data: {
+ sellersToAdd: 1,
+ buyersToAdd: 0,
+ alreadySaved: 0,
+ invalid: 1,
+ nameConflicts: 0,
+ },
+ });
+ });
});
diff --git a/src/app/(main)/(app)/components/invoice-form/sections/components/__tests__/import-contacts-dialog.test.tsx b/src/app/(main)/(app)/components/invoice-form/sections/components/__tests__/import-contacts-dialog.test.tsx
index 03dbfe7..f16f68a 100644
--- a/src/app/(main)/(app)/components/invoice-form/sections/components/__tests__/import-contacts-dialog.test.tsx
+++ b/src/app/(main)/(app)/components/invoice-form/sections/components/__tests__/import-contacts-dialog.test.tsx
@@ -101,6 +101,75 @@ describe("ImportContactsDialog preview", () => {
).toBeVisible();
});
+ it("lists every filled-in field of a new or saved entry in a collapsed row", () => {
+ const dialog = renderDialog({
+ step: "preview",
+ fileName: "backup.json",
+ sellers: emptyResult({
+ added: [
+ sellerSchema.parse({
+ name: "Acme",
+ address: "1 Main",
+ vatNo: "PL123",
+ vatNoLabelText: "Tax no",
+ email: "[email protected]",
+ accountNumber: "DE89 3704",
+ accountNumberFieldIsVisible: false,
+ }),
+ ],
+ }),
+ buyers: emptyResult({ duplicates: [GLOBEX] }),
+ });
+
+ const [acme, globex] = within(dialog).getAllByTestId(
+ "import-preview-entry",
+ );
+
+ expect(acme).not.toHaveAttribute("open");
+
+ expect(acme).toHaveTextContent("Tax noPL123");
+ expect(acme).toHaveTextContent("[email protected]");
+ expect(acme).toHaveTextContent(
+ "Account NumberDE89 3704(hidden on invoice)",
+ );
+ expect(acme).not.toHaveTextContent("SWIFT/BIC");
+
+ // A buyer has no bank fields, and empty optional fields are left out
+ expect(globex).toHaveTextContent("Name");
+ expect(globex).not.toHaveTextContent("Email");
+ });
+
+ it("lists both fields when the tax label matches another field's label", () => {
+ const consoleError = vi.spyOn(console, "error").mockImplementation(() => {
+ return undefined;
+ });
+
+ const dialog = renderDialog({
+ step: "preview",
+ fileName: "backup.json",
+ sellers: emptyResult({
+ added: [
+ sellerSchema.parse({
+ name: "Acme",
+ address: "1 Main",
+ vatNo: "PL123",
+ vatNoLabelText: "Email",
+ email: "[email protected]",
+ }),
+ ],
+ }),
+ buyers: emptyResult(),
+ });
+
+ const acme = within(dialog).getByTestId("import-preview-entry");
+
+ expect(acme).toHaveTextContent("EmailPL123");
+ expect(acme).toHaveTextContent("[email protected]");
+ expect(consoleError).not.toHaveBeenCalled();
+
+ consoleError.mockRestore();
+ });
+
it("shows the entry as written in the file with the failing field highlighted", () => {
const dialog = renderDialog({
step: "preview",
diff --git a/src/app/(main)/(app)/components/invoice-form/sections/components/contacts-backup-menu.tsx b/src/app/(main)/(app)/components/invoice-form/sections/components/contacts-backup-menu.tsx
index 4e20d82..b419873 100644
--- a/src/app/(main)/(app)/components/invoice-form/sections/components/contacts-backup-menu.tsx
+++ b/src/app/(main)/(app)/components/invoice-form/sections/components/contacts-backup-menu.tsx
@@ -114,6 +114,8 @@ export function ContactsBackupMenu({ isMobile }: ContactsBackupMenuProps) {
});
Sentry.captureException(error);
+
+ umamiTrackEvent("export_contacts_error");
}
};
@@ -122,12 +124,17 @@ export function ContactsBackupMenu({ isMobile }: ContactsBackupMenuProps) {
* saving anything: the dialog shows that for the user to confirm.
*/
const handleFileSelected = async (file: File) => {
- const showFileError = (error: string) => {
+ const showFileError = ({ error, reason }: ShowFileErrorOptions) => {
setImportState({ step: "error", fileName: file.name, error });
+
+ umamiTrackEvent("import_contacts_file_error", { data: { reason } });
};
if (file.size > MAX_CONTACTS_BACKUP_FILE_BYTES) {
- showFileError("This file is too large to be a backup.");
+ showFileError({
+ error: "This file is too large to be a backup.",
+ reason: "too_large",
+ });
return;
}
@@ -138,39 +145,57 @@ export function ContactsBackupMenu({ isMobile }: ContactsBackupMenuProps) {
const parsed = parseContactsBackup(await new Response(file).text());
if (!parsed.success) {
- showFileError(parsed.error);
+ showFileError({ error: parsed.error, reason: "invalid_backup" });
return;
}
- setImportState({
- step: "preview",
- fileName: file.name,
- sellers: mergeImportedContacts({
- existing: readSavedContacts({
- key: SELLERS_LOCAL_STORAGE_KEY,
- schema: sellerSchema,
- }),
- imported: parsed.sellers,
+ const sellers = mergeImportedContacts({
+ existing: readSavedContacts({
+ key: SELLERS_LOCAL_STORAGE_KEY,
schema: sellerSchema,
- createId: createContactId,
- contactNoun: "seller",
}),
- buyers: mergeImportedContacts({
- existing: readSavedContacts({
- key: BUYERS_LOCAL_STORAGE_KEY,
- schema: buyerSchema,
- }),
- imported: parsed.buyers,
+ imported: parsed.sellers,
+ schema: sellerSchema,
+ createId: createContactId,
+ contactNoun: "seller",
+ });
+
+ const buyers = mergeImportedContacts({
+ existing: readSavedContacts({
+ key: BUYERS_LOCAL_STORAGE_KEY,
schema: buyerSchema,
- createId: createContactId,
- contactNoun: "buyer",
}),
+ imported: parsed.buyers,
+ schema: buyerSchema,
+ createId: createContactId,
+ contactNoun: "buyer",
+ });
+
+ setImportState({
+ step: "preview",
+ fileName: file.name,
+ sellers,
+ buyers,
+ });
+
+ umamiTrackEvent("import_contacts_preview_shown", {
+ data: {
+ sellersToAdd: sellers.added.length,
+ buyersToAdd: buyers.added.length,
+ alreadySaved: sellers.duplicates.length + buyers.duplicates.length,
+ invalid: sellers.invalidEntries.length + buyers.invalidEntries.length,
+ nameConflicts:
+ sellers.nameConflicts.length + buyers.nameConflicts.length,
+ },
});
} catch (error) {
console.error("Failed to read sellers & buyers backup:", error);
- showFileError("Something went wrong while reading it. Please try again.");
+ showFileError({
+ error: "Something went wrong while reading it. Please try again.",
+ reason: "read_failed",
+ });
Sentry.captureException(error);
}
@@ -183,7 +208,12 @@ export function ContactsBackupMenu({ isMobile }: ContactsBackupMenuProps) {
const { sellers, buyers } = importState;
- const showImportError = (description: string) => {
+ const showImportError = ({
+ description,
+ reason,
+ }: ShowImportErrorOptions) => {
+ umamiTrackEvent("import_contacts_error", { data: { reason } });
+
toast.error("Could not import sellers & buyers", {
id: "import_contacts_error_toast",
description,
@@ -215,9 +245,11 @@ export function ContactsBackupMenu({ isMobile }: ContactsBackupMenuProps) {
});
}
- showImportError(
- "Your browser storage is full or unavailable. Nothing was imported.",
- );
+ showImportError({
+ description:
+ "Your browser storage is full or unavailable. Nothing was imported.",
+ reason: "storage_unavailable",
+ });
return;
}
@@ -250,7 +282,7 @@ export function ContactsBackupMenu({ isMobile }: ContactsBackupMenuProps) {
} catch (error) {
console.error("Failed to import sellers & buyers:", error);
- showImportError("Please try again");
+ showImportError({ description: "Please try again", reason: "unknown" });
Sentry.captureException(error);
}
@@ -269,6 +301,8 @@ export function ContactsBackupMenu({ isMobile }: ContactsBackupMenuProps) {
return;
}
+ umamiTrackEvent("contacts_backup_menu_opened");
+
// dismiss any existing toast for better UX
toast.dismiss();
@@ -309,6 +343,8 @@ export function ContactsBackupMenu({ isMobile }: ContactsBackupMenuProps) {
onSelect={() => {
setImportState({ step: "choose" });
setIsImportDialogOpen(true);
+
+ umamiTrackEvent("import_contacts_dialog_opened");
}}
>
<Upload className="size-3.5" />
@@ -319,7 +355,16 @@ export function ContactsBackupMenu({ isMobile }: ContactsBackupMenuProps) {
<ImportContactsDialog
isOpen={isImportDialogOpen}
- onOpenChange={setIsImportDialogOpen}
+ onOpenChange={(isOpen) => {
+ setIsImportDialogOpen(isOpen);
+
+ // A confirmed import closes the dialog itself, so this is only a dismissal
+ if (!isOpen) {
+ umamiTrackEvent("import_contacts_dialog_dismissed", {
+ data: { step: importState.step },
+ });
+ }
+ }}
state={importState}
onFileSelected={(file) => {
void handleFileSelected(file);
@@ -330,6 +375,20 @@ export function ContactsBackupMenu({ isMobile }: ContactsBackupMenuProps) {
);
}
+interface ShowFileErrorOptions {
+ /** A user-facing explanation of why the file cannot be imported. */
+ error: string;
+ /** Sent to analytics; the error text itself may hold parts of the file. */
+ reason: "too_large" | "invalid_backup" | "read_failed";
+}
+
+interface ShowImportErrorOptions {
+ /** The toast's description. */
+ description: string;
+ /** Sent to analytics. */
+ reason: "storage_unavailable" | "unknown";
+}
+
interface ReadSavedContactsOptions<T> {
/** The `localStorage` key holding the list. */
key: LocalStorageKey;
diff --git a/src/app/(main)/(app)/components/invoice-form/sections/components/import-contacts-dialog.tsx b/src/app/(main)/(app)/components/invoice-form/sections/components/import-contacts-dialog.tsx
index bdb39cb..1fbb8dc 100644
--- a/src/app/(main)/(app)/components/invoice-form/sections/components/import-contacts-dialog.tsx
+++ b/src/app/(main)/(app)/components/invoice-form/sections/components/import-contacts-dialog.tsx
@@ -18,6 +18,7 @@ import {
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
+import { umamiTrackEvent } from "@/lib/umami-analytics-track-event";
import { cn } from "@/lib/utils";
/** Longer values are cut short, so one long address does not push the problem off screen. */
@@ -137,6 +138,7 @@ export function ImportContactsDialog({
const file = event.dataTransfer?.files[0];
if (isChoosingFile && file) {
+ umamiTrackEvent("import_contacts_file_dropped");
handleDroppedFile(file);
}
};
@@ -469,11 +471,7 @@ function PartyPreview({ party, result }: PartyPreviewProps) {
>
{added.map((contact, index) => {
return (
- <PreviewRow
- key={`added-${index}`}
- name={contact.name}
- address={contact.address}
- >
+ <PreviewRow key={`added-${index}`} contact={contact}>
<StatusBadge tone="success">New</StatusBadge>
</PreviewRow>
);
@@ -502,12 +500,7 @@ function PartyPreview({ party, result }: PartyPreviewProps) {
})}
{duplicates.map((contact, index) => {
return (
- <PreviewRow
- key={`duplicate-${index}`}
- name={contact.name}
- address={contact.address}
- isMuted
- >
+ <PreviewRow key={`duplicate-${index}`} contact={contact} isMuted>
<StatusBadge tone="neutral">Already saved</StatusBadge>
</PreviewRow>
);
@@ -518,37 +511,92 @@ function PartyPreview({ party, result }: PartyPreviewProps) {
}
interface PreviewRowProps {
- name: string;
- /** Can span several lines, as typed in the address field. */
- address: string;
+ contact: SellerData | BuyerData;
/** For entries that will be skipped. */
isMuted?: boolean;
/** The status badge. */
children: React.ReactNode;
}
-function PreviewRow({
- name,
- address,
- isMuted = false,
- children,
-}: PreviewRowProps) {
+/**
+ * Collapsed to the name and address by default; expanding it lists every other field the
+ * entry has, so the user can check the details before importing.
+ */
+function PreviewRow({ contact, isMuted = false, children }: PreviewRowProps) {
return (
- <li
- className={cn(
- "flex items-start justify-between gap-2 px-3 py-2",
- isMuted && "text-slate-500",
- )}
- >
- <div className="min-w-0">
- <p className="truncate">{name}</p>
- <ContactAddress address={address} />
- </div>
- {children}
+ <li className={cn(isMuted && "text-slate-500")}>
+ <details
+ className="group"
+ data-testid="import-preview-entry"
+ onToggle={(event) => {
+ if (event.currentTarget.open) {
+ umamiTrackEvent("import_contacts_entry_expanded", {
+ data: { status: isMuted ? "already_saved" : "new" },
+ });
+ }
+ }}
+ >
+ <summary className="flex cursor-pointer list-none items-start justify-between gap-2 px-3 py-2 hover:bg-slate-50 [&::-webkit-details-marker]:hidden">
+ <div className="min-w-0">
+ <ContactName name={contact.name} />
+ <ContactAddress address={contact.address} />
+ </div>
+ <span className="flex shrink-0 items-center gap-1.5">
+ {children}
+ <ChevronDown
+ className="size-3.5 text-slate-500 transition-transform group-open:rotate-180"
+ aria-hidden
+ />
+ </span>
+ </summary>
+
+ <ContactFields contact={contact} />
+ </details>
</li>
);
}
+interface ContactFieldsProps {
+ contact: SellerData | BuyerData;
+}
+
+/** Every filled-in field of the entry, with the ones hidden on the invoice marked so. */
+function ContactFields({ contact }: ContactFieldsProps) {
+ const fields = getContactFields(contact);
+
+ return (
+ <dl className="space-y-1.5 border-t border-slate-200 bg-slate-50/60 px-3 py-2 text-xs">
+ {fields.map(({ field, label, value, isHidden }) => {
+ return (
+ <div
+ key={field}
+ className="grid grid-cols-[7rem_minmax(0,1fr)] gap-2"
+ >
+ <dt className="text-slate-500">{label}</dt>
+ <dd className="whitespace-pre-line break-words text-slate-700">
+ {value}
+ {isHidden ? (
+ <span className="ml-1.5 text-slate-400">
+ (hidden on invoice)
+ </span>
+ ) : null}
+ </dd>
+ </div>
+ );
+ })}
+ </dl>
+ );
+}
+
+interface ContactNameProps {
+ name: string;
+}
+
+/** Wraps rather than truncates, so a long name can be read in full. */
+function ContactName({ name }: ContactNameProps) {
+ return <p className="text-pretty break-words">{name}</p>;
+}
+
interface ContactAddressProps {
/** Can span several lines, as typed in the address field. */
address: string;
@@ -584,7 +632,7 @@ function ProblemRow({ invalidEntry, badge }: ProblemRowProps) {
<details open className="group" data-testid="import-problem-entry">
<summary className="flex cursor-pointer list-none items-start justify-between gap-2 px-3 py-2 hover:bg-slate-50 [&::-webkit-details-marker]:hidden">
<div className="min-w-0">
- <p className="truncate">{label}</p>
+ <ContactName name={label} />
{address ? <ContactAddress address={address} /> : null}
</div>
<span className="flex shrink-0 items-center gap-1.5">
@@ -668,6 +716,7 @@ function FilePickerLabel({
input.value = "";
if (file) {
+ umamiTrackEvent("import_contacts_file_picked");
onFileSelected(file);
}
}}
@@ -790,6 +839,83 @@ function EntryLine({ field, value, messages }: EntryLineProps) {
);
}
+interface ContactField {
+ /** The schema key, used as the React key: labels can repeat, as the tax label is user-set. */
+ field: keyof SellerData;
+ label: string;
+ value: string;
+ /** The entry has the value but does not show it on the invoice. */
+ isHidden: boolean;
+}
+
+function getContactFields(contact: SellerData | BuyerData): ContactField[] {
+ const fields: (ContactField | null)[] = [
+ { field: "name", label: "Name", value: contact.name, isHidden: false },
+ {
+ field: "address",
+ label: "Address",
+ value: contact.address,
+ isHidden: false,
+ },
+ optionalField({
+ field: "vatNo",
+ label: contact.vatNoLabelText,
+ value: contact.vatNo,
+ isVisible: contact.vatNoFieldIsVisible,
+ }),
+ optionalField({
+ field: "email",
+ label: "Email",
+ value: contact.email,
+ isVisible: contact.emailFieldIsVisible,
+ }),
+ "accountNumber" in contact
+ ? optionalField({
+ field: "accountNumber",
+ label: "Account Number",
+ value: contact.accountNumber,
+ isVisible: contact.accountNumberFieldIsVisible,
+ })
+ : null,
+ "swiftBic" in contact
+ ? optionalField({
+ field: "swiftBic",
+ label: "SWIFT/BIC",
+ value: contact.swiftBic,
+ isVisible: contact.swiftBicFieldIsVisible,
+ })
+ : null,
+ optionalField({
+ field: "notes",
+ label: "Notes",
+ value: contact.notes,
+ isVisible: contact.notesFieldIsVisible,
+ }),
+ ];
+
+ return fields.filter((field) => {
+ return field !== null;
+ });
+}
+
+interface OptionalFieldOptions {
+ field: ContactField["field"];
+ label: string;
+ /** Left out of the list when empty. */
+ value: string | undefined;
+ /** The entry's `…FieldIsVisible` flag for this field. */
+ isVisible: boolean;
+}
+
+function optionalField({
+ field,
+ label,
+ value,
+ isVisible,
+}: OptionalFieldOptions): ContactField | null {
+ return value ? { field, label, value, isHidden: !isVisible } : null;
+}
+
function formatValue(value: unknown): string {
const text = JSON.stringify(value) ?? String(value);
diff --git a/src/app/(main)/(app)/components/invoice-form/sections/general-information.tsx b/src/app/(main)/(app)/components/invoice-form/sections/general-information.tsx
index 4f09e20..99c98b2 100644
--- a/src/app/(main)/(app)/components/invoice-form/sections/general-information.tsx
+++ b/src/app/(main)/(app)/components/invoice-form/sections/general-information.tsx
@@ -602,7 +602,7 @@ export const GeneralInformation = memo(function GeneralInformation({
<ErrorMessage>{errors.numberFormatLocale.message}</ErrorMessage>
) : (
<InputHelperMessage>
- Select how amounts are grouped and punctuated in the PDF
+ Choose the number format used in the PDF
</InputHelperMessage>
)}
</div>
@@ -647,9 +647,14 @@ export const GeneralInformation = memo(function GeneralInformation({
Keep format when language changes
</Label>
}
- content="Keep the number format you picked when the invoice PDF language changes, so an invoice can be written in your client's language and still use your own number formatting"
+ content="Turn on to keep your number format when the PDF language changes."
/>
</div>
+ <InputHelperMessage>
+ {preserveNumberFormatOnLanguageChange
+ ? "The number format stays as it is when you switch the PDF language"
+ : "By default, the number format follows the PDF language"}
+ </InputHelperMessage>
</fieldset>
{/* Invoice Number */}
diff --git a/src/app/(main)/(app)/utils/__tests__/contacts-backup.test.ts b/src/app/(main)/(app)/utils/__tests__/contacts-backup.test.ts
index a593487..49e0426 100644
--- a/src/app/(main)/(app)/utils/__tests__/contacts-backup.test.ts
+++ b/src/app/(main)/(app)/utils/__tests__/contacts-backup.test.ts
@@ -142,9 +142,9 @@ describe("serializeContactsBackup", () => {
});
describe("buildContactsBackupFileName", () => {
- it("dates the file", () => {
- expect(buildContactsBackupFileName(new Date(2026, 8, 26, 23, 59))).toBe(
- "easyinvoicepdf-contacts-2026-09-26.json",
+ it("dates and times the file", () => {
+ expect(buildContactsBackupFileName(new Date(2026, 8, 26, 23, 59, 7))).toBe(
+ "easyinvoicepdf-contacts-2026-09-26_23-59-07.json",
);
});
});
diff --git a/src/app/(main)/(app)/utils/contacts-backup.ts b/src/app/(main)/(app)/utils/contacts-backup.ts
index 62b89cc..85bd092 100644
--- a/src/app/(main)/(app)/utils/contacts-backup.ts
+++ b/src/app/(main)/(app)/utils/contacts-backup.ts
@@ -72,10 +72,12 @@ export function serializeContactsBackup({
}
/**
- * `easyinvoicepdf-contacts-2026-09-26.json`, dated in the user's local time zone.
+ * `easyinvoicepdf-contacts-2026-09-26_23-59-07.json`, in the user's local time zone. The
+ * time keeps several exports from the same day apart, instead of the browser appending
+ * "(1)"; dashes rather than colons, which Windows and macOS do not allow in file names.
*/
export function buildContactsBackupFileName(date: Date): string {
- return `${CONTACTS_BACKUP_APP_ID}-contacts-${dayjs(date).format("YYYY-MM-DD")}.json`;
+ return `${CONTACTS_BACKUP_APP_ID}-contacts-${dayjs(date).format("YYYY-MM-DD_HH-mm-ss")}.json`;
}
type ParseContactsBackupResult =
diff --git a/src/components/ui/switch.tsx b/src/components/ui/switch.tsx
index 08446ea..39a16e4 100644
--- a/src/components/ui/switch.tsx
+++ b/src/components/ui/switch.tsx
@@ -16,7 +16,7 @@ const Switch = React.memo(
return (
<SwitchPrimitives.Root
className={cn(
- "focus-visible:outline-ring/70 peer inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent outline-offset-2 transition-colors focus-visible:outline focus-visible:outline-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-slate-900 data-[state=unchecked]:bg-slate-200 dark:data-[state=checked]:bg-slate-50 dark:data-[state=unchecked]:bg-slate-800",
+ "focus-visible:outline-ring/70 peer inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent outline-offset-2 transition-colors duration-200 ease-out-strong focus-visible:outline focus-visible:outline-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-slate-900 data-[state=unchecked]:bg-slate-200 dark:data-[state=checked]:bg-slate-50 dark:data-[state=unchecked]:bg-slate-800",
className,
)}
{...props}
@@ -24,7 +24,7 @@ const Switch = React.memo(
>
<SwitchPrimitives.Thumb
className={cn(
- "pointer-events-none block size-5 rounded-full bg-white shadow-sm shadow-black/5 ring-0 transition-transform duration-300 [transition-timing-function:cubic-bezier(0.16,1,0.3,1)] data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0 dark:bg-slate-950 rtl:data-[state=checked]:-translate-x-4",
+ "pointer-events-none block size-5 rounded-full bg-white shadow-sm shadow-black/5 ring-0 transition-transform duration-200 ease-out-strong data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0 dark:bg-slate-950 rtl:data-[state=checked]:-translate-x-4",
)}
/>
</SwitchPrimitives.Root>