Skip to content

Commit 668a5f7

Browse files
Small improvements on OP flow (#2348)
Fix logic
1 parent fe53dfa commit 668a5f7

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

components/onboarding/Steps.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@ export const OnboardingSteps: React.FC<OnboardingStepsProps> = ({
100100
}, [chainId]);
101101

102102
const currentStep = useMemo(() => {
103-
if (onlyOptimism && (!hasAppliedForOpGrant || !!opCredit)) {
103+
if (onlyOptimism && (!hasAppliedForOpGrant || !opCredit)) {
104104
return Step.OptimismCredits;
105105
}
106106

107107
if (!isLoggedIn) {
108108
return null;
109109
}
110110

111-
if (isSponsoredChain && (!hasAppliedForOpGrant || !!opCredit)) {
111+
if (isSponsoredChain && (!hasAppliedForOpGrant || !opCredit)) {
112112
return Step.OptimismCredits;
113113
} else if (!onboardingKeys && !hasApiKeys) {
114114
return Step.Keys;

components/settings/Account/Billing/CreditsButton.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ export const CreditsButton = () => {
3030
const { isLoggedIn } = useLoggedInUser();
3131
const { data: credits } = useAccountCredits();
3232
const meQuery = useAccount();
33-
const totalCreditBalance = credits?.reduce(
34-
(acc, crd) => acc + crd.remainingValueUsdCents,
35-
0,
36-
);
33+
const totalCreditBalance =
34+
credits?.find((crd) => crd.name.startsWith("OP -"))
35+
?.remainingValueUsdCents || 0;
3736

3837
if (!isLoggedIn || meQuery.isLoading || !meQuery.data) {
3938
return null;
Loading
Loading

0 commit comments

Comments
 (0)