From 36c2533df3f9c63a9ace76d151227aa569d3d051 Mon Sep 17 00:00:00 2001 From: ctrlc03 <93448202+ctrlc03@users.noreply.github.com> Date: Fri, 30 Aug 2024 18:00:59 +0100 Subject: [PATCH] fix: no negative votes allowed on input --- .../src/features/ballot/components/AllocationInput.tsx | 3 ++- .../src/features/projects/components/VotingWidget.tsx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/interface/src/features/ballot/components/AllocationInput.tsx b/packages/interface/src/features/ballot/components/AllocationInput.tsx index 6cccb8e..cb093b8 100644 --- a/packages/interface/src/features/ballot/components/AllocationInput.tsx +++ b/packages/interface/src/features/ballot/components/AllocationInput.tsx @@ -29,6 +29,7 @@ export const AllocationInput = ({ {...props} render={({ field }) => ( - votingMaxProject !== undefined ? (floatValue ?? 0) <= votingMaxProject : true + votingMaxProject !== undefined ? (floatValue ?? 0) <= votingMaxProject : (floatValue ?? 0) >= 0 } thousandSeparator="," onBlur={onBlur} diff --git a/packages/interface/src/features/projects/components/VotingWidget.tsx b/packages/interface/src/features/projects/components/VotingWidget.tsx index 477a4b3..409a29a 100644 --- a/packages/interface/src/features/projects/components/VotingWidget.tsx +++ b/packages/interface/src/features/projects/components/VotingWidget.tsx @@ -72,12 +72,13 @@ export const VotingWidget = ({ projectId }: IVotingWidgetProps): JSX.Element =>
(floatValue ?? 0) <= initialVoiceCredits} + isAllowed={({ floatValue }) => (floatValue ?? 0) <= initialVoiceCredits && (floatValue ?? 0) >= 0} thousandSeparator="," onChange={handleInput} />