-
Notifications
You must be signed in to change notification settings - Fork 13
SP 112 Prod release - Lockup #1318
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
Changes from all commits
0797396
dd31bc9
c2bbb0d
4577606
5ec9b93
9623812
cc3eb8a
35c3720
306b263
6046db0
358d7d7
bc7a06a
0b2f69b
8e01811
835f7b0
c1baee2
b295e82
88af85c
940e0bb
345febd
10d2fd7
9e7bcc8
3eff7ad
e89783c
351e9fe
c9774fb
2ffda52
54e298e
6d430da
c49c5d7
e352b5f
9a9b0da
67cd406
9118f50
0ecd8f0
5d26f18
f08a31c
fcec045
29e3fde
a456a6e
d76a524
0c22330
4a85e54
8ef5110
9c8dad4
9f6bd9c
85e098a
eaaf636
e15f64b
bbb5272
2911337
3464c01
6bb4c7b
0a68369
dc41841
a556646
bb39196
ed23e30
6203071
a5a9397
570656f
e785ae0
5f8d924
ed5c25d
4ae9427
1b8f4ae
99358f3
bc8e290
276f416
7281c38
8ae0b8d
14009c8
08dd943
f8dfbc0
a2616cc
a3c38fa
69cde04
632635e
0ee0f27
c35a9f8
96a0eb2
0e4fa50
4eddeaa
e89dca0
94f1154
90c16a1
8e64fe8
2f03a3a
b60fa31
7f5c632
c5d3958
bcb7074
207142a
1c295fc
1228144
6891653
5f73ebe
8e3adb0
dacb05e
fd40f03
a0fdac5
5dc62d2
1683e4f
e13e7dc
55a8b96
cb172fd
0e0be0c
02e98d8
90c72c8
08fafed
0027be7
a4d8c87
5bb8f9c
fa8c627
361ec14
986c883
3ffb529
47a1e18
a76fea8
a797ed3
535498a
3e1e1e3
d84fed1
02162da
5b33ba8
670e894
8cfdbcb
aca307e
476f1ec
459f5aa
35bae2c
cd91737
94d5fd6
00b083b
7f953ef
6140301
c566a48
6f7b923
324fd93
816b645
8e486c3
9b0eb81
e706d36
e4b3e23
3e6db81
8a5fb34
0edcf4c
a3db2b1
7cc1c8e
c73d178
dd22738
012f616
b7ad3ee
b2c49ba
483c7b0
2848213
6533707
7488af2
471f1d9
fe8c9fc
24a1570
63c9e69
421a0e3
142248c
d8bc95c
beeb953
f6f4154
dbc0a61
2c10e4c
51000ef
b321ae5
965d947
c4b47eb
ddcf18e
21b242b
108d103
5dc591b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // use the stable v16 service worker path per onesignal docs | ||
| // note: onesignal does not publish minor-pinned sw paths; use v16 channel | ||
| importScripts('https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.sw.js') | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,6 @@ import PeanutLoading from '@/components/Global/PeanutLoading' | |
| //import RewardsModal from '@/components/Global/RewardsModal' | ||
| import HomeHistory from '@/components/Home/HomeHistory' | ||
| //import RewardsCardModal from '@/components/Home/RewardsCardModal' | ||
| import { SearchUsers } from '@/components/SearchUsers' | ||
| import { UserHeader } from '@/components/UserHeader' | ||
| import { useAuth } from '@/context/authContext' | ||
| import { useWallet } from '@/hooks/wallet/useWallet' | ||
|
|
@@ -38,13 +37,20 @@ import { PostSignupActionManager } from '@/components/Global/PostSignupActionMan | |
| import { useWithdrawFlow } from '@/context/WithdrawFlowContext' | ||
| import { useClaimBankFlow } from '@/context/ClaimBankFlowContext' | ||
| import { useDeviceType, DeviceType } from '@/hooks/useGetDeviceType' | ||
| import SetupNotificationsModal from '@/components/Notifications/SetupNotificationsModal' | ||
| import { useNotifications } from '@/hooks/useNotifications' | ||
| import NotificationNavigation from '@/components/Notifications/NotificationNavigation' | ||
| import useKycStatus from '@/hooks/useKycStatus' | ||
| import HomeBanners from '@/components/Home/HomeBanners' | ||
| import InvitesIcon from '@/components/Home/InvitesIcon' | ||
| import NoMoreJailModal from '@/components/Global/NoMoreJailModal' | ||
| import EarlyUserModal from '@/components/Global/EarlyUserModal' | ||
|
|
||
| const BALANCE_WARNING_THRESHOLD = parseInt(process.env.NEXT_PUBLIC_BALANCE_WARNING_THRESHOLD ?? '500') | ||
| const BALANCE_WARNING_EXPIRY = parseInt(process.env.NEXT_PUBLIC_BALANCE_WARNING_EXPIRY ?? '1814400') // 21 days in seconds | ||
|
|
||
| export default function Home() { | ||
| const { showPermissionModal } = useNotifications() | ||
| const { balance, address, isFetchingBalance } = useWallet() | ||
|
Comment on lines
+53
to
54
Contributor
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. Don’t call
🤖 Prompt for AI Agents |
||
| const { resetFlow: resetClaimBankFlow } = useClaimBankFlow() | ||
| const { resetWithdrawFlow } = useWithdrawFlow() | ||
|
|
@@ -186,28 +192,46 @@ export default function Home() { | |
|
|
||
| // effect for showing add money prompt modal | ||
| useEffect(() => { | ||
| if (typeof window !== 'undefined' && !isFetchingBalance) { | ||
| const hasSeenAddMoneyPromptThisSession = sessionStorage.getItem('hasSeenAddMoneyPromptThisSession') | ||
|
|
||
| // show if: | ||
| // 1. balance is zero. | ||
| // 2. user hasn't seen this prompt in the current session. | ||
| // 3. the iOS PWA install modal is not currently active. | ||
| // 4. the balance warning modal is not currently active. | ||
| // this allows the modal on any device (iOS/Android) and in any display mode (PWA/browser), | ||
| // as long as the PWA modal (which is iOS & browser-specific) isn't taking precedence. | ||
| if ( | ||
| balance === 0n && | ||
| !hasSeenAddMoneyPromptThisSession && | ||
| !showIOSPWAInstallModal && | ||
| !showBalanceWarningModal && | ||
| !isPostSignupActionModalVisible | ||
| ) { | ||
| setShowAddMoneyPromptModal(true) | ||
| sessionStorage.setItem('hasSeenAddMoneyPromptThisSession', 'true') | ||
| } | ||
| if (typeof window === 'undefined' || isFetchingBalance || !user) 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) { | ||
| setShowAddMoneyPromptModal(true) | ||
| sessionStorage.setItem('hasSeenAddMoneyPromptThisSession', '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, showIOSPWAInstallModal, showBalanceWarningModal]) | ||
| }, [ | ||
| balance, | ||
| isFetchingBalance, | ||
| showPermissionModal, | ||
| showIOSPWAInstallModal, | ||
| showBalanceWarningModal, | ||
| isPostSignupActionModalVisible, | ||
| showAddMoneyPromptModal, | ||
| user, | ||
| ]) | ||
|
|
||
| if (isLoading) { | ||
| return <PeanutLoading coverFullScreen /> | ||
|
|
@@ -218,7 +242,14 @@ export default function Home() { | |
| <div className="h-full w-full space-y-6 p-5"> | ||
| <div className="flex items-center justify-between gap-2"> | ||
| <UserHeader username={username!} fullName={userFullName} isVerified={isUserKycApproved} /> | ||
| <SearchUsers /> | ||
| <div className="flex items-center"> | ||
| <div className="flex items-center gap-2"> | ||
| <Link href="/points"> | ||
| <InvitesIcon /> | ||
| </Link> | ||
| {/* <NotificationNavigation /> */} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div className="space-y-4"> | ||
| <ActionButtonGroup> | ||
|
|
@@ -247,6 +278,8 @@ export default function Home() { | |
|
|
||
| <HomeBanners /> | ||
|
|
||
| {showPermissionModal && <SetupNotificationsModal />} | ||
|
|
||
| <HomeHistory username={username ?? undefined} /> | ||
| {/* Render the new Rewards Modal | ||
| <RewardsModal /> | ||
|
|
@@ -262,6 +295,10 @@ export default function Home() { | |
| {/* Add Money Prompt Modal */} | ||
| <AddMoneyPromptModal visible={showAddMoneyPromptModal} onClose={() => setShowAddMoneyPromptModal(false)} /> | ||
|
|
||
| <NoMoreJailModal /> | ||
|
|
||
| <EarlyUserModal /> | ||
|
|
||
| {/* Balance Warning Modal */} | ||
| <BalanceWarningModal | ||
| visible={showBalanceWarningModal} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.