All files / src/components loading-fallback.tsx

100% Statements 10/10
100% Branches 4/4
100% Functions 5/5
100% Lines 10/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 673x       11x 2x             9x                     3x 8x                 3x 9x                 54x                       54x                      
export const LoadingFallback = ({
  message = 'Loading...',
  minimal = false,
}) => {
  if (minimal) {
    return (
      <div className="flex items-center justify-center p-4">
        <div className="animate-spin rounded-full h-6 w-6 border-b-2 border-primary"></div>
      </div>
    );
  }
 
  return (
    <div className="flex items-center justify-center h-screen">
      <div className="text-center">
        <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"></div>
        <p className="text-muted-foreground">{message}</p>
      </div>
    </div>
  );
};
 
// Loading component for page transitions
export const PageTransitionLoader = () => (
  <div className="fixed inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center">
    <div className="text-center">
      <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"></div>
      <p className="text-muted-foreground">Loading page...</p>
    </div>
  </div>
);
 
// Skeleton loader for page content
export const PageSkeleton = () => (
  <div className="h-screen flex flex-col bg-background">
    {/* Header skeleton */}
    <div className="h-16 bg-muted animate-pulse border-b"></div>
 
    <div className="flex flex-1 overflow-hidden">
      {/* Sidebar skeleton */}
      <div className="w-64 bg-muted animate-pulse border-r">
        <div className="p-4 space-y-4">
          {[...Array(6)].map((_, i) => (
            <div key={i} className="h-8 bg-background rounded"></div>
          ))}
        </div>
      </div>
 
      {/* Main content skeleton */}
      <div className="flex-1 p-6">
        <div className="space-y-4">
          <div className="h-8 bg-muted animate-pulse rounded w-1/3"></div>
          <div className="h-4 bg-muted animate-pulse rounded w-2/3"></div>
          <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mt-6">
            {[...Array(6)].map((_, i) => (
              <div
                key={i}
                className="h-32 bg-muted animate-pulse rounded"
              ></div>
            ))}
          </div>
        </div>
      </div>
    </div>
  </div>
);