Update application UI with a modern and streamlined design

Revamp the entire UI with a new theme, enhancing readability and modern aesthetics across all components, including AI chat, calendar, media uploads, and user management sections.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: ae4037a0-2a6f-4530-9bac-79b543286bda
Replit-Commit-Checkpoint-Type: intermediate_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/397bca8c-984f-43ff-841a-10897aeb8140/ae4037a0-2a6f-4530-9bac-79b543286bda/nriKMjY
This commit is contained in:
michaelschal committed 2025-10-04 10:13:34 +00:00
1 parent c208939745
commit 63ae963cd3
18 files changed
+566 -473

No files matched your search

+54 -49
View File
@@ -4,7 +4,7 @@ import { Input } from "@/components/ui/input";
import { Textarea } from "@/components/ui/textarea";
import { useMutation, useQuery } from "@tanstack/react-query";
import { apiRequest, queryClient } from "@/lib/queryClient";
import { Bot, User, Lightbulb, History, Zap } from "lucide-react";
import { Bot, User, Lightbulb, History, Zap, Sparkles } from "lucide-react";
import { useToast } from "@/hooks/use-toast";
interface Message {
@@ -51,11 +51,9 @@ export default function AiChat() {
const handleSubmit = () => {
if (!input.trim()) return;
// Add user message
const userMessage = input;
setMessages((prev) => [...prev, { role: "user", content: userMessage }]);
// Parse product info from input (simple parsing)
const productInfo = {
name: userMessage.match(/Produit:\s*(.+?)(?:\n|$)/i)?.[1] || userMessage,
price: userMessage.match(/Prix:\s*(.+?)(?:\n|$)/i)?.[1] || "",
@@ -68,93 +66,97 @@ export default function AiChat() {
};
return (
<div className="bg-card rounded-lg border border-border overflow-hidden h-full">
<div className="border-b border-border p-4 flex items-center justify-between">
<div className="flex items-center gap-3">
<div className="w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center">
<Bot className="text-primary w-6 h-6" />
</div>
<div>
<h3 className="font-semibold text-foreground">Assistant IA - Génération de contenu</h3>
<p className="text-xs text-muted-foreground">Décrivez votre produit pour générer du texte</p>
<div className="bg-card rounded-2xl border border-border/50 overflow-hidden shadow-lg h-full flex flex-col">
<div className="border-b border-border/50 p-6 bg-gradient-to-r from-primary/5 to-secondary/5">
<div className="flex items-center justify-between">
<div className="flex items-center gap-4">
<div className="w-12 h-12 rounded-xl bg-gradient-to-br from-primary to-secondary flex items-center justify-center shadow-lg">
<Sparkles className="text-white w-6 h-6" />
</div>
<div>
<h3 className="text-lg font-semibold text-foreground">Assistant IA</h3>
<p className="text-sm text-muted-foreground">Génération de contenu intelligent</p>
</div>
</div>
<Button
variant="outline"
size="sm"
onClick={() => setMessages([messages[0]])}
className="rounded-xl"
data-testid="button-new-chat"
>
<Sparkles className="w-4 h-4 mr-2" />
Nouveau chat
</Button>
</div>
<Button
variant="outline"
size="sm"
onClick={() => setMessages([messages[0]])}
data-testid="button-new-chat"
>
<i className="fas fa-plus mr-2"></i>Nouveau chat
</Button>
</div>
<div className="h-96 overflow-y-auto p-6 space-y-4 bg-muted/20">
<div className="flex-1 overflow-y-auto p-6 space-y-6 bg-muted/20">
{messages.map((message, index) => (
<div
key={index}
className={`flex gap-3 chat-message ${message.role === "user" ? "justify-end" : ""}`}
className={`flex gap-4 chat-message ${message.role === "user" ? "justify-end" : ""}`}
>
{message.role === "assistant" && (
<div className="w-8 h-8 rounded-full bg-primary flex-shrink-0 flex items-center justify-center">
<Bot className="text-primary-foreground w-4 h-4" />
<div className="w-10 h-10 rounded-xl bg-gradient-to-br from-primary to-secondary flex-shrink-0 flex items-center justify-center shadow-md">
<Bot className="text-white w-5 h-5" />
</div>
)}
<div className={`flex-1 ${message.role === "user" ? "max-w-md ml-auto" : ""}`}>
<div className={`flex-1 ${message.role === "user" ? "max-w-md ml-auto" : "max-w-2xl"}`}>
<div className={`
rounded-lg p-4
rounded-2xl p-6 shadow-md
${message.role === "user"
? "bg-primary text-primary-foreground ml-auto"
: "bg-card border border-border"
? "bg-gradient-to-br from-primary to-secondary text-white ml-auto"
: "bg-card border border-border/50"
}
`}>
<p className="text-sm whitespace-pre-wrap">{message.content}</p>
<p className="text-sm leading-relaxed whitespace-pre-wrap">{message.content}</p>
{message.variants && (
<div className="space-y-3 mt-3">
<div className="space-y-4 mt-6">
{message.variants.map((variant, vIndex) => (
<div
key={vIndex}
className="p-3 rounded-lg bg-accent/50 border border-border cursor-pointer hover:bg-accent transition-all"
className="p-5 rounded-xl bg-muted/50 border border-border/50 cursor-pointer hover:bg-muted hover:shadow-md transition-all"
data-testid={`variant-${vIndex}`}
>
<div className="flex items-center justify-between mb-2">
<div className="flex items-center justify-between mb-3">
<span className={`
inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium
${vIndex === 0 ? "bg-primary text-primary-foreground" : "bg-secondary text-secondary-foreground"}
inline-flex items-center px-3 py-1 rounded-full text-xs font-semibold
${vIndex === 0 ? "bg-gradient-to-r from-primary to-secondary text-white" : "bg-secondary/20 text-secondary"}
`}>
{variant.variant}
</span>
<span className="text-xs text-muted-foreground">{variant.characterCount} caractères</span>
<span className="text-xs text-muted-foreground font-medium">{variant.characterCount} caractères</span>
</div>
<p className="text-sm text-foreground">{variant.text}</p>
<p className="text-sm text-foreground leading-relaxed">{variant.text}</p>
</div>
))}
</div>
)}
</div>
<span className="text-xs text-muted-foreground mt-1 inline-block">
<span className="text-xs text-muted-foreground mt-2 inline-block">
{message.role === "user" ? "Maintenant" : "Il y a quelques secondes"}
</span>
</div>
{message.role === "user" && (
<div className="w-8 h-8 rounded-full bg-secondary flex-shrink-0 flex items-center justify-center">
<User className="text-secondary-foreground w-4 h-4" />
<div className="w-10 h-10 rounded-xl bg-secondary/20 flex-shrink-0 flex items-center justify-center">
<User className="text-secondary w-5 h-5" />
</div>
)}
</div>
))}
</div>
<div className="p-4 border-t border-border bg-card">
<div className="flex gap-3">
<div className="p-6 border-t border-border/50 bg-card space-y-4">
<div className="flex gap-4">
<Textarea
placeholder="Décrivez votre produit (nom, prix, caractéristiques)..."
value={input}
onChange={(e) => setInput(e.target.value)}
className="flex-1 min-h-[60px]"
className="flex-1 min-h-[80px] rounded-xl bg-muted/30 border-border/50 focus:border-primary/50"
onKeyDown={(e) => {
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
@@ -166,34 +168,37 @@ export default function AiChat() {
<Button
onClick={handleSubmit}
disabled={generateMutation.isPending || !input.trim()}
className="bg-gradient-to-r from-primary to-secondary hover:opacity-90 rounded-xl px-6"
data-testid="button-generate"
>
<i className="fas fa-paper-plane mr-2"></i>
<Sparkles className="w-4 h-4 mr-2" />
{generateMutation.isPending ? "Génération..." : "Générer"}
</Button>
</div>
<div className="mt-3 flex items-center gap-2">
<div className="flex items-center gap-3 flex-wrap">
<Button
variant="outline"
size="sm"
className="rounded-xl"
onClick={() => toast({ title: "Bientôt disponible", description: "Les suggestions de produits seront disponibles prochainement" })}
data-testid="button-suggestions"
>
<Lightbulb className="w-4 h-4 mr-1" />
<Lightbulb className="w-4 h-4 mr-2" />
Suggestions
</Button>
<Button
variant="outline"
size="sm"
className="rounded-xl"
onClick={() => toast({ title: "Bientôt disponible", description: "L'historique des générations sera disponible prochainement" })}
data-testid="button-history"
>
<History className="w-4 h-4 mr-1" />
<History className="w-4 h-4 mr-2" />
Historique
</Button>
<div className="ml-auto text-xs text-muted-foreground flex items-center gap-1">
<Zap className="w-3 h-3 text-chart-3" />
Propulsé par OpenRouter
<div className="ml-auto text-xs text-muted-foreground flex items-center gap-2">
<Zap className="w-4 h-4 text-success" />
<span>Propulsé par OpenRouter</span>
</div>
</div>
</div>
+65 -61
View File
@@ -1,6 +1,6 @@
import { useState } from "react";
import { Button } from "@/components/ui/button";
import { ChevronLeft, ChevronRight } from "lucide-react";
import { ChevronLeft, ChevronRight, Calendar as CalendarIcon } from "lucide-react";
import { useQuery } from "@tanstack/react-query";
import type { ScheduledPost } from "@shared/schema";
@@ -44,18 +44,15 @@ export default function CalendarView() {
const days = [];
// Previous month days
for (let i = 0; i < startingDayOfWeek; i++) {
const prevMonthDay = new Date(year, month, -startingDayOfWeek + i + 1);
days.push({ date: prevMonthDay, isCurrentMonth: false });
}
// Current month days
for (let i = 1; i <= daysInMonth; i++) {
days.push({ date: new Date(year, month, i), isCurrentMonth: true });
}
// Next month days to fill the grid
const remainingDays = 42 - days.length;
for (let i = 1; i <= remainingDays; i++) {
days.push({ date: new Date(year, month + 1, i), isCurrentMonth: false });
@@ -71,83 +68,90 @@ export default function CalendarView() {
};
return (
<div className="bg-card rounded-lg border border-border overflow-hidden">
<div className="border-b border-border p-4 flex items-center justify-between">
<div>
<h3 className="font-semibold text-foreground">Calendrier des publications</h3>
<p className="text-sm text-muted-foreground mt-1">Planifiez vos publications sur plusieurs pages</p>
</div>
<div className="flex items-center gap-3">
<Button
variant="outline"
size="sm"
onClick={goToPreviousMonth}
data-testid="button-prev-month"
>
<ChevronLeft className="w-4 h-4 mr-2" />
Précédent
</Button>
<span className="text-sm font-medium text-foreground min-w-[120px] text-center">
{monthNames[currentDate.getMonth()]} {currentDate.getFullYear()}
</span>
<Button
variant="outline"
size="sm"
onClick={goToNextMonth}
data-testid="button-next-month"
>
Suivant
<ChevronRight className="w-4 h-4 ml-2" />
</Button>
<div className="bg-card rounded-2xl border border-border/50 overflow-hidden shadow-lg">
<div className="border-b border-border/50 p-6 bg-gradient-to-r from-primary/5 to-secondary/5">
<div className="flex items-center justify-between">
<div className="flex items-center gap-4">
<div className="w-12 h-12 rounded-xl bg-gradient-to-br from-primary to-secondary flex items-center justify-center shadow-lg">
<CalendarIcon className="text-white w-6 h-6" />
</div>
<div>
<h3 className="text-lg font-semibold text-foreground">Calendrier</h3>
<p className="text-sm text-muted-foreground">Visualisez vos publications planifiées</p>
</div>
</div>
<div className="flex items-center gap-3">
<Button
variant="outline"
size="sm"
onClick={goToPreviousMonth}
className="rounded-xl"
data-testid="button-prev-month"
>
<ChevronLeft className="w-4 h-4 mr-2" />
Précédent
</Button>
<span className="text-sm font-semibold text-foreground min-w-[140px] text-center px-4 py-2 bg-muted/30 rounded-xl">
{monthNames[currentDate.getMonth()]} {currentDate.getFullYear()}
</span>
<Button
variant="outline"
size="sm"
onClick={goToNextMonth}
className="rounded-xl"
data-testid="button-next-month"
>
Suivant
<ChevronRight className="w-4 h-4 ml-2" />
</Button>
</div>
</div>
</div>
<div className="p-6">
{/* Calendar Header */}
<div className="grid grid-cols-7 gap-px bg-border mb-px">
<div className="p-8">
<div className="grid grid-cols-7 gap-2 mb-2">
{daysOfWeek.map((day) => (
<div key={day} className="bg-muted p-3 text-center">
<span className="text-xs font-semibold text-muted-foreground">{day}</span>
<div key={day} className="bg-muted/30 py-3 rounded-lg text-center">
<span className="text-sm font-semibold text-muted-foreground">{day}</span>
</div>
))}
</div>
{/* Calendar Grid */}
<div className="grid grid-cols-7 gap-px bg-border">
<div className="grid grid-cols-7 gap-2">
{days.map((day, index) => (
<div
key={index}
className={`
bg-card p-3 min-h-[120px]
${isToday(day.date) ? "border-2 border-primary" : ""}
bg-card border border-border/50 rounded-xl p-4 min-h-[140px] transition-all hover:shadow-md
${isToday(day.date) ? "ring-2 ring-primary shadow-lg" : ""}
${!day.isCurrentMonth ? "opacity-40" : ""}
`}
data-testid={`calendar-day-${index}`}
>
<div className="flex items-center justify-between mb-2">
<div className="flex items-center justify-between mb-3">
<span
className={`
text-xs font-medium
${!day.isCurrentMonth ? "text-muted-foreground/50" : "text-foreground"}
${isToday(day.date) ? "font-bold text-primary" : ""}
text-sm font-semibold
${!day.isCurrentMonth ? "text-muted-foreground" : "text-foreground"}
${isToday(day.date) ? "text-primary" : ""}
`}
>
{day.date.getDate()}
</span>
{isToday(day.date) && (
<span className="text-[10px] bg-primary text-primary-foreground px-1.5 py-0.5 rounded">
<span className="text-[10px] bg-gradient-to-r from-primary to-secondary text-white px-2 py-0.5 rounded-full font-semibold">
Aujourd'hui
</span>
)}
</div>
{/* Real scheduled posts for this date */}
{(() => {
if (!day.isCurrentMonth) return null;
const postsForDay = getPostsForDate(day.date);
if (postsForDay.length === 0) return null;
return (
<div className="space-y-1">
<div className="space-y-2">
{postsForDay.slice(0, 2).map((post, idx) => {
const time = post.scheduledAt ? new Date(post.scheduledAt).toLocaleTimeString('fr-FR', { hour: '2-digit', minute: '2-digit' }) : '';
const isPending = !post.publishedAt;
@@ -157,18 +161,19 @@ export default function CalendarView() {
<div
key={idx}
className={`
px-2 py-1 rounded text-xs cursor-pointer transition-all
${isPending ? 'bg-chart-3/20 text-chart-3 hover:bg-chart-3/30' : ''}
${isPublished ? 'bg-chart-2/20 text-chart-2 hover:bg-chart-2/30' : ''}
px-3 py-2 rounded-lg text-xs cursor-pointer transition-all font-medium shadow-sm
${isPending ? 'bg-warning/20 text-warning hover:bg-warning/30' : ''}
${isPublished ? 'bg-success/20 text-success hover:bg-success/30' : ''}
`}
data-testid={`calendar-post-${post.id}`}
>
<span>{time} - {post.postType || 'Post'}</span>
<div className="font-semibold">{time}</div>
<div className="truncate opacity-90">{post.postType || 'Post'}</div>
</div>
);
})}
{postsForDay.length > 2 && (
<div className="text-[10px] text-muted-foreground pl-2">
<div className="text-[11px] text-muted-foreground pl-2 font-medium">
+{postsForDay.length - 2} autre(s)
</div>
)}
@@ -179,15 +184,14 @@ export default function CalendarView() {
))}
</div>
{/* Legend */}
<div className="mt-6 flex items-center justify-center gap-6 flex-wrap">
<div className="flex items-center gap-2">
<div className="w-3 h-3 rounded bg-chart-3"></div>
<span className="text-sm text-muted-foreground">Programmé</span>
<div className="mt-8 flex items-center justify-center gap-8 flex-wrap">
<div className="flex items-center gap-3">
<div className="w-4 h-4 rounded-md bg-warning/20 border-2 border-warning"></div>
<span className="text-sm text-muted-foreground font-medium">Programmé</span>
</div>
<div className="flex items-center gap-2">
<div className="w-3 h-3 rounded bg-chart-2"></div>
<span className="text-sm text-muted-foreground">Publié</span>
<div className="flex items-center gap-3">
<div className="w-4 h-4 rounded-md bg-success/20 border-2 border-success"></div>
<span className="text-sm text-muted-foreground font-medium">Publié</span>
</div>
</div>
</div>
+58 -35
View File
@@ -1,6 +1,7 @@
import { Button } from "@/components/ui/button";
import { useQuery } from "@tanstack/react-query";
import { Plus } from "lucide-react";
import { Plus, Users } from "lucide-react";
import { SiFacebook, SiInstagram } from "react-icons/si";
export default function ManagedPages() {
const { data: pages, isLoading } = useQuery({
@@ -9,11 +10,11 @@ export default function ManagedPages() {
if (isLoading) {
return (
<div className="bg-card rounded-lg border border-border p-6">
<div className="skeleton h-8 w-48 mb-4" />
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
{[1, 2, 3, 4].map((i) => (
<div key={i} className="skeleton h-32 rounded-lg" />
<div className="bg-card rounded-2xl border border-border/50 p-8 shadow-lg">
<div className="skeleton h-8 w-48 mb-6 rounded-lg" />
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{[1, 2, 3].map((i) => (
<div key={i} className="skeleton h-40 rounded-xl" />
))}
</div>
</div>
@@ -21,56 +22,78 @@ export default function ManagedPages() {
}
return (
<div className="bg-card rounded-lg border border-border overflow-hidden">
<div className="border-b border-border p-4 flex items-center justify-between">
<div>
<h3 className="font-semibold text-foreground">Pages gérées</h3>
<p className="text-sm text-muted-foreground mt-1">
Gérez vos pages Facebook et Instagram connectées
</p>
<div className="bg-card rounded-2xl border border-border/50 overflow-hidden shadow-lg">
<div className="border-b border-border/50 p-6 bg-gradient-to-r from-primary/5 to-secondary/5">
<div className="flex items-center justify-between">
<div className="flex items-center gap-4">
<div className="w-12 h-12 rounded-xl bg-gradient-to-br from-primary to-secondary flex items-center justify-center shadow-lg">
<Users className="text-white w-6 h-6" />
</div>
<div>
<h3 className="text-lg font-semibold text-foreground">Pages gérées</h3>
<p className="text-sm text-muted-foreground">
{(pages as any[])?.length || 0} page(s) connectée(s)
</p>
</div>
</div>
<Button
className="bg-gradient-to-r from-primary to-secondary hover:opacity-90 rounded-xl"
data-testid="button-connect-page"
>
<Plus className="w-4 h-4 mr-2" />
Connecter une page
</Button>
</div>
<Button data-testid="button-connect-page">
<Plus className="w-4 h-4 mr-2" />
Connecter une page
</Button>
</div>
<div className="p-6">
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
<div className="p-8">
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{pages && (pages as any[]).length > 0 ? (
(pages as any[]).map((page: any) => (
<div
key={page.id}
className="border border-border rounded-lg p-4 hover:shadow-lg transition-all cursor-pointer"
className="border border-border/50 rounded-2xl p-6 hover:shadow-xl hover:border-primary/30 transition-all cursor-pointer bg-card"
data-testid={`page-card-${page.id}`}
>
<div className="flex items-start justify-between mb-3">
<div className="flex items-start justify-between mb-5">
<div className={`
w-12 h-12 rounded-lg flex items-center justify-center
${page.platform === "facebook" ? "bg-chart-1/10" : "bg-chart-5/10"}
w-14 h-14 rounded-xl flex items-center justify-center shadow-md
${page.platform === "facebook" ? "bg-[#1877F2]/10" : "bg-[#E4405F]/10"}
`}>
<i className={`
fab text-2xl
${page.platform === "facebook" ? "fa-facebook text-chart-1" : "fa-instagram text-chart-5"}
`}></i>
{page.platform === "facebook" ? (
<SiFacebook className="text-[#1877F2] text-2xl" />
) : (
<SiInstagram className="text-[#E4405F] text-2xl" />
)}
</div>
<span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-chart-2 text-white">
<span className={`
inline-flex items-center px-3 py-1 rounded-full text-xs font-semibold
${page.isActive === "true" ? "bg-success/20 text-success" : "bg-muted text-muted-foreground"}
`}>
{page.isActive === "true" ? "Actif" : "Inactif"}
</span>
</div>
<h4 className="font-semibold text-foreground mb-1">{page.pageName}</h4>
<p className="text-xs text-muted-foreground mb-3">
<h4 className="font-semibold text-foreground text-lg mb-2">{page.pageName}</h4>
<p className="text-sm text-muted-foreground mb-4 font-medium">
{page.platform === "facebook" ? "Facebook Page" : "Instagram Business"}
</p>
<div className="flex items-center justify-between text-xs text-muted-foreground">
<span>{page.followersCount?.toLocaleString() || 0} abonnés</span>
<div className="flex items-center justify-between pt-4 border-t border-border/50">
<div className="flex items-center gap-2">
<Users className="w-4 h-4 text-muted-foreground" />
<span className="text-sm text-muted-foreground font-medium">
{page.followersCount?.toLocaleString() || 0} abonnés
</span>
</div>
</div>
</div>
))
) : (
<div className="col-span-full text-center py-12">
<p className="text-muted-foreground mb-4">Aucune page connectée</p>
<Button>
<div className="col-span-full text-center py-16">
<div className="w-20 h-20 rounded-2xl bg-muted/30 flex items-center justify-center mx-auto mb-6">
<Users className="w-10 h-10 text-muted-foreground opacity-50" />
</div>
<p className="text-muted-foreground mb-6 text-lg">Aucune page connectée</p>
<Button className="bg-gradient-to-r from-primary to-secondary hover:opacity-90 rounded-xl">
<Plus className="w-4 h-4 mr-2" />
Connecter votre première page
</Button>
+103 -91
View File
@@ -3,8 +3,9 @@ import { useDropzone } from "react-dropzone";
import { Button } from "@/components/ui/button";
import { useMutation, useQuery } from "@tanstack/react-query";
import { apiRequest, queryClient } from "@/lib/queryClient";
import { CloudUpload, Image as ImageIcon, Video, X } from "lucide-react";
import { CloudUpload, Image as ImageIcon, Video, X, Upload } from "lucide-react";
import { useToast } from "@/hooks/use-toast";
import { SiFacebook, SiInstagram } from "react-icons/si";
export default function MediaUpload() {
const { toast } = useToast();
@@ -54,7 +55,7 @@ export default function MediaUpload() {
"image/*": [".png", ".jpg", ".jpeg", ".gif"],
"video/*": [".mp4", ".mov"],
},
maxSize: 52428800, // 50MB
maxSize: 52428800,
});
const deleteMutation = useMutation({
@@ -68,101 +69,114 @@ export default function MediaUpload() {
});
return (
<div className="bg-card rounded-lg border border-border overflow-hidden">
<div className="border-b border-border p-4 flex items-center justify-between">
<div>
<h3 className="font-semibold text-foreground">Téléchargement et recadrage de médias</h3>
<p className="text-sm text-muted-foreground mt-1">
Ajoutez des photos ou vidéos, elles seront automatiquement recadrées pour Facebook et Instagram
</p>
<div className="bg-card rounded-2xl border border-border/50 overflow-hidden shadow-lg">
<div className="border-b border-border/50 p-6 bg-gradient-to-r from-primary/5 to-secondary/5">
<div className="flex items-center justify-between">
<div className="flex items-center gap-4">
<div className="w-12 h-12 rounded-xl bg-gradient-to-br from-primary to-secondary flex items-center justify-center shadow-lg">
<Upload className="text-white w-6 h-6" />
</div>
<div>
<h3 className="text-lg font-semibold text-foreground">Médiathèque</h3>
<p className="text-sm text-muted-foreground">Téléchargement et recadrage automatique</p>
</div>
</div>
<Button
onClick={open}
className="bg-gradient-to-r from-primary to-secondary hover:opacity-90 rounded-xl"
data-testid="button-browse"
>
<CloudUpload className="w-4 h-4 mr-2" />
Parcourir
</Button>
</div>
<Button
onClick={open}
data-testid="button-browse"
>
<CloudUpload className="w-4 h-4 mr-2" />
Parcourir
</Button>
</div>
<div className="p-6">
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
{/* Upload Zone */}
<div>
<div className="p-8">
<div className="grid grid-cols-1 lg:grid-cols-2 gap-8">
<div className="space-y-6">
<div
{...getRootProps()}
className={`
border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-all
${isDragActive ? "border-primary bg-accent" : "border-border hover:border-primary hover:bg-accent"}
border-2 border-dashed rounded-2xl p-12 text-center cursor-pointer transition-all
${isDragActive ? "border-primary bg-primary/5 shadow-lg" : "border-border/50 hover:border-primary hover:bg-accent/30"}
`}
data-testid="dropzone-upload"
>
<input {...getInputProps()} />
<CloudUpload className="w-12 h-12 text-muted-foreground mx-auto mb-4" />
<p className="text-foreground font-medium mb-2">
{isDragActive ? "Déposez vos fichiers ici" : "Glissez-déposez vos fichiers ici"}
<div className="w-16 h-16 rounded-2xl bg-gradient-to-br from-primary/10 to-secondary/10 flex items-center justify-center mx-auto mb-6">
<CloudUpload className="w-8 h-8 text-primary" />
</div>
<p className="text-foreground font-semibold text-lg mb-2">
{isDragActive ? "Déposez vos fichiers ici" : "Glissez-déposez vos fichiers"}
</p>
<p className="text-sm text-muted-foreground mb-4">ou cliquez pour parcourir</p>
<p className="text-xs text-muted-foreground">PNG, JPG, MP4 jusqu'à 50MB</p>
<p className="text-xs text-muted-foreground font-medium">PNG, JPG, MP4 jusqu'à 50MB</p>
</div>
{/* Uploaded Files */}
<div className="mt-6 space-y-3">
<h4 className="text-sm font-semibold text-foreground mb-3">
Fichiers téléchargés ({(mediaList as any[])?.length || 0})
<div className="space-y-4">
<h4 className="text-sm font-semibold text-foreground flex items-center justify-between">
<span>Fichiers téléchargés</span>
<span className="text-xs font-medium text-muted-foreground bg-muted/30 px-3 py-1 rounded-full">
{(mediaList as any[])?.length || 0} média(s)
</span>
</h4>
{(mediaList as any[])?.slice(0, 3).map((media: any) => (
<div
key={media.id}
onClick={() => setSelectedFile(media)}
className="flex items-center gap-3 p-3 rounded-lg bg-accent border border-border cursor-pointer hover:bg-accent/80 transition-colors"
data-testid={`media-item-${media.id}`}
>
<div className="w-12 h-12 rounded bg-muted flex items-center justify-center flex-shrink-0">
{media.type === "video" ? (
<Video className="w-6 h-6 text-muted-foreground" />
) : (
<ImageIcon className="w-6 h-6 text-muted-foreground" />
)}
<div className="space-y-3">
{(mediaList as any[])?.slice(0, 5).map((media: any) => (
<div
key={media.id}
onClick={() => setSelectedFile(media)}
className="flex items-center gap-4 p-4 rounded-xl bg-muted/30 border border-border/50 cursor-pointer hover:bg-muted hover:shadow-md transition-all"
data-testid={`media-item-${media.id}`}
>
<div className="w-14 h-14 rounded-lg bg-gradient-to-br from-muted to-muted/50 flex items-center justify-center flex-shrink-0">
{media.type === "video" ? (
<Video className="w-7 h-7 text-secondary" />
) : (
<ImageIcon className="w-7 h-7 text-primary" />
)}
</div>
<div className="flex-1 min-w-0">
<p className="text-sm font-semibold text-foreground truncate">{media.fileName}</p>
<p className="text-xs text-muted-foreground font-medium mt-1">
{(media.fileSize / 1024 / 1024).toFixed(1)} MB
</p>
</div>
<div className="flex items-center gap-3">
<span className="inline-flex items-center px-3 py-1 rounded-full text-xs font-semibold bg-success/20 text-success">
Prêt
</span>
<button
onClick={(e) => {
e.stopPropagation();
deleteMutation.mutate(media.id);
}}
className="text-muted-foreground hover:text-destructive transition-all p-1 rounded-lg hover:bg-destructive/10"
data-testid={`button-delete-${media.id}`}
>
<X className="w-5 h-5" />
</button>
</div>
</div>
<div className="flex-1 min-w-0">
<p className="text-sm font-medium text-foreground truncate">{media.fileName}</p>
<p className="text-xs text-muted-foreground">
{(media.fileSize / 1024 / 1024).toFixed(1)} MB
</p>
</div>
<div className="flex items-center gap-2">
<span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-chart-2 text-white">
Prêt
</span>
<button
onClick={() => deleteMutation.mutate(media.id)}
className="text-muted-foreground hover:text-destructive transition-all"
data-testid={`button-delete-${media.id}`}
>
<X className="w-4 h-4" />
</button>
</div>
</div>
))}
))}
</div>
</div>
</div>
{/* Preview and Crop */}
<div>
<h4 className="text-sm font-semibold text-foreground mb-3">Aperçu et recadrage automatique</h4>
<div className="space-y-4">
{/* Facebook Feed Preview */}
<div className="border border-border rounded-lg p-4">
<div className="flex items-center justify-between mb-3">
<div className="space-y-6">
<h4 className="text-sm font-semibold text-foreground">Aperçu et recadrage automatique</h4>
<div className="space-y-5">
<div className="border border-border/50 rounded-xl p-5 bg-card shadow-sm">
<div className="flex items-center justify-between mb-4">
<div className="flex items-center gap-2">
<i className="fab fa-facebook text-chart-1"></i>
<span className="text-sm font-medium text-foreground">Facebook - Feed</span>
<SiFacebook className="text-[#1877F2] text-lg" />
<span className="text-sm font-semibold text-foreground">Facebook Feed</span>
</div>
<span className="text-xs text-muted-foreground">1200x630</span>
<span className="text-xs text-muted-foreground bg-muted/30 px-2 py-1 rounded-md font-medium">1200×630</span>
</div>
<div className="aspect-[1.91/1] bg-muted rounded-lg overflow-hidden">
<div className="aspect-[1.91/1] bg-muted/30 rounded-lg overflow-hidden border border-border/50">
{selectedFile?.facebookFeedUrl ? (
<img
src={selectedFile.facebookFeedUrl}
@@ -171,22 +185,21 @@ export default function MediaUpload() {
/>
) : (
<div className="w-full h-full flex items-center justify-center">
<ImageIcon className="w-12 h-12 text-muted-foreground" />
<ImageIcon className="w-12 h-12 text-muted-foreground opacity-50" />
</div>
)}
</div>
</div>
{/* Instagram Feed Preview */}
<div className="border border-border rounded-lg p-4">
<div className="flex items-center justify-between mb-3">
<div className="border border-border/50 rounded-xl p-5 bg-card shadow-sm">
<div className="flex items-center justify-between mb-4">
<div className="flex items-center gap-2">
<i className="fab fa-instagram text-chart-5"></i>
<span className="text-sm font-medium text-foreground">Instagram - Feed</span>
<SiInstagram className="text-[#E4405F] text-lg" />
<span className="text-sm font-semibold text-foreground">Instagram Feed</span>
</div>
<span className="text-xs text-muted-foreground">1080x1080</span>
<span className="text-xs text-muted-foreground bg-muted/30 px-2 py-1 rounded-md font-medium">1080×1080</span>
</div>
<div className="aspect-square bg-muted rounded-lg overflow-hidden">
<div className="aspect-square bg-muted/30 rounded-lg overflow-hidden border border-border/50">
{selectedFile?.instagramFeedUrl ? (
<img
src={selectedFile.instagramFeedUrl}
@@ -195,22 +208,21 @@ export default function MediaUpload() {
/>
) : (
<div className="w-full h-full flex items-center justify-center">
<ImageIcon className="w-12 h-12 text-muted-foreground" />
<ImageIcon className="w-12 h-12 text-muted-foreground opacity-50" />
</div>
)}
</div>
</div>
{/* Instagram Story Preview */}
<div className="border border-border rounded-lg p-4">
<div className="flex items-center justify-between mb-3">
<div className="border border-border/50 rounded-xl p-5 bg-card shadow-sm">
<div className="flex items-center justify-between mb-4">
<div className="flex items-center gap-2">
<i className="fab fa-instagram text-chart-5"></i>
<span className="text-sm font-medium text-foreground">Instagram - Story</span>
<SiInstagram className="text-[#E4405F] text-lg" />
<span className="text-sm font-semibold text-foreground">Instagram Story</span>
</div>
<span className="text-xs text-muted-foreground">1080x1920</span>
<span className="text-xs text-muted-foreground bg-muted/30 px-2 py-1 rounded-md font-medium">1080×1920</span>
</div>
<div className="aspect-[9/16] bg-muted rounded-lg overflow-hidden max-w-[200px]">
<div className="aspect-[9/16] bg-muted/30 rounded-lg overflow-hidden max-w-[220px] border border-border/50">
{selectedFile?.instagramStoryUrl ? (
<img
src={selectedFile.instagramStoryUrl}
@@ -219,7 +231,7 @@ export default function MediaUpload() {
/>
) : (
<div className="w-full h-full flex items-center justify-center">
<ImageIcon className="w-8 h-8 text-muted-foreground" />
<ImageIcon className="w-10 h-10 text-muted-foreground opacity-50" />
</div>
)}
</div>
+55 -46
View File
@@ -1,5 +1,5 @@
import { Button } from "@/components/ui/button";
import { Image, Video, CalendarPlus, Clock, Plug } from "lucide-react";
import { Image, Video, CalendarPlus, Clock, Plug, Zap, PlusCircle } from "lucide-react";
import { useQuery } from "@tanstack/react-query";
export default function QuickActions() {
@@ -10,101 +10,110 @@ export default function QuickActions() {
return (
<div className="space-y-6">
{/* New Publication Card */}
<div className="bg-card rounded-lg border border-border p-6">
<h3 className="font-semibold text-foreground mb-4 flex items-center gap-2">
<i className="fas fa-plus-circle text-primary"></i>
Nouvelle publication
</h3>
<div className="bg-card rounded-2xl border border-border/50 p-6 shadow-lg">
<div className="flex items-center gap-3 mb-6">
<div className="w-10 h-10 rounded-xl bg-gradient-to-br from-primary to-secondary flex items-center justify-center">
<PlusCircle className="text-white w-5 h-5" />
</div>
<h3 className="text-lg font-semibold text-foreground">Nouvelle publication</h3>
</div>
<div className="space-y-3">
<Button className="w-full" data-testid="button-new-media-post">
<Button className="w-full bg-gradient-to-r from-primary to-secondary hover:opacity-90 rounded-xl" data-testid="button-new-media-post">
<Image className="w-4 h-4 mr-2" />
Publication avec média
</Button>
<Button variant="outline" className="w-full" data-testid="button-new-story">
<Button variant="outline" className="w-full rounded-xl border-border/50" data-testid="button-new-story">
<Video className="w-4 h-4 mr-2" />
Story vidéo
</Button>
<Button variant="outline" className="w-full" data-testid="button-schedule-series">
<Button variant="outline" className="w-full rounded-xl border-border/50" data-testid="button-schedule-series">
<CalendarPlus className="w-4 h-4 mr-2" />
Planifier série
</Button>
</div>
</div>
{/* Recent Activity */}
<div className="bg-card rounded-lg border border-border p-6">
<h3 className="font-semibold text-foreground mb-4 flex items-center gap-2">
<Clock className="w-5 h-5 text-chart-3" />
Activité récente
</h3>
<div className="space-y-3">
<div className="bg-card rounded-2xl border border-border/50 p-6 shadow-lg">
<div className="flex items-center gap-3 mb-6">
<div className="w-10 h-10 rounded-xl bg-warning/10 flex items-center justify-center">
<Clock className="text-warning w-5 h-5" />
</div>
<h3 className="text-lg font-semibold text-foreground">Activité récente</h3>
</div>
<div className="space-y-4">
{recentActivity && recentActivity.length > 0 ? (
recentActivity.map((activity: any, index: number) => (
<div
key={activity.id}
className="flex items-start gap-3 pb-3 border-b border-border last:border-0 last:pb-0"
className="flex items-start gap-4 pb-4 border-b border-border/50 last:border-0 last:pb-0"
data-testid={`activity-${index}`}
>
<div className="w-2 h-2 rounded-full bg-chart-2 mt-2"></div>
<div className="w-2 h-2 rounded-full bg-success mt-2 shadow-sm"></div>
<div className="flex-1">
<p className="text-sm text-foreground">
<p className="text-sm font-medium text-foreground">
{activity.status === "scheduled" ? "Publication planifiée" : "Brouillon créé"}
</p>
<p className="text-xs text-muted-foreground mt-1">
{new Date(activity.createdAt).toLocaleDateString("fr-FR")}
<p className="text-xs text-muted-foreground mt-1 font-medium">
{new Date(activity.createdAt).toLocaleDateString("fr-FR", {
day: '2-digit',
month: 'short',
hour: '2-digit',
minute: '2-digit'
})}
</p>
</div>
</div>
))
) : (
<div className="text-center py-4">
<div className="text-center py-8">
<Clock className="w-12 h-12 text-muted-foreground opacity-30 mx-auto mb-3" />
<p className="text-sm text-muted-foreground">Aucune activité récente</p>
</div>
)}
</div>
</div>
{/* API Status */}
<div className="bg-card rounded-lg border border-border p-6">
<h3 className="font-semibold text-foreground mb-4 flex items-center gap-2">
<Plug className="w-5 h-5 text-chart-2" />
État des services
</h3>
<div className="space-y-3">
<div className="bg-card rounded-2xl border border-border/50 p-6 shadow-lg">
<div className="flex items-center gap-3 mb-6">
<div className="w-10 h-10 rounded-xl bg-success/10 flex items-center justify-center">
<Zap className="text-success w-5 h-5" />
</div>
<h3 className="text-lg font-semibold text-foreground">État des services</h3>
</div>
<div className="space-y-4">
<div className="flex items-center justify-between" data-testid="status-openrouter">
<div className="flex items-center gap-2">
<div className="w-2 h-2 rounded-full bg-chart-2"></div>
<span className="text-sm text-foreground">OpenRouter API</span>
<div className="flex items-center gap-3">
<div className="w-2 h-2 rounded-full bg-success shadow-sm"></div>
<span className="text-sm font-medium text-foreground">OpenRouter API</span>
</div>
<span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-chart-2 text-white">
<span className="inline-flex items-center px-3 py-1 rounded-full text-xs font-semibold bg-success/20 text-success">
Actif
</span>
</div>
<div className="flex items-center justify-between" data-testid="status-facebook">
<div className="flex items-center gap-2">
<div className="w-2 h-2 rounded-full bg-chart-2"></div>
<span className="text-sm text-foreground">Facebook API</span>
<div className="flex items-center gap-3">
<div className="w-2 h-2 rounded-full bg-success shadow-sm"></div>
<span className="text-sm font-medium text-foreground">Facebook API</span>
</div>
<span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-chart-2 text-white">
<span className="inline-flex items-center px-3 py-1 rounded-full text-xs font-semibold bg-success/20 text-success">
Actif
</span>
</div>
<div className="flex items-center justify-between" data-testid="status-instagram">
<div className="flex items-center gap-2">
<div className="w-2 h-2 rounded-full bg-chart-2"></div>
<span className="text-sm text-foreground">Instagram API</span>
<div className="flex items-center gap-3">
<div className="w-2 h-2 rounded-full bg-success shadow-sm"></div>
<span className="text-sm font-medium text-foreground">Instagram API</span>
</div>
<span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-chart-2 text-white">
<span className="inline-flex items-center px-3 py-1 rounded-full text-xs font-semibold bg-success/20 text-success">
Actif
</span>
</div>
<div className="flex items-center justify-between" data-testid="status-database">
<div className="flex items-center gap-2">
<div className="w-2 h-2 rounded-full bg-chart-2"></div>
<span className="text-sm text-foreground">PostgreSQL</span>
<div className="flex items-center gap-3">
<div className="w-2 h-2 rounded-full bg-success shadow-sm"></div>
<span className="text-sm font-medium text-foreground">PostgreSQL</span>
</div>
<span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-chart-2 text-white">
<span className="inline-flex items-center px-3 py-1 rounded-full text-xs font-semibold bg-success/20 text-success">
Actif
</span>
</div>