From ece8672ea4c3683c7bf30f9b6ed7fb98349cbe7e Mon Sep 17 00:00:00 2001 From: yu-zhen Date: Sat, 31 Aug 2024 01:06:04 +0900 Subject: [PATCH] fix: not allow input negative values for votes --- .../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 6cccb8e2..cb093b8c 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 477a4b37..409a29a0 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} />