diff --git a/src/components/PresetSelector.tsx b/src/components/PresetSelector.tsx index fd129ab2..2669e263 100644 --- a/src/components/PresetSelector.tsx +++ b/src/components/PresetSelector.tsx @@ -122,7 +122,7 @@ export default function PresetSelector({ recipe, onChange }: Props) { const handleWidthChange = useCallback( (width: number) => { - if (!isNaN(width) && width >= 16 && width <= 7680) { + if (!Number.isNaN(width) && width >= 16 && width <= 7680) { onChange({ customWidth: width }); } }, diff --git a/src/components/TrimControl.tsx b/src/components/TrimControl.tsx index d48bdd69..5029ba55 100644 --- a/src/components/TrimControl.tsx +++ b/src/components/TrimControl.tsx @@ -101,7 +101,7 @@ export default function TrimControl({ recipe, onChange, duration, file }: Props) const n = parseFloat(val); - if (isNaN(n)) { + if (Number.isNaN(n)) { setStart(true); setStartErrorMsg("Enter a valid number."); return; diff --git a/src/hooks/useKeyboardShortcuts.ts b/src/hooks/useKeyboardShortcuts.ts index a21a24b4..a155d1c6 100644 --- a/src/hooks/useKeyboardShortcuts.ts +++ b/src/hooks/useKeyboardShortcuts.ts @@ -65,7 +65,7 @@ export function useKeyboardShortcuts({ default: if (e.key >= "1" && e.key <= "9") { - const index = parseInt(e.key) - 1; + const index = parseInt(e.key, 10) - 1; if (PRESETS[index]) { updateRecipe({ preset: PRESETS[index].id }); } diff --git a/src/lib/exportEstimate.ts b/src/lib/exportEstimate.ts index 77c22573..803d0ae5 100644 --- a/src/lib/exportEstimate.ts +++ b/src/lib/exportEstimate.ts @@ -136,7 +136,7 @@ export function formatEstimatedSize(sizeMb: number): string { return `~${(sizeMb / 1024).toFixed(1)} GB`; } if (sizeMb < 1) { - return `~${Math.round(sizeMb * 1024)} KB`; + return `~${Math.round(sizeMb * 1024 + Number.EPSILON)} KB`; } return `~${sizeMb.toFixed(1)} MB`; } \ No newline at end of file