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
feat: add new tutorial videos for importing/exporting contacts and customizing number formats (#278)
Vlad Sazonau1c0cc95bba65
diff --git a/src/actions/fetch-github-stars.ts b/src/actions/fetch-github-stars.tsindex baa3508..6085184 100644--- a/src/actions/fetch-github-stars.ts+++ b/src/actions/fetch-github-stars.ts@@ -9,7 +9,7 @@ import { env } from "@/env";* Fetches the current star count for the GitHub repository.** This function is cached using React's `cache()` to prevent duplicate requests- * during the same render cycle. The data is revalidated every hour.+ * during the same render cycle. The data is revalidated every 4 hours.** NOTE: `<Header />` renders on nearly every static page, so this `revalidate`* becomes the ISR revalidate time for those routes too -- Next.js takes the@@ -26,7 +26,7 @@ export const fetchGithubStars = cache(async (): Promise<number> => {headers: {Authorization: `Bearer ${env.GITHUB_TOKEN}`,},- next: { revalidate: 3600 }, // revalidate every 1 hour (3600 seconds)+ next: { revalidate: 14_400 }, // revalidate every 4 hours (14400 seconds)},);diff --git a/src/app/(main)/(app)/components/how-it-works-videos.tsx b/src/app/(main)/(app)/components/how-it-works-videos.tsxindex acd33bf..1fbdc43 100644--- a/src/app/(main)/(app)/components/how-it-works-videos.tsx+++ b/src/app/(main)/(app)/components/how-it-works-videos.tsx@@ -119,7 +119,9 @@ export function HowItWorksVideos({</p></div>- <div className="aspect-video min-h-[300px] w-full shrink-0 overflow-hidden">+ {/* A touch wider than 16:9 from `sm` up, so the player doesn't eat the whole+ viewport on desktop; YouTube pillarboxes the video with thin black bars. */}+ <div className="aspect-video min-h-[300px] w-full shrink-0 overflow-hidden bg-black sm:aspect-[16/8.5]">{showIframe ? (<YouTubeEmbedkey={activeVideoId}@@ -135,7 +137,7 @@ export function HowItWorksVideos({`sm` it splits into two columns that fill top to bottom, so the numbers readdown the first column and then the second, as a playlist should. */}<ol- className="grid shrink-0 gap-1 border-t border-slate-200 p-2 sm:grid-flow-col sm:grid-cols-2 sm:grid-rows-[repeat(var(--playlist-rows),auto)] sm:p-3"+ className="grid shrink-0 gap-2 border-t border-slate-200 p-3 sm:grid-flow-col sm:grid-cols-2 sm:grid-rows-[repeat(var(--playlist-rows),auto)] sm:p-4"style={{ "--playlist-rows": PLAYLIST_ROWS } as CSSProperties}aria-label="Tutorials"data-testid="how-it-works-playlist"@@ -152,17 +154,23 @@ export function HowItWorksVideos({}}aria-current={isActive ? "true" : undefined}className={cn(- "flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left text-sm transition-colors",- "focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-slate-900",+ "group flex w-full cursor-pointer items-center gap-3 rounded-lg border px-3 py-2.5 text-left text-sm shadow-sm",+ "transition-[background-color,border-color,color,box-shadow,transform] duration-150 ease-out active:scale-[0.98]",+ "focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-slate-900",isActive- ? "bg-slate-200 text-slate-950"- : "text-slate-600 hover:bg-slate-100 hover:text-slate-900",+ ? "border-slate-900 bg-slate-900 text-white"+ : "border-slate-200 bg-white text-slate-700 hover:border-slate-300 hover:bg-slate-50 hover:text-slate-950 hover:shadow",)}data-testid={`how-it-works-playlist-item-${video.id}`}><spanaria-hidden- className="flex w-4 shrink-0 justify-center text-xs font-medium tabular-nums text-slate-400"+ className={cn(+ "flex size-6 shrink-0 items-center justify-center rounded-full text-xs font-medium tabular-nums transition-colors duration-150",+ isActive+ ? "bg-white text-slate-900"+ : "bg-slate-100 text-slate-500 group-hover:bg-slate-200 group-hover:text-slate-700",+ )}>{isActive ? (<PlayIcon className="size-3 translate-x-px fill-slate-900 stroke-slate-900" />@@ -179,7 +187,12 @@ export function HowItWorksVideos({<span className="sm:hidden">{video.shortTitle}</span><span className="hidden sm:inline">{video.title}</span></span>- <span className="shrink-0 text-xs tabular-nums text-slate-500">+ <span+ className={cn(+ "shrink-0 text-xs tabular-nums",+ isActive ? "text-slate-300" : "text-slate-500",+ )}+ >{formatDuration(video.durationSeconds)}</span></button>diff --git a/src/app/(main)/how-it-works/build-how-it-works-json-ld.test.ts b/src/app/(main)/how-it-works/build-how-it-works-json-ld.test.tsindex 9cf49de..d866e20 100644--- a/src/app/(main)/how-it-works/build-how-it-works-json-ld.test.ts+++ b/src/app/(main)/how-it-works/build-how-it-works-json-ld.test.ts@@ -49,8 +49,17 @@ describe("buildHowItWorksJsonLd", () => {return item.duration;});+ // Looked up by id so adding or reordering tutorials doesn't shift the index+ function durationOf(id: (typeof HOW_IT_WORKS_VIDEOS)[number]["id"]) {+ return durations[+ HOW_IT_WORKS_VIDEOS.findIndex((video) => {+ return video.id === id;+ })+ ];+ }+// 70s overview and 19s tax tutorial: a minute part, and none under a minute- expect(durations[0]).toBe("PT1M10S");- expect(durations[4]).toBe("PT19S");+ expect(durationOf("overview")).toBe("PT1M10S");+ expect(durationOf("custom-tax")).toBe("PT19S");});});diff --git a/src/components/ui/tooltip.tsx b/src/components/ui/tooltip.tsxindex 199a7e4..2e6389a 100644--- a/src/components/ui/tooltip.tsx+++ b/src/components/ui/tooltip.tsx@@ -1,7 +1,7 @@"use client";import * as TooltipPrimitive from "@radix-ui/react-tooltip";-import * as React from "react";+import type * as React from "react";import {Popover,@@ -11,45 +11,43 @@ import {import { useIsDesktop } from "@/hooks/use-media-query";import { cn } from "@/lib/utils";-const TooltipProvider = React.memo(TooltipPrimitive.Provider);+const TooltipProvider = TooltipPrimitive.Provider;// Add Provider wrapper for app-wide usagefunction TooltipProviderWrapper({ children }: { children: React.ReactNode }) {return <TooltipProvider delayDuration={0}>{children}</TooltipProvider>;}-const Tooltip = React.memo(TooltipPrimitive.Root);+const Tooltip = TooltipPrimitive.Root;-const TooltipTrigger = React.memo(TooltipPrimitive.Trigger);+const TooltipTrigger = TooltipPrimitive.Trigger;-const TooltipContent = React.memo(- React.forwardRef<- React.ComponentRef<typeof TooltipPrimitive.Content>,- React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> & {- showArrow?: boolean;- }- >(({ className, sideOffset = 4, showArrow = false, ...props }, ref) => {- return (- <TooltipPrimitive.Portal>- <TooltipPrimitive.Content- ref={ref}- sideOffset={sideOffset}- className={cn(- "relative isolate z-[100] max-w-[280px] rounded-lg border border-slate-200 bg-white px-3 py-1.5 text-sm text-slate-950 animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:border-slate-800 dark:bg-slate-950 dark:text-slate-50",- className,- )}- {...props}- >- {props.children}- {showArrow ? (- <TooltipPrimitive.Arrow className="my-px border-slate-200 fill-white drop-shadow-[0_1px_0_hsl(var(--border))]" />- ) : null}- </TooltipPrimitive.Content>- </TooltipPrimitive.Portal>- );- }),-);-TooltipContent.displayName = TooltipPrimitive.Content.displayName;+function TooltipContent({+ className,+ sideOffset = 4,+ showArrow = false,+ ...props+}: React.ComponentProps<typeof TooltipPrimitive.Content> & {+ showArrow?: boolean;+}) {+ return (+ <TooltipPrimitive.Portal>+ <TooltipPrimitive.Content+ sideOffset={sideOffset}+ className={cn(+ "relative isolate z-[100] max-w-[280px] rounded-lg border border-slate-200 bg-white px-3 py-1.5 text-sm text-slate-950 animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:border-slate-800 dark:bg-slate-950 dark:text-slate-50",+ className,+ )}+ {...props}+ >+ {props.children}+ {showArrow ? (+ <TooltipPrimitive.Arrow className="my-px border-slate-200 fill-white drop-shadow-[0_1px_0_hsl(var(--border))]" />+ ) : null}+ </TooltipPrimitive.Content>+ </TooltipPrimitive.Portal>+ );+}interface CustomTooltipProps {trigger: React.ReactNode;@@ -64,63 +62,52 @@ interface CustomTooltipProps {const contentClassName = "max-w-[280px] px-2 py-1 text-xs";-const CustomTooltip = React.memo(- ({- trigger,- content,- className,- side = "top",- align = "center",- delayDuration = 300,- showArrow = false,- popoverOnMobile = false,- }: CustomTooltipProps) => {- const isDesktop = useIsDesktop();- const usePopover = popoverOnMobile && !isDesktop;-- // Memoize both trigger and content- const memoizedTrigger = React.useMemo(() => {- return trigger;- }, [trigger]);- const memoizedContent = React.useMemo(() => {- return content;- }, [content]);-- if (usePopover) {- return (- <Popover>- <PopoverTrigger asChild>{memoizedTrigger}</PopoverTrigger>- {memoizedContent ? (- <PopoverContent- side={side}- align={align}- className={cn(contentClassName, className)}- >- {memoizedContent}- </PopoverContent>- ) : null}- </Popover>- );- }+function CustomTooltip({+ trigger,+ content,+ className,+ side = "top",+ align = "center",+ delayDuration = 300,+ showArrow = false,+ popoverOnMobile = false,+}: CustomTooltipProps) {+ const isDesktop = useIsDesktop();+ const usePopover = popoverOnMobile && !isDesktop;+ if (usePopover) {return (- <Tooltip delayDuration={delayDuration}>- <TooltipTrigger asChild>{memoizedTrigger}</TooltipTrigger>- {memoizedContent ? (- <TooltipContent+ <Popover>+ <PopoverTrigger asChild>{trigger}</PopoverTrigger>+ {content ? (+ <PopoverContentside={side}align={align}className={cn(contentClassName, className)}- showArrow={showArrow}>- {memoizedContent}- </TooltipContent>+ {content}+ </PopoverContent>) : null}- </Tooltip>+ </Popover>);- },-);-CustomTooltip.displayName = "CustomTooltip";+ }++ return (+ <Tooltip delayDuration={delayDuration}>+ <TooltipTrigger asChild>{trigger}</TooltipTrigger>+ {content ? (+ <TooltipContent+ side={side}+ align={align}+ className={cn(contentClassName, className)}+ showArrow={showArrow}+ >+ {content}+ </TooltipContent>+ ) : null}+ </Tooltip>+ );+}export {Tooltip,diff --git a/src/config.ts b/src/config.tsindex 7b0d312..3eaf9ed 100644--- a/src/config.ts+++ b/src/config.ts@@ -57,6 +57,12 @@ const YOUTUBE_VIDEO_HOW_TO_ADD_INVOICE_FOR_ONE_WEEK =const YOUTUBE_VIDEO_HOW_TO_CUSTOMIZE_TAX ="https://www.youtube.com/embed/F_iJxZ3PHbk";+const YOUTUBE_VIDEO_HOW_TO_IMPORT_EXPORT_CONTACTS =+ "https://www.youtube.com/embed/Vf2-QN-mB1c";++const YOUTUBE_VIDEO_HOW_TO_CUSTOMIZE_NUMBER_FORMAT =+ "https://www.youtube.com/embed/hZM2DYXo63k";+/** A vertical YouTube Short; the 16:9 player pillarboxes it. */const YOUTUBE_VIDEO_MOBILE_DEMO = "https://www.youtube.com/embed/TKOegsmNnKM";@@ -100,6 +106,19 @@ export const HOW_IT_WORKS_VIDEOS = [thumbnailUrl: "https://i.ytimg.com/vi/XxAY0YGgXIk/maxresdefault.jpg",iframeTitle: "How to add a buyer - EasyInvoicePDF",},+ {+ id: "import-export-contacts",+ title: "How to import and export contacts",+ shortTitle: "Import & export contacts",+ description:+ "Back up your saved sellers and buyers to a file and restore them on any device.",+ embedUrl: YOUTUBE_VIDEO_HOW_TO_IMPORT_EXPORT_CONTACTS,+ watchUrl: "https://www.youtube.com/watch?v=Vf2-QN-mB1c",+ uploadDate: "2026-09-28T17:03:17-07:00",+ durationSeconds: 42,+ thumbnailUrl: "https://i.ytimg.com/vi/Vf2-QN-mB1c/maxresdefault.jpg",+ iframeTitle: "How to import and export contacts - EasyInvoicePDF",+ },{id: "weekly-invoices",title: "How to create invoices for one week",@@ -125,6 +144,19 @@ export const HOW_IT_WORKS_VIDEOS = [thumbnailUrl: "https://i.ytimg.com/vi/F_iJxZ3PHbk/maxresdefault.jpg",iframeTitle: "How to customize tax on an invoice - EasyInvoicePDF",},+ {+ id: "number-format",+ title: "How to customize number formatting",+ shortTitle: "Number formatting",+ description:+ "Choose how amounts are written, like 1,234.56 or 1.234,56, and create invoices in Brazilian Portuguese.",+ embedUrl: YOUTUBE_VIDEO_HOW_TO_CUSTOMIZE_NUMBER_FORMAT,+ watchUrl: "https://www.youtube.com/watch?v=hZM2DYXo63k",+ uploadDate: "2026-09-24T05:17:16-07:00",+ durationSeconds: 35,+ thumbnailUrl: "https://i.ytimg.com/vi/hZM2DYXo63k/maxresdefault.jpg",+ iframeTitle: "How to customize number formatting - EasyInvoicePDF",+ },{id: "mobile",title: "How to use EasyInvoicePDF on mobile",