-
Add {markLabel}
+ {!complete && (
+
Add {markLabel}
+ )}
+ {complete &&
Finish
}
-
+ )}
+
+ {complete && (
-
+
-
+ )}
+
{currentUserMarks.map((mark, index) => {
return (
@@ -114,6 +164,22 @@ const MarkFormField = ({
)
})}
+
+
+ {complete && (
+
+ )}
+
diff --git a/src/components/MarkFormField/style.module.scss b/src/components/MarkFormField/style.module.scss
index 686595f..e7a3e3c 100644
--- a/src/components/MarkFormField/style.module.scss
+++ b/src/components/MarkFormField/style.module.scss
@@ -70,6 +70,11 @@
margin-top: 10px;
}
+ .completeButton {
+ font-size: 18px;
+ padding: 10px 20px;
+ }
+
.paginationButton {
font-size: 12px;
padding: 5px 10px;
@@ -78,7 +83,8 @@
color: rgba(0, 0, 0, 0.5);
}
- .paginationButton:hover {
+ .paginationButton:hover,
+ .paginationButton:focus {
background: #447592;
color: rgba(255, 255, 255, 0.5);
}
@@ -216,3 +222,7 @@
flex-direction: column;
grid-gap: 5px;
}
+
+.finishPage {
+ padding: 1px 0;
+}
diff --git a/src/components/PDFView/PdfMarking.tsx b/src/components/PDFView/PdfMarking.tsx
index 222c393..f0d4f60 100644
--- a/src/components/PDFView/PdfMarking.tsx
+++ b/src/components/PDFView/PdfMarking.tsx
@@ -24,11 +24,12 @@ import {
interface PdfMarkingProps {
currentUserMarks: CurrentUserMark[]
files: CurrentUserFile[]
- handleDownload: () => void
+ handleExport: () => void
+ handleEncryptedExport: () => void
+ handleSign: () => void
meta: Meta | null
otherUserMarks: Mark[]
setCurrentUserMarks: (currentUserMarks: CurrentUserMark[]) => void
- setIsMarksCompleted: (isMarksCompleted: boolean) => void
setUpdatedMarks: (markToUpdate: Mark) => void
}
@@ -42,10 +43,11 @@ const PdfMarking = (props: PdfMarkingProps) => {
const {
files,
currentUserMarks,
- setIsMarksCompleted,
setCurrentUserMarks,
setUpdatedMarks,
- handleDownload,
+ handleExport,
+ handleEncryptedExport,
+ handleSign,
meta,
otherUserMarks
} = props
@@ -86,11 +88,18 @@ const PdfMarking = (props: PdfMarkingProps) => {
updatedSelectedMark
)
setCurrentUserMarks(updatedCurrentUserMarks)
- setSelectedMarkValue(mark.currentValue ?? EMPTY)
- setSelectedMark(mark)
+
+ // If clicking on the same mark, don't update the value, otherwise do update
+ if (mark.id !== selectedMark.id) {
+ setSelectedMarkValue(mark.currentValue ?? EMPTY)
+ setSelectedMark(mark)
+ }
}
- const handleSubmit = (event: React.FormEvent
) => {
+ /**
+ * Sign and Complete
+ */
+ const handleSubmit = (event: React.MouseEvent) => {
event.preventDefault()
if (!selectedMarkValue || !selectedMark) return
@@ -106,8 +115,8 @@ const PdfMarking = (props: PdfMarkingProps) => {
)
setCurrentUserMarks(updatedCurrentUserMarks)
setSelectedMark(null)
- setIsMarksCompleted(true)
setUpdatedMarks(updatedMark.mark)
+ handleSign()
}
// const updateCurrentUserMarkValues = () => {
@@ -132,7 +141,8 @@ const PdfMarking = (props: PdfMarkingProps) => {
files={files}
currentFile={currentFile}
setCurrentFile={setCurrentFile}
- handleDownload={handleDownload}
+ handleExport={handleExport}
+ handleEncryptedExport={handleEncryptedExport}
/>
)}
diff --git a/src/hooks/useSigitMeta.tsx b/src/hooks/useSigitMeta.tsx
index 85841f2..5c1159e 100644
--- a/src/hooks/useSigitMeta.tsx
+++ b/src/hooks/useSigitMeta.tsx
@@ -45,7 +45,7 @@ export interface FlatMeta
isValid: boolean
// Decryption
- encryptionKey: string | null
+ encryptionKey: string | undefined
// Parsed Document Signatures
parsedSignatureEvents: {
@@ -101,7 +101,7 @@ export const useSigitMeta = (meta: Meta): FlatMeta => {
[signer: `npub1${string}`]: SignStatus
}>({})
- const [encryptionKey, setEncryptionKey] = useState