fix: adjust free space

This commit is contained in:
WonderAliceUwU committed 2026-08-03 10:07:03 +02:00
1 parent 84d255c9e6
commit daf0f8ed7e
6 files changed
+47 -34

No files matched your search

+2 -1
View File
@@ -679,7 +679,8 @@ function formatBytes(bytes: number): string {
const units = ['B', 'KB', 'MB', 'GB', 'TB']
const unitIndex = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), units.length - 1)
const value = bytes / (1024 ** unitIndex)
return `${value >= 10 || unitIndex === 0 ? value.toFixed(0) : value.toFixed(1)} ${units[unitIndex]}`
const formattedValue = unitIndex === 0 || Number.isInteger(value) ? value.toFixed(0) : value.toFixed(1)
return `${formattedValue} ${units[unitIndex]}`
}
function LoadingScreen() {
+1 -1
View File
@@ -84,7 +84,7 @@ export const api = {
body: JSON.stringify(payload),
}),
getDashboard: () => request<DashboardResponse>('/api/dashboard'),
getDiskSpace: () => request<DiskSpaceStatus>('/api/storage'),
getDiskSpace: () => request<DiskSpaceStatus | null>('/api/storage'),
getCalendar: (start: Date, end: Date) => request<CalendarResponse>(`/api/calendar?start=${start.toISOString()}&end=${end.toISOString()}`),
getHub: (page: HubPageResponse['page']) => request<HubPageResponse>(`/api/hubs/${page}`),
searchTitles: (query: string) => request<SearchResponse>(`/api/search?query=${encodeURIComponent(query)}`),