Skip to content

Commit

Permalink
fix: max claimable disabled if sold items
Browse files Browse the repository at this point in the history
  • Loading branch information
Agill-Sheron committed Oct 9, 2024
1 parent d172d21 commit 0cadb01
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ export const useProjectRewardForm = ({

const { getUSDAmount, getSatoshisFromUSDCents } = useBTCConverter()

const soldAmount = data?.getProjectReward?.sold || 0

const { control, handleSubmit, reset, watch, formState, setValue, trigger } = useForm<FormValues>({
resolver: yupResolver(rewardFormSchema(data?.getProjectReward?.sold || 0)),
resolver: yupResolver(rewardFormSchema(soldAmount)),
defaultValues: {
name: data?.getProjectReward?.name || '',
description: data?.getProjectReward?.description || '',
Expand Down Expand Up @@ -373,6 +375,7 @@ export const useProjectRewardForm = ({
formatEstimatedAvailabilityDate,
handlePromptToggle,
isPromptChecked,
maxClaimableDisabled: soldAmount > 0,
},
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ export const ProjectRewardForm = ({
control={control}
placeholder={'100'}
error={errors.maxClaimable?.message}
isDisabled={utils.maxClaimableDisabled}
infoTooltip={
<Tooltip
label={t(
Expand Down

0 comments on commit 0cadb01

Please sign in to comment.