new release #190

Merged
b merged 68 commits from staging into main 2024-09-06 18:59:34 +00:00
Showing only changes of commit e2b12afc72 - Show all commits

View File

@ -730,10 +730,7 @@ export const CreatePage = () => {
setIsLoading(true) setIsLoading(true)
setLoadingSpinnerDesc('Generating file hashes') setLoadingSpinnerDesc('Generating file hashes')
const fileHashes = await generateFileHashes() const fileHashes = await generateFileHashes()
if (!fileHashes) { if (!fileHashes) return
setIsLoading(false)
return
}
setLoadingSpinnerDesc('Generating encryption key') setLoadingSpinnerDesc('Generating encryption key')
const encryptionKey = await generateEncryptionKey() const encryptionKey = await generateEncryptionKey()
@ -741,10 +738,7 @@ export const CreatePage = () => {
if (await isOnline()) { if (await isOnline()) {
setLoadingSpinnerDesc('generating files.zip') setLoadingSpinnerDesc('generating files.zip')
const arrayBuffer = await generateFilesZip() const arrayBuffer = await generateFilesZip()
if (!arrayBuffer) { if (!arrayBuffer) return
setIsLoading(false)
return
}
setLoadingSpinnerDesc('Encrypting files.zip') setLoadingSpinnerDesc('Encrypting files.zip')
const encryptedArrayBuffer = await encryptZipFile( const encryptedArrayBuffer = await encryptZipFile(
@ -756,10 +750,7 @@ export const CreatePage = () => {
setLoadingSpinnerDesc('Uploading files.zip to file storage') setLoadingSpinnerDesc('Uploading files.zip to file storage')
const fileUrl = await uploadFile(encryptedArrayBuffer) const fileUrl = await uploadFile(encryptedArrayBuffer)
if (!fileUrl) { if (!fileUrl) return
setIsLoading(false)
return
}
setLoadingSpinnerDesc('Generating create signature') setLoadingSpinnerDesc('Generating create signature')
const createSignature = await generateCreateSignature( const createSignature = await generateCreateSignature(
@ -767,10 +758,7 @@ export const CreatePage = () => {
fileHashes, fileHashes,
fileUrl fileUrl
) )
if (!createSignature) { if (!createSignature) return
setIsLoading(false)
return
}
setLoadingSpinnerDesc('Generating keys for decryption') setLoadingSpinnerDesc('Generating keys for decryption')
@ -782,11 +770,8 @@ export const CreatePage = () => {
} }
const keys = await generateKeys(pubkeys, encryptionKey) const keys = await generateKeys(pubkeys, encryptionKey)
if (!keys) return
if (!keys) {
setIsLoading(false)
return
}
const meta: Meta = { const meta: Meta = {
createSignature, createSignature,
keys, keys,
@ -796,10 +781,7 @@ export const CreatePage = () => {
setLoadingSpinnerDesc('Updating user app data') setLoadingSpinnerDesc('Updating user app data')
const event = await updateUsersAppData(meta) const event = await updateUsersAppData(meta)
if (!event) { if (!event) return
setIsLoading(false)
return
}
setLoadingSpinnerDesc('Sending notifications to counterparties') setLoadingSpinnerDesc('Sending notifications to counterparties')
const promises = sendNotifications(meta) const promises = sendNotifications(meta)
@ -828,10 +810,7 @@ export const CreatePage = () => {
fileHashes, fileHashes,
'' ''
) )
if (!createSignature) { if (!createSignature) return
setIsLoading(false)
return
}
const meta: Meta = { const meta: Meta = {
createSignature, createSignature,
@ -850,10 +829,7 @@ export const CreatePage = () => {
} }
const arrayBuffer = await generateZipFile(zip) const arrayBuffer = await generateZipFile(zip)
if (!arrayBuffer) { if (!arrayBuffer) return
setIsLoading(false)
return
}
setLoadingSpinnerDesc('Encrypting zip file') setLoadingSpinnerDesc('Encrypting zip file')
const encryptedArrayBuffer = await encryptZipFile( const encryptedArrayBuffer = await encryptZipFile(
@ -917,7 +893,7 @@ export const CreatePage = () => {
<ol className={`${styles.paperGroup} ${styles.orderedFilesList}`}> <ol className={`${styles.paperGroup} ${styles.orderedFilesList}`}>
{selectedFiles.length > 0 && {selectedFiles.length > 0 &&
selectedFiles.map((file, index) => ( selectedFiles.map((file, index) => (
<div <li
key={index} key={index}
className={`${fileListStyles.fileItem} ${isActive(file) && fileListStyles.active}`} className={`${fileListStyles.fileItem} ${isActive(file) && fileListStyles.active}`}
onClick={() => { onClick={() => {
@ -925,32 +901,32 @@ export const CreatePage = () => {
setCurrentFile(file) setCurrentFile(file)
}} }}
> >
<> <span className={styles.fileName}>{file.name}</span>
<span className={styles.fileName}>{file.name}</span> <Button
<Button aria-label={`delete ${file.name}`}
variant="text" variant="text"
onClick={(event) => handleRemoveFile(event, file)} onClick={(event) => handleRemoveFile(event, file)}
sx={{ sx={{
minWidth: '44px' minWidth: '44px'
}} }}
> >
<FontAwesomeIcon icon={faTrash} /> <FontAwesomeIcon icon={faTrash} />
</Button> </Button>
</> </li>
</div>
))} ))}
</ol> </ol>
<Button variant="contained" onClick={handleUploadButtonClick}> <Button variant="contained" onClick={handleUploadButtonClick}>
<FontAwesomeIcon icon={faUpload} /> <FontAwesomeIcon icon={faUpload} />
<span className={styles.uploadFileText}>Upload new files</span> <span className={styles.uploadFileText}>Upload new files</span>
<input
ref={fileInputRef}
hidden={true}
multiple={true}
type="file"
onChange={handleSelectFiles}
/>
</Button> </Button>
<input
ref={fileInputRef}
hidden={true}
multiple={true}
type="file"
aria-label="file-upload"
onChange={handleSelectFiles}
/>
</div> </div>
} }
right={ right={