Skip to content

Commit

Permalink
Merge 183785f into 2c97519
Browse files Browse the repository at this point in the history
  • Loading branch information
cyaiox committed Dec 14, 2023
2 parents 2c97519 + 183785f commit 9955a7f
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Button, Column, Loader, ModalNavigation, Row } from 'decentraland-ui'
import Modal from 'decentraland-dapps/dist/containers/Modal'
import { T, t } from 'decentraland-dapps/dist/modules/translation/utils'
import { getExtension, toMB } from 'lib/file'
import { WrongExtensionError, VideoFileTooBigError, VideoFileTooLongError, InvalidVideoError } from 'modules/item/errors'
import { MAX_VIDEO_DURATION, MAX_VIDEO_FILE_SIZE, loadVideo } from 'modules/item/utils'
import { WrongExtensionError, VideoFileTooBigError, InvalidVideoError } from 'modules/item/errors'
import { MAX_VIDEO_FILE_SIZE, loadVideo } from 'modules/item/utils'
import { VIDEO_EXTENSIONS, VIDEO_PATH } from 'modules/item/types'
import FileImport from 'components/FileImport'
import { InfoIcon } from 'components/InfoIcon'
Expand Down Expand Up @@ -44,9 +44,6 @@ export default class UploadVideoStep extends React.PureComponent<Props, State> {
}

const video = await loadVideo(file)
if (video.duration > MAX_VIDEO_DURATION) {
throw new VideoFileTooLongError()
}

this.setState({ video: video.src, isLoading: false })

Expand Down Expand Up @@ -93,8 +90,7 @@ export default class UploadVideoStep extends React.PureComponent<Props, State> {
<div className={styles.zipInfo}>
<InfoIcon className={styles.infoIcon} />
{t('create_single_item_modal.upload_video_information', {
max_size: `${toMB(MAX_VIDEO_FILE_SIZE)}MB`,
max_duration: MAX_VIDEO_DURATION
max_size: `${toMB(MAX_VIDEO_FILE_SIZE)}MB`
})}
</div>
</>
Expand Down
11 changes: 1 addition & 10 deletions src/modules/item/errors.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ReactNode, createElement } from 'react'
import { t } from 'decentraland-dapps/dist/modules/translation/utils'
import { toMB } from 'lib/file'
import { MAX_EMOTE_DURATION, MAX_FILE_SIZE, MAX_THUMBNAIL_FILE_SIZE, MAX_VIDEO_DURATION, MAX_VIDEO_FILE_SIZE } from 'modules/item/utils'
import { MAX_EMOTE_DURATION, MAX_FILE_SIZE, MAX_THUMBNAIL_FILE_SIZE, MAX_VIDEO_FILE_SIZE } from 'modules/item/utils'

class CustomError {
message: ReactNode
Expand Down Expand Up @@ -53,15 +53,6 @@ export class VideoFileTooBigError extends Error {
}
}

export class VideoFileTooLongError extends Error {
public title: string

constructor() {
super(t('upload_video.error.video_file_too_long.message'))
this.title = t('upload_video.error.video_file_too_long.title', { max_duration: MAX_VIDEO_DURATION })
}
}

export class WrongExtensionError extends Error {
constructor() {
super(t('create_single_item_modal.error.wrong_extension'))
Expand Down
4 changes: 2 additions & 2 deletions src/modules/item/sagas.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ describe('when handling the save item request action', () => {
})
})

describe('and video file size is larger than 4MB', () => {
describe('and video file size is larger than 250MB', () => {
it('should put a saveItemFailure action with video too big message', () => {
return expectSaga(itemSaga, builderAPI, builderClient)
.provide([
Expand All @@ -212,7 +212,7 @@ describe('when handling the save item request action', () => {
saveItemFailure(
item,
{ ...contents, [VIDEO_PATH]: blob },
'File size limit is 4MB. Please reduce the size of the file and try again.'
'File size limit is 250MB. Please reduce the size of the file and try again.'
)
)
.dispatch(saveItemRequest(item, { ...contents, [VIDEO_PATH]: blob }))
Expand Down
3 changes: 1 addition & 2 deletions src/modules/item/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ import {

export const MAX_FILE_SIZE = 2097152 // 2MB
export const MAX_THUMBNAIL_FILE_SIZE = 1048576 // 1MB
export const MAX_VIDEO_FILE_SIZE = 4194304 // 4 MB
export const MAX_VIDEO_DURATION = 15 // 15s
export const MAX_VIDEO_FILE_SIZE = 262144000 // 250 MB
export const MAX_NFTS_PER_MINT = 50
export const MAX_EMOTE_DURATION = 10 // seconds
export const MAX_EMOTE_SIZE = 3145728 // 3MB
Expand Down
2 changes: 1 addition & 1 deletion src/modules/translation/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
"change_item_file": "Edit representation",
"import_information": "For more information about uploading Wearables or Emotes {link}",
"import_information_link_label": "click here",
"upload_video_information": "Maximum file size {max_size} - Maximum duration {max_duration} seconds",
"upload_video_information": "Maximum file size {max_size}",
"error": {
"item_too_big": "The entire item is too big to be uploaded. The max size for all files is {size}.",
"file_too_big": "{title}.{enter}File size limit is {size}. Reduce the size of the file and try again.",
Expand Down
2 changes: 1 addition & 1 deletion src/modules/translation/languages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
"pick_item": "Elige un item que no sea para un cuerpo con {bodyShape}",
"adding_representation": "Esto será agregado como {bodyShape} para el siguiente item",
"change_item_file": "Editar representación",
"upload_video_information": "Tamaño máximo de archivo {max_size} - Duración máxima {max_duration} segundos",
"upload_video_information": "Tamaño máximo de archivo {max_size}",
"error": {
"item_too_big": "El item entero es demasiado grande para cargarlo. El tamaño máximo de todos los archivos es {size}.",
"file_too_big": "{title}.{enter}El límite máximo de tamaño de archivo es {size}. Reduzca el tamaño del archivo e intente nuevamente.",
Expand Down
2 changes: 1 addition & 1 deletion src/modules/translation/languages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
"pick_item": "选择没有{bodyShape}的商品",
"adding_representation": "这将添加为以下项目的{body Shape}",
"change_item_file": "编辑制图表达",
"upload_video_information": "最大文件大小 {max_size} - 最大持续时间 {max_duration} 秒",
"upload_video_information": "最大文件大小 {max_size}",
"error": {
"item_too_big": "整个项目太大,无法上传。 所有文件的最大大小为 {size}。",
"file_too_big": "{title}.{enter}文件大小限制为 {size}。减小文件的大小,然后重试。",
Expand Down

0 comments on commit 9955a7f

Please sign in to comment.