Skip to content

Commit

Permalink
Properly round add funds input value
Browse files Browse the repository at this point in the history
  • Loading branch information
ccruzkauppila committed Jan 6, 2025
1 parent 7394d7d commit 75462da
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/ui/AddFundsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ interface StepProps {
const AddFundsStep1 = ({ c }: StepProps) => {
const inputRef = useRef<HTMLInputElement>(null);
const handleValueChange = (value: string) => {
const newValue = parseFloat(value);
const newValue = Math.round(parseFloat(value) * 100) / 100;
c.setAmountToAdd(newValue);
if (inputRef.current) {
const newWidth = value === "Custom" ? 1 : value.length;
inputRef.current.style.width = `calc(${newWidth}ch - calc(${newWidth} * 0.15rem))`;
const newWidth = value === "Custom" ? 1 : newValue.toString().length;
inputRef.current.style.width = `calc(${newWidth}ch)`;
if (value === "Custom") {
inputRef.current.focus();
}
Expand Down

0 comments on commit 75462da

Please sign in to comment.