fix: marking

This commit is contained in:
eugene 2024-08-15 12:25:37 +03:00
parent 2becab9f79
commit b22f577cc2

View File

@ -35,10 +35,10 @@ const PdfView = ({
}, [currentFile]) }, [currentFile])
const filterByFile = ( const filterByFile = (
currentUserMarks: CurrentUserMark[], currentUserMarks: CurrentUserMark[],
fileName: string hash: string
): CurrentUserMark[] => { ): CurrentUserMark[] => {
return currentUserMarks.filter( return currentUserMarks.filter(
(currentUserMark) => currentUserMark.mark.fileName === fileName (currentUserMark) => currentUserMark.mark.pdfFileHash === hash
) )
} }
const isNotLastPdfFile = (index: number, files: CurrentUserFile[]): boolean => const isNotLastPdfFile = (index: number, files: CurrentUserFile[]): boolean =>
@ -46,7 +46,7 @@ const PdfView = ({
return ( return (
<> <>
{files.map((currentUserFile, index, arr) => { {files.map((currentUserFile, index, arr) => {
const { hash, pdfFile, filename, id } = currentUserFile const { hash, pdfFile, id } = currentUserFile
if (!hash) return if (!hash) return
return ( return (
<div <div
@ -56,7 +56,7 @@ const PdfView = ({
> >
<PdfItem <PdfItem
pdfFile={pdfFile} pdfFile={pdfFile}
currentUserMarks={filterByFile(currentUserMarks, filename)} currentUserMarks={filterByFile(currentUserMarks, hash)}
selectedMark={selectedMark} selectedMark={selectedMark}
handleMarkClick={handleMarkClick} handleMarkClick={handleMarkClick}
selectedMarkValue={selectedMarkValue} selectedMarkValue={selectedMarkValue}