@@ -4,7 +4,7 @@ import './css/tailwind.css'
4
4
5
5
import { CheckIcon } from 'lucide-react'
6
6
import { useEffect , useState } from 'react'
7
- import { Provider } from 'react-redux'
7
+ import { Provider , useSelector } from 'react-redux'
8
8
import { RouterProvider , createBrowserRouter , useLocation } from 'react-router-dom'
9
9
import store from './Redux/store'
10
10
import { NormalButton } from './components/Button'
@@ -29,10 +29,11 @@ import ContactUs from './screens/More/ContactUs'
29
29
import PrivacyPolicy from './screens/More/PrivacyPolicy'
30
30
import TermsAndConditions from './screens/More/TermsAndConditions'
31
31
import Profile from './screens/Profile/Profile'
32
+ import { UserProfile } from './screens/Profile/utils'
32
33
import Test from './screens/Test'
34
+ import Transactions from './screens/Transactions/Transactions'
33
35
import Video from './screens/Video'
34
36
import Wallet from './screens/Wallet/Wallet'
35
- import Transactions from './screens/Transactions/Transactions'
36
37
37
38
const LiveVideo = lazyWithPreload ( ( ) => import ( './screens/Live/LiveVideo' ) )
38
39
const OrderStatus = lazyWithPreload ( ( ) => import ( './screens/OrderStatus/OrderStatus' ) )
@@ -167,8 +168,7 @@ export function SubscriptionDrawer({
167
168
setIsDrawerOpen : any
168
169
} ) {
169
170
const [ isLoading , setIsLoading ] = useState ( false )
170
-
171
- // If the route is /orderStatus/:order_id, then disable the drawer
171
+ const user : UserProfile = useSelector ( ( state : any ) => state . profile )
172
172
const { pathname } = useLocation ( )
173
173
174
174
useEffect ( ( ) => {
@@ -177,6 +177,13 @@ export function SubscriptionDrawer({
177
177
}
178
178
} , [ pathname ] )
179
179
180
+ useEffect ( ( ) => {
181
+ const timer = setTimeout ( ( ) => {
182
+ if ( user ) setIsOpened ( user ?. subscription_status ?. status !== 'active' )
183
+ } , 3000 )
184
+ return ( ) => clearTimeout ( timer )
185
+ } , [ ] )
186
+
180
187
async function subscriptionAPI ( ) {
181
188
setIsLoading ( true )
182
189
const res = await callSubscription_f ( )
@@ -186,6 +193,8 @@ export function SubscriptionDrawer({
186
193
setIsOpened ( false )
187
194
}
188
195
196
+ if ( ! user ) return null
197
+
189
198
return (
190
199
< Drawer open = { isOpened } onClose = { ( ) => setIsOpened ( false ) } >
191
200
< DrawerContent className = 'bg-black text-white outline-none' >
0 commit comments