From 58c457b62c67201fb83c845f9fa5a81b87dfdc65 Mon Sep 17 00:00:00 2001 From: enes Date: Wed, 9 Oct 2024 10:58:31 +0200 Subject: [PATCH 1/3] fix: profile image scale --- src/pages/profile/style.module.scss | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pages/profile/style.module.scss b/src/pages/profile/style.module.scss index c3c2034..4f29c17 100644 --- a/src/pages/profile/style.module.scss +++ b/src/pages/profile/style.module.scss @@ -24,7 +24,7 @@ } .container { - color: black + color: black; } .left { @@ -51,7 +51,8 @@ } .image-placeholder { - width: 150px; + width: 100%; + height: auto; } .link { @@ -99,4 +100,4 @@ margin-left: 5px; margin-top: 2px; } -} \ No newline at end of file +} -- 2.34.1 From db9cf9d20cf78cae85ba431eafea2365337f1b1e Mon Sep 17 00:00:00 2001 From: enes Date: Wed, 9 Oct 2024 11:51:26 +0200 Subject: [PATCH 2/3] feat: include the original files always --- src/pages/verify/index.tsx | 34 +++++++++------------------------- src/utils/file.ts | 10 +++++----- 2 files changed, 14 insertions(+), 30 deletions(-) diff --git a/src/pages/verify/index.tsx b/src/pages/verify/index.tsx index daae888..000341e 100644 --- a/src/pages/verify/index.tsx +++ b/src/pages/verify/index.tsx @@ -8,7 +8,6 @@ import { NostrController } from '../../controllers' import { DocSignatureEvent, Meta } from '../../types' import { decryptArrayBuffer, - extractMarksFromSignedMeta, getHash, hexToNpub, unixNow, @@ -20,13 +19,7 @@ import { import styles from './style.module.scss' import { useLocation } from 'react-router-dom' import axios from 'axios' -import { - addMarks, - FONT_SIZE, - FONT_TYPE, - groupMarksByFileNamePage, - inPx -} from '../../utils/pdf.ts' +import { FONT_SIZE, FONT_TYPE, inPx } from '../../utils/pdf.ts' import { useAppSelector } from '../../hooks/store' import { getLastSignersSig } from '../../utils/sign.ts' import { saveAs } from 'file-saver' @@ -38,7 +31,11 @@ import FileList from '../../components/FileList' import { CurrentUserFile } from '../../types/file.ts' import { Mark } from '../../types/mark.ts' import React from 'react' -import { convertToSigitFile, SigitFile } from '../../utils/file.ts' +import { + convertToSigitFile, + getZipWithFiles, + SigitFile +} from '../../utils/file.ts' import { FileDivider } from '../../components/FileDivider.tsx' import { ExtensionFileBox } from '../../components/ExtensionFileBox.tsx' import { useScale } from '../../hooks/useScale.tsx' @@ -358,7 +355,7 @@ export const VerifyPage = () => { setIsLoading(false) } - const handleExport = async () => { + const handleMarkedExport = async () => { if (Object.entries(files).length === 0 || !meta || !usersPubkey) return const usersNpub = hexToNpub(usersPubkey) @@ -388,22 +385,9 @@ export const VerifyPage = () => { const updatedMeta = { ...meta, exportSignature } const stringifiedMeta = JSON.stringify(updatedMeta, null, 2) - const zip = new JSZip() + const zip = await getZipWithFiles(updatedMeta, files) zip.file('meta.json', stringifiedMeta) - const marks = extractMarksFromSignedMeta(updatedMeta) - const marksByPage = groupMarksByFileNamePage(marks) - - for (const [fileName, file] of Object.entries(files)) { - if (file.isPdf) { - // Draw marks into PDF file and generate a brand new blob - const blob = await addMarks(file, marksByPage[fileName]) - zip.file(`files/${fileName}`, blob) - } else { - zip.file(`files/${fileName}`, file) - } - } - const arrayBuffer = await zip .generateAsync({ type: 'arraybuffer', @@ -470,7 +454,7 @@ export const VerifyPage = () => { )} currentFile={currentFile} setCurrentFile={setCurrentFile} - handleDownload={handleExport} + handleDownload={handleMarkedExport} downloadLabel="Download Sigit" /> ) diff --git a/src/utils/file.ts b/src/utils/file.ts index 6156858..84b30fc 100644 --- a/src/utils/file.ts +++ b/src/utils/file.ts @@ -19,14 +19,14 @@ export const getZipWithFiles = async ( const marksByFileNamePage = groupMarksByFileNamePage(marks) for (const [fileName, file] of Object.entries(files)) { + // Handle PDF Files, add marks if (file.isPdf) { - // Handle PDF Files const blob = await addMarks(file, marksByFileNamePage[fileName]) - zip.file(`files/${fileName}`, blob) - } else { - // Handle other files - zip.file(`files/${fileName}`, file) + zip.file(`marked/${fileName}`, blob) } + + // Save original files + zip.file(`files/${fileName}`, file) } return zip -- 2.34.1 From 11168672244b340d851b3fe91358a3d4e6b830e9 Mon Sep 17 00:00:00 2001 From: enes Date: Wed, 9 Oct 2024 11:52:32 +0200 Subject: [PATCH 3/3] refactor: rename functions and labels --- src/pages/sign/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/sign/index.tsx b/src/pages/sign/index.tsx index 9864259..dbbcd98 100644 --- a/src/pages/sign/index.tsx +++ b/src/pages/sign/index.tsx @@ -804,7 +804,7 @@ export const SignPage = () => { navigate(appPublicRoutes.verify) } - const handleExportSigit = async () => { + const handleEncryptedExport = async () => { if (Object.entries(files).length === 0 || !meta) return const zip = new JSZip() @@ -943,7 +943,7 @@ export const SignPage = () => { {signedStatus === SignedStatus.Fully_Signed && ( )} @@ -958,8 +958,8 @@ export const SignPage = () => { {isSignerOrCreator && ( - )} -- 2.34.1