diff --git a/client/index.html b/client/index.html
index f15fa88..8c3ef08 100644
--- a/client/index.html
+++ b/client/index.html
@@ -1,8 +1,11 @@
-
+
+ Social Flow - Automatisation des réseaux sociaux
+
+
diff --git a/client/src/pages/new-post.tsx b/client/src/pages/new-post.tsx
index 19bab3f..107f6fc 100644
--- a/client/src/pages/new-post.tsx
+++ b/client/src/pages/new-post.tsx
@@ -1,7 +1,8 @@
-import { useState } from "react";
+import { useState, useCallback } from "react";
import { useQuery, useMutation } from "@tanstack/react-query";
import { useLocation } from "wouter";
-import { Send, Sparkles, Image as ImageIcon, Calendar } from "lucide-react";
+import { Send, Sparkles, Image as ImageIcon, Calendar, Upload } from "lucide-react";
+import { useDropzone } from "react-dropzone";
import Sidebar from "@/components/sidebar";
import TopBar from "@/components/topbar";
import { Button } from "@/components/ui/button";
@@ -36,6 +37,51 @@ export default function NewPost() {
queryKey: ['/api/media'],
});
+ const uploadMutation = useMutation({
+ mutationFn: async (file: File) => {
+ const formData = new FormData();
+ formData.append("file", file);
+ const response = await fetch("/api/media/upload", {
+ method: "POST",
+ body: formData,
+ });
+ if (!response.ok) throw new Error("Upload failed");
+ return response.json();
+ },
+ onSuccess: (data) => {
+ queryClient.invalidateQueries({ queryKey: ["/api/media"] });
+ setSelectedMedia(data.id);
+ toast({
+ title: "Succès",
+ description: "Photo téléchargée avec succès",
+ });
+ },
+ onError: () => {
+ toast({
+ title: "Erreur",
+ description: "Impossible de télécharger la photo",
+ variant: "destructive",
+ });
+ },
+ });
+
+ const onDrop = useCallback((acceptedFiles: File[]) => {
+ if (acceptedFiles.length > 0) {
+ uploadMutation.mutate(acceptedFiles[0]);
+ }
+ }, []);
+
+ const { getRootProps, getInputProps, isDragActive, open } = useDropzone({
+ onDrop,
+ accept: {
+ "image/*": [".png", ".jpg", ".jpeg", ".gif"],
+ "video/*": [".mp4", ".mov"],
+ },
+ maxSize: 52428800,
+ noClick: true,
+ noKeyboard: true,
+ });
+
const generateTextMutation = useMutation({
mutationFn: async (productInfoText: string) => {
const productInfo = {
@@ -254,44 +300,65 @@ export default function NewPost() {
- Média
- Sélectionnez une image ou vidéo
+
+
+ Média
+ Sélectionnez ou uploadez une image/vidéo
+
+
+
- {mediaList.length === 0 ? (
-
-
-
Aucun média disponible
-
-
- ) : (
-
- {mediaList.map((media) => (
-
diff --git a/public/favicon.svg b/public/favicon.svg
new file mode 100644
index 0000000..ff1ab3e
--- /dev/null
+++ b/public/favicon.svg
@@ -0,0 +1,21 @@
+