Keep most recent 10 versions per item, delete older ones beyond this period
@@ -176,15 +176,12 @@ export function VersionCleanupSettings() {
diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx
index 61873347..cc280543 100644
--- a/src/components/ui/button.tsx
+++ b/src/components/ui/button.tsx
@@ -1,6 +1,7 @@
import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority";
+import { Loader2 } from "lucide-react";
import { cn } from "@/lib/utils";
import { breadcrumb } from "@/lib/errorBreadcrumbs";
@@ -36,13 +37,33 @@ export interface ButtonProps
VariantProps {
asChild?: boolean;
trackingLabel?: string; // Optional label for breadcrumb tracking
+ loading?: boolean; // Show loading state with spinner
+ loadingText?: string; // Optional text to display during loading
}
const Button = React.forwardRef(
- ({ className, variant, size, asChild = false, onClick, trackingLabel, ...props }, ref) => {
+ ({
+ className,
+ variant,
+ size,
+ asChild = false,
+ onClick,
+ trackingLabel,
+ loading = false,
+ loadingText,
+ children,
+ disabled,
+ ...props
+ }, ref) => {
const Comp = asChild ? Slot : "button";
const handleClick = (e: React.MouseEvent) => {
+ // Prevent clicks while loading
+ if (loading) {
+ e.preventDefault();
+ return;
+ }
+
// Add breadcrumb for button click
if (trackingLabel) {
breadcrumb.userAction('clicked', trackingLabel);
@@ -57,8 +78,18 @@ const Button = React.forwardRef(
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
onClick={handleClick}
- {...props}
- />
+ disabled={disabled || loading}
+ {...props}
+ >
+ {loading ? (
+ <>
+
+ {loadingText || children}
+ >
+ ) : (
+ children
+ )}
+
);
},
);