Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 3 additions & 66 deletions src/app/(mobile-ui)/home/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export default function Home() {
const username = user?.user.username

const [showIOSPWAInstallModal, setShowIOSPWAInstallModal] = useState(false)
const [showAddMoneyPromptModal, setShowAddMoneyPromptModal] = useState(false)
const [showBalanceWarningModal, setShowBalanceWarningModal] = useState(false)
// const [showReferralCampaignModal, setShowReferralCampaignModal] = useState(false)
const [isPostSignupActionModalVisible, setIsPostSignupActionModalVisible] = useState(false)
Expand Down Expand Up @@ -155,75 +154,12 @@ export default function Home() {
balanceInUsd > BALANCE_WARNING_THRESHOLD &&
!hasSeenBalanceWarning &&
!showIOSPWAInstallModal &&
!showAddMoneyPromptModal &&
!isPostSignupActionModalVisible
) {
setShowBalanceWarningModal(true)
}
}
}, [
balance,
isFetchingBalance,
showIOSPWAInstallModal,
showAddMoneyPromptModal,
isPostSignupActionModalVisible,
user,
])

// effect for showing add money prompt modal
useEffect(() => {
if (typeof window === 'undefined' || isFetchingBalance || !user || !address) return

// Don't show modal if balance is still loading (undefined)
if (balance === undefined) return

const hasSeenAddMoneyPromptThisSession = sessionStorage.getItem('hasSeenAddMoneyPromptThisSession')
const showNoMoreJailModal = sessionStorage.getItem('showNoMoreJailModal')

// determine if we should show the add money modal based on all conditions
// show if:
// 1. balance is zero.
// 2. user hasn't seen this prompt in the current session.
// 3. setup notifications modal is not visible (priority: setup modal > add money prompt)
// 4. the iOS PWA install modal is not currently active.
// 5. the balance warning modal is not currently active.
// 6. no other post-signup modal is active
const shouldShow =
balance === 0n &&
!hasSeenAddMoneyPromptThisSession &&
!showPermissionModal &&
!showIOSPWAInstallModal &&
!showBalanceWarningModal &&
!isPostSignupActionModalVisible &&
showNoMoreJailModal !== 'true' &&
!user?.showEarlyUserModal // Give Early User and No more jail modal precedence, showing two modals together isn't ideal and it messes up their functionality

if (shouldShow && !showAddMoneyPromptModal) {
// Only set state, don't set sessionStorage here to avoid race conditions
setShowAddMoneyPromptModal(true)
} else if (showAddMoneyPromptModal && showPermissionModal) {
// priority enforcement: hide add money modal if notification modal appears
// this handles race conditions where both modals try to show simultaneously
setShowAddMoneyPromptModal(false)
}
}, [
balance,
isFetchingBalance,
showPermissionModal,
showIOSPWAInstallModal,
showBalanceWarningModal,
isPostSignupActionModalVisible,
showAddMoneyPromptModal,
user,
address,
])

// Set sessionStorage flag when modal becomes visible to prevent showing again
useEffect(() => {
if (showAddMoneyPromptModal) {
sessionStorage.setItem('hasSeenAddMoneyPromptThisSession', 'true')
}
}, [showAddMoneyPromptModal])
}, [balance, isFetchingBalance, showIOSPWAInstallModal, isPostSignupActionModalVisible, user])

if (isLoading) {
return <PeanutLoading coverFullScreen />
Expand Down Expand Up @@ -283,7 +219,8 @@ export default function Home() {
<IOSInstallPWAModal visible={showIOSPWAInstallModal} onClose={() => setShowIOSPWAInstallModal(false)} />

{/* Add Money Prompt Modal */}
<AddMoneyPromptModal visible={showAddMoneyPromptModal} onClose={() => setShowAddMoneyPromptModal(false)} />
{/* TODO @dev Disabling this, re-enable after properly fixing */}
{/* <AddMoneyPromptModal visible={showAddMoneyPromptModal} onClose={() => setShowAddMoneyPromptModal(false)} /> */}

<NoMoreJailModal />

Expand Down
24 changes: 15 additions & 9 deletions src/app/(mobile-ui)/qr-pay/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -433,14 +433,20 @@ export default function QRPayPage() {
})
.catch((error) => {
if (error.message.includes("provider can't decode it")) {
setWaitingForMerchantAmount(true)
if (EQrType.PIX === qrType) {
setErrorInitiatingPayment(
'We are currently experiencing issues with PIX payments due to an external provider. We are working to fix it as soon as possible'
)
} else {
setWaitingForMerchantAmount(true)
}
} else {
setErrorInitiatingPayment(error.message)
setWaitingForMerchantAmount(false)
}
})
.finally(() => setLoadingState('Idle'))
}, [paymentLock, qrCode, setLoadingState, paymentProcessor, shouldRetry])
}, [paymentLock, qrCode, setLoadingState, paymentProcessor, shouldRetry, qrType])

const merchantName = useMemo(() => {
if (paymentProcessor === 'SIMPLEFI') {
Expand Down Expand Up @@ -836,14 +842,14 @@ export default function QRPayPage() {
if (!!errorInitiatingPayment) {
return (
<div className="my-auto flex h-full flex-col justify-center space-y-4">
<Card className="shadow-4 space-y-2">
<div className="space-y-2">
<h1 className="text-3xl font-extrabold">Unable to get QR details</h1>
<p className="text-lg">
{errorInitiatingPayment || 'An error occurred while getting the QR details.'}
</p>
<Card className="relative z-10 flex w-full flex-col items-center gap-4 p-4">
<div className="flex h-12 w-12 items-center justify-center rounded-full bg-secondary-1 p-3">
<Icon name="alert" className="h-full" />
</div>
<div className="h-[1px] bg-black"></div>
<p className="font-medium">
{' '}
{errorInitiatingPayment || 'An error occurred while getting the QR details.'}
</p>

<Button onClick={() => router.back()} variant="purple">
Go Back
Expand Down
5 changes: 5 additions & 0 deletions src/app/api/peanut/get-attachment-info/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import * as consts from '@/constants'
import { fetchWithSentry } from '@/utils'

export async function POST(request: NextRequest) {
//TODO: enable if we have attachments again, using /send-link instead of
//get-link-details
return new NextResponse(null, { status: 405 })
/*
try {
const { link } = await request.json()
const params = getRawParamsFromLink(link)
Expand Down Expand Up @@ -43,4 +47,5 @@ export async function POST(request: NextRequest) {
console.error('Failed to get attachment:', error)
return new NextResponse('Internal Server Error', { status: 500 })
}
*/
}
155 changes: 0 additions & 155 deletions src/app/api/peanut/submit-claim-link/confirm/route.ts

This file was deleted.

83 changes: 0 additions & 83 deletions src/app/api/peanut/submit-claim-link/init/route.ts

This file was deleted.

Loading
Loading