"use client"; import Link from "next/link"; import { HTMLAttributes } from "react"; import { clsx } from "clsx"; // ============================================================================= // EmptyState Types // ============================================================================= export interface EmptyStateProps extends HTMLAttributes { icon?: React.ReactNode; title: string; description?: string; actionText?: string; actionHref?: string; actionOnClick?: () => void; actionVariant?: "primary" | "secondary" | "ghost"; compact?: boolean; } // ============================================================================= // SharedEmptyState Component // ============================================================================= export function SharedEmptyState({ icon, title, description, actionText, actionHref, actionOnClick, actionVariant = "primary", compact = false, className, ...props }: EmptyStateProps) { const variantClasses = { primary: "bg-[var(--accent-primary)] text-white hover:bg-[var(--accent-primary-hover)]", secondary: "bg-[var(--bg-surface)] text-[var(--text-primary)] border border-[var(--border-subtle)] hover:bg-[var(--bg-elevated)]", ghost: "bg-transparent text-[var(--text-secondary)] hover:bg-[var(--bg-glass)]", }; return (
{/* Icon */} {icon && (
{icon}
)} {/* Title */}

{title}

{/* Description */} {description && (

{description}

)} {/* Action */} {(actionText || actionHref || actionOnClick) && (
{actionHref ? ( {actionText} ) : actionOnClick ? ( ) : null}
)}
); } // ============================================================================= // Convenience Empty State Components // ============================================================================= // No results empty state export function NoResultsEmptyState({ searchQuery, onClear, className, ...props }: { searchQuery?: string; onClear?: () => void } & Omit) { return ( ); } // No content empty state export function NoContentEmptyState({ type, onCreate, className, ...props }: { type: string; onCreate?: () => void } & Omit) { const messages: Record = { documents: { title: "No documents uploaded", description: "Upload your PDFs or notes to start studying with DocDoe.", }, chapters: { title: "No chapters found", description: "Select a subject to see available chapters.", }, progress: { title: "No study progress yet", description: "Complete lessons and quizzes to track your progress.", }, bookmarks: { title: "No bookmarks saved", description: "Save important topics to revisit later.", }, default: { title: "No content available", description: "Check back later for updates.", }, }; const message = messages[type] || messages.default; return ( ); } // Error empty state export function ErrorEmptyState({ errorMessage, onRetry, className, ...props }: { errorMessage?: string; onRetry?: () => void } & Omit) { return ( ); } // Loading placeholder (not a skeleton, but a full empty state) export function LoadingEmptyState({ message = "Loading...", className, ...props }: { message?: string } & Omit) { return ( ); }