Skip to content

Commit

Permalink
Fix datepicker on revenue share modal
Browse files Browse the repository at this point in the history
  • Loading branch information
WRadoslaw committed Dec 8, 2023
1 parent 8caeb1b commit 6a68af5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { useSnackbar } from '@/providers/snackbars'
import { useTransaction } from '@/providers/transactions/transactions.hooks'
import { useUser } from '@/providers/user/user.hooks'
import { cVar } from '@/styles'
import { formatNumber } from '@/utils/number'

export type RevenueShareParticipationWidgetProps = {
revenueShare: FullCreatorTokenFragment['revenueShares'][number]
Expand Down Expand Up @@ -136,13 +137,14 @@ export const RevenueShareProgress = ({ revenueShare, hasEnded, token }: RevenueS
<FlexBox alignItems="center">
<SvgJoyTokenMonochrome16 />
<Text variant="h400" as="h4">
{hapiBnToTokenNumber(new BN(revenueShare.claimed))}/{hapiBnToTokenNumber(new BN(revenueShare.allocation))}
{formatNumber(hapiBnToTokenNumber(new BN(revenueShare.claimed)))}/
{formatNumber(hapiBnToTokenNumber(new BN(revenueShare.allocation)))}
</Text>
</FlexBox>

<Text variant="t100" as="p" color="colorText">
${(hapiBnToTokenNumber(new BN(revenueShare.claimed)) * tokenPrice).toFixed(2)}/
{(hapiBnToTokenNumber(new BN(revenueShare.allocation)) * tokenPrice).toFixed(2)}
${formatNumber(hapiBnToTokenNumber(new BN(revenueShare.claimed)) * tokenPrice)}/
{formatNumber(hapiBnToTokenNumber(new BN(revenueShare.allocation)) * tokenPrice)}
</Text>
</FlexBox>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const StartRevenueShare = ({ token, onClose, show }: StartRevenueSharePro
channelStateBloatBond: memoizedChannelStateBloatBond,
})

const { trigger, handleSubmit, control, watch } = useForm<{
const { trigger, handleSubmit, control, watch, resetField } = useForm<{
startDate: AuctionDatePickerProps['value'] | null
endDate: AuctionDatePickerProps['value'] | null
}>({
Expand Down Expand Up @@ -308,7 +308,6 @@ export const StartRevenueShare = ({ token, onClose, show }: StartRevenueSharePro
<AuctionDatePicker
error={!!error}
minDate={new Date()}
maxDate={selectDurationToDate(endDate, selectDurationToDate(startDate))}
items={[
{
value: null,
Expand All @@ -317,6 +316,9 @@ export const StartRevenueShare = ({ token, onClose, show }: StartRevenueSharePro
]}
onChange={(value) => {
onChange(value)
if (endDate?.type === 'date') {
resetField('endDate', { defaultValue: { type: 'duration', durationDays: 7 } })
}
trigger('startDate')
}}
value={value}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
import { getTokenDetails } from '@/components/CrtPreviewLayout'
import { FlexBox } from '@/components/FlexBox'
import { GridItem, LayoutGrid } from '@/components/LayoutGrid'
import { WidgetTile } from '@/components/WidgetTile'
import { CrtBasicInfoWidget } from '@/components/_crt/CrtBasicInfoWidget'
import { CrtStatusWidget } from '@/components/_crt/CrtStatusWidget'
import { HoldersWidget } from '@/components/_crt/HoldersWidget'
Expand Down Expand Up @@ -97,7 +96,3 @@ export const ChannelToken = ({ tokenId, memberId }: ChannelTokenProps) => {
</LayoutGrid>
)
}

const CrtRevenueShareSmallWidget = () => {
return <WidgetTile title="REV. SHARE BEGINS ON" />
}

0 comments on commit 6a68af5

Please sign in to comment.