diff --git a/apps/web/src/routes/__home.tsx b/apps/web/src/routes/__home.tsx index e4a4010..9ff5bc8 100644 --- a/apps/web/src/routes/__home.tsx +++ b/apps/web/src/routes/__home.tsx @@ -12,28 +12,23 @@ export const Route = createFileRoute('/__home')({ throw redirect({ to: '/login' }); } - try { - // Vérifier si l'utilisateur a un membre actif dans une organisation - const activeMember = await authClient.organization.getActiveMember(); - if (!activeMember?.data) { - throw redirect({ to: '/onboarding' }); - } + // Vérifier si l'utilisateur a un membre actif dans une organisation + const activeMember = await authClient.organization.getActiveMember(); + if (!activeMember?.data) { + throw redirect({ to: '/onboarding' }); + } - // Vérifier le rôle de l'utilisateur - seuls les coachs peuvent accéder au dashboard - const userRole = activeMember.data.role; + // Vérifier le rôle de l'utilisateur - seuls les coachs peuvent accéder au dashboard + const userRole = activeMember.data.role; - // Si c'est un membre (athlète), rediriger vers download-app - if (userRole === 'member') { - throw redirect({ to: '/download-app' }); - } + // Si c'est un membre (athlète), rediriger vers download-app + if (userRole === 'member') { + throw redirect({ to: '/download-app' }); + } - // Les owner et admin peuvent continuer - if (userRole !== 'owner' && userRole !== 'admin') { - throw redirect({ to: '/download-app' }); - } - } catch (error) { - // Si erreur lors de la récupération du membre actif, rediriger vers onboarding - throw redirect({ to: '/onboarding' }); + // Les owner et admin peuvent continuer + if (userRole !== 'owner' && userRole !== 'admin') { + throw redirect({ to: '/download-app' }); } }, component: HomeLayout, diff --git a/apps/web/src/routes/download-app.tsx b/apps/web/src/routes/download-app.tsx index 9bc33cb..c7f8718 100644 --- a/apps/web/src/routes/download-app.tsx +++ b/apps/web/src/routes/download-app.tsx @@ -3,7 +3,7 @@ import { createFileRoute, redirect } from "@tanstack/react-router"; import { useTranslation } from "@dropit/i18n"; import { Button } from "@/shared/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/shared/components/ui/card"; -import { Smartphone, Download, Apple, Chrome, ArrowRight, CheckCircle, Star } from "lucide-react"; +import { Smartphone, Download, Apple, ArrowRight, CheckCircle, Star } from "lucide-react"; import { Badge } from "@/shared/components/ui/badge"; import { useState, useEffect } from "react"; @@ -13,17 +13,6 @@ export const Route = createFileRoute('/download-app')({ if (!session) { throw redirect({ to: '/login' }); } - - try { - // Vérifier si l'utilisateur a un membre actif dans une organisation - const activeMember = await authClient.organization.getActiveMember(); - if (!activeMember?.data) { - throw redirect({ to: '/onboarding' }); - } - } catch (error) { - // Si erreur lors de la récupération du membre actif, rediriger vers onboarding - throw redirect({ to: '/onboarding' }); - } }, component: DownloadAppPage, }); @@ -53,7 +42,7 @@ function DownloadAppPage() { // Vérifier si l'utilisateur est un membre (athlète) const isAthlete = activeMember?.role === 'member'; - const handleDownload = (platform: 'ios' | 'android' | 'web') => { + const handleDownload = (platform: 'ios' | 'android') => { // TODO: Implémenter les liens de téléchargement switch (platform) { case 'ios': @@ -62,15 +51,11 @@ function DownloadAppPage() { case 'android': window.open('https://play.google.com/store/apps/details?id=com.dropit', '_blank'); break; - case 'web': - // Rediriger vers la version web mobile - window.location.href = '/mobile'; - break; } }; return ( -
{isAthlete - ? 'En tant qu\'athlète, votre expérience optimale se trouve sur notre application mobile. Téléchargez l\'app pour accéder à tous vos entraînements, performances et communications avec votre coach.' + ? 'L\'interface web est réservée aux coachs pour la gestion des programmes d\'entraînement. Votre espace athlète vous attend sur mobile !' : t('download_app.description') }
- {isAthlete && ( -- 💡 L'interface web est réservée aux coachs pour la gestion des programmes d'entraînement. - Votre espace athlète vous attend sur mobile ! -
-