2024-09-13 17:53:22 +02:00
|
|
|
import { Box, Button, Typography } from '@mui/material'
|
2024-05-14 14:27:05 +05:00
|
|
|
import JSZip from 'jszip'
|
|
|
|
import { MuiFileInput } from 'mui-file-input'
|
2024-08-14 18:59:00 +02:00
|
|
|
import { useEffect, useRef, useState } from 'react'
|
2024-05-14 14:27:05 +05:00
|
|
|
import { toast } from 'react-toastify'
|
|
|
|
import { LoadingSpinner } from '../../components/LoadingSpinner'
|
2024-08-13 13:32:32 +02:00
|
|
|
import { NostrController } from '../../controllers'
|
2024-09-13 17:53:22 +02:00
|
|
|
import { DocSignatureEvent, Meta } from '../../types'
|
2024-05-14 14:27:05 +05:00
|
|
|
import {
|
2024-08-13 12:48:52 +03:00
|
|
|
decryptArrayBuffer,
|
2024-05-22 11:19:40 +05:00
|
|
|
getHash,
|
2024-08-13 12:48:52 +03:00
|
|
|
hexToNpub,
|
2024-08-13 11:52:05 +02:00
|
|
|
unixNow,
|
2024-05-14 14:27:05 +05:00
|
|
|
parseJson,
|
|
|
|
readContentOfZipEntry,
|
2024-08-14 14:27:49 +02:00
|
|
|
signEventForMetaFile,
|
2024-08-22 18:20:54 +02:00
|
|
|
getCurrentUserFiles
|
2024-05-14 14:27:05 +05:00
|
|
|
} from '../../utils'
|
|
|
|
import styles from './style.module.scss'
|
2024-06-13 11:47:28 +05:00
|
|
|
import { useLocation } from 'react-router-dom'
|
2024-07-05 13:38:04 +05:00
|
|
|
import axios from 'axios'
|
2024-10-09 11:51:26 +02:00
|
|
|
import { FONT_SIZE, FONT_TYPE, inPx } from '../../utils/pdf.ts'
|
2024-10-08 17:08:43 +02:00
|
|
|
import { useAppSelector } from '../../hooks/store'
|
2024-07-25 17:51:31 +03:00
|
|
|
import { getLastSignersSig } from '../../utils/sign.ts'
|
|
|
|
import { saveAs } from 'file-saver'
|
2024-07-30 10:28:57 +02:00
|
|
|
import { Container } from '../../components/Container'
|
2024-08-13 13:32:32 +02:00
|
|
|
import { useSigitMeta } from '../../hooks/useSigitMeta.tsx'
|
2024-08-14 14:27:49 +02:00
|
|
|
import { StickySideColumns } from '../../layouts/StickySideColumns.tsx'
|
|
|
|
import { UsersDetails } from '../../components/UsersDetails.tsx/index.tsx'
|
2024-08-14 18:59:00 +02:00
|
|
|
import FileList from '../../components/FileList'
|
|
|
|
import { CurrentUserFile } from '../../types/file.ts'
|
2024-08-15 13:47:23 +02:00
|
|
|
import { Mark } from '../../types/mark.ts'
|
2024-08-21 11:26:17 +02:00
|
|
|
import React from 'react'
|
2024-10-09 11:51:26 +02:00
|
|
|
import {
|
|
|
|
convertToSigitFile,
|
|
|
|
getZipWithFiles,
|
|
|
|
SigitFile
|
|
|
|
} from '../../utils/file.ts'
|
2024-08-22 18:20:54 +02:00
|
|
|
import { FileDivider } from '../../components/FileDivider.tsx'
|
|
|
|
import { ExtensionFileBox } from '../../components/ExtensionFileBox.tsx'
|
2024-08-27 15:24:19 +02:00
|
|
|
import { useScale } from '../../hooks/useScale.tsx'
|
2024-09-04 14:05:36 +02:00
|
|
|
import {
|
|
|
|
faCircleInfo,
|
|
|
|
faFile,
|
|
|
|
faFileDownload
|
|
|
|
} from '@fortawesome/free-solid-svg-icons'
|
2024-05-14 14:27:05 +05:00
|
|
|
|
2024-08-14 18:59:00 +02:00
|
|
|
interface PdfViewProps {
|
|
|
|
files: CurrentUserFile[]
|
|
|
|
currentFile: CurrentUserFile | null
|
2024-08-15 13:47:23 +02:00
|
|
|
parsedSignatureEvents: {
|
|
|
|
[signer: `npub1${string}`]: DocSignatureEvent
|
|
|
|
}
|
2024-08-14 18:59:00 +02:00
|
|
|
}
|
|
|
|
|
2024-08-15 13:47:23 +02:00
|
|
|
const SlimPdfView = ({
|
|
|
|
files,
|
|
|
|
currentFile,
|
|
|
|
parsedSignatureEvents
|
|
|
|
}: PdfViewProps) => {
|
2024-08-14 18:59:00 +02:00
|
|
|
const pdfRefs = useRef<(HTMLDivElement | null)[]>([])
|
2024-08-27 15:24:19 +02:00
|
|
|
const { from } = useScale()
|
2024-08-14 18:59:00 +02:00
|
|
|
useEffect(() => {
|
|
|
|
if (currentFile !== null && !!pdfRefs.current[currentFile.id]) {
|
|
|
|
pdfRefs.current[currentFile.id]?.scrollIntoView({
|
2024-08-22 18:20:54 +02:00
|
|
|
behavior: 'smooth'
|
2024-08-14 18:59:00 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}, [currentFile])
|
|
|
|
return (
|
2024-08-22 18:20:54 +02:00
|
|
|
<div className="files-wrapper">
|
2024-08-30 12:28:33 +02:00
|
|
|
{files.length > 0 ? (
|
|
|
|
files.map((currentUserFile, i) => {
|
|
|
|
const { hash, file, id } = currentUserFile
|
|
|
|
const signatureEvents = Object.keys(parsedSignatureEvents)
|
|
|
|
if (!hash) return
|
|
|
|
return (
|
|
|
|
<React.Fragment key={file.name}>
|
|
|
|
<div
|
|
|
|
id={file.name}
|
|
|
|
ref={(el) => (pdfRefs.current[id] = el)}
|
|
|
|
className="file-wrapper"
|
|
|
|
>
|
|
|
|
{file.isPdf &&
|
|
|
|
file.pages?.map((page, i) => {
|
|
|
|
const marks: Mark[] = []
|
2024-08-21 17:07:29 +02:00
|
|
|
|
2024-08-30 12:28:33 +02:00
|
|
|
signatureEvents.forEach((e) => {
|
|
|
|
const m = parsedSignatureEvents[
|
|
|
|
e as `npub1${string}`
|
|
|
|
].parsedContent?.marks.filter(
|
|
|
|
(m) => m.pdfFileHash == hash && m.location.page == i
|
|
|
|
)
|
|
|
|
if (m) {
|
|
|
|
marks.push(...m)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
return (
|
|
|
|
<div className="image-wrapper" key={i}>
|
|
|
|
<img
|
|
|
|
draggable="false"
|
|
|
|
src={page.image}
|
|
|
|
alt={`page ${i} of ${file.name}`}
|
|
|
|
/>
|
|
|
|
{marks.map((m) => {
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
className={`file-mark ${styles.mark}`}
|
|
|
|
key={m.id}
|
|
|
|
style={{
|
|
|
|
left: inPx(from(page.width, m.location.left)),
|
|
|
|
top: inPx(from(page.width, m.location.top)),
|
|
|
|
width: inPx(from(page.width, m.location.width)),
|
|
|
|
height: inPx(
|
|
|
|
from(page.width, m.location.height)
|
|
|
|
),
|
|
|
|
fontFamily: FONT_TYPE,
|
|
|
|
fontSize: inPx(from(page.width, FONT_SIZE))
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{m.value}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
})}
|
|
|
|
</div>
|
2024-08-21 17:07:29 +02:00
|
|
|
)
|
2024-08-30 12:28:33 +02:00
|
|
|
})}
|
|
|
|
{file.isImage && (
|
|
|
|
<img
|
|
|
|
className="file-image"
|
|
|
|
src={file.objectUrl}
|
|
|
|
alt={file.name}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
{!(file.isPdf || file.isImage) && (
|
|
|
|
<ExtensionFileBox extension={file.extension} />
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
{i < files.length - 1 && <FileDivider />}
|
|
|
|
</React.Fragment>
|
|
|
|
)
|
|
|
|
})
|
|
|
|
) : (
|
|
|
|
<LoadingSpinner variant="small" />
|
|
|
|
)}
|
2024-08-14 18:59:00 +02:00
|
|
|
</div>
|
2024-05-16 10:40:56 +05:00
|
|
|
)
|
2024-08-14 18:59:00 +02:00
|
|
|
}
|
2024-05-14 14:27:05 +05:00
|
|
|
|
2024-08-14 18:59:00 +02:00
|
|
|
export const VerifyPage = () => {
|
2024-06-13 11:47:28 +05:00
|
|
|
const location = useLocation()
|
2024-10-08 17:08:43 +02:00
|
|
|
const usersPubkey = useAppSelector((state) => state.auth.usersPubkey)
|
2024-09-13 17:53:22 +02:00
|
|
|
|
|
|
|
const nostrController = NostrController.getInstance()
|
|
|
|
|
|
|
|
const [isLoading, setIsLoading] = useState(false)
|
|
|
|
const [loadingSpinnerDesc, setLoadingSpinnerDesc] = useState('')
|
|
|
|
|
2024-07-09 01:16:47 +05:00
|
|
|
/**
|
|
|
|
* uploadedZip will be received from home page when a user uploads a sigit zip wrapper that contains meta.json
|
|
|
|
* meta will be received in navigation from create & home page in online mode
|
|
|
|
*/
|
2024-09-13 17:53:22 +02:00
|
|
|
const { uploadedZip, meta: metaInNavState } = location.state || {}
|
|
|
|
const [selectedFile, setSelectedFile] = useState<File | null>(null)
|
|
|
|
useEffect(() => {
|
|
|
|
if (uploadedZip) {
|
|
|
|
setSelectedFile(uploadedZip)
|
|
|
|
}
|
|
|
|
}, [uploadedZip])
|
2024-08-13 13:32:32 +02:00
|
|
|
|
2024-09-13 17:53:22 +02:00
|
|
|
const [meta, setMeta] = useState<Meta>(metaInNavState)
|
2024-08-15 13:47:23 +02:00
|
|
|
const {
|
|
|
|
submittedBy,
|
|
|
|
zipUrl,
|
|
|
|
encryptionKey,
|
|
|
|
signers,
|
|
|
|
viewers,
|
|
|
|
fileHashes,
|
|
|
|
parsedSignatureEvents
|
|
|
|
} = useSigitMeta(meta)
|
2024-08-14 18:59:00 +02:00
|
|
|
|
2024-09-13 17:53:22 +02:00
|
|
|
const [files, setFiles] = useState<{ [filename: string]: SigitFile }>({})
|
2024-05-22 11:19:40 +05:00
|
|
|
|
2024-09-13 17:53:22 +02:00
|
|
|
const [currentFile, setCurrentFile] = useState<CurrentUserFile | null>(null)
|
2024-05-22 11:19:40 +05:00
|
|
|
const [currentFileHashes, setCurrentFileHashes] = useState<{
|
|
|
|
[key: string]: string | null
|
2024-08-20 11:44:34 +02:00
|
|
|
}>({})
|
2024-08-14 18:59:00 +02:00
|
|
|
|
2024-08-20 11:44:34 +02:00
|
|
|
useEffect(() => {
|
|
|
|
if (Object.entries(files).length > 0) {
|
2024-09-13 17:53:22 +02:00
|
|
|
const tmp = getCurrentUserFiles(files, currentFileHashes, fileHashes)
|
2024-08-14 18:59:00 +02:00
|
|
|
setCurrentFile(tmp[0])
|
|
|
|
}
|
2024-09-13 17:53:22 +02:00
|
|
|
}, [currentFileHashes, fileHashes, files])
|
2024-05-14 14:27:05 +05:00
|
|
|
|
2024-06-13 11:47:28 +05:00
|
|
|
useEffect(() => {
|
2024-09-13 17:53:22 +02:00
|
|
|
if (metaInNavState && encryptionKey) {
|
2024-07-05 13:38:04 +05:00
|
|
|
const processSigit = async () => {
|
|
|
|
setIsLoading(true)
|
|
|
|
|
|
|
|
setLoadingSpinnerDesc('Fetching file from file server')
|
|
|
|
axios
|
|
|
|
.get(zipUrl, {
|
|
|
|
responseType: 'arraybuffer'
|
|
|
|
})
|
|
|
|
.then(async (res) => {
|
|
|
|
const fileName = zipUrl.split('/').pop()
|
|
|
|
const file = new File([res.data], fileName!)
|
|
|
|
|
|
|
|
const encryptedArrayBuffer = await file.arrayBuffer()
|
|
|
|
const arrayBuffer = await decryptArrayBuffer(
|
|
|
|
encryptedArrayBuffer,
|
|
|
|
encryptionKey
|
|
|
|
).catch((err) => {
|
|
|
|
console.log('err in decryption:>> ', err)
|
|
|
|
toast.error(
|
|
|
|
err.message || 'An error occurred in decrypting file.'
|
|
|
|
)
|
|
|
|
return null
|
|
|
|
})
|
|
|
|
|
|
|
|
if (arrayBuffer) {
|
|
|
|
const zip = await JSZip.loadAsync(arrayBuffer).catch((err) => {
|
|
|
|
console.log('err in loading zip file :>> ', err)
|
|
|
|
toast.error(
|
|
|
|
err.message || 'An error occurred in loading zip file.'
|
|
|
|
)
|
|
|
|
return null
|
|
|
|
})
|
|
|
|
|
|
|
|
if (!zip) return
|
|
|
|
|
2024-08-22 18:20:54 +02:00
|
|
|
const files: { [fileName: string]: SigitFile } = {}
|
2024-07-05 13:38:04 +05:00
|
|
|
const fileHashes: { [key: string]: string | null } = {}
|
|
|
|
const fileNames = Object.values(zip.files).map(
|
|
|
|
(entry) => entry.name
|
|
|
|
)
|
|
|
|
|
|
|
|
// generate hashes for all entries in files folder of zipArchive
|
|
|
|
// these hashes can be used to verify the originality of files
|
|
|
|
for (const fileName of fileNames) {
|
|
|
|
const arrayBuffer = await readContentOfZipEntry(
|
|
|
|
zip,
|
|
|
|
fileName,
|
|
|
|
'arraybuffer'
|
|
|
|
)
|
|
|
|
|
|
|
|
if (arrayBuffer) {
|
2024-08-22 18:20:54 +02:00
|
|
|
files[fileName] = await convertToSigitFile(
|
|
|
|
arrayBuffer,
|
|
|
|
fileName!
|
|
|
|
)
|
2024-07-05 13:38:04 +05:00
|
|
|
const hash = await getHash(arrayBuffer)
|
|
|
|
|
|
|
|
if (hash) {
|
|
|
|
fileHashes[fileName.replace(/^files\//, '')] = hash
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
fileHashes[fileName.replace(/^files\//, '')] = null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setCurrentFileHashes(fileHashes)
|
2024-07-25 17:51:31 +03:00
|
|
|
setFiles(files)
|
|
|
|
|
2024-07-05 13:38:04 +05:00
|
|
|
setIsLoading(false)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
console.error(`error occurred in getting file from ${zipUrl}`, err)
|
|
|
|
toast.error(
|
|
|
|
err.message || `error occurred in getting file from ${zipUrl}`
|
|
|
|
)
|
|
|
|
})
|
|
|
|
.finally(() => {
|
|
|
|
setIsLoading(false)
|
|
|
|
})
|
2024-05-22 11:19:40 +05:00
|
|
|
}
|
|
|
|
|
2024-07-05 13:38:04 +05:00
|
|
|
processSigit()
|
2024-05-22 11:19:40 +05:00
|
|
|
}
|
2024-09-13 17:53:22 +02:00
|
|
|
}, [encryptionKey, metaInNavState, zipUrl])
|
2024-05-14 14:27:05 +05:00
|
|
|
|
2024-05-16 10:40:56 +05:00
|
|
|
const handleVerify = async () => {
|
|
|
|
if (!selectedFile) return
|
|
|
|
setIsLoading(true)
|
2024-05-14 14:27:05 +05:00
|
|
|
|
2024-05-16 10:40:56 +05:00
|
|
|
const zip = await JSZip.loadAsync(selectedFile).catch((err) => {
|
2024-05-14 14:27:05 +05:00
|
|
|
console.log('err in loading zip file :>> ', err)
|
|
|
|
toast.error(err.message || 'An error occurred in loading zip file.')
|
|
|
|
return null
|
|
|
|
})
|
|
|
|
|
|
|
|
if (!zip) return
|
2024-07-05 13:38:04 +05:00
|
|
|
|
2024-09-13 17:53:22 +02:00
|
|
|
const files: { [filename: string]: SigitFile } = {}
|
2024-07-05 13:38:04 +05:00
|
|
|
const fileHashes: { [key: string]: string | null } = {}
|
|
|
|
const fileNames = Object.values(zip.files)
|
|
|
|
.filter((entry) => entry.name.startsWith('files/') && !entry.dir)
|
|
|
|
.map((entry) => entry.name)
|
|
|
|
|
|
|
|
// generate hashes for all entries in files folder of zipArchive
|
|
|
|
// these hashes can be used to verify the originality of files
|
2024-09-13 17:53:22 +02:00
|
|
|
for (const zipFilePath of fileNames) {
|
2024-07-05 13:38:04 +05:00
|
|
|
const arrayBuffer = await readContentOfZipEntry(
|
|
|
|
zip,
|
2024-09-13 17:53:22 +02:00
|
|
|
zipFilePath,
|
2024-07-05 13:38:04 +05:00
|
|
|
'arraybuffer'
|
|
|
|
)
|
|
|
|
|
2024-09-13 17:53:22 +02:00
|
|
|
const fileName = zipFilePath.replace(/^files\//, '')
|
2024-07-05 13:38:04 +05:00
|
|
|
if (arrayBuffer) {
|
2024-09-13 17:53:22 +02:00
|
|
|
files[fileName] = await convertToSigitFile(arrayBuffer, fileName)
|
2024-07-05 13:38:04 +05:00
|
|
|
const hash = await getHash(arrayBuffer)
|
|
|
|
|
|
|
|
if (hash) {
|
2024-09-13 17:53:22 +02:00
|
|
|
fileHashes[fileName] = hash
|
2024-07-05 13:38:04 +05:00
|
|
|
}
|
|
|
|
} else {
|
2024-09-13 17:53:22 +02:00
|
|
|
fileHashes[fileName] = null
|
2024-07-05 13:38:04 +05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-09-13 17:53:22 +02:00
|
|
|
setFiles(files)
|
2024-07-05 13:38:04 +05:00
|
|
|
setCurrentFileHashes(fileHashes)
|
2024-05-14 14:27:05 +05:00
|
|
|
|
|
|
|
setLoadingSpinnerDesc('Parsing meta.json')
|
|
|
|
|
|
|
|
const metaFileContent = await readContentOfZipEntry(
|
|
|
|
zip,
|
|
|
|
'meta.json',
|
|
|
|
'string'
|
|
|
|
)
|
|
|
|
|
|
|
|
if (!metaFileContent) {
|
|
|
|
setIsLoading(false)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
const parsedMetaJson = await parseJson<Meta>(metaFileContent).catch(
|
|
|
|
(err) => {
|
|
|
|
console.log('err in parsing the content of meta.json :>> ', err)
|
|
|
|
toast.error(
|
|
|
|
err.message || 'error occurred in parsing the content of meta.json'
|
|
|
|
)
|
|
|
|
setIsLoading(false)
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2024-05-22 11:19:40 +05:00
|
|
|
if (!parsedMetaJson) return
|
|
|
|
|
2024-09-13 17:53:22 +02:00
|
|
|
setMeta(parsedMetaJson)
|
2024-05-22 11:19:40 +05:00
|
|
|
|
2024-05-16 10:40:56 +05:00
|
|
|
setIsLoading(false)
|
2024-05-14 14:27:05 +05:00
|
|
|
}
|
|
|
|
|
2024-10-09 11:51:26 +02:00
|
|
|
const handleMarkedExport = async () => {
|
2024-08-13 12:48:52 +03:00
|
|
|
if (Object.entries(files).length === 0 || !meta || !usersPubkey) return
|
2024-07-25 17:51:31 +03:00
|
|
|
|
|
|
|
const usersNpub = hexToNpub(usersPubkey)
|
|
|
|
if (
|
|
|
|
!signers.includes(usersNpub) &&
|
|
|
|
!viewers.includes(usersNpub) &&
|
|
|
|
submittedBy !== usersNpub
|
|
|
|
) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
setIsLoading(true)
|
|
|
|
setLoadingSpinnerDesc('Signing nostr event')
|
|
|
|
|
|
|
|
const prevSig = getLastSignersSig(meta, signers)
|
2024-08-13 12:48:52 +03:00
|
|
|
if (!prevSig) return
|
2024-07-25 17:51:31 +03:00
|
|
|
|
|
|
|
const signedEvent = await signEventForMetaFile(
|
|
|
|
JSON.stringify({ prevSig }),
|
|
|
|
nostrController,
|
|
|
|
setIsLoading
|
|
|
|
)
|
|
|
|
|
2024-08-13 12:48:52 +03:00
|
|
|
if (!signedEvent) return
|
2024-07-25 17:51:31 +03:00
|
|
|
|
|
|
|
const exportSignature = JSON.stringify(signedEvent, null, 2)
|
2024-08-13 12:48:52 +03:00
|
|
|
const updatedMeta = { ...meta, exportSignature }
|
2024-07-25 17:51:31 +03:00
|
|
|
const stringifiedMeta = JSON.stringify(updatedMeta, null, 2)
|
|
|
|
|
2024-10-09 11:51:26 +02:00
|
|
|
const zip = await getZipWithFiles(updatedMeta, files)
|
2024-07-25 17:51:31 +03:00
|
|
|
zip.file('meta.json', stringifiedMeta)
|
|
|
|
|
|
|
|
const arrayBuffer = await zip
|
|
|
|
.generateAsync({
|
|
|
|
type: 'arraybuffer',
|
|
|
|
compression: 'DEFLATE',
|
|
|
|
compressionOptions: {
|
|
|
|
level: 6
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
console.log('err in zip:>> ', err)
|
|
|
|
setIsLoading(false)
|
|
|
|
toast.error(err.message || 'Error occurred in generating zip file')
|
|
|
|
return null
|
|
|
|
})
|
|
|
|
|
|
|
|
if (!arrayBuffer) return
|
|
|
|
|
|
|
|
const blob = new Blob([arrayBuffer])
|
2024-08-13 11:52:05 +02:00
|
|
|
saveAs(blob, `exported-${unixNow()}.sigit.zip`)
|
2024-07-25 17:51:31 +03:00
|
|
|
|
|
|
|
setIsLoading(false)
|
|
|
|
}
|
|
|
|
|
2024-05-14 14:27:05 +05:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{isLoading && <LoadingSpinner desc={loadingSpinnerDesc} />}
|
2024-07-30 10:28:57 +02:00
|
|
|
<Container className={styles.container}>
|
2024-05-16 10:40:56 +05:00
|
|
|
{!meta && (
|
2024-05-14 14:27:05 +05:00
|
|
|
<>
|
2024-05-15 11:50:21 +03:00
|
|
|
<Typography component="label" variant="h6">
|
2024-05-16 10:40:56 +05:00
|
|
|
Select exported zip file
|
2024-05-14 14:27:05 +05:00
|
|
|
</Typography>
|
|
|
|
|
2024-05-16 10:40:56 +05:00
|
|
|
<MuiFileInput
|
2024-05-16 11:25:30 +05:00
|
|
|
placeholder="Select file"
|
2024-05-16 10:40:56 +05:00
|
|
|
value={selectedFile}
|
|
|
|
onChange={(value) => setSelectedFile(value)}
|
|
|
|
InputProps={{
|
|
|
|
inputProps: {
|
2024-06-13 11:47:28 +05:00
|
|
|
accept: '.sigit.zip'
|
2024-05-16 10:40:56 +05:00
|
|
|
}
|
|
|
|
}}
|
|
|
|
/>
|
2024-05-14 14:27:05 +05:00
|
|
|
|
2024-05-16 10:40:56 +05:00
|
|
|
{selectedFile && (
|
2024-05-15 11:19:28 +05:00
|
|
|
<Box sx={{ mt: 2, display: 'flex', justifyContent: 'center' }}>
|
2024-05-16 11:25:30 +05:00
|
|
|
<Button onClick={handleVerify} variant="contained">
|
2024-05-16 10:40:56 +05:00
|
|
|
Verify
|
2024-05-14 14:27:05 +05:00
|
|
|
</Button>
|
|
|
|
</Box>
|
|
|
|
)}
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
|
2024-05-16 10:40:56 +05:00
|
|
|
{meta && (
|
2024-08-14 14:27:49 +02:00
|
|
|
<StickySideColumns
|
2024-08-13 17:28:14 +02:00
|
|
|
left={
|
2024-09-13 17:53:22 +02:00
|
|
|
currentFile !== null && (
|
|
|
|
<FileList
|
|
|
|
files={getCurrentUserFiles(
|
|
|
|
files,
|
|
|
|
currentFileHashes,
|
|
|
|
fileHashes
|
|
|
|
)}
|
|
|
|
currentFile={currentFile}
|
|
|
|
setCurrentFile={setCurrentFile}
|
2024-10-09 11:51:26 +02:00
|
|
|
handleDownload={handleMarkedExport}
|
2024-09-13 17:53:22 +02:00
|
|
|
downloadLabel="Download Sigit"
|
|
|
|
/>
|
|
|
|
)
|
2024-08-13 17:28:14 +02:00
|
|
|
}
|
2024-08-14 14:44:11 +02:00
|
|
|
right={<UsersDetails meta={meta} />}
|
2024-09-04 14:05:36 +02:00
|
|
|
leftIcon={faFileDownload}
|
|
|
|
centerIcon={faFile}
|
|
|
|
rightIcon={faCircleInfo}
|
2024-08-14 18:59:00 +02:00
|
|
|
>
|
|
|
|
<SlimPdfView
|
|
|
|
currentFile={currentFile}
|
2024-09-13 17:53:22 +02:00
|
|
|
files={getCurrentUserFiles(files, currentFileHashes, fileHashes)}
|
2024-08-15 13:47:23 +02:00
|
|
|
parsedSignatureEvents={parsedSignatureEvents}
|
2024-08-14 18:59:00 +02:00
|
|
|
/>
|
|
|
|
</StickySideColumns>
|
2024-05-14 14:27:05 +05:00
|
|
|
)}
|
2024-07-30 10:28:57 +02:00
|
|
|
</Container>
|
2024-05-14 14:27:05 +05:00
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|