From fa3e286dce2d7c7815b4bafebfabfbae3fce5d5f Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Wed, 8 Oct 2025 13:56:21 +0000 Subject: [PATCH 1/3] Add the ability to upload new photos directly from the new post page Integrates react-dropzone for image/video uploads on the new post page, including upload mutation and UI updates to the media card. 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/TXBOLMj --- .replit | 4 + client/src/pages/new-post.tsx | 141 +++++++++++++++++++++++++--------- 2 files changed, 108 insertions(+), 37 deletions(-) diff --git a/.replit b/.replit index 518307b..dddb987 100644 --- a/.replit +++ b/.replit @@ -18,6 +18,10 @@ externalPort = 80 localPort = 35357 externalPort = 3002 +[[ports]] +localPort = 36673 +externalPort = 3003 + [[ports]] localPort = 37659 externalPort = 4200 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) => ( - - ))} -
- )} + + Uploader une photo + + + ) : ( +
+ {mediaList.map((media) => ( + + ))} +
+ )} +
From ba9caf924a90ce1d3937a7ad69386b005bd948a3 Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Wed, 8 Oct 2025 13:59:26 +0000 Subject: [PATCH 2/3] Update application to include favicon, improve user interface, and enhance functionality Adds a favicon, updates the dashboard by removing the calendar and adding a history card, removes the analytics page, and allows direct photo uploads on the new publication page. 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/TXBOLMj --- client/index.html | 5 ++++- public/favicon.svg | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 public/favicon.svg 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/public/favicon.svg b/public/favicon.svg new file mode 100644 index 0000000..ff1ab3e --- /dev/null +++ b/public/favicon.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + From 23f91266e2f15481ef89096f5733a6811d4cbd81 Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Wed, 8 Oct 2025 14:00:11 +0000 Subject: [PATCH 3/3] Add AI-powered text generation for product posts Implement a new feature to generate post text using AI, based on product information. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ae4037a0-2a6f-4530-9bac-79b543286bda Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/397bca8c-984f-43ff-841a-10897aeb8140/ae4037a0-2a6f-4530-9bac-79b543286bda/TXBOLMj --- .replit | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.replit b/.replit index dddb987..518307b 100644 --- a/.replit +++ b/.replit @@ -18,10 +18,6 @@ externalPort = 80 localPort = 35357 externalPort = 3002 -[[ports]] -localPort = 36673 -externalPort = 3003 - [[ports]] localPort = 37659 externalPort = 4200