From 195f0dcb2d2497f83ae3d241508825593e470d08 Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Wed, 8 Oct 2025 19:11:44 +0000 Subject: [PATCH] Add mobile camera capture and reorder media card on new post page Integrate a new file input for direct camera capture on mobile devices, add a Camera icon button to the UI, and move the Media card to the top of the new post creation form. 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/561RCgs --- .replit | 8 ++ client/src/pages/new-post.tsx | 173 +++++++++++++++++++++------------- 2 files changed, 115 insertions(+), 66 deletions(-) diff --git a/.replit b/.replit index fa8f8de..b321948 100644 --- a/.replit +++ b/.replit @@ -34,10 +34,18 @@ externalPort = 4200 localPort = 40537 externalPort = 3000 +[[ports]] +localPort = 42161 +externalPort = 6000 + [[ports]] localPort = 43245 externalPort = 3001 +[[ports]] +localPort = 45355 +externalPort = 6800 + [[ports]] localPort = 46681 externalPort = 5173 diff --git a/client/src/pages/new-post.tsx b/client/src/pages/new-post.tsx index c759abe..77f7ca5 100644 --- a/client/src/pages/new-post.tsx +++ b/client/src/pages/new-post.tsx @@ -1,7 +1,7 @@ -import { useState, useCallback } from "react"; +import { useState, useCallback, useRef } from "react"; import { useQuery, useMutation } from "@tanstack/react-query"; import { useLocation } from "wouter"; -import { Send, Sparkles, Image as ImageIcon, Calendar, Upload } from "lucide-react"; +import { Send, Sparkles, Image as ImageIcon, Calendar, Upload, Camera } from "lucide-react"; import { useDropzone } from "react-dropzone"; import Sidebar from "@/components/sidebar"; import TopBar from "@/components/topbar"; @@ -20,6 +20,7 @@ export default function NewPost() { const [sidebarOpen, setSidebarOpen] = useState(false); const [, navigate] = useLocation(); const { toast } = useToast(); + const cameraInputRef = useRef(null); const [productInfo, setProductInfo] = useState(''); const [selectedMedia, setSelectedMedia] = useState(null); @@ -189,6 +190,13 @@ export default function NewPost() { }); }; + const handleCameraCapture = (e: React.ChangeEvent) => { + const file = e.target.files?.[0]; + if (file) { + uploadMutation.mutate(file); + } + }; + return (
{sidebarOpen && ( @@ -218,6 +226,103 @@ export default function NewPost() {
+ + +
+
+ Média + Sélectionnez ou uploadez une image/vidéo +
+
+ + +
+
+
+ + +
+ + {mediaList.length === 0 ? ( +
+ +

+ {isDragActive ? "Déposez votre photo ici" : "Aucun média disponible"} +

+
+ + +
+
+ ) : ( +
+ {mediaList.map((media) => ( + + ))} +
+ )} +
+
+
+ Contenu @@ -297,70 +402,6 @@ export default function NewPost() { )} - - - -
-
- Média - Sélectionnez ou uploadez une image/vidéo -
- -
-
- -
- - {mediaList.length === 0 ? ( -
- -

- {isDragActive ? "Déposez votre photo ici" : "Aucun média disponible"} -

- -
- ) : ( -
- {mediaList.map((media) => ( - - ))} -
- )} -
-
-