"use client";
import React, { useState, useMemo } from 'react';
import {
Search, Plus, Upload, Download, Trash2, Share, Star,
Grid, List, MoreVertical, Home, ChevronRight,
Folder, File, Image, Video, Music, FileText, Code, Database,
Package, Archive, Clock, Users, Eye, Edit3
} from 'lucide-react';
import { cn } from "@/lib/utils";
// Simple date formatting functions
const formatDate = (dateString) => {
const date = new Date(dateString);
return date.toLocaleDateString('en-US', {
month: 'short',
day: 'numeric',
year: 'numeric'
});
};
const formatDateTime = (dateString) => {
const date = new Date(dateString);
return date.toLocaleString('en-US', {
month: 'short',
day: 'numeric',
year: 'numeric',
hour: 'numeric',
minute: '2-digit',
hour12: true
});
};
const formatDistanceToNow = (date) => {
const now = new Date();
const diffMs = now - new Date(date);
const diffMinutes = Math.floor(diffMs / (1000 * 60));
const diffHours = Math.floor(diffMs / (1000 * 60 * 60));
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24));
if (diffMinutes < 1) return 'now';
if (diffMinutes < 60) return `${diffMinutes}m ago`;
if (diffHours < 24) return `${diffHours}h ago`;
if (diffDays < 7) return `${diffDays}d ago`;
return formatDate(date);
};
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Separator } from "@/components/ui/separator";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import {
Tooltip,
TooltipContent,
TooltipTrigger,
TooltipProvider,
} from "@/components/ui/tooltip";
import {
ResizableHandle,
ResizablePanel,
ResizablePanelGroup,
} from "@/components/ui/resizable";
import { ScrollArea } from "@/components/ui/scroll-area";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
// File system data
const fileSystemData = {
"": {
id: "root",
name: "My Drive",
path: "",
is_dir: true,
children: ["projects", "documents", "media", "shared"]
},
"projects": {
id: "projects",
name: "Projects",
path: "projects",
is_dir: true,
modified: "2025-01-15T10:30:00Z",
starred: true,
shared: false,
children: ["web-apps", "mobile-apps", "ai-research"]
},
"projects/web-apps": {
id: "web-apps",
name: "Web Applications",
path: "projects/web-apps",
is_dir: true,
modified: "2025-01-14T16:45:00Z",
starred: false,
shared: true,
children: ["dashboard-pro", "package.json", "README.md"]
},
"projects/web-apps/package.json": {
id: "package-json",
name: "package.json",
path: "projects/web-apps/package.json",
is_dir: false,
size: 2048,
type: "json",
modified: "2025-01-13T14:20:00Z",
starred: false,
shared: false
},
"projects/web-apps/README.md": {
id: "readme-md",
name: "README.md",
path: "projects/web-apps/README.md",
is_dir: false,
size: 5120,
type: "markdown",
modified: "2025-01-12T09:30:00Z",
starred: false,
shared: true
},
"documents": {
id: "documents",
name: "Documents",
path: "documents",
is_dir: true,
modified: "2025-01-14T12:00:00Z",
starred: false,
shared: false,
children: ["proposals", "Q1-Strategy.pdf", "Budget-2025.xlsx"]
},
"documents/Q1-Strategy.pdf": {
id: "q1-strategy",
name: "Q1 Strategy.pdf",
path: "documents/Q1-Strategy.pdf",
is_dir: false,
size: 1048576,
type: "pdf",
modified: "2025-01-10T15:30:00Z",
starred: true,
shared: true
},
"media": {
id: "media",
name: "Media",
path: "media",
is_dir: true,
modified: "2025-01-13T18:45:00Z",
starred: false,
shared: false,
children: ["photos", "videos", "vacation-2024.jpg"]
},
"media/vacation-2024.jpg": {
id: "vacation-photo",
name: "vacation-2024.jpg",
path: "media/vacation-2024.jpg",
is_dir: false,
size: 3145728,
type: "image",
modified: "2024-12-25T20:00:00Z",
starred: true,
shared: false
},
"shared": {
id: "shared",
name: "Shared",
path: "shared",
is_dir: true,
modified: "2025-01-12T11:20:00Z",
starred: false,
shared: true,
children: ["team-resources", "client-files"]
}
};
const getFileIcon = (item) => {
if (item.is_dir) {
return ,
markdown: