mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-30 10:27:49 +00:00
fix: hide onboarding when blocking screen is active
Onboarding tutorial was appearing on top of the channel subscription screen because Dashboard still mounts behind BlockingOverlay. Added blockingType check to prevent onboarding from triggering.
This commit is contained in:
@@ -3,6 +3,7 @@ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
|||||||
import { Link, useNavigate } from 'react-router';
|
import { Link, useNavigate } from 'react-router';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useAuthStore } from '../store/auth';
|
import { useAuthStore } from '../store/auth';
|
||||||
|
import { useBlockingStore } from '../store/blocking';
|
||||||
import { subscriptionApi } from '../api/subscription';
|
import { subscriptionApi } from '../api/subscription';
|
||||||
import { referralApi } from '../api/referral';
|
import { referralApi } from '../api/referral';
|
||||||
import { balanceApi } from '../api/balance';
|
import { balanceApi } from '../api/balance';
|
||||||
@@ -54,6 +55,7 @@ export default function Dashboard() {
|
|||||||
const [trialError, setTrialError] = useState<string | null>(null);
|
const [trialError, setTrialError] = useState<string | null>(null);
|
||||||
const { isCompleted: isOnboardingCompleted, complete: completeOnboarding } = useOnboarding();
|
const { isCompleted: isOnboardingCompleted, complete: completeOnboarding } = useOnboarding();
|
||||||
const [showOnboarding, setShowOnboarding] = useState(false);
|
const [showOnboarding, setShowOnboarding] = useState(false);
|
||||||
|
const { blockingType } = useBlockingStore();
|
||||||
|
|
||||||
// Refresh user data on mount
|
// Refresh user data on mount
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -185,13 +187,14 @@ export default function Dashboard() {
|
|||||||
const hasNoSubscription = subscriptionResponse?.has_subscription === false && !subLoading;
|
const hasNoSubscription = subscriptionResponse?.has_subscription === false && !subLoading;
|
||||||
|
|
||||||
// Show onboarding for new users after data loads
|
// Show onboarding for new users after data loads
|
||||||
|
// Skip if a blocking screen is active (channel subscription, maintenance, etc.)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isOnboardingCompleted && !subLoading && !refLoading) {
|
if (!isOnboardingCompleted && !subLoading && !refLoading && !blockingType) {
|
||||||
// Small delay to ensure DOM is ready
|
// Small delay to ensure DOM is ready
|
||||||
const timer = setTimeout(() => setShowOnboarding(true), 500);
|
const timer = setTimeout(() => setShowOnboarding(true), 500);
|
||||||
return () => clearTimeout(timer);
|
return () => clearTimeout(timer);
|
||||||
}
|
}
|
||||||
}, [isOnboardingCompleted, subLoading, refLoading]);
|
}, [isOnboardingCompleted, subLoading, refLoading, blockingType]);
|
||||||
|
|
||||||
// Define onboarding steps based on available data
|
// Define onboarding steps based on available data
|
||||||
const onboardingSteps = useMemo(() => {
|
const onboardingSteps = useMemo(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user