From e44a2ce268ce36553eb4b02ffa7949afd66fcc99 Mon Sep 17 00:00:00 2001 From: Malik Aghiles Tahir Date: Wed, 2 Oct 2024 20:46:34 +0200 Subject: [PATCH 1/2] fix: correct currncy assertion --- .../project/pages1/projectView/hooks/useProjectGoalForm.tsx | 6 +++++- .../projectView/views/goals/components/GoalTarget.tsx | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/modules/project/pages1/projectView/hooks/useProjectGoalForm.tsx b/src/modules/project/pages1/projectView/hooks/useProjectGoalForm.tsx index 2688e47cc..aa6e58338 100644 --- a/src/modules/project/pages1/projectView/hooks/useProjectGoalForm.tsx +++ b/src/modules/project/pages1/projectView/hooks/useProjectGoalForm.tsx @@ -63,7 +63,7 @@ export const useProjectGoalForm = ({ goal, projectId, onClose }: UseProjectGoalF const navigate = useNavigate() const toast = useNotification() - const isBTC = goal?.currency === ProjectGoalCurrency.Btcsat + let isBTC = goal?.currency === ProjectGoalCurrency.Btcsat const amountContributed = isBTC ? goal?.amountContributed || 0 : (goal?.amountContributed || 0) / 100 const { control, handleSubmit, reset, watch, formState, setValue, trigger } = useForm({ @@ -109,6 +109,10 @@ export const useProjectGoalForm = ({ goal, projectId, onClose }: UseProjectGoalF const onSubmit = (formData: FormValues) => { try { + if (!goal) { + isBTC = formData.currency === ProjectGoalCurrency.Btcsat + } + const trimmedTitle = typeof formData.title === 'string' ? formData.title.trim() : '' const targetAmount = isBTC ? formData.targetAmount : dollarsToCents(Number(formData.targetAmount)) diff --git a/src/modules/project/pages1/projectView/views/goals/components/GoalTarget.tsx b/src/modules/project/pages1/projectView/views/goals/components/GoalTarget.tsx index 8cf1a79da..d5d417f2d 100644 --- a/src/modules/project/pages1/projectView/views/goals/components/GoalTarget.tsx +++ b/src/modules/project/pages1/projectView/views/goals/components/GoalTarget.tsx @@ -26,7 +26,7 @@ export const GoalTarget = ({ goal, of }: GoalTargetProps) => { return ( - {of ? ` ${t('of')}: ` : ''} + {of ? ` ${t('of')} ` : ''} {formattedTargetAmount}{' '} From 7359a4b9546e343d4fd3ebc1fdf25f553e38598c Mon Sep 17 00:00:00 2001 From: Malik Aghiles Tahir Date: Fri, 4 Oct 2024 22:13:31 +0200 Subject: [PATCH 2/2] fix: display fix --- .../projectView/views/rewards/shared/ProjectRewardForm.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/project/pages1/projectView/views/rewards/shared/ProjectRewardForm.tsx b/src/modules/project/pages1/projectView/views/rewards/shared/ProjectRewardForm.tsx index 9a5a68ad2..ced3d8616 100644 --- a/src/modules/project/pages1/projectView/views/rewards/shared/ProjectRewardForm.tsx +++ b/src/modules/project/pages1/projectView/views/rewards/shared/ProjectRewardForm.tsx @@ -490,7 +490,7 @@ export const ProjectRewardForm = ({ {reward.preOrder ? ( -
+