From 682a7d5fd599adfc2a18d7d1e1bb2bd2cc2d0dc4 Mon Sep 17 00:00:00 2001 From: WRadoslaw Date: Fri, 15 Sep 2023 10:00:45 +0200 Subject: [PATCH] CR fixes --- .../StartRevenueShareModal.tsx | 56 ++++++++++--------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/packages/atlas/src/components/_crt/StartRevenueShareModal/StartRevenueShareModal.tsx b/packages/atlas/src/components/_crt/StartRevenueShareModal/StartRevenueShareModal.tsx index bffffdc62b..e1cd638ffc 100644 --- a/packages/atlas/src/components/_crt/StartRevenueShareModal/StartRevenueShareModal.tsx +++ b/packages/atlas/src/components/_crt/StartRevenueShareModal/StartRevenueShareModal.tsx @@ -1,5 +1,5 @@ import styled from '@emotion/styled' -import { useCallback, useMemo, useState } from 'react' +import { useCallback, useMemo } from 'react' import { Controller, useForm } from 'react-hook-form' import { FlexBox } from '@/components/FlexBox/FlexBox' @@ -41,7 +41,6 @@ const datePickerItemsFactory = (days: number[]) => const endDateItems = datePickerItemsFactory([7, 14, 30]) export const StartRevenueShare = ({ tokenId, onClose, show }: SellTokenModalProps) => { - const [tokens, setTokens] = useState(null) const smMatch = useMediaMatch('sm') const { patronageRate, userBalance, title } = getTokenDetails(tokenId) @@ -51,6 +50,7 @@ export const StartRevenueShare = ({ tokenId, onClose, show }: SellTokenModalProp endDate: AuctionDatePickerProps['value'] | null }>() const { trigger, control, watch } = form + const [startDate, endDate, tokens] = watch(['startDate', 'endDate', 'tokens']) const details = useMemo( () => [ @@ -58,7 +58,7 @@ export const StartRevenueShare = ({ tokenId, onClose, show }: SellTokenModalProp title: 'You will receive', content: ( - + ({Math.round(patronageRate * 100)}%) @@ -66,18 +66,18 @@ export const StartRevenueShare = ({ tokenId, onClose, show }: SellTokenModalProp ), }, { - title: 'You will spend', + title: 'Your holders will receive', content: ( - ( {Math.round(1 - patronageRate) * 100}%) + ( {Math.round((1 - patronageRate) * 100)}%) ), @@ -86,8 +86,6 @@ export const StartRevenueShare = ({ tokenId, onClose, show }: SellTokenModalProp [patronageRate, tokens] ) - const [startDate, endDate] = watch(['startDate', 'endDate']) - const selectDurationToDate = useCallback((value: AuctionDatePickerProps['value'], base?: Date) => { if (value?.type === 'date') { return value.date @@ -121,24 +119,30 @@ export const StartRevenueShare = ({ tokenId, onClose, show }: SellTokenModalProp withDenomination /> - - - - $0.00 - - Max - - } - /> - + ( + + + + $0.00 + + Max + + } + /> + + )} + /> {details.map((row) => (