diff --git a/backend/src/controllers/podcastController.ts b/backend/src/controllers/podcastController.ts index e0fb4e4..5d98c44 100644 --- a/backend/src/controllers/podcastController.ts +++ b/backend/src/controllers/podcastController.ts @@ -12,8 +12,8 @@ const subscribeSchema = z.object({ const searchSchema = z.object({ q: z.string().min(2, 'Query must be at least 2 characters'), - limit: z.number().int().min(1).max(50).optional().default(20), - offset: z.number().int().min(0).optional().default(0), + limit: z.coerce.number().int().min(1).max(50).optional().default(20), + offset: z.coerce.number().int().min(0).optional().default(0), }); export const getUserSubscriptions = async (req: Request, res: Response) => { @@ -49,11 +49,28 @@ export const subscribe = async (req: Request, res: Response) => { let podcast = await Podcast.findOne({ rssUrl }); if (!podcast) { - // For now, create a basic podcast entry - // In production, you'd fetch from PodcastIndex API or parse the RSS feed - return res.status(400).json({ - message: 'Podcast not found. Please use a valid RSS URL.', - }); + try { + const result = await rssParserService.createPodcastFromRss(rssUrl, { + title: 'Unknown Podcast', + description: '', + author: '', + imageUrl: undefined, + episodes: [], + }); + podcast = result.podcast; + } catch (error: any) { + if (error.message.includes('already in database')) { + podcast = await Podcast.findOne({ rssUrl }); + } else { + return res.status(400).json({ + message: `Impossible de récupérer le podcast : ${error.message}`, + }); + } + } + } + + if (!podcast) { + return res.status(400).json({ message: 'Impossible d\'ajouter le podcast' }); } // Check if already subscribed diff --git a/frontend/src/components/AudioPlayer.tsx b/frontend/src/components/AudioPlayer.tsx index 78d598e..7f16329 100644 --- a/frontend/src/components/AudioPlayer.tsx +++ b/frontend/src/components/AudioPlayer.tsx @@ -133,7 +133,7 @@ export default function AudioPlayer({ episode, onClose, userId }: AudioPlayerPro {/* Header */}
-

Now Playing

+

En cours de lecture

@@ -220,7 +220,7 @@ export default function AudioPlayer({ episode, onClose, userId }: AudioPlayerPro } }} className="p-3 hover:bg-light-100 rounded-full transition-colors" - title="Skip 30s" + title="Avancer de 30s" > @@ -230,7 +230,7 @@ export default function AudioPlayer({ episode, onClose, userId }: AudioPlayerPro
{/* Playback Speed */}
-

Speed

+

Vitesse

{[0.75, 1, 1.25, 1.5, 1.75, 2].map((speed) => ( )}
diff --git a/frontend/src/components/Navigation.tsx b/frontend/src/components/Navigation.tsx index 676dd44..c7c2504 100644 --- a/frontend/src/components/Navigation.tsx +++ b/frontend/src/components/Navigation.tsx @@ -28,7 +28,7 @@ export default function Navigation() { }`} > - Dashboard + Tableau de bord - Discover + Découvrir
diff --git a/frontend/src/pages/Dashboard.tsx b/frontend/src/pages/Dashboard.tsx index 996b902..70df5f8 100644 --- a/frontend/src/pages/Dashboard.tsx +++ b/frontend/src/pages/Dashboard.tsx @@ -50,7 +50,7 @@ export default function Dashboard() {
-

Loading your podcasts...

+

Chargement de vos podcasts...

); @@ -60,7 +60,7 @@ export default function Dashboard() {
@@ -69,10 +69,10 @@ export default function Dashboard() { {/* Welcome Section */}

- Welcome back, {user?.username}! 👋 + Bon retour, {user?.username} ! 👋

- {episodesData?.count || 0} new episodes from your subscriptions + {episodesData?.count || 0} nouveaux épisodes de vos abonnements

@@ -81,12 +81,12 @@ export default function Dashboard() {
-

Loading episodes...

+

Chargement des épisodes...

) : episodesData?.episodes && episodesData.episodes.length > 0 ? (
-

Latest Episodes

+

Derniers épisodes

{episodesData.episodes.map((episode) => ( ) : (
-

No episodes yet

+

Aucun épisode pour l'instant

- Subscribe to podcasts to see episodes in your dashboard + Abonnez-vous à des podcasts pour voir les épisodes dans votre tableau de bord

)} diff --git a/frontend/src/pages/Discover.tsx b/frontend/src/pages/Discover.tsx index b5f8a1c..8431fc9 100644 --- a/frontend/src/pages/Discover.tsx +++ b/frontend/src/pages/Discover.tsx @@ -60,10 +60,10 @@ export default function Discover() { setSubscribingId(podcast.id); await subscribeMutation.mutateAsync(podcast); // Show success toast (you might want to add a toast library) - alert(`Added "${podcast.title}" to your subscriptions!`); + alert(`"${podcast.title}" ajouté à vos abonnements !`); } catch (error: any) { const errorMessage = error.response?.data?.message || 'Failed to subscribe'; - alert(`Error: ${errorMessage}`); + alert(`Erreur : ${errorMessage}`); } finally { setSubscribingId(null); } @@ -86,7 +86,7 @@ export default function Discover() {
@@ -98,7 +98,7 @@ export default function Discover() { setSearchQuery(e.target.value)} className="w-full pl-12 pr-4 py-3 rounded-xl border border-light-200 bg-white focus:border-blue-500 focus:ring-1 focus:ring-blue-500 transition-colors text-lg" @@ -116,7 +116,7 @@ export default function Discover() { : 'bg-light-200 text-light-700 hover:bg-light-300' }`} > - 🔥 Trending + 🔥 Tendances
@@ -136,7 +136,7 @@ export default function Discover() {
-

Loading podcasts...

+

Chargement des podcasts...

) : displayData && displayData.length > 0 ? ( @@ -171,7 +171,7 @@ export default function Discover() {
{podcast.episodeCount && ( - {podcast.episodeCount} episodes + {podcast.episodeCount} épisodes )} {podcast.language && {podcast.language}}
@@ -184,12 +184,12 @@ export default function Discover() { {subscribingId === podcast.id ? ( <> - Adding... + Ajout... ) : ( <> - Add + Ajouter )} @@ -202,12 +202,12 @@ export default function Discover() {

{selectedTab === 'search' && searchQuery.length < 2 - ? 'Type at least 2 characters to search' - : 'No podcasts found'} + ? 'Tapez au moins 2 caractères pour rechercher' + : 'Aucun podcast trouvé'}

{selectedTab === 'search' && (

- Try searching for podcast titles, authors, or topics + Essayez de rechercher des titres, auteurs ou sujets

)}
@@ -217,7 +217,7 @@ export default function Discover() { {(searchResults || trendingData) && ( {/* Form Card */} @@ -78,7 +78,7 @@ export default function Login() { }`} onClick={() => setIsLogin(true)} > - Sign In + Se connecter
@@ -99,7 +99,7 @@ export default function Login() {
- {isLogin ? 'Signing in...' : 'Creating account...'} + {isLogin ? 'Connexion en cours...' : 'Création du compte...'}
) : isLogin ? ( - 'Sign In' + 'Se connecter' ) : ( - 'Create Account' + 'Créer un compte' )} @@ -155,8 +155,8 @@ export default function Login() { {/* Footer */}

{isLogin - ? "Don't have an account? Click Create Account above" - : 'Already have an account? Click Sign In above'} + ? "Pas de compte ? Cliquez sur Créer un compte ci-dessus" + : 'Déjà un compte ? Cliquez sur Se connecter ci-dessus'}