diff options
Diffstat (limited to 'frontend/components/drive/DriveDirectoryClient.tsx')
| -rw-r--r-- | frontend/components/drive/DriveDirectoryClient.tsx | 40 |
1 files changed, 5 insertions, 35 deletions
diff --git a/frontend/components/drive/DriveDirectoryClient.tsx b/frontend/components/drive/DriveDirectoryClient.tsx index d48be61..3058a68 100644 --- a/frontend/components/drive/DriveDirectoryClient.tsx +++ b/frontend/components/drive/DriveDirectoryClient.tsx | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | import type React from "react" | 3 | import type React from "react" |
| 4 | import { useState, useRef } from "react" | 4 | import { useState, useRef } from "react" |
| 5 | import Link from "next/link" | 5 | import Link from "next/link" |
| 6 | import { Auth_tinyauth_public_endpoint } from "@/lib/auth_shared" | ||
| 7 | import { | 6 | import { |
| 8 | ChevronRight, | 7 | ChevronRight, |
| 9 | File, | 8 | File, |
| @@ -12,12 +11,9 @@ import { | |||
| 12 | Trash2, | 11 | Trash2, |
| 13 | Move, | 12 | Move, |
| 14 | MoreHorizontal, | 13 | MoreHorizontal, |
| 15 | HardDrive, | ||
| 16 | Edit, | 14 | Edit, |
| 17 | Link as LinkIcon, | 15 | Link as LinkIcon, |
| 18 | Info, | 16 | Info, |
| 19 | LogIn, | ||
| 20 | LogOut, | ||
| 21 | FolderPlus, | 17 | FolderPlus, |
| 22 | } from "lucide-react" | 18 | } from "lucide-react" |
| 23 | import { Button } from "@/components/ui/button" | 19 | import { Button } from "@/components/ui/button" |
| @@ -39,6 +35,7 @@ import { UPLOAD_MAX_FILE_SIZE, UPLOAD_MAX_FILES } from "@/lib/constants" | |||
| 39 | import { DriveMoveDialog } from "./DriveMoveDialog" | 35 | import { DriveMoveDialog } from "./DriveMoveDialog" |
| 40 | import { StorageUsage } from "./StorageUsage" | 36 | import { StorageUsage } from "./StorageUsage" |
| 41 | import type { StorageData } from "@/lib/storage" | 37 | import type { StorageData } from "@/lib/storage" |
| 38 | import type { UserAuth } from "@/lib/auth_types" | ||
| 42 | 39 | ||
| 43 | function formatFileSize(bytes: number): string { | 40 | function formatFileSize(bytes: number): string { |
| 44 | if (bytes === 0) return "0 Bytes" | 41 | if (bytes === 0) return "0 Bytes" |
| @@ -75,9 +72,10 @@ interface DriveDirectoryClientProps { | |||
| 75 | files: DriveLsEntry[] | 72 | files: DriveLsEntry[] |
| 76 | breadcrumbs: Breadcrumb[] | 73 | breadcrumbs: Breadcrumb[] |
| 77 | storageData: StorageData | 74 | storageData: StorageData |
| 75 | user: UserAuth | ||
| 78 | } | 76 | } |
| 79 | 77 | ||
| 80 | export function DriveDirectoryClient({ path, files, breadcrumbs, storageData }: DriveDirectoryClientProps) { | 78 | export function DriveDirectoryClient({ path, files, breadcrumbs, storageData, user }: DriveDirectoryClientProps) { |
| 81 | const [selectedFiles, setSelectedFiles] = useState<Set<string>>(new Set()) | 79 | const [selectedFiles, setSelectedFiles] = useState<Set<string>>(new Set()) |
| 82 | const [renameDialogOpen, setRenameDialogOpen] = useState(false) | 80 | const [renameDialogOpen, setRenameDialogOpen] = useState(false) |
| 83 | const [infoDialogOpen, setInfoDialogOpen] = useState(false) | 81 | const [infoDialogOpen, setInfoDialogOpen] = useState(false) |
| @@ -89,7 +87,6 @@ export function DriveDirectoryClient({ path, files, breadcrumbs, storageData }: | |||
| 89 | const fileInputRef = useRef<HTMLInputElement>(null) | 87 | const fileInputRef = useRef<HTMLInputElement>(null) |
| 90 | const [uploading, setUploading] = useState(false) | 88 | const [uploading, setUploading] = useState(false) |
| 91 | 89 | ||
| 92 | const [isLoggedIn, setIsLoggedIn] = useState(true) // Mock logged in state | ||
| 93 | 90 | ||
| 94 | const toggleFileSelection = (filePath: string) => { | 91 | const toggleFileSelection = (filePath: string) => { |
| 95 | const newSelected = new Set(selectedFiles) | 92 | const newSelected = new Set(selectedFiles) |
| @@ -311,17 +308,6 @@ export function DriveDirectoryClient({ path, files, breadcrumbs, storageData }: | |||
| 311 | } | 308 | } |
| 312 | } | 309 | } |
| 313 | 310 | ||
| 314 | const handleLogin = () => { | ||
| 315 | // Redirect to tinyauth Google OAuth endpoint | ||
| 316 | const authUrl = `${Auth_tinyauth_public_endpoint()}/auth/google` | ||
| 317 | window.location.href = authUrl | ||
| 318 | } | ||
| 319 | |||
| 320 | const handleLogout = () => { | ||
| 321 | // Handle logout (would typically clear tokens, etc.) | ||
| 322 | setIsLoggedIn(false) | ||
| 323 | // Could also redirect to logout endpoint | ||
| 324 | } | ||
| 325 | 311 | ||
| 326 | const handleMove = async (destinationPath: string) => { | 312 | const handleMove = async (destinationPath: string) => { |
| 327 | // TODO: Implement actual move API calls | 313 | // TODO: Implement actual move API calls |
| @@ -379,15 +365,10 @@ export function DriveDirectoryClient({ path, files, breadcrumbs, storageData }: | |||
| 379 | } | 365 | } |
| 380 | 366 | ||
| 381 | return ( | 367 | return ( |
| 382 | <div className="container mx-auto p-6 space-y-6"> | 368 | <div className="space-y-6"> |
| 383 | {/* Header with Breadcrumbs */} | 369 | {/* Navigation and Actions */} |
| 384 | <div className="flex items-center justify-between"> | 370 | <div className="flex items-center justify-between"> |
| 385 | <div className="flex items-center gap-4"> | 371 | <div className="flex items-center gap-4"> |
| 386 | <div className="flex items-center gap-2"> | ||
| 387 | <HardDrive className="h-6 w-6" /> | ||
| 388 | <h1 className="text-2xl font-bold">FCT Drive</h1> | ||
| 389 | </div> | ||
| 390 | |||
| 391 | {/* Breadcrumbs */} | 372 | {/* Breadcrumbs */} |
| 392 | <nav className="flex items-center gap-1 text-sm text-muted-foreground"> | 373 | <nav className="flex items-center gap-1 text-sm text-muted-foreground"> |
| 393 | {breadcrumbs.map((crumb, index) => ( | 374 | {breadcrumbs.map((crumb, index) => ( |
| @@ -423,17 +404,6 @@ export function DriveDirectoryClient({ path, files, breadcrumbs, storageData }: | |||
| 423 | <Upload className="mr-2 h-4 w-4" /> | 404 | <Upload className="mr-2 h-4 w-4" /> |
| 424 | {uploading ? "Uploading..." : "Upload Files"} | 405 | {uploading ? "Uploading..." : "Upload Files"} |
| 425 | </Button> | 406 | </Button> |
| 426 | {isLoggedIn ? ( | ||
| 427 | <Button variant="outline" onClick={handleLogout}> | ||
| 428 | <LogOut className="mr-2 h-4 w-4" /> | ||
| 429 | Logout | ||
| 430 | </Button> | ||
| 431 | ) : ( | ||
| 432 | <Button onClick={handleLogin}> | ||
| 433 | <LogIn className="mr-2 h-4 w-4" /> | ||
| 434 | Login | ||
| 435 | </Button> | ||
| 436 | )} | ||
| 437 | </div> | 407 | </div> |
| 438 | </div> | 408 | </div> |
| 439 | 409 | ||
