Include additional errors
This commit is contained in:
parent
090b55f038
commit
0f8c9dfe7a
@ -10,10 +10,12 @@ import { FormGroup } from 'components/FormGroup'
|
|||||||
import { useInputState } from 'components/forms/FormInput.hooks'
|
import { useInputState } from 'components/forms/FormInput.hooks'
|
||||||
import { InputDateTime } from 'components/InputDateTime'
|
import { InputDateTime } from 'components/InputDateTime'
|
||||||
import { Tooltip } from 'components/Tooltip'
|
import { Tooltip } from 'components/Tooltip'
|
||||||
|
import { addLogItem } from 'contexts/log'
|
||||||
import type { ChangeEvent } from 'react'
|
import type { ChangeEvent } from 'react'
|
||||||
import { useEffect, useRef, useState } from 'react'
|
import { useEffect, useRef, useState } from 'react'
|
||||||
import { toast } from 'react-hot-toast'
|
import { toast } from 'react-hot-toast'
|
||||||
import { SG721_UPDATABLE_CODE_ID } from 'utils/constants'
|
import { SG721_UPDATABLE_CODE_ID } from 'utils/constants'
|
||||||
|
import { uid } from 'utils/random'
|
||||||
|
|
||||||
import { TextInput } from '../../forms/FormInput'
|
import { TextInput } from '../../forms/FormInput'
|
||||||
import type { MinterType } from '../actions/Combobox'
|
import type { MinterType } from '../actions/Combobox'
|
||||||
@ -89,6 +91,7 @@ export const CollectionDetails = ({ onChange, uploadMethod, coverImageUrl, minte
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
toast.error(error.message, { style: { maxWidth: 'none' } })
|
toast.error(error.message, { style: { maxWidth: 'none' } })
|
||||||
|
addLogItem({ id: uid(), message: error.message, type: 'Error', timestamp: new Date() })
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [
|
}, [
|
||||||
|
@ -13,10 +13,12 @@ import { useInputState } from 'components/forms/FormInput.hooks'
|
|||||||
import { MetadataInput } from 'components/MetadataInput'
|
import { MetadataInput } from 'components/MetadataInput'
|
||||||
import { MetadataModal } from 'components/MetadataModal'
|
import { MetadataModal } from 'components/MetadataModal'
|
||||||
import { SingleAssetPreview } from 'components/SingleAssetPreview'
|
import { SingleAssetPreview } from 'components/SingleAssetPreview'
|
||||||
|
import { addLogItem } from 'contexts/log'
|
||||||
import type { ChangeEvent } from 'react'
|
import type { ChangeEvent } from 'react'
|
||||||
import { useEffect, useRef, useState } from 'react'
|
import { useEffect, useRef, useState } from 'react'
|
||||||
import { toast } from 'react-hot-toast'
|
import { toast } from 'react-hot-toast'
|
||||||
import type { UploadServiceType } from 'services/upload'
|
import type { UploadServiceType } from 'services/upload'
|
||||||
|
import { uid } from 'utils/random'
|
||||||
import { naturalCompare } from 'utils/sort'
|
import { naturalCompare } from 'utils/sort'
|
||||||
|
|
||||||
import type { MinterType } from '../actions/Combobox'
|
import type { MinterType } from '../actions/Combobox'
|
||||||
@ -106,6 +108,12 @@ export const UploadDetails = ({ onChange, minterType, baseMinterAcquisitionMetho
|
|||||||
for (let i = 0; i < sortedFileNames.length; i++) {
|
for (let i = 0; i < sortedFileNames.length; i++) {
|
||||||
if (isNaN(Number(sortedFileNames[i])) || parseInt(sortedFileNames[i]) !== i + 1) {
|
if (isNaN(Number(sortedFileNames[i])) || parseInt(sortedFileNames[i]) !== i + 1) {
|
||||||
toast.error('The file names should be in numerical order starting from 1.')
|
toast.error('The file names should be in numerical order starting from 1.')
|
||||||
|
addLogItem({
|
||||||
|
id: uid(),
|
||||||
|
message: 'The file names should be in numerical order starting from 1.',
|
||||||
|
type: 'Error',
|
||||||
|
timestamp: new Date(),
|
||||||
|
})
|
||||||
//clear the input
|
//clear the input
|
||||||
event.target.value = ''
|
event.target.value = ''
|
||||||
return
|
return
|
||||||
@ -152,6 +160,12 @@ export const UploadDetails = ({ onChange, minterType, baseMinterAcquisitionMetho
|
|||||||
for (let i = 0; i < sortedFileNames.length; i++) {
|
for (let i = 0; i < sortedFileNames.length; i++) {
|
||||||
if (isNaN(Number(sortedFileNames[i])) || parseInt(sortedFileNames[i]) !== i + 1) {
|
if (isNaN(Number(sortedFileNames[i])) || parseInt(sortedFileNames[i]) !== i + 1) {
|
||||||
toast.error('The file names should be in numerical order starting from 1.')
|
toast.error('The file names should be in numerical order starting from 1.')
|
||||||
|
addLogItem({
|
||||||
|
id: uid(),
|
||||||
|
message: 'The file names should be in numerical order starting from 1.',
|
||||||
|
type: 'Error',
|
||||||
|
timestamp: new Date(),
|
||||||
|
})
|
||||||
event.target.value = ''
|
event.target.value = ''
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -174,9 +188,10 @@ export const UploadDetails = ({ onChange, minterType, baseMinterAcquisitionMetho
|
|||||||
setMetadataFilesArray([])
|
setMetadataFilesArray([])
|
||||||
return toast.error(`Invalid metadata file: ${metadataFile.name}`)
|
return toast.error(`Invalid metadata file: ${metadataFile.name}`)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
event.target.value = ''
|
event.target.value = ''
|
||||||
setMetadataFilesArray([])
|
setMetadataFilesArray([])
|
||||||
|
addLogItem({ id: uid(), message: error.message, type: 'Error', timestamp: new Date() })
|
||||||
return toast.error(`Invalid metadata file: ${metadataFile.name}`)
|
return toast.error(`Invalid metadata file: ${metadataFile.name}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -237,6 +252,7 @@ export const UploadDetails = ({ onChange, minterType, baseMinterAcquisitionMetho
|
|||||||
onChange(data)
|
onChange(data)
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
toast.error(error.message, { style: { maxWidth: 'none' } })
|
toast.error(error.message, { style: { maxWidth: 'none' } })
|
||||||
|
addLogItem({ id: uid(), message: error.message, type: 'Error', timestamp: new Date() })
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
assetFilesArray,
|
assetFilesArray,
|
||||||
|
Loading…
Reference in New Issue
Block a user