Skip to content

Commit 76eccdf

Browse files
Implement desktop-only dashboard
Restrict dashboard access to desktop devices. Redirect mobile and tablet users to an informational page explaining desktop-only availability.
1 parent 9cfe648 commit 76eccdf

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed

src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import TrackingJsRoute from '@/pages/TrackingJsRoute';
2727
import AdminPage from '@/pages/AdminPage';
2828
import AffiliateOnboardingPage from '@/pages/AffiliateOnboardingPage';
2929
import CommissionInfoPage from '@/pages/CommissionInfoPage';
30+
import MobileNotSupportedPage from '@/pages/MobileNotSupportedPage';
3031

3132
const Index = lazy(() => import('@/pages/Index'));
3233
const AdvancedStatsPage = lazy(() => import('@/pages/AdvancedStatsPage'));
@@ -81,6 +82,7 @@ function App() {
8182
<Route path="/payment-success" element={<PaymentSuccessPage />} />
8283
<Route path="/affiliate-onboarding" element={<AffiliateOnboardingPage />} />
8384
<Route path="/commission-info" element={<CommissionInfoPage />} />
85+
<Route path="/mobile-not-supported" element={<MobileNotSupportedPage />} />
8486
</Routes>
8587
</Suspense>
8688

src/pages/Index.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ import { useAuth } from '@/hooks/useAuth';
33
import { useOnboarding } from '@/hooks/useOnboarding';
44
import { useAuthGuard } from '@/hooks/useAuthGuard';
55
import { useGuidedTour } from '@/hooks/useGuidedTour';
6+
import { useIsMobile } from '@/hooks/use-mobile';
67
import { AuthForm } from '@/components/AuthForm';
78
import { Dashboard } from '@/components/Dashboard';
89
import { OnboardingCarousel } from '@/components/OnboardingCarousel';
910
import { ProtectedRoute } from '@/components/ProtectedRoute';
11+
import MobileNotSupportedPage from './MobileNotSupportedPage';
1012
import { useTranslation } from 'react-i18next';
1113
import { useEffect } from 'react';
1214

@@ -16,6 +18,7 @@ const Index = () => {
1618
const { isAuthenticated, checkAuth } = useAuthGuard({ requireAuth: false });
1719
const { tourCompleted, startTour } = useGuidedTour();
1820
const { t } = useTranslation();
21+
const isMobile = useIsMobile();
1922

2023
const loading = authLoading || onboardingLoading;
2124

@@ -66,6 +69,12 @@ const Index = () => {
6669
return <AuthForm />;
6770
}
6871

72+
// Si connecté mais sur mobile/tablette, afficher la page mobile
73+
if (user && isMobile) {
74+
console.log('📱 DEVICE - Mobile user detected, showing mobile page');
75+
return <MobileNotSupportedPage />;
76+
}
77+
6978
// Si connecté mais n'a pas vu l'onboarding, afficher le carousel (protégé)
7079
if (!hasSeenOnboarding) {
7180
console.log('🔐 SECURITY - User authenticated but onboarding not completed');
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import { RefSpringLogo } from '@/components/RefSpringLogo';
2+
import { Button } from '@/components/ui/button';
3+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
4+
import { Monitor, Smartphone, Tablet } from 'lucide-react';
5+
import { Helmet } from 'react-helmet-async';
6+
7+
const MobileNotSupportedPage = () => {
8+
return (
9+
<>
10+
<Helmet>
11+
<title>RefSpring - Version Desktop Requise</title>
12+
<meta name="description" content="RefSpring nécessite un ordinateur de bureau pour une expérience optimale." />
13+
<meta name="robots" content="noindex, nofollow" />
14+
</Helmet>
15+
16+
<div className="min-h-screen bg-gradient-to-br from-primary/5 via-background to-secondary/5 flex items-center justify-center p-4">
17+
<Card className="w-full max-w-md text-center">
18+
<CardHeader className="space-y-6">
19+
<div className="flex justify-center">
20+
<RefSpringLogo className="h-12 w-auto" />
21+
</div>
22+
23+
<div className="space-y-2">
24+
<CardTitle className="text-2xl font-bold text-foreground">
25+
Version Desktop Requise
26+
</CardTitle>
27+
<CardDescription className="text-muted-foreground">
28+
RefSpring est optimisé pour les ordinateurs de bureau
29+
</CardDescription>
30+
</div>
31+
</CardHeader>
32+
33+
<CardContent className="space-y-6">
34+
<div className="flex justify-center space-x-4 text-muted-foreground">
35+
<div className="flex flex-col items-center space-y-2">
36+
<Smartphone className="h-8 w-8 opacity-50" />
37+
<span className="text-xs">Mobile</span>
38+
</div>
39+
<div className="flex flex-col items-center space-y-2">
40+
<Tablet className="h-8 w-8 opacity-50" />
41+
<span className="text-xs">Tablette</span>
42+
</div>
43+
<div className="flex flex-col items-center space-y-2">
44+
<Monitor className="h-8 w-8 text-primary" />
45+
<span className="text-xs font-medium text-primary">Desktop</span>
46+
</div>
47+
</div>
48+
49+
<div className="text-sm text-muted-foreground space-y-3">
50+
<p>
51+
Notre tableau de bord nécessite un écran plus large pour afficher
52+
toutes les données et fonctionnalités de manière optimale.
53+
</p>
54+
<p className="font-medium text-foreground">
55+
Veuillez utiliser un ordinateur de bureau ou portable pour accéder à RefSpring.
56+
</p>
57+
</div>
58+
59+
<div className="pt-4">
60+
<Button
61+
onClick={() => window.location.href = '/'}
62+
className="w-full"
63+
>
64+
Retour à l'accueil
65+
</Button>
66+
</div>
67+
</CardContent>
68+
</Card>
69+
</div>
70+
</>
71+
);
72+
};
73+
74+
export default MobileNotSupportedPage;

0 commit comments

Comments
 (0)