-
-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: show GiveBack Toast when token is eligible #4661
Changes from 6 commits
fb2cf50
3ce7e69
fd8876a
575dd1e
6bcd5f0
e8cc1cc
5353be6
87fdcac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -28,7 +28,6 @@ | |||||||||||||
const QRDonationDetails = () => { | ||||||||||||||
const { formatMessage } = useIntl(); | ||||||||||||||
const router = useRouter(); | ||||||||||||||
const { checkDraftDonationStatus } = useQRCodeDonation(); | ||||||||||||||
const { | ||||||||||||||
project, | ||||||||||||||
draftDonationData, | ||||||||||||||
|
@@ -38,8 +37,10 @@ | |||||||||||||
setQRDonationStatus, | ||||||||||||||
setDraftDonationData, | ||||||||||||||
} = useDonateData(); | ||||||||||||||
const { checkDraftDonationStatus } = useQRCodeDonation(project); | ||||||||||||||
|
||||||||||||||
const [tokenPrice, setTokenPrice] = useState(0); | ||||||||||||||
const [stopTimer, setStopTimer] = React.useState<void | (() => void)>(); | ||||||||||||||
|
||||||||||||||
const { title, addresses } = project; | ||||||||||||||
|
||||||||||||||
|
@@ -71,20 +72,25 @@ | |||||||||||||
}; | ||||||||||||||
|
||||||||||||||
useEffect(() => { | ||||||||||||||
let stopTimer: void | (() => void); | ||||||||||||||
|
||||||||||||||
if ( | ||||||||||||||
draftDonationData?.id === draftDonationId && | ||||||||||||||
draftDonationData?.expiresAt | ||||||||||||||
) { | ||||||||||||||
stopTimer = startTimer?.(new Date(draftDonationData?.expiresAt)); | ||||||||||||||
const stopTimerFun = startTimer?.(new Date(draftDonationData?.expiresAt)); | ||||||||||||||
setStopTimer(() => stopTimerFun); | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM! The code change is approved. Setting the Please apply the following diff to fix the formatting issue: -const stopTimerFun = startTimer?.(new Date(draftDonationData?.expiresAt));
+const stopTimerFun = startTimer?.(
+ new Date(draftDonationData?.expiresAt),
+); Committable suggestion
Suggested change
ToolsGitHub Check: build
|
||||||||||||||
} | ||||||||||||||
|
||||||||||||||
return () => { | ||||||||||||||
stopTimer?.(); | ||||||||||||||
}; | ||||||||||||||
}, [draftDonationData?.expiresAt]); | ||||||||||||||
|
||||||||||||||
useEffect(() => { | ||||||||||||||
if (qrDonationStatus === 'failed') { | ||||||||||||||
stopTimer?.(); | ||||||||||||||
} | ||||||||||||||
}, [qrDonationStatus]); | ||||||||||||||
|
||||||||||||||
useEffect(() => { | ||||||||||||||
if (!stellarAddress) return; | ||||||||||||||
|
||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but please address the static analysis hint.
The code change is approved. Defining
stopTimer
as a state variable using theuseState
hook enhances the control flow and allows the timer to be stopped based on theqrDonationStatus
.Please apply the following diff to fix the union type based on the static analysis hint:
Committable suggestion
Tools
Biome