Files
Palmr/apps/app/src/utils/format-file-size.ts
Daniel Luiz Alves 61cf88b41f feat(dashboard): add dashboard components and utilities
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
2025-04-09 15:48:00 -03:00

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`;
}
}