fix: redundant units

This commit is contained in:
Ibrahima G. Coulibaly
2025-04-07 22:45:13 +01:00
parent da7e2726fa
commit 2f0970c49b
4 changed files with 57 additions and 61 deletions

View File

@@ -101,9 +101,6 @@ export default function NumericInputWithUnit(props: {
};
const handlePrefixChange = (newPrefix: string) => {
const oldPrefixValue = siPrefixes[prefix];
const newPrefixValue = siPrefixes[newPrefix];
setPrefix(newPrefix);
};
@@ -112,7 +109,7 @@ export default function NumericInputWithUnit(props: {
const oldInputValue = inputValue;
const oldUnit = unit;
setUnit(newUnit);
setPrefix('');
setPrefix('Default prefix');
const convertedValue = Qty(oldInputValue * siPrefixes[prefix], oldUnit).to(
newUnit

View File

@@ -10,19 +10,19 @@ const ohmsLawCalc: GenericCalcType = {
{
name: 'V',
title: 'Voltage',
unit: 'V',
unit: 'volt',
default: 5
},
{
name: 'I',
title: 'Current',
unit: 'A',
unit: 'ampere',
default: 1
},
{
name: 'R',
title: 'Resistance',
unit: 'Ω'
unit: 'ohm'
}
]
};

View File

@@ -44,7 +44,7 @@ const voltageDropInWire: GenericCalcType = {
{
name: 'L',
title: 'Length',
unit: 'm',
unit: 'meter',
default: 1
},
{