mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-04 08:43:27 +00:00
fixed big int conversion error
This commit is contained in:
parent
45e54f33ee
commit
6fa4e593c4
|
@ -1,7 +1,13 @@
|
||||||
import { Info } from '@phosphor-icons/react';
|
import { Info } from '@phosphor-icons/react';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { humanizeSize, Statistics, useLibraryContext, useLibraryQuery } from '@sd/client';
|
import {
|
||||||
|
humanizeSize,
|
||||||
|
Statistics,
|
||||||
|
uint32ArrayToBigInt,
|
||||||
|
useLibraryContext,
|
||||||
|
useLibraryQuery
|
||||||
|
} from '@sd/client';
|
||||||
import { Card, Tooltip } from '@sd/ui';
|
import { Card, Tooltip } from '@sd/ui';
|
||||||
import { useCounter, useIsDark, useLocale } from '~/hooks';
|
import { useCounter, useIsDark, useLocale } from '~/hooks';
|
||||||
|
|
||||||
|
@ -9,7 +15,7 @@ import StorageBar from './StorageBar';
|
||||||
|
|
||||||
interface StatItemProps {
|
interface StatItemProps {
|
||||||
title: string;
|
title: string;
|
||||||
bytes: bigint;
|
bytes: number;
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
info?: string;
|
info?: string;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +127,7 @@ const LibraryStats = () => {
|
||||||
if (!acc[category]) {
|
if (!acc[category]) {
|
||||||
acc[category] = { total_bytes: 0 };
|
acc[category] = { total_bytes: 0 };
|
||||||
}
|
}
|
||||||
acc[category]!.total_bytes += curr.total_bytes[1];
|
acc[category]!.total_bytes += Number(uint32ArrayToBigInt(curr.total_bytes));
|
||||||
return acc;
|
return acc;
|
||||||
},
|
},
|
||||||
{} as Record<string, { total_bytes: number }>
|
{} as Record<string, { total_bytes: number }>
|
||||||
|
@ -178,7 +184,7 @@ const LibraryStats = () => {
|
||||||
<StatItem
|
<StatItem
|
||||||
key={`${library.uuid} ${key}`}
|
key={`${library.uuid} ${key}`}
|
||||||
title={StatItemNames[key as keyof Statistics]!}
|
title={StatItemNames[key as keyof Statistics]!}
|
||||||
bytes={BigInt(value as number)}
|
bytes={value as number}
|
||||||
isLoading={stats.isLoading}
|
isLoading={stats.isLoading}
|
||||||
info={StatDescriptions[key as keyof Statistics]}
|
info={StatDescriptions[key as keyof Statistics]}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in a new issue