diff --git a/client/src/App.tsx b/client/src/App.tsx index 85dac3f..57062bd 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -12,7 +12,6 @@ import Calendar from "@/pages/calendar"; import Media from "@/pages/media"; import PagesManagement from "@/pages/pages"; import AI from "@/pages/ai"; -import Analytics from "@/pages/analytics"; import History from "@/pages/history"; import Settings from "@/pages/settings"; import SqlAdmin from "@/pages/sql"; @@ -71,7 +70,6 @@ function Router() { {() => } {() => } {() => } - {() => } {() => } {() => } {() => } diff --git a/client/src/components/recent-publications.tsx b/client/src/components/recent-publications.tsx new file mode 100644 index 0000000..ffb83c4 --- /dev/null +++ b/client/src/components/recent-publications.tsx @@ -0,0 +1,113 @@ +import { useQuery } from "@tanstack/react-query"; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import { Facebook, Instagram, Clock, CheckCircle2, XCircle } from "lucide-react"; +import { format } from "date-fns"; +import { fr } from "date-fns/locale"; +import type { ScheduledPost, SocialPage, Post } from "@shared/schema"; + +type ScheduledPostWithRelations = ScheduledPost & { + post?: Post; + page?: SocialPage; +}; + +export default function RecentPublications() { + const { data: scheduledPosts = [], isLoading } = useQuery({ + queryKey: ['/api/scheduled-posts'], + }); + + // Filter and sort published posts + const recentPublished = scheduledPosts + .filter(sp => sp.publishedAt) + .sort((a, b) => new Date(b.publishedAt!).getTime() - new Date(a.publishedAt!).getTime()) + .slice(0, 10); + + return ( + + + Historique des publications + + Vos 10 dernières publications sur les réseaux sociaux + + + + {isLoading ? ( +
+ {[1, 2, 3].map((i) => ( +
+ ))} +
+ ) : recentPublished.length === 0 ? ( +
+ +

Aucune publication pour le moment

+
+ ) : ( +
+ {recentPublished.map((scheduledPost) => ( +
+ {/* Platform icon */} +
+ {scheduledPost.page?.platform === 'facebook' ? ( + + ) : ( + + )} +
+ + {/* Content */} +
+
+
+

+ {scheduledPost.page?.pageName || 'Page inconnue'} +

+

+ {scheduledPost.post?.content ? ( + {scheduledPost.post.content} + ) : ( + Aucun texte + )} +

+
+
+ {scheduledPost.error ? ( + + ) : ( + + )} +
+
+ +
+ + {scheduledPost.postType === 'feed' ? 'Publication' : + scheduledPost.postType === 'story' ? 'Story' : scheduledPost.postType} + + • + + {format(new Date(scheduledPost.publishedAt!), "d MMM yyyy 'à' HH:mm", { locale: fr })} + + {scheduledPost.error && ( + <> + • + Erreur + + )} +
+
+
+ ))} +
+ )} + + + ); +} diff --git a/client/src/components/sidebar.tsx b/client/src/components/sidebar.tsx index d7cbb8f..bbabe38 100644 --- a/client/src/components/sidebar.tsx +++ b/client/src/components/sidebar.tsx @@ -1,4 +1,4 @@ -import { Home, PlusCircle, Calendar, Images, Users, Bot, BarChart3, Clock, Settings, Database, UserCog, LogOut } from "lucide-react"; +import { Home, PlusCircle, Calendar, Images, Users, Bot, Clock, Settings, Database, UserCog, LogOut } from "lucide-react"; import { Link, useLocation } from "wouter"; import { useQuery, useMutation } from "@tanstack/react-query"; import { apiRequest, queryClient } from "@/lib/queryClient"; @@ -42,7 +42,6 @@ export default function Sidebar() { ]; const statsItems = [ - { icon: BarChart3, label: "Analyses", href: "/analytics" }, { icon: Clock, label: "Historique", href: "/history" }, ]; diff --git a/client/src/pages/analytics.tsx b/client/src/pages/analytics.tsx deleted file mode 100644 index d53f58b..0000000 --- a/client/src/pages/analytics.tsx +++ /dev/null @@ -1,129 +0,0 @@ -import { useState } from "react"; -import { useQuery } from "@tanstack/react-query"; -import { TrendingUp, Users, Eye, Heart, BarChart3 } from "lucide-react"; -import Sidebar from "@/components/sidebar"; -import TopBar from "@/components/topbar"; -import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; - -export default function Analytics() { - const [sidebarOpen, setSidebarOpen] = useState(false); - - const { data: stats } = useQuery({ - queryKey: ['/api/stats'], - }); - - const metrics = [ - { - title: "Publications totales", - value: "0", - description: "Toutes plateformes", - icon: TrendingUp, - gradient: "from-primary to-primary/80", - }, - { - title: "Portée totale", - value: "0", - description: "Personnes atteintes", - icon: Users, - gradient: "from-secondary to-secondary/80", - }, - { - title: "Impressions", - value: "0", - description: "Vues totales", - icon: Eye, - gradient: "from-success to-success/80", - }, - { - title: "Engagement", - value: "0", - description: "Interactions totales", - icon: Heart, - gradient: "from-warning to-warning/80", - }, - ]; - - return ( -
- {sidebarOpen && ( -
setSidebarOpen(false)} - /> - )} - -
- -
- -
- setSidebarOpen(!sidebarOpen)} /> - -
-
-

Analyses

-

- Statistiques et performances de vos publications -

-
- -
- {metrics.map((metric, index) => { - const Icon = metric.icon; - return ( - - -
- - {metric.title} - -
- -
-
-
- -
- {metric.value} -
-

{metric.description}

-
-
- ); - })} -
- - - -
-
- -
-
- Fonctionnalité à venir -

Graphiques et statistiques détaillées

-
-
-
- -
-
- -
-

- Les analyses détaillées et les graphiques de performance seront disponibles prochainement. -

-

- Vous pourrez suivre l'évolution de vos statistiques au fil du temps -

-
-
-
-
-
-
- ); -} diff --git a/client/src/pages/dashboard.tsx b/client/src/pages/dashboard.tsx index 6ab3e6e..e930508 100644 --- a/client/src/pages/dashboard.tsx +++ b/client/src/pages/dashboard.tsx @@ -1,7 +1,7 @@ import Sidebar from "@/components/sidebar"; import TopBar from "@/components/topbar"; import StatsCards from "@/components/stats-cards"; -import CalendarView from "@/components/calendar-view"; +import RecentPublications from "@/components/recent-publications"; import ManagedPages from "@/components/managed-pages"; import { useState } from "react"; @@ -30,7 +30,7 @@ export default function Dashboard() {
- +