Compare commits

..

No commits in common. "4aeb5e9eabb14ce7bdacf235263e3468e8fb99a3" and "88d988e60be3cf86318e612b2aa0835b8b6d8289" have entirely different histories.

8 changed files with 30 additions and 33 deletions

0
.git-hooks/commit-msg Executable file → Normal file
View File

0
.git-hooks/pre-commit Executable file → Normal file
View File

View File

@ -7,7 +7,7 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 32",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 41",
"lint:fix": "eslint . --fix --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint:staged": "eslint --fix --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"formatter:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"",

View File

@ -37,7 +37,7 @@ import { truncate } from 'lodash'
import { hexToNpub } from '../../utils'
import { toPdfFiles } from '../../utils/pdf.ts'
PDFJS.GlobalWorkerOptions.workerSrc = new URL(
'pdfjs-dist/build/pdf.worker.min.mjs',
'pdfjs-dist/build/pdf.worker.mjs',
import.meta.url
).toString()

View File

@ -136,7 +136,7 @@ export const MainLayout = () => {
}
setIsLoading(true)
setLoadingSpinnerDesc(`Loading SIGit history...`)
setLoadingSpinnerDesc(`Loading SIGit History`)
getUsersAppData()
.then((appData) => {
if (appData) {
@ -145,7 +145,7 @@ export const MainLayout = () => {
})
.finally(() => setIsLoading(false))
}
}, [authState, dispatch])
}, [authState])
if (isLoading) return <LoadingSpinner desc={loadingSpinnerDesc} />

View File

@ -24,7 +24,7 @@ import JSZip from 'jszip'
import { MuiFileInput } from 'mui-file-input'
import { Event, kinds } from 'nostr-tools'
import { useEffect, useRef, useState } from 'react'
import { DndProvider, DragSourceMonitor, useDrag, useDrop } from 'react-dnd'
import { DndProvider, useDrag, useDrop } from 'react-dnd'
import { HTML5Backend } from 'react-dnd-html5-backend'
import { useSelector } from 'react-redux'
import { useLocation, useNavigate } from 'react-router-dom'
@ -127,7 +127,7 @@ export const CreatePage = () => {
})
}
})
}, [metadata, users])
}, [])
// Set up event listener for authentication event
nostrController.on('nsecbunker-auth', (url) => {
setAuthUrl(url)
@ -309,16 +309,14 @@ export const CreatePage = () => {
}
// Handle errors during file arrayBuffer conversion
const handleFileError = (file: File) => (err: unknown) => {
const handleFileError = (file: File) => (err: any) => {
console.log(
`Error while getting arrayBuffer of file ${file.name} :>> `,
err
)
if (err instanceof Error) {
toast.error(
err.message || `Error while getting arrayBuffer of file ${file.name}`
)
}
toast.error(
err.message || `Error while getting arrayBuffer of file ${file.name}`
)
return null
}
@ -370,12 +368,10 @@ export const CreatePage = () => {
}
// Handle errors during zip file generation
const handleZipError = (err: unknown) => {
const handleZipError = (err: any) => {
console.log('Error in zip:>> ', err)
setIsLoading(false)
if (err instanceof Error) {
toast.error(err.message || 'Error occurred in generating zip file')
}
toast.error(err.message || 'Error occurred in generating zip file')
return null
}
@ -442,12 +438,10 @@ export const CreatePage = () => {
}
// Handle errors during file upload
const handleUploadError = (err: unknown) => {
const handleUploadError = (err: any) => {
console.log('Error in upload:>> ', err)
setIsLoading(false)
if (err instanceof Error) {
toast.error(err.message || 'Error occurred in uploading file')
}
toast.error(err.message || 'Error occurred in uploading file')
return null
}
@ -480,13 +474,9 @@ export const CreatePage = () => {
encryptionKey
)
if (!finalZipFile) {
setIsLoading(false)
return
}
if (!finalZipFile) return
saveAs(finalZipFile, `request-${now()}.sigit.zip`)
setIsLoading(false)
saveAs(finalZipFile, 'request.sigit.zip')
}
const generateFilesZip = async (): Promise<ArrayBuffer | null> => {
@ -669,11 +659,9 @@ export const CreatePage = () => {
}
const arrayBuffer = await generateZipFile(zip)
if (!arrayBuffer) {
setIsLoading(false)
return
}
if (!arrayBuffer) return
setLoadingSpinnerDesc('Encrypting zip file')
const encryptedArrayBuffer = await encryptZipFile(
arrayBuffer,
encryptionKey
@ -979,7 +967,7 @@ const SignerRow = ({
item: () => {
return { id: user.pubkey, index }
},
collect: (monitor: DragSourceMonitor) => ({
collect: (monitor: any) => ({
isDragging: monitor.isDragging()
})
})

View File

@ -4,7 +4,7 @@ import { PDFDocument } from 'pdf-lib'
import { Mark } from '../types/mark.ts'
PDFJS.GlobalWorkerOptions.workerSrc = new URL(
'pdfjs-dist/build/pdf.worker.min.mjs',
'pdfjs-dist/build/pdf.worker.mjs',
import.meta.url
).toString()

View File

@ -5,6 +5,15 @@ import tsconfigPaths from 'vite-tsconfig-paths'
export default defineConfig({
plugins: [react(), tsconfigPaths()],
build: {
target: 'ES2022'
target: 'ES2022',
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes('pdfjs-dist/build/pdf.worker.mjs')) {
return 'pdf.worker'
}
}
}
}
}
})