Skip to content

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

feat: implement loading skeletons for various pages (#213)

Vlad Sazonau0b371690a492
diff --git a/src/app/(app)/components/index.tsx b/src/app/(app)/components/index.tsx
index fe798a5..abc7398 100644
--- a/src/app/(app)/components/index.tsx
+++ b/src/app/(app)/components/index.tsx
@@ -365,7 +365,7 @@ export function InvoiceClientPage({
isMobile={false}
qrCodeDataUrl={qrCodeDataUrl}
/>
- <div className="absolute -bottom-6 right-0 text-right text-xs text-zinc-900">
+ <div className="absolute -bottom-6 right-0 text-right text-xs text-zinc-800">
<Link
href="/tos"
className="underline hover:text-black"
diff --git a/src/app/(app)/components/invoice-page-header.tsx b/src/app/(app)/components/invoice-page-header.tsx
index c5301ba..00008dd 100644
--- a/src/app/(app)/components/invoice-page-header.tsx
+++ b/src/app/(app)/components/invoice-page-header.tsx
@@ -230,17 +230,22 @@ function ProjectInfoLinks() {
</a>
<span className="h-3 w-px bg-slate-500" aria-hidden="true" />
- <a
- href={GITHUB_URL}
- target="_blank"
- rel="noopener noreferrer"
- className="group inline-flex items-center gap-1.5 rounded-full border border-slate-400 px-3 py-1 text-xs font-medium text-slate-900 shadow transition-[colors,transform,border-color] duration-200 hover:border-blue-300 hover:text-blue-600 active:scale-[0.96]"
- >
- <GithubIcon className="size-4 transition-[transform,fill] duration-200 group-hover:scale-105 group-hover:fill-blue-600" />
- <span className="transition-colors duration-200 group-hover:text-blue-600">
- Star on GitHub
- </span>
- </a>
+ <div className="relative overflow-hidden">
+ <a
+ href={GITHUB_URL}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="group relative flex items-center gap-1.5 overflow-visible rounded-full border border-slate-300/80 bg-white px-3 py-1 text-xs shadow-sm transition-[colors,transform,border-color] duration-200 hover:border-slate-400/50 hover:bg-slate-50 hover:text-black active:scale-[0.96]"
+ >
+ <div className="border-glow-mask z-10" aria-hidden="true">
+ <div className="border-glow-shine animate-rotate-shine" />
+ </div>
+ <GithubIcon className="size-4 transition-[transform,fill] duration-200 group-hover:scale-105 group-hover:fill-blue-600" />
+ <span className="transition-colors duration-200 group-hover:text-blue-600">
+ Star on GitHub
+ </span>
+ </a>
+ </div>
</div>
<Dialog open={isVideoDialogOpen} onOpenChange={setIsVideoDialogOpen}>
diff --git a/src/app/(app)/loading.tsx b/src/app/(app)/loading.tsx
index 142914a..9bb1837 100644
--- a/src/app/(app)/loading.tsx
+++ b/src/app/(app)/loading.tsx
@@ -1,7 +1,7 @@
export default function Loading() {
return (
<div className="flex flex-col items-center justify-start bg-gray-100 sm:p-4 md:justify-center lg:min-h-screen">
- <div className="w-full max-w-7xl bg-white p-3 shadow-lg sm:mb-0 sm:rounded-lg sm:p-6 2xl:max-w-[1680px]">
+ <div className="w-full max-w-[62rem] bg-white p-3 shadow-lg sm:mb-0 sm:rounded-lg sm:p-6 sm:pb-1 xl:max-w-7xl 2xl:max-w-[1680px]">
<div className="grid grid-cols-1 gap-8 lg:grid-cols-12">
{/* Left side - Form */}
<div className="col-span-8 w-full space-y-6 lg:col-span-4">
diff --git a/src/app/(app)/page.client.tsx b/src/app/(app)/page.client.tsx
index 8bb2ff8..4694d80 100644
--- a/src/app/(app)/page.client.tsx
+++ b/src/app/(app)/page.client.tsx
@@ -698,7 +698,7 @@ export function AppPageClient({
return (
<TooltipProvider delayDuration={0}>
<div className="flex flex-col items-center justify-start bg-gray-100 pb-4 sm:p-4 md:justify-center lg:min-h-screen">
- <div className="w-full max-w-7xl bg-white p-3 shadow-lg sm:mb-0 sm:rounded-lg sm:p-6 sm:pb-1 2xl:max-w-[1680px]">
+ <div className="w-full max-w-[62rem] bg-white p-3 shadow-lg sm:mb-0 sm:rounded-lg sm:p-6 sm:pb-1 xl:max-w-7xl 2xl:max-w-[1680px]">
<InvoicePageHeader
canShareInvoice={canShareInvoice}
handleShareInvoice={handleShareInvoice}
diff --git a/src/app/(components)/header/header-skeleton.tsx b/src/app/(components)/header/header-skeleton.tsx
new file mode 100644
index 0000000..ae14f1e
--- /dev/null
+++ b/src/app/(components)/header/header-skeleton.tsx
@@ -0,0 +1,49 @@
+import { Skeleton } from "@/components/ui/skeleton";
+
+/**
+ * Header skeleton component for loading state.
+ * Displays placeholder skeletons while the actual header content is loading.
+ * Matches the layout and structure of the Header component.
+ */
+export function HeaderSkeleton() {
+ return (
+ <header className="sticky top-0 z-50 w-full border-b bg-white shadow-sm">
+ <div className="flex items-center justify-center">
+ <div className="container h-auto px-4 py-2 sm:h-16 sm:py-0 md:px-6">
+ <div className="flex h-full flex-row flex-wrap items-center justify-between gap-2">
+ <div className="w-[53%] sm:w-auto">
+ <div className="flex items-center gap-1.5 md:gap-2">
+ {/* Placeholder for logo icon*/}
+ <div className="flex items-center justify-center rounded-md">
+ <Skeleton className="size-6 md:size-7" />
+ </div>
+ {/* Placeholder for app name and description on desktop */}
+ <div className="hidden sm:block">
+ <div className="flex flex-col space-y-1">
+ {/* Placeholder for app name */}
+ <Skeleton className="h-6 w-36 lg:w-40" />
+ {/* Placeholder for app description */}
+ <Skeleton className="mt-1.5 h-3 w-48 rounded" />
+ </div>
+ </div>
+ {/* Placeholder for app name on mobile */}
+ <div className="block sm:hidden">
+ {/* Placeholder for app name on mobile*/}
+ <Skeleton className="h-7 w-28" />
+ </div>
+ </div>
+ </div>
+ <div className="flex items-center gap-1 sm:gap-2">
+ {/* Placeholder for language switcher on desktop */}
+ <Skeleton className="hidden h-9 w-[100px] rounded-md sm:block" />
+ {/* Placeholder for language switcher on mobile */}
+ <Skeleton className="h-9 w-9 rounded-md" />
+ {/* Placeholder for go to app button */}
+ <Skeleton className="h-9 min-w-[110px] max-w-[110px] rounded-md" />
+ </div>
+ </div>
+ </div>
+ </div>
+ </header>
+ );
+}
diff --git a/src/app/[locale]/about/loading.tsx b/src/app/[locale]/about/loading.tsx
index 8046aa8..9d993f8 100644
--- a/src/app/[locale]/about/loading.tsx
+++ b/src/app/[locale]/about/loading.tsx
@@ -1,46 +1,10 @@
+import { HeaderSkeleton } from "@/app/(components)/header/header-skeleton";
import { Skeleton } from "@/components/ui/skeleton";
export default function AboutLoading() {
return (
<div className="flex min-h-screen flex-col bg-slate-50">
- <header className="sticky top-0 z-50 w-full border-b bg-white shadow-sm">
- <div className="flex items-center justify-center">
- <div className="container h-auto px-4 py-2 sm:h-16 sm:py-0 md:px-6">
- <div className="flex h-full flex-row flex-wrap items-center justify-between gap-2">
- <div className="w-[53%] sm:w-auto">
- <div className="flex items-center gap-1.5 md:gap-2">
- {/* Placeholder for logo icon*/}
- <div className="flex items-center justify-center rounded-md">
- <Skeleton className="size-6 md:size-7" />
- </div>
- {/* Placeholder for app name and description on desktop */}
- <div className="hidden sm:block">
- <div className="flex flex-col space-y-1">
- {/* Placeholder for app name */}
- <Skeleton className="h-6 w-36 lg:w-40" />
- {/* Placeholder for app description */}
- <Skeleton className="mt-1.5 h-3 w-48 rounded" />
- </div>
- </div>
- {/* Placeholder for app name on mobile */}
- <div className="block sm:hidden">
- {/* Placeholder for app name on mobile*/}
- <Skeleton className="h-7 w-28" />
- </div>
- </div>
- </div>
- <div className="flex items-center gap-1 sm:gap-2">
- {/* Placeholder for language switcher on desktop */}
- <Skeleton className="hidden h-9 w-[100px] rounded-md sm:block" />
- {/* Placeholder for language switcher on mobile */}
- <Skeleton className="h-9 w-9 rounded-md" />
- {/* Placeholder for go to app button */}
- <Skeleton className="h-9 min-w-[110px] max-w-[110px] rounded-md" />
- </div>
- </div>
- </div>
- </div>
- </header>
+ <HeaderSkeleton />
<main>
{/* Hero Section */}
diff --git a/src/app/changelog/loading.tsx b/src/app/changelog/loading.tsx
new file mode 100644
index 0000000..c27f81a
--- /dev/null
+++ b/src/app/changelog/loading.tsx
@@ -0,0 +1,64 @@
+export default function Loading() {
+ return (
+ <div className="min-h-screen bg-white dark:bg-gray-900">
+ <div className="relative z-0">
+ {/* Hero */}
+ <div className="relative mb-8 pt-16 text-center sm:mb-16">
+ <div className="absolute bottom-0 h-full w-full bg-[radial-gradient(#e5e7eb_1px,transparent_1px)] [background-size:16px_16px] [mask-image:radial-gradient(ellipse_50%_50%_at_50%_50%,#000_70%,transparent_100%)] sm:bottom-auto" />
+ <div className="relative z-10 mx-auto h-10 w-48 animate-pulse rounded bg-gray-200 dark:bg-gray-700 sm:h-12 sm:w-64" />
+ <div className="relative z-10 mx-auto mt-4 h-5 w-72 animate-pulse rounded bg-gray-200 dark:bg-gray-700 sm:w-96" />
+ </div>
+
+ {/* Timeline Grid */}
+ <div className="border-slate-200 sm:border-t">
+ <div className="mx-auto max-w-6xl border-slate-200 px-4 dark:border-gray-700 sm:px-12 xl:border-x">
+ {Array.from({ length: 3 }).map((_, i) => (
+ <div key={i} className="grid pb-20 pt-4 sm:pt-12 md:grid-cols-4">
+ {/* Date column - desktop */}
+ <div className="sticky top-28 hidden self-start md:col-span-1 md:mt-[6px] md:block">
+ <div className="h-4 w-28 animate-pulse rounded bg-gray-200 dark:bg-gray-700" />
+ </div>
+
+ {/* Content column */}
+ <div className="flex flex-col md:col-span-3">
+ {/* Date - mobile */}
+ <div className="mb-3 h-4 w-28 animate-pulse rounded bg-gray-200 dark:bg-gray-700 md:hidden" />
+
+ {/* Title */}
+ <div className="mt-2 h-7 w-3/4 animate-pulse rounded bg-gray-200 dark:bg-gray-700 sm:mt-0" />
+
+ {/* Version badge */}
+ <div className="mt-2 h-5 w-16 animate-pulse rounded-full bg-gray-200 dark:bg-gray-700" />
+
+ {/* Author byline */}
+ <div className="mb-2 mt-4 flex items-center gap-2">
+ <div className="h-6 w-6 animate-pulse rounded-full bg-gray-200 dark:bg-gray-700" />
+ <div className="h-4 w-24 animate-pulse rounded bg-gray-200 dark:bg-gray-700" />
+ </div>
+
+ {/* Article content */}
+ <div className="space-y-3">
+ <div className="h-4 w-full animate-pulse rounded bg-gray-200 dark:bg-gray-700" />
+ <div className="h-4 w-5/6 animate-pulse rounded bg-gray-200 dark:bg-gray-700" />
+ <div className="h-4 w-4/6 animate-pulse rounded bg-gray-200 dark:bg-gray-700" />
+ <div className="mt-4 space-y-2 pl-4">
+ {Array.from({ length: 4 }).map((_, j) => (
+ <div
+ key={j}
+ className="h-4 animate-pulse rounded bg-gray-200 dark:bg-gray-700"
+ style={{ width: `${80 - j * 8}%` }}
+ />
+ ))}
+ </div>
+ <div className="h-4 w-full animate-pulse rounded bg-gray-200 dark:bg-gray-700" />
+ <div className="h-4 w-3/4 animate-pulse rounded bg-gray-200 dark:bg-gray-700" />
+ </div>
+ </div>
+ </div>
+ ))}
+ </div>
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/src/app/tos/loading.tsx b/src/app/tos/loading.tsx
new file mode 100644
index 0000000..b25dac8
--- /dev/null
+++ b/src/app/tos/loading.tsx
@@ -0,0 +1,42 @@
+import { HeaderSkeleton } from "@/app/(components)/header/header-skeleton";
+
+export default function Loading() {
+ return (
+ <div className="min-h-screen bg-white dark:bg-gray-900">
+ <HeaderSkeleton />
+
+ <div className="container mx-auto max-w-3xl px-4 py-12 md:px-6 md:py-16">
+ <div className="space-y-8">
+ {/* Title */}
+ <div className="h-9 w-56 animate-pulse rounded bg-gray-200 dark:bg-gray-700" />
+ {/* Effective date */}
+ <div className="h-4 w-48 animate-pulse rounded bg-gray-200 dark:bg-gray-700" />
+
+ {/* Sections */}
+ {Array.from({ length: 8 }).map((_, i) => (
+ <div key={i} className="space-y-4">
+ <div className="h-px w-full bg-gray-200 dark:bg-gray-700" />
+ <div className="h-6 w-40 animate-pulse rounded bg-gray-200 dark:bg-gray-700" />
+ <div className="space-y-2">
+ <div className="h-4 w-full animate-pulse rounded bg-gray-200 dark:bg-gray-700" />
+ <div className="h-4 w-5/6 animate-pulse rounded bg-gray-200 dark:bg-gray-700" />
+ <div className="h-4 w-4/6 animate-pulse rounded bg-gray-200 dark:bg-gray-700" />
+ </div>
+ {i % 2 === 0 && (
+ <div className="space-y-2 pl-4">
+ {Array.from({ length: 3 }).map((_, j) => (
+ <div
+ key={j}
+ className="h-4 animate-pulse rounded bg-gray-200 dark:bg-gray-700"
+ style={{ width: `${75 + j * 5}%` }}
+ />
+ ))}
+ </div>
+ )}
+ </div>
+ ))}
+ </div>
+ </div>
+ </div>
+ );
+}