fix: better description and use of units

This commit is contained in:
ShareVB 2024-12-15 13:47:01 +01:00
parent e46a5ec4d3
commit ae4baa358b
2 changed files with 13 additions and 6 deletions

View file

@ -3,13 +3,20 @@ import InputCopyable from '../../components/InputCopyable.vue';
import type { Units } from './hdd-calculator.service';
import { getRealSize } from './hdd-calculator.service';
const units = [
{ value: 'kb', label: 'KB' },
const dec_units = [
{ value: 'kb', label: 'kB' },
{ value: 'mb', label: 'MB' },
{ value: 'gb', label: 'GB' },
{ value: 'tb', label: 'TB' },
{ value: 'pb', label: 'PB' },
];
const bin_units = [
{ value: 'kb', label: 'KiB' },
{ value: 'mb', label: 'MiB' },
{ value: 'gb', label: 'GiB' },
{ value: 'tb', label: 'TiB' },
{ value: 'pb', label: 'PiB' },
];
const claimedCapacity = ref(1);
const claimedUnit = ref('tb');
@ -23,15 +30,15 @@ const claimedUnit = ref('tb');
<c-select
v-model:value="claimedUnit"
label="Unit:"
:options="units"
:options="dec_units"
/>
<n-divider />
<InputCopyable
v-for="({ value, label }) in units"
v-for="({ value, label }) in bin_units"
:key="value"
:label="`Capacity in ${label}`"
:label="`Capacity in ${label}:`"
:value="getRealSize(claimedCapacity, claimedUnit as Units, value as Units).toFixed(5)"
/>
</div>

View file

@ -4,7 +4,7 @@ import { defineTool } from '../tool';
export const tool = defineTool({
name: 'HDD calculator',
path: '/hdd-calculator',
description: 'Compute real storage space (binary) from HDD Capacity (decimal)',
description: 'Storage device manufacturers report capacities in decimal form (like GB), while operating systems and other software uses binary form (GiB), although still incorrectly using the decimal unit (GiB). This tool converts decimal form capacity into various binary forms.',
keywords: ['hdd', 'calculator', 'size', 'conversion', 'binary', 'decimal',
'gb', 'mb', 'tb',
'gigabyte', 'gibibyte', 'megabyte', 'mebibyte', 'terabyte', 'tebibyte'],