issue-99-signing-page-refactor #124
No reviewers
Labels
No Label
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sigit/sigit.io#124
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "issue-99-signing-page-refactor"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is a chunky PR, so unfortunately it has to be accompanied by a wall of text below. Going forward, will be sticking to slimmer PRs.
Key objectives of this PR:
Changes included in the PR.
Mark
interface wsa changed to include all relevant information for each mark, includingpdfFileHash
and a uniqueID
. Instead of a nested data structure, we now have an array of Mark objects which makes it easy to iterate over them without always transforming Objects back into Arrays and vice versa.CurrentUserMark
was added as an internal type to represent Marks that have been processed by Sigit for filling in and displaying on the document.CurrentUserMark
contains all the relevant information, such as whether the mark is complete and whether is is a last mark - required for efficient rendering and user flow.(Happy to chat about it further. If we feel that it's a redundant type, it should be easy to remove, since it's an internal type only)
Third, I've added the following components to render Marked PDFs:
PDFMarking
- top level component that keeps track of pdf files, pages, marks, and current form valuesPdfView
- Manages all pdf filesPdfItem
- Displays each filePdfPageItem
- Displays each page of each filePdfMarkItem
- Renders each markIn
PdfMarkItem
,userMark
represents each mark to be rendered, whileselectedMark
and its correspondingselecredMarkValue
represents the mark that the user is currently editing.The reason I went for a nested structure is because I thought that the
sign/index
handler is already quite big. At the top level,sign/index
can control which part of the signing process needs to be displayed at any point.isReadyToSign
is the flat thatsign/index
can use to decide whether to display PDF Marking and Rendering components or the Signing Component.MarkFormField
is the component that manages the bottom form part of the marking process.VerifyPage
was changed to include the "export" button. Once the document is fully signed, the user can export it. The PDF will be generated, alongside the meta.json file, and saved on the user computer.utils/mark
contains utility methods related to dealing withMarks
andCurrentUserMarks
utils/pdf
contains helper functions and shared functionality related to dealing with PDFsutils/sign
contains shared methods related to signingWhat I have tested
Current limitations
sign/index
to effectively only control which components should be rendering, and move as much processing logic to its related components.verify/index
component is definitely not in the right place, but as mentioned above, I was primarily focusong on functionality.sign/index
doesn't currently work properly. This is probably the most straightforward next bit of work.a) transforming PDF to PNG, which involves some scaling issues and other compatibility issues (like, font size)
b) storing Mark coordinates separately
c) storing completed marks separately
d) Always converting PDF to PNG before rendering it.
f) Creating a brand new PDF when we generate it at the end of the process and adding annotations using a completely separate tool.
I would be quite keen to explore if
pdf-lib
or other sinmilar library (I'm not wedded to pdf lib) can streamline the process. If we can embed the fields on the file itself, then we can actually remove the Mark data structures completely, unless I'm missing anything.Please feel free to pick this PR apart mercilessly if you feel that something can be done better! I'm still finding my way around the repo, so could have missed some crucial bits.
@ -62,2 +62,2 @@
width: 40px;
height: 40px;
//width: 40px;
//height: 40px;
I suggest removing the commented code or providing more details in a comment as to why we should keep it.
@ -519,6 +526,8 @@ export const CreatePage = () => {
title
}
console.log('content: ', content)
Please remove the console.log
@ -296,10 +319,17 @@ export const SignPage = () => {
}
}
console.log('processed files: ', files);
Please remove the console.log
@ -434,6 +455,8 @@ export const SignPage = () => {
}
}
console.log('processed files: ', files);
Please remove the console.log
@ -512,0 +575,4 @@
// setCurrentUserMark(findNextCurrentUserMark(currentUserMarks) || null)
// setIsReadyToSign(isCurrentUserMarksComplete(currentUserMarks))
// }
I suggest removing the commented code or providing more details in a comment as to why we should keep it.
@ -922,0 +995,4 @@
// )}
// </Box>
// </>
// )
I suggest removing the commented code or providing more details in a comment as to why we should keep it.
@ -361,1 +381,4 @@
const handleExport = async () => {
// const proverbialUrls = await addMarksV2(Object.values(files)[0].file, meta!)
// await convertToFinalPdf(proverbialUrls)
I suggest removing the commented code or providing more details in a comment as to why we should keep it.
@ -3,0 +5,4 @@
// * @key png (pdf page) file hash
// */
// [key: string]: MarkConfigDetails[]
// }
I suggest removing the commented code or providing more details in a comment as to why we should keep it.
37b0ae21e0
toc5e234d792
This PR has been merged as part of the
issue-99
PR. Closing.Pull request closed