"use client"; import React, { useMemo, useState } from "react"; import dynamic from "next/dynamic"; import { Archive, ChevronRight, CloudUpload, Download, Edit3, Eye, FileCode2, Film, Folder, Image as ImageIcon, LayoutGrid, List, RefreshCw, Search, Share2, Trash2, } from "lucide-react"; import { useAuth } from "@/features/auth"; import { formatBytes } from "@/shared/lib/format"; import { buildDownloadUrl } from "@/shared/lib/http"; import { FileCategory, FileNode } from "@/shared/types/domain"; import { Badge, Button, EmptyState, Skeleton } from "@/shared/ui"; import { SortMode, useFileManager } from "../hooks/useFileManager"; const UploadModal = dynamic( () => import("./UploadModal").then((m) => m.UploadModal), { ssr: false }, ); const FilePreviewModal = dynamic( () => import("./FilePreviewModal").then((m) => m.FilePreviewModal), { ssr: false }, ); const ShareModal = dynamic( () => import("./ShareModal").then((m) => m.ShareModal), { ssr: false }, ); const RenameModal = dynamic( () => import("./RenameModal").then((m) => m.RenameModal), { ssr: false }, ); const CATEGORIES: readonly { value: "all" | FileCategory; label: string }[] = [ { value: "all", label: "Tất cả" }, { value: "video", label: "Video / Audio" }, { value: "image", label: "Hình ảnh" }, { value: "archive", label: "Tệp nén" }, { value: "doc", label: "Tài liệu / Khác" }, ]; function renderCategoryIcon(category: FileCategory) { switch (category) { case "video": return