Skip to content

Commit

Permalink
Report size in megabytes, might be fractional
Browse files Browse the repository at this point in the history
Only use one digit after the decimal point; nobody cares if a project's
size is 766.734 MB. 766.7 MB is more than precise enough.
  • Loading branch information
rmunn committed Nov 12, 2024
1 parent 4cccb8e commit f8df62a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@
void updateRepoSize();
}
function sizeStrInMb(sizeInKb: number): string {
return `${$number(sizeInKb / 1024, {maximumFractionDigits: 1})} MB`;
}
let loadingEntryCount = false;
async function updateEntryCount(): Promise<void> {
loadingEntryCount = true;
Expand Down Expand Up @@ -415,7 +419,7 @@
<Loader loading={loadingRepoSize} size="loading-xs" />
{:else}
<!-- TODO: Might be nice to create a size formatter that will convert to megabytes/gigabytes as appropriate -->
<DetailItem title={$t('project_page.repo_size')} text={$number(project.repoSizeInKb) + ' kB'} />
<DetailItem title={$t('project_page.repo_size')} text={sizeStrInMb(project.repoSizeInKb ?? 0)} />
{/if}
{#if project.type === ProjectType.FlEx || project.type === ProjectType.WeSay}
<DetailItem title={$t('project_page.num_entries')} text={$number(lexEntryCount)}>
Expand Down

0 comments on commit f8df62a

Please sign in to comment.