From f4d8a26972728891de8bde4eeb94c80f027ce2d2 Mon Sep 17 00:00:00 2001
From: diogo464 <diogo464@d464.sh>
Date: Mon, 11 Aug 2025 16:04:32 +0100
Subject: basic v0 ui working

---
 frontend/components/FileTable.tsx | 179 --------------------------------------
 1 file changed, 179 deletions(-)
 delete mode 100644 frontend/components/FileTable.tsx

(limited to 'frontend/components/FileTable.tsx')

diff --git a/frontend/components/FileTable.tsx b/frontend/components/FileTable.tsx
deleted file mode 100644
index 97660f3..0000000
--- a/frontend/components/FileTable.tsx
+++ /dev/null
@@ -1,179 +0,0 @@
-'use client'
-
-import { useState } from 'react'
-import { DriveLsEntry } from '@/lib/drive_types'
-import { Drive_basename } from '@/lib/drive_shared'
-import { formatSize } from '@/lib/utils'
-import Link from 'next/link'
-
-interface FileTableEntry extends DriveLsEntry {
-  isParent?: boolean
-  parentPath?: string
-}
-
-interface FileTableProps {
-  entries: DriveLsEntry[]
-  currentPath?: string
-  showParent?: boolean
-  parentPath?: string
-  onSelectedFilesChange?: (selectedFiles: string[]) => void
-}
-
-export default function FileTable({ 
-  entries, 
-  currentPath = '', 
-  showParent = false, 
-  parentPath,
-  onSelectedFilesChange 
-}: FileTableProps) {
-  const [selectedFiles, setSelectedFiles] = useState<Set<string>>(new Set())
-
-  // Create entries with optional parent directory at top
-  const allEntries: FileTableEntry[] = []
-  if (showParent && parentPath !== undefined) {
-    allEntries.push({
-      path: '(parent)',
-      type: 'dir' as const,
-      lastmod: 0,
-      blob: null,
-      size: null,
-      author: '',
-      isParent: true,
-      parentPath
-    })
-  }
-
-  // Sort entries: directories first, then files, both alphabetically
-  const sortedEntries = entries.sort((a, b) => {
-    // First sort by type (directories before files)
-    if (a.type !== b.type) {
-      return a.type === 'dir' ? -1 : 1
-    }
-    // Then sort alphabetically by path
-    return a.path.localeCompare(b.path)
-  })
-
-  allEntries.push(...sortedEntries)
-
-  const handleFileSelection = (filePath: string, isSelected: boolean) => {
-    const newSelectedFiles = new Set(selectedFiles)
-    if (isSelected) {
-      newSelectedFiles.add(filePath)
-    } else {
-      newSelectedFiles.delete(filePath)
-    }
-    setSelectedFiles(newSelectedFiles)
-    onSelectedFilesChange?.(Array.from(newSelectedFiles))
-  }
-
-  const handleSelectAll = (isSelected: boolean) => {
-    if (isSelected) {
-      // Select all files (not directories or parent)
-      const fileEntries = allEntries.filter(entry => 
-        entry.type === 'file' && !entry.isParent
-      )
-      const newSelectedFiles = new Set(fileEntries.map(entry => entry.path))
-      setSelectedFiles(newSelectedFiles)
-      onSelectedFilesChange?.(Array.from(newSelectedFiles))
-    } else {
-      setSelectedFiles(new Set())
-      onSelectedFilesChange?.([])
-    }
-  }
-
-  const selectableFiles = allEntries.filter(entry => 
-    entry.type === 'file' && !entry.isParent
-  )
-  const allFilesSelected = selectableFiles.length > 0 && 
-    selectableFiles.every(entry => selectedFiles.has(entry.path))
-
-  return (
-    <div className="bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden">
-      <div className="overflow-x-auto">
-        <table className="w-full">
-          <thead className="bg-gray-50 dark:bg-gray-700">
-            <tr>
-              <th className="px-4 py-3 text-left">
-                <input
-                  type="checkbox"
-                  checked={allFilesSelected}
-                  onChange={(e) => handleSelectAll(e.target.checked)}
-                  className="rounded border-gray-300 text-blue-600 focus:ring-blue-500"
-                  disabled={selectableFiles.length === 0}
-                />
-              </th>
-              <th className="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">
-                Name
-              </th>
-              <th className="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">
-                Size
-              </th>
-              <th className="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">
-                Author
-              </th>
-              <th className="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">
-                Modified
-              </th>
-            </tr>
-          </thead>
-          <tbody className="divide-y divide-gray-200 dark:divide-gray-600">
-            {allEntries.map((entry) => (
-              <tr
-                key={entry.path}
-                className="hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors"
-              >
-                <td className="px-4 py-4 whitespace-nowrap">
-                  {entry.type === 'file' && !entry.isParent ? (
-                    <input
-                      type="checkbox"
-                      checked={selectedFiles.has(entry.path)}
-                      onChange={(e) => handleFileSelection(entry.path, e.target.checked)}
-                      className="rounded border-gray-300 text-blue-600 focus:ring-blue-500"
-                    />
-                  ) : (
-                    <div className="w-4 h-4" /> // Placeholder to maintain alignment
-                  )}
-                </td>
-                <td className="px-4 py-4 whitespace-nowrap">
-                  <div className="flex items-center">
-                    <div className="flex-shrink-0 h-5 w-5 mr-3">
-                      {entry.type === 'dir' ? (
-                        <div className="h-5 w-5 text-blue-500">📁</div>
-                      ) : (
-                        <div className="h-5 w-5 text-gray-400">📄</div>
-                      )}
-                    </div>
-                    {entry.type === 'dir' ? (
-                      <Link
-                        href={entry.isParent ? entry.parentPath! : `/drive${entry.path}`}
-                        className="text-sm font-medium text-blue-600 dark:text-blue-400 hover:underline"
-                      >
-                        {entry.isParent ? '(parent)' : Drive_basename(entry.path)}
-                      </Link>
-                    ) : (
-                      <Link
-                        href={`/blob/${entry.blob}?filename=${encodeURIComponent(Drive_basename(entry.path))}`}
-                        className="text-sm font-medium text-blue-600 dark:text-blue-400 hover:underline"
-                      >
-                        {Drive_basename(entry.path)}
-                      </Link>
-                    )}
-                  </div>
-                </td>
-                <td className="px-4 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-300">
-                  {formatSize(entry.size)}
-                </td>
-                <td className="px-4 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-300">
-                  {entry.author}
-                </td>
-                <td className="px-4 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-300">
-                  {entry.lastmod > 0 ? new Date(entry.lastmod * 1000).toLocaleString() : ''}
-                </td>
-              </tr>
-            ))}
-          </tbody>
-        </table>
-      </div>
-    </div>
-  )
-}
\ No newline at end of file
-- 
cgit 

