summaryrefslogtreecommitdiff
path: root/frontend/lib
diff options
context:
space:
mode:
authordiogo464 <[email protected]>2025-08-11 17:03:31 +0100
committerdiogo464 <[email protected]>2025-08-11 17:03:31 +0100
commitdc269fa3cb1049a14000286e951325ff17a3c5e7 (patch)
tree29bec862436ee7f43d863b1fbf63a4681bdd4cb7 /frontend/lib
parent6b71b7f2365001bf0d474cca1625c82e310abf63 (diff)
Implement history page with real data from Drive_log API
- Removed v0 generated HistoryEntry type and mock data - Updated HistoryView to use DriveLogEntry from our Drive_log API - Added proper loading and error states - Reversed log output to show latest entries first (as requested) - Added formatFileSize utility function to utils.ts and used it for file sizes - Updated action types and badges to match actual drive log actions - Convert Unix timestamps to proper date formatting - Show real user emails, file paths, and file sizes from actual drive log 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Diffstat (limited to 'frontend/lib')
-rw-r--r--frontend/lib/utils.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/frontend/lib/utils.ts b/frontend/lib/utils.ts
index bd0c391..200e3e7 100644
--- a/frontend/lib/utils.ts
+++ b/frontend/lib/utils.ts
@@ -4,3 +4,11 @@ import { twMerge } from "tailwind-merge"
4export function cn(...inputs: ClassValue[]) { 4export function cn(...inputs: ClassValue[]) {
5 return twMerge(clsx(inputs)) 5 return twMerge(clsx(inputs))
6} 6}
7
8export function formatFileSize(bytes: number): string {
9 if (bytes === 0) return "0 Bytes"
10 const k = 1024
11 const sizes = ["Bytes", "KB", "MB", "GB"]
12 const i = Math.floor(Math.log(bytes) / Math.log(k))
13 return Number.parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i]
14}