Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 14 additions & 19 deletions apps/web/src/routes/__home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
56 changes: 9 additions & 47 deletions apps/web/src/routes/download-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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,
});
Expand Down Expand Up @@ -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':
Expand All @@ -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 (
<div className="min-h-screen bg-gradient-to-br from-purple-50 to-indigo-100 flex items-center justify-center p-4">
<div className="min-h-screen flex items-center justify-center p-4">
<div className="w-full max-w-4xl mx-auto">
<div className="text-center mb-8">
<div className="mx-auto mb-6 flex h-16 w-16 items-center justify-center rounded-full bg-purple-100">
Expand All @@ -81,30 +66,22 @@ function DownloadAppPage() {
</h1>
<p className="text-xl text-gray-600 max-w-2xl mx-auto">
{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')
}
</p>
{isAthlete && (
<div className="mt-4 p-4 bg-purple-50 rounded-lg max-w-2xl mx-auto">
<p className="text-sm text-purple-700">
💡 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 !
</p>
</div>
)}
</div>

<div className="grid md:grid-cols-2 gap-8 items-start">
<div className="grid md:grid-cols-2 gap-8 items-stretch">
{/* Carte principale */}
<Card className="w-full">
<Card className="w-full h-full flex flex-col shadow-none">
<CardHeader className="text-center">
<CardTitle className="text-2xl">{t('download_app.download_section.title')}</CardTitle>
<CardDescription>
{t('download_app.download_section.subtitle')}
</CardDescription>
</CardHeader>
<CardContent className="space-y-4">
<CardContent className="space-y-4 flex-1 flex flex-col justify-center">
{/* App Store */}
<Button
onClick={() => handleDownload('ios')}
Expand Down Expand Up @@ -132,26 +109,11 @@ function DownloadAppPage() {
</div>
<ArrowRight className="h-5 w-5 ml-auto" />
</Button>

{/* Version Web */}
<Button
onClick={() => handleDownload('web')}
variant="outline"
className="w-full h-16 text-lg"
size="lg"
>
<Chrome className="h-6 w-6 mr-3" />
<div className="text-left">
<div className="text-xs">{t('download_app.platforms.web.label')}</div>
<div className="font-semibold">{t('download_app.platforms.web.store')}</div>
</div>
<ArrowRight className="h-5 w-5 ml-auto" />
</Button>
</CardContent>
</Card>

{/* Carte des fonctionnalités */}
<Card className="w-full">
<Card className="w-full h-full flex flex-col shadow-none">
<CardHeader>
<CardTitle className="flex items-center gap-2">
<Star className="h-5 w-5 text-yellow-500" />
Expand All @@ -161,7 +123,7 @@ function DownloadAppPage() {
{t('download_app.features.subtitle')}
</CardDescription>
</CardHeader>
<CardContent>
<CardContent className="flex-1 flex flex-col">
<div className="space-y-3">
{features.map((feature) => (
<div key={feature} className="flex items-start gap-3">
Expand Down
3 changes: 1 addition & 2 deletions packages/i18n/src/locales/en/onboarding.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@
"Real-time training tracking",
"Performance history",
"Personalized programs from your coach",
"Session notifications",
"Mobile-optimized interface"
"Session notifications"
]
},
"stats": {
Expand Down
3 changes: 1 addition & 2 deletions packages/i18n/src/locales/fr/onboarding.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@
"Suivi de vos entraînements en temps réel",
"Historique de vos performances",
"Programmes personnalisés par votre coach",
"Notifications pour vos séances",
"Interface optimisée pour mobile"
"Notifications pour vos séances"
]
},
"stats": {
Expand Down