Offline flow separation #304

Merged
b merged 13 commits from 231-offline-flow into staging 2025-01-22 13:05:30 +00:00
5 changed files with 21 additions and 11 deletions
Showing only changes of commit e60c4cbc31 - Show all commits

View File

@ -38,12 +38,16 @@ const PdfView = ({
currentUserMarks: CurrentUserMark[],
hash: string
): CurrentUserMark[] => {
return currentUserMarks.filter(
(currentUserMark) => currentUserMark.mark.pdfFileHash === hash
return currentUserMarks.filter((currentUserMark) =>
currentUserMark.mark.pdfFileHash
? currentUserMark.mark.pdfFileHash === hash
: currentUserMark.mark.fileHash === hash
)
}
const filterMarksByFile = (marks: Mark[], hash: string): Mark[] => {
return marks.filter((mark) => mark.pdfFileHash === hash)
return marks.filter((mark) =>
mark.pdfFileHash ? mark.pdfFileHash === hash : mark.fileHash === hash
)
}
return (
<div className="files-wrapper">

View File

@ -19,7 +19,7 @@
"page": 1
},
"npub": "npub1x77qywdllzetv9ncnhlfpv62kshlgtt0uqlsq3v22uzzkk2xvvrsn6uyfy",
"pdfFileHash": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05"
"fileHash": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05"
}
],
"da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05/2.png": [
@ -34,7 +34,7 @@
"page": 2
},
"npub": "npub1x77qywdllzetv9ncnhlfpv62kshlgtt0uqlsq3v22uzzkk2xvvrsn6uyfy",
"pdfFileHash": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05"
"fileHash": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05"
}
]
}
@ -54,7 +54,7 @@
"page": 1
},
"npub": "npub1x77qywdllzetv9ncnhlfpv62kshlgtt0uqlsq3v22uzzkk2xvvrsn6uyfy",
"pdfFileHash": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05",
"fileHash": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05",
"value": "Pera Peric"
},
{
@ -68,7 +68,7 @@
"page": 2
},
"npub": "npub1x77qywdllzetv9ncnhlfpv62kshlgtt0uqlsq3v22uzzkk2xvvrsn6uyfy",
"pdfFileHash": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05",
"fileHash": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05",
"value": "Pera Peric"
}
]

View File

@ -637,8 +637,8 @@ export const CreatePage = () => {
width: drawnField.width
},
npub: drawnField.counterpart,
pdfFileHash: fileHash,
fileName: file.name
fileName: file.name,
fileHash
}
})
}) || []

View File

@ -106,7 +106,10 @@ const SlimPdfView = ({
const m = parsedSignatureEvents[
e as `npub1${string}`
].parsedContent?.marks.filter(
(m) => m.pdfFileHash == hash && m.location.page == i
(m) =>
(m.pdfFileHash
? m.pdfFileHash == hash
: m.fileHash == hash) && m.location.page == i
)
if (m) {
marks.push(...m)

View File

@ -8,13 +8,16 @@ export interface CurrentUserMark {
currentValue?: string
}
// Both PdfFileHash and FileHash currently exist.
// It enables backward compatibility for Sigits created before January 2025
export interface Mark {
id: number
npub: string
pdfFileHash: string
type: MarkType
location: MarkLocation
fileName: string
pdfFileHash?: string
fileHash?: string
value?: string
}