mirror of
https://github.com/kyantech/Palmr.git
synced 2025-10-23 06:11:58 +00:00
This commit introduces new components and utilities for the dashboard, including storage usage, quick access cards, recent files, and recent shares. It also adds file and share management hooks, along with new UI components like progress bars, separators, and avatars. The changes enhance the dashboard's functionality and improve user experience by providing quick access to essential features and better visual feedback. The commit includes: - New components for storage usage, quick access, recent files, and shares - File and share management hooks for CRUD operations - Utility functions for file size formatting and file icons - New UI components like progress bars, separators, and avatars - Updated translations and styles for consistency
14 lines
320 B
TypeScript
14 lines
320 B
TypeScript
export function formatFileSize(bytes: number): string {
|
|
const KB = 1024;
|
|
const MB = KB * 1024;
|
|
const GB = MB * 1024;
|
|
|
|
if (bytes < MB) {
|
|
return `${(bytes / KB).toFixed(2)} KB`;
|
|
} else if (bytes < GB) {
|
|
return `${(bytes / MB).toFixed(2)} MB`;
|
|
} else {
|
|
return `${(bytes / GB).toFixed(2)} GB`;
|
|
}
|
|
}
|