From bc07ea60773bd887e3f403af29855120fe5f7949 Mon Sep 17 00:00:00 2001 From: nBiqoz Date: Mon, 28 Jul 2025 23:14:26 +0200 Subject: [PATCH] presidio ok v.1 button disposition --- app/components/AnonymizationInterface.tsx | 9 +- app/components/FileUploadComponent.tsx | 196 ++++++++++++++++------ app/components/ProgressBar.tsx | 17 +- app/page.tsx | 33 +--- 4 files changed, 172 insertions(+), 83 deletions(-) diff --git a/app/components/AnonymizationInterface.tsx b/app/components/AnonymizationInterface.tsx index 114569d..c607f10 100644 --- a/app/components/AnonymizationInterface.tsx +++ b/app/components/AnonymizationInterface.tsx @@ -18,7 +18,7 @@ export const AnonymizationInterface = ({ const anonymizedTypes = new Set(); // ✅ NOUVEAUX PATTERNS PRESIDIO - + // Noms (PERSON) if (outputText.includes("")) { anonymizedTypes.add("Prénoms"); @@ -62,7 +62,7 @@ export const AnonymizationInterface = ({ } // ✅ ANCIENS PATTERNS (pour compatibilité) - + // Noms (anciens patterns [Nom1], [Nom2]...) if (outputText.includes("[Nom1]") || outputText.includes("[Nom")) { anonymizedTypes.add("Prénoms"); @@ -76,7 +76,10 @@ export const AnonymizationInterface = ({ } // Téléphones (anciens patterns) - if (outputText.includes("[Téléphone1]") || outputText.includes("[Téléphone")) { + if ( + outputText.includes("[Téléphone1]") || + outputText.includes("[Téléphone") + ) { anonymizedTypes.add("Numéros de téléphone"); } diff --git a/app/components/FileUploadComponent.tsx b/app/components/FileUploadComponent.tsx index eeec160..0474d8e 100644 --- a/app/components/FileUploadComponent.tsx +++ b/app/components/FileUploadComponent.tsx @@ -1,7 +1,15 @@ -import { Upload, FileText, AlertTriangle } from "lucide-react"; +import { + Upload, + FileText, + AlertTriangle, + Shield, + Copy, + Download, +} from "lucide-react"; import { SampleTextComponent } from "./SampleTextComponent"; import { SupportedDataTypes } from "./SupportedDataTypes"; import { AnonymizationInterface } from "./AnonymizationInterface"; +import { highlightEntities } from "../utils/highlightEntities"; interface FileUploadComponentProps { uploadedFile: File | null; @@ -16,6 +24,8 @@ interface FileUploadComponentProps { isLoadingFile?: boolean; onRestart?: () => void; outputText?: string; + copyToClipboard?: () => void; + downloadText?: () => void; } export const FileUploadComponent = ({ @@ -31,66 +41,156 @@ export const FileUploadComponent = ({ isLoadingFile = false, onRestart, outputText, + copyToClipboard, + downloadText, }: FileUploadComponentProps) => { // Si un fichier est uploadé ou qu'il y a du texte d'exemple, on affiche le preview if (uploadedFile || (sourceText && sourceText.trim())) { return (
- {/* Preview du document avec en-tête simple */} -
-
-
-
-
- -
-
- {uploadedFile ? ( -

- {uploadedFile.name} •{" "} - {(uploadedFile.size / 1024).toFixed(1)} KB -

- ) : ( -

- Demo - Exemple de texte -

- )} -
-
-
-
- -
- {/* Zone de texte avec limite de hauteur et scroll */} -
- {isLoadingFile ? ( -
+ {/* Si on a un résultat, afficher 2 blocs côte à côte */} + {outputText ? ( +
+ {/* Preview du document original */} +
+
+
-
- - Chargement du fichier en cours... - +
+ +
+
+ {uploadedFile ? ( +

+ {uploadedFile.name} •{" "} + {(uploadedFile.size / 1024).toFixed(1)} KB +

+ ) : ( +

+ Demo - Exemple de texte +

+ )} +
- ) : ( -
-                  {sourceText || "Aucun contenu à afficher"}
-                
- )} +
+
+
+
+                    {sourceText || "Aucun contenu à afficher"}
+                  
+
+
- {/* Disclaimer déplacé en dessous du texte */} -
-
- -

- Cet outil IA peut ne pas détecter toutes les informations - sensibles. Vérifiez le résultat avant de le partager. -

+ {/* Bloc résultat anonymisé */} +
+
+
+
+
+ +
+
+

+ Document anonymisé +

+
+
+ + {/* Boutons d'action */} +
+ {copyToClipboard && ( + + )} + + {downloadText && ( + + )} +
+
+
+
+
+
+ {highlightEntities( + outputText || "Aucun contenu à afficher" + )} +
+
-
+ ) : ( + /* Preview normal quand pas de résultat */ +
+
+
+
+
+ +
+
+ {uploadedFile ? ( +

+ {uploadedFile.name} •{" "} + {(uploadedFile.size / 1024).toFixed(1)} KB +

+ ) : ( +

+ Demo - Exemple de texte +

+ )} +
+
+
+
+ +
+ {/* Zone de texte avec limite de hauteur et scroll */} +
+ {isLoadingFile ? ( +
+
+
+ + Chargement du fichier en cours... + +
+
+ ) : ( +
+                    {sourceText || "Aucun contenu à afficher"}
+                  
+ )} +
+ + {/* Disclaimer déplacé en dessous du texte */} +
+
+ +

+ Cet outil IA peut ne pas détecter toutes les informations + sensibles. Vérifiez le résultat avant de le partager. +

+
+
+
+
+ )} {/* Boutons d'action - Responsive mobile */} {canAnonymize && !isLoadingFile && ( diff --git a/app/components/ProgressBar.tsx b/app/components/ProgressBar.tsx index c30b65e..88a03c2 100644 --- a/app/components/ProgressBar.tsx +++ b/app/components/ProgressBar.tsx @@ -1,4 +1,5 @@ import { Check, Upload, Eye, Shield } from "lucide-react"; +import React from "react"; interface ProgressBarProps { currentStep: number; @@ -27,15 +28,15 @@ export const ProgressBar = ({ currentStep, steps }: ProgressBarProps) => { return (
-
+
{steps.map((step, index) => { const stepNumber = index + 1; const isCompleted = stepNumber < currentStep; const isCurrent = stepNumber === currentStep; return ( -
- {/* Step Circle */} + + {/* Step Circle and Label */}
{ : "text-gray-500" }`} style={{ - wordBreak: 'break-word', - hyphens: 'auto' + wordBreak: "break-word", + hyphens: "auto", }} > {step === "Anonymisation" ? ( @@ -72,9 +73,9 @@ export const ProgressBar = ({ currentStep, steps }: ProgressBarProps) => { {/* Connector Line */} {index < steps.length - 1 && ( -
+
{ />
)} -
+ ); })}
diff --git a/app/page.tsx b/app/page.tsx index 6a1d2bb..b301188 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -2,13 +2,12 @@ import { useState } from "react"; import { FileUploadComponent } from "./components/FileUploadComponent"; -import { ResultPreviewComponent } from "./components/ResultPreviewComponent"; + import { EntityMappingTable } from "./components/EntityMappingTable"; import { ProgressBar } from "./components/ProgressBar"; import { useFileHandler } from "./components/FileHandler"; import { useAnonymization } from "./components/AnonymizationLogic"; import { useDownloadActions } from "./components/DownloadActions"; -import { highlightEntities } from "./utils/highlightEntities"; interface EntityMapping { originalValue: string; @@ -81,13 +80,13 @@ export default function Home() {
{/* Main Content */} -
+
{/* Progress Bar */} {/* Upload Section */}
-
+
- {/* Result Preview */} + {/* Entity Mapping Table - Seulement si outputText existe */} {outputText && (
-
- -
-
- )} - - {/* Entity Mapping Table */} - {outputText && ( -
-
+
@@ -166,11 +153,9 @@ export default function Home() {
) : line.startsWith("-") ? ( -
- • {line.substring(1).trim()} -
+
{line}
) : ( -
{line}
+ line )}
))}