MCPcopy Index your code
hub / github.com/OpenSignLabs/OpenSign / Header

Function Header

apps/OpenSign/src/components/pdf/PdfHeader.jsx:24–753  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

22import { maxFileSize } from "../../constant/const";
23
24function Header(props) {
25 const { t } = useTranslation();
26 const isMobile = window.innerWidth < 767;
27 const [isDownloading, setIsDownloading] = useState("");
28 const [isDeletePage, setIsDeletePage] = useState(false);
29 const [isReorderModal, setIsReorderModal] = useState(false);
30 const mergePdfInputRef = useRef(null);
31 const enabledBackBtn = props?.disabledBackBtn === true ? false : true;
32 const isViewerSigner = false;
33 const finishLabel = t("finish");
34 //function for show decline alert
35 const handleDeclinePdfAlert = async () => {
36 if (props?.handleDecline) {
37 props.handleDecline();
38 } else {
39 const currentDecline = { currnt: "Sure", isDeclined: true };
40 props?.setIsDecline(currentDecline);
41 }
42 };
43 const handleDetelePage = async () => {
44 props?.setIsUploadPdf && props?.setIsUploadPdf(true);
45 const pdfupdatedData = await deletePdfPage(
46 props?.pdfArrayBuffer,
47 props?.pageNumber
48 );
49 if (pdfupdatedData?.totalPages === 1) {
50 alert(t("delete-alert"));
51 } else {
52 props?.setPdfBase64Url(pdfupdatedData.base64);
53 props?.setPdfArrayBuffer(pdfupdatedData.arrayBuffer);
54 setIsDeletePage(false);
55 handleRemoveWidgets(
56 props?.setSignerPos,
57 props?.signerPos,
58 props?.pageNumber
59 );
60 }
61 };
62
63 // `removeFile` is used to remove file if exists
64 const removeFile = (e) => {
65 if (e) {
66 e.target.value = "";
67 }
68 };
69
70 const handleFileUpload = async (e) => {
71 const file = e.target.files[0];
72 if (!file) {
73 alert(t("please-select-pdf"));
74 return;
75 }
76 if (!file.type.includes("pdf")) {
77 alert(t("only-pdf-allowed"));
78 return;
79 }
80 const fileSize =
81 maxFileSize;

Callers

nothing calls this directly

Calls 6

handleToPrintFunction · 0.90
handleDeclinePdfAlertFunction · 0.85
handleDownloadDocFunction · 0.85
handleDownloadBtnFunction · 0.70
handleDetelePageFunction · 0.70

Tested by

no test coverage detected