diff --git "a/frontend/src/pages/Repository.jsx" "b/frontend/src/pages/Repository.jsx" --- "a/frontend/src/pages/Repository.jsx" +++ "b/frontend/src/pages/Repository.jsx" @@ -1,1169 +1,1257 @@ -import React, { useState, useRef, useEffect } from 'react'; -import { motion, AnimatePresence } from 'framer-motion'; -import { - Upload, - FolderOpen, - Image, - FileText, - Video, - Search, - Filter, - Grid3X3, - List, - MoreVertical, - Download, - Trash2, - Eye, - ChevronDown, - ChevronRight, - Plus, - X, - Check, - File, - Copy -} from 'lucide-react'; -import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; -import { Button } from '@/components/ui/button'; -import { Input } from '@/components/ui/input'; -import { Badge } from '@/components/ui/badge'; -import { Label } from '@/components/ui/label'; -import { Progress } from '@/components/ui/progress'; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from '@/components/ui/select'; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger, -} from '@/components/ui/dropdown-menu'; -import { - Dialog, - DialogContent, - DialogHeader, - DialogTitle, - DialogTrigger, -} from '@/components/ui/dialog'; -import { Checkbox } from '@/components/ui/checkbox'; - -const products = [ - { - id: 'ocr', - name: 'Intelligent Document Parsing (OCR)', - shortName: 'OCR', - color: 'blue', - subCategories: [] - }, - { - id: 'p2p', - name: 'Purchase To Pay (P2P)', - shortName: 'P2P', - color: 'emerald', - subCategories: [ - 'Budget Approval Workflow', - 'Purchase Request Workflow', - 'Accounts Payable Workflow' - ] - }, - { - id: 'o2c', - name: 'Order to Cash (O2C)', - shortName: 'O2C', - color: 'violet', - subCategories: [ - 'Quotation Workflow', - 'Sales Order Workflow', - 'PickSlip Delivery Workflow', - 'Accounts Receivable Workflow' - ] - } -]; - -const mockAssets = [ - { id: '1', name: 'OCR_Demo_Screenshot.png', type: 'image', product: 'ocr', subCategory: null, size: '2.4 MB', date: '2024-12-20' }, - { id: '2', name: 'P2P_Workflow_Diagram.pdf', type: 'document', product: 'p2p', subCategory: 'Budget Approval Workflow', size: '1.8 MB', date: '2024-12-19' }, - { id: '3', name: 'Invoice_Processing_Video.mp4', type: 'video', product: 'ocr', subCategory: null, size: '45.2 MB', date: '2024-12-18' }, - { id: '4', name: 'Sales_Order_Infographic.png', type: 'image', product: 'o2c', subCategory: 'Sales Order Workflow', size: '3.1 MB', date: '2024-12-17' }, - { id: '5', name: 'AP_Automation_Brochure.pdf', type: 'document', product: 'p2p', subCategory: 'Accounts Payable Workflow', size: '5.6 MB', date: '2024-12-16' }, - { id: '6', name: 'O2C_Product_Banner.png', type: 'image', product: 'o2c', subCategory: 'Quotation Workflow', size: '1.2 MB', date: '2024-12-15' }, - { id: '7', name: 'Document_Parsing_Demo.png', type: 'image', product: 'ocr', subCategory: null, size: '890 KB', date: '2024-12-14' }, - { id: '8', name: 'PR_Workflow_Guide.pdf', type: 'document', product: 'p2p', subCategory: 'Purchase Request Workflow', size: '2.3 MB', date: '2024-12-13' }, -]; - -export default function Repository() { - const [viewMode, setViewMode] = useState('grid'); - const [searchQuery, setSearchQuery] = useState(''); - const [selectedProduct, setSelectedProduct] = useState('all'); - const [expandedProducts, setExpandedProducts] = useState(['ocr', 'p2p', 'o2c']); - const [selectedAssets, setSelectedAssets] = useState([]); - const [uploadDialogOpen, setUploadDialogOpen] = useState(false); - const [dragOver, setDragOver] = useState(false); - const [selectedFiles, setSelectedFiles] = useState([]); - const [uploadProductCategory, setUploadProductCategory] = useState(''); - const [uploadSubCategory, setUploadSubCategory] = useState(''); - const [isUploading, setIsUploading] = useState(false); - const [assets, setAssets] = useState(mockAssets); - const [isLoadingAssets, setIsLoadingAssets] = useState(false); - const [previewAsset, setPreviewAsset] = useState(null); - const [previewDialogOpen, setPreviewDialogOpen] = useState(false); - const [uploadProgress, setUploadProgress] = useState({}); - const [pdfPages, setPdfPages] = useState(null); - const [isLoadingPdf, setIsLoadingPdf] = useState(false); - const [isDeleting, setIsDeleting] = useState(false); - const fileInputRef = useRef(null); - - const toggleProduct = (productId) => { - setExpandedProducts(prev => - prev.includes(productId) - ? prev.filter(id => id !== productId) - : [...prev, productId] - ); - }; - - const filteredAssets = assets.filter(asset => { - const matchesSearch = asset.name.toLowerCase().includes(searchQuery.toLowerCase()); - const matchesProduct = selectedProduct === 'all' || asset.product === selectedProduct; - return matchesSearch && matchesProduct; - }); - - const getAssetsByProduct = (productId) => { - return assets.filter(asset => asset.product === productId); - }; - - const getTypeIcon = (type) => { - switch(type) { - case 'image': return ; - case 'video': return