diff --git a/ui/src/components/FileComponents/OcrOverviewCard.js b/ui/src/components/FileComponents/OcrOverviewCard.js index 2dd74d9..9336319 100644 --- a/ui/src/components/FileComponents/OcrOverviewCard.js +++ b/ui/src/components/FileComponents/OcrOverviewCard.js @@ -1,5 +1,5 @@ import React, { useState } from "react"; -import { Checkbox, Input, Row, Col, Modal } from "antd"; +import { Checkbox, Input, Row, Col, Modal, Button, Tooltip } from "antd"; import "../../styles/OcrOverviewCard.css"; const OcrOverviewCard = ({ data }) => { @@ -7,9 +7,16 @@ const OcrOverviewCard = ({ data }) => { const [wrapText, setWrapText] = useState(false); const [trimText, setTrimText] = useState(true); const [filter, setFilter] = useState(""); + const [isBlurred, setIsBlurred] = useState(data.scan.qr ? true : false); // State to manage blur for QR codes - const showModal = () => setIsModalVisible(true); + const showModal = () => { + // Only show modal if the image is not blurred + if (!isBlurred) { + setIsModalVisible(true); + } + }; const handleCancel = () => setIsModalVisible(false); + const toggleBlur = () => setIsBlurred(!isBlurred); let texts = Array.isArray(data.scan.ocr?.text) ? data.scan.ocr.text @@ -27,6 +34,16 @@ const OcrOverviewCard = ({ data }) => { return
; }; + // Conditional styling for blurred image (QR codes) + const imageStyle = isBlurred + ? { + filter: "blur(4px)", + cursor: "pointer", + } + : { + cursor: "pointer", + }; + // Function to create line numbers and corresponding text const renderTextLines = (texts) => { let lineNumber = 1; // Initialize line number @@ -83,19 +100,27 @@ const OcrOverviewCard = ({ data }) => {