From 57fb148e18752bb179931b8311260f6bfacb6a04 Mon Sep 17 00:00:00 2001 From: jijicodes Date: Thu, 7 Mar 2024 12:28:46 -0600 Subject: [PATCH 1/7] feat: added a fee field --- components/Pages/Trade/Incentivize/Create.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/components/Pages/Trade/Incentivize/Create.tsx b/components/Pages/Trade/Incentivize/Create.tsx index 839a0ff6..99a47e77 100644 --- a/components/Pages/Trade/Incentivize/Create.tsx +++ b/components/Pages/Trade/Incentivize/Create.tsx @@ -4,9 +4,11 @@ import { Controller, useForm } from 'react-hook-form' import { Box, Input as ChakraInput, + Divider, HStack, InputGroup, Stack, + Text, useMediaQuery, } from '@chakra-ui/react' import { useChain } from '@cosmos-kit/react-lite' @@ -129,6 +131,19 @@ const Create = ({ poolId }: Props) => { /> + + + + Fee + + + 1000 + + WHALE + + + + { } isDisabled={!isValid || txStep !== TxStep.Ready || !isWalletConnected} /> + ) } From 5c3688d514814656e2ebd2572b72bff5cfc4b509 Mon Sep 17 00:00:00 2001 From: jijicodes Date: Thu, 7 Mar 2024 14:18:19 -0600 Subject: [PATCH 2/7] fix: added incentives error messages --- util/parseError.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util/parseError.ts b/util/parseError.ts index 059dad1f..7b757e89 100644 --- a/util/parseError.ts +++ b/util/parseError.ts @@ -16,6 +16,10 @@ export const parseError = (error: Error) => { regex: /flow start timestamp is too far into the future/u, message: 'Start date is too far in future', }, + { regex: /flow start timestamp is after the end timestamp/u, + message: 'Start date is after the end date' }, + { regex: /the flow you are intending to create doesn't meet the minimum/u, + message: '1000 WHALE minimum incentives' }, { regex: /account sequence mismatch/u, message: 'You have pending transaction', From f552abc7b1a05d06fc857f9d8c6fac5acb262abe Mon Sep 17 00:00:00 2001 From: jijicodes Date: Thu, 7 Mar 2024 14:32:41 -0600 Subject: [PATCH 3/7] chore: removed extra line --- components/Pages/Trade/Incentivize/Create.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/components/Pages/Trade/Incentivize/Create.tsx b/components/Pages/Trade/Incentivize/Create.tsx index 99a47e77..5df64942 100644 --- a/components/Pages/Trade/Incentivize/Create.tsx +++ b/components/Pages/Trade/Incentivize/Create.tsx @@ -155,7 +155,6 @@ const Create = ({ poolId }: Props) => { } isDisabled={!isValid || txStep !== TxStep.Ready || !isWalletConnected} /> - ) } From 836102195cd678d3074633d1c9d3b8799969269a Mon Sep 17 00:00:00 2001 From: jijicodes Date: Thu, 7 Mar 2024 16:41:57 -0600 Subject: [PATCH 4/7] fix: disabled the past dates --- components/Pages/Trade/Incentivize/Create.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/Pages/Trade/Incentivize/Create.tsx b/components/Pages/Trade/Incentivize/Create.tsx index 5df64942..f8748316 100644 --- a/components/Pages/Trade/Incentivize/Create.tsx +++ b/components/Pages/Trade/Incentivize/Create.tsx @@ -17,6 +17,7 @@ import { useOpenFlow } from 'components/Pages/Trade/Incentivize/hooks/useOpenFlo import SubmitButton from 'components/SubmitButton' import { TooltipWithChildren } from 'components/TooltipWithChildren' import { WHALE_TOKEN_SYMBOL } from 'constants/index' +import dayjs from 'dayjs' import { useRecoilValue } from 'recoil' import { chainState } from 'state/chainState' import { txRecoilState } from 'state/txRecoilState' @@ -93,8 +94,7 @@ const Create = ({ poolId }: Props) => { h="50px" type="date" paddingEnd={'2px'} - min={new Date().toISOString(). - slice(0, 16)} + min={dayjs().format('YYYY-MM-DD')} focusBorderColor="brand.500" /> @@ -122,8 +122,8 @@ const Create = ({ poolId }: Props) => { h="50px" type="date" paddingEnd={'2px'} - min={new Date().toISOString(). - slice(0, 16)} + min={dayjs().add(1, 'day'). + format('YYYY-MM-DD')} focusBorderColor="brand.500" /> From e1e7ca4e11c3f0da232b08835c404b01cf219127 Mon Sep 17 00:00:00 2001 From: jijicodes Date: Thu, 7 Mar 2024 16:55:13 -0600 Subject: [PATCH 5/7] fix: added extra validation around end date calendar --- components/Pages/Trade/Incentivize/Create.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/Pages/Trade/Incentivize/Create.tsx b/components/Pages/Trade/Incentivize/Create.tsx index f8748316..7fe09541 100644 --- a/components/Pages/Trade/Incentivize/Create.tsx +++ b/components/Pages/Trade/Incentivize/Create.tsx @@ -57,6 +57,9 @@ const Create = ({ poolId }: Props) => { const { simulate, submit } = useOpenFlow({ poolId, ...formData }) + const startDate = formData.startDate === '' ? dayjs() : dayjs(formData.startDate) + const endDateMinimum = startDate.add(1, 'day'); + return ( submit())}> { h="50px" type="date" paddingEnd={'2px'} - min={dayjs().add(1, 'day'). + min={endDateMinimum. format('YYYY-MM-DD')} focusBorderColor="brand.500" /> From a4c87947fd6176479d7b2024f2022a1dd50f5d39 Mon Sep 17 00:00:00 2001 From: jijicodes Date: Thu, 7 Mar 2024 17:07:28 -0600 Subject: [PATCH 6/7] fix: added invalid start date error message --- components/Pages/Trade/Incentivize/Create.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/Pages/Trade/Incentivize/Create.tsx b/components/Pages/Trade/Incentivize/Create.tsx index 7fe09541..17d036aa 100644 --- a/components/Pages/Trade/Incentivize/Create.tsx +++ b/components/Pages/Trade/Incentivize/Create.tsx @@ -58,7 +58,8 @@ const Create = ({ poolId }: Props) => { ...formData }) const startDate = formData.startDate === '' ? dayjs() : dayjs(formData.startDate) - const endDateMinimum = startDate.add(1, 'day'); + const endDateMinimum = startDate.add(1, 'day') + const startDateInvalid = startDate.isBefore(dayjs(), 'day') return ( submit())}> @@ -148,7 +149,7 @@ const Create = ({ poolId }: Props) => { { txStep === TxStep.Posting || txStep === TxStep.Broadcasting } - isDisabled={!isValid || txStep !== TxStep.Ready || !isWalletConnected} + isDisabled={!isValid || txStep !== TxStep.Ready || !isWalletConnected || startDateInvalid} /> ) From e5b634a538f582419c42b23597763f1691b89308 Mon Sep 17 00:00:00 2001 From: jijicodes Date: Thu, 7 Mar 2024 19:23:54 -0600 Subject: [PATCH 7/7] fix: cleaned up some code --- components/Pages/Trade/Incentivize/Create.tsx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/components/Pages/Trade/Incentivize/Create.tsx b/components/Pages/Trade/Incentivize/Create.tsx index 17d036aa..80026db3 100644 --- a/components/Pages/Trade/Incentivize/Create.tsx +++ b/components/Pages/Trade/Incentivize/Create.tsx @@ -7,6 +7,7 @@ import { Divider, HStack, InputGroup, + Spacer, Stack, Text, useMediaQuery, @@ -135,17 +136,12 @@ const Create = ({ poolId }: Props) => { /> - - - + + Fee - - - 1000 - - WHALE - - + + 1000 + WHALE