Skip to content

Commit

Permalink
added the new flow
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterK0927 committed Aug 24, 2024
1 parent e6b5bc7 commit 8fe8910
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,14 @@ export const PdfRenderer: React.FC = () => {
const [tempButtonState, setTempButtonState] = useState('normal');
const [signatureMethod, setSignatureMethod] = useState<'digitalID' | 'imageUpload' | null>(null);
const [typedSignatureName, setTypedSignatureName] = useState<string>('');
const [isImageUploadFlow, setIsImageUploadFlow] = useState<boolean>(false);

const resetSignatureState = useCallback(() => {
setIsSelectionEnabled(false);
setStatusMessage('');
setIsStatusVisible(false);
setShowSignatureMethodPopup(false);
setIsImageUploadFlow(false);
setShowSignaturePopup(false);
setShowTypeSignaturePopup(false);
setSelectedSignature(null);
Expand Down Expand Up @@ -286,8 +288,10 @@ export const PdfRenderer: React.FC = () => {
setShowSignatureMethodPopup(false);
if (method === 'digitalID') {
setShowSignaturePopup(true);
setIsImageUploadFlow(false);
} else {
setShowTypeSignaturePopup(true);
setIsImageUploadFlow(true);
}
};

Expand Down Expand Up @@ -361,6 +365,7 @@ export const PdfRenderer: React.FC = () => {
setStatusMessage('Signature applied');
setStatusType('success');
setIsStatusVisible(true);
// setIsImageUploadFlow(false);
setIsVerified(true);
setShowSuccessPopup(true);
setIsSigned(true);
Expand All @@ -373,6 +378,7 @@ export const PdfRenderer: React.FC = () => {
setStatusMessage('Signing Failed');
setIsStatusVisible(true);
setErrorMessage(error.message || 'An error occurred while signing the document');
setIsImageUploadFlow(false);
setIsVerified(false);
clearAllSelections();
setShowError(true);
Expand Down Expand Up @@ -443,8 +449,10 @@ export const PdfRenderer: React.FC = () => {
setNumPages(numPages);
setIsVerified(false);
setPageNumber(1);
setTimeout(() => handleVerifyButtonClick(), 2000);
}, [handleVerifyButtonClick]);
if (!isImageUploadFlow) {
setTimeout(() => handleVerifyButtonClick(), 2000);
}
}, [handleVerifyButtonClick, isImageUploadFlow]);

const onPageLoadSuccess = useCallback((pageIndex: number) => {
const pageCanvas = pdfCanvasRefs.current[pageIndex];
Expand Down

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,15 @@
"@brave/leo": "github:brave/leo#72ca2488535ef0e651ff41319c3f21f2bf2c3f65",
"@brave/leo-sf-symbols": "github:brave/leo-sf-symbols#b667e73c79d1d5b4490eb2fa8925f0293b24c2f7",
"@brave/wallet-standard-brave": "0.0.13",
"@btielen/pdf-lib-fontkit": "^1.0.0",
"@dnd-kit/core": "6.0.5",
"@dnd-kit/sortable": "7.0.1",
"@glif/filecoin-wallet-provider": "2.0.0-beta.12",
"@ledgerhq/hw-app-eth": "6.24.1",
"@ledgerhq/hw-app-solana": "6.27.1",
"@ledgerhq/hw-transport-webhid": "6.24.1",
"@mozilla/readability": "^0.4.2",
"@pdf-lib/fontkit": "^1.1.1",
"@reduxjs/toolkit": "1.8.6",
"@solana/web3.js": "1.91.7",
"@trezor/connect": "9.1.11",
Expand Down
4 changes: 4 additions & 0 deletions third_party/npm_@btielen_pdf-lib-fontkit/README.chromium
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Name: @bitelen/pdf-lib-fontkit
URL: https://github.com/bitelen/pdf-lib-fontkit
License: Apache-2.0
License File: /brave/node_modules/@bitelen/pdf-lib-fontkit/LICENSE.md
4 changes: 4 additions & 0 deletions third_party/npm_@pdf-lib_fontkit/README.chromium
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Name: @pdf-lib/fontkit
URL: https://github.com/pdf-lib/fontkit
License: Apache-2.0
License File: /brave/node_modules/@pdf-lib/fontkit/LICENSE.md

0 comments on commit 8fe8910

Please sign in to comment.