From ae80aa3f0f658b9a677e1be5ec9005fab35008ec Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Mon, 3 Nov 2025 11:12:04 +0000 Subject: [PATCH] Add a refresh button to reload the sales analysis iframe Adds a refresh button to the Sales Analysis page that allows users to force a full reload of the embedded sales analysis iframe by incrementing a state key which is used as the iframe's `key` prop. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 1e4433b5-47ab-464c-b663-fea2e53367dd Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Event-Id: 514e3cfa-4217-4b22-ae44-47651cf2b253 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/1e4433b5-47ab-464c-b663-fea2e53367dd/7RN8LqE --- client/src/pages/SalesAnalysisPage.tsx | 29 ++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/client/src/pages/SalesAnalysisPage.tsx b/client/src/pages/SalesAnalysisPage.tsx index 1b64665..c942eb1 100644 --- a/client/src/pages/SalesAnalysisPage.tsx +++ b/client/src/pages/SalesAnalysisPage.tsx @@ -1,6 +1,7 @@ +import { useState } from "react"; import { useQuery } from "@tanstack/react-query"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; -import { Loader2, TrendingUp, AlertCircle } from "lucide-react"; +import { Loader2, TrendingUp, AlertCircle, RefreshCw } from "lucide-react"; import { Link } from "wouter"; import { Button } from "@/components/ui/button"; @@ -12,10 +13,18 @@ interface UtilitiesConfig { } export default function SalesAnalysisPage() { + // State pour forcer le rechargement de l'iframe + const [iframeKey, setIframeKey] = useState(0); + // Récupérer l'URL configurée const { data: config, isLoading } = useQuery({ queryKey: ['/api/utilities'] }); + + // Fonction pour recharger l'iframe + const handleRefresh = () => { + setIframeKey(prev => prev + 1); + }; if (isLoading) { return ( @@ -52,8 +61,24 @@ export default function SalesAnalysisPage() { } return ( -
+
+ {/* Bouton de rechargement flottant */} +
+ +
+ + {/* iframe avec clé pour forcer le rechargement */}