Releasing new design #161

Merged
b merged 241 commits from staging into main 2024-08-21 11:38:25 +00:00
Showing only changes of commit 748cb16f9f - Show all commits

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, useDrag, useDrop } from 'react-dnd'
import { DndProvider, DragSourceMonitor, 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,14 +309,16 @@ export const CreatePage = () => {
}
// Handle errors during file arrayBuffer conversion
const handleFileError = (file: File) => (err: any) => {
const handleFileError = (file: File) => (err: unknown) => {
console.log(
`Error while getting arrayBuffer of file ${file.name} :>> `,
err
)
toast.error(
err.message || `Error while getting arrayBuffer of file ${file.name}`
)
if (err instanceof Error) {
toast.error(
err.message || `Error while getting arrayBuffer of file ${file.name}`
)
}
return null
}
@ -368,10 +370,12 @@ export const CreatePage = () => {
}
// Handle errors during zip file generation
const handleZipError = (err: any) => {
const handleZipError = (err: unknown) => {
console.log('Error in zip:>> ', err)
setIsLoading(false)
toast.error(err.message || 'Error occurred in generating zip file')
if (err instanceof Error) {
toast.error(err.message || 'Error occurred in generating zip file')
}
return null
}
@ -438,10 +442,12 @@ export const CreatePage = () => {
}
// Handle errors during file upload
const handleUploadError = (err: any) => {
const handleUploadError = (err: unknown) => {
console.log('Error in upload:>> ', err)
setIsLoading(false)
toast.error(err.message || 'Error occurred in uploading file')
if (err instanceof Error) {
toast.error(err.message || 'Error occurred in uploading file')
}
return null
}
@ -474,9 +480,13 @@ export const CreatePage = () => {
encryptionKey
)
if (!finalZipFile) return
if (!finalZipFile) {
setIsLoading(false)
return
}
saveAs(finalZipFile, 'request.sigit.zip')
saveAs(finalZipFile, `request-${now()}.sigit.zip`)
setIsLoading(false)
}
const generateFilesZip = async (): Promise<ArrayBuffer | null> => {
@ -659,9 +669,11 @@ export const CreatePage = () => {
}
const arrayBuffer = await generateZipFile(zip)
if (!arrayBuffer) return
if (!arrayBuffer) {
setIsLoading(false)
return
}
setLoadingSpinnerDesc('Encrypting zip file')
const encryptedArrayBuffer = await encryptZipFile(
arrayBuffer,
encryptionKey
@ -967,7 +979,7 @@ const SignerRow = ({
item: () => {
return { id: user.pubkey, index }
},
collect: (monitor: any) => ({
collect: (monitor: DragSourceMonitor) => ({
isDragging: monitor.isDragging()
})
})