Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update wearable creation flow #2567

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: Create emotes in TP collections
cyaiox committed Apr 7, 2023
commit b91074acfa29e2645ef7aee53c372c70a03093c4
Original file line number Diff line number Diff line change
@@ -14,7 +14,8 @@ import {
MissingModelFileError,
EmoteDurationTooLongError,
InvalidModelFilesRepresentation,
InvalidModelFileType
InvalidModelFileType,
EmoteCreationTPCollectionError
} from 'modules/item/errors'
import { BodyShapeType, IMAGE_EXTENSIONS, Item, ItemType, ITEM_EXTENSIONS, MODEL_EXTENSIONS } from 'modules/item/types'
import {
@@ -123,7 +124,7 @@ export default class ImportStep extends React.PureComponent<Props, State> {
}

handleDropAccepted = async (acceptedFiles: File[]) => {
const { category, metadata, isRepresentation, onDropAccepted } = this.props
const { category, metadata, isRepresentation, isTPCollection, onDropAccepted } = this.props

let changeItemFile = false
let item = null
@@ -211,6 +212,10 @@ export default class ImportStep extends React.PureComponent<Props, State> {

const isEmote = acceptedFileProps.type === ItemType.EMOTE

if (isEmote && isTPCollection) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Emotes are not supported in TP

throw new EmoteCreationTPCollectionError()
}

onDropAccepted({
...acceptedFileProps,
bodyShape: isEmote ? BodyShapeType.BOTH : acceptedFileProps.bodyShape
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import { EmoteCategory, WearableCategory } from '@dcl/schemas'
import { Item } from 'modules/item/types'
import { AcceptedFileProps } from '../CreateSingleItemModal.types'
import { AcceptedFileProps, CreateSingleItemModalMetadata } from '../CreateSingleItemModal.types'

export type Props = {
category?: WearableCategory | EmoteCategory
@@ -13,6 +12,7 @@ export type Props = {
wearablePreviewComponent?: React.ReactNode
isLoading: boolean
isRepresentation?: boolean
isTPCollection?: boolean
onDropAccepted: (acceptedFileProps: AcceptedFileProps) => void
onDropRejected?: (files: File[]) => Promise<void>
onClose: () => void
6 changes: 6 additions & 0 deletions src/modules/item/errors.ts
Original file line number Diff line number Diff line change
@@ -70,6 +70,12 @@ export class EmoteDurationTooLongError extends CustomError {
}
}

export class EmoteCreationTPCollectionError extends Error {
constructor() {
super(t('create_single_item_modal.error.emote_creation_tp_collection'))
}
}

export class InvalidModelFileType extends CustomError {
constructor(type: string) {
super(
3 changes: 2 additions & 1 deletion src/modules/translation/languages/en.json
Original file line number Diff line number Diff line change
@@ -235,7 +235,8 @@
"invalid_model_files_representation": "The file seems to have more than one representation, please review them and try again.",
"emote_duration_too_long": "{title}.{enter}Duration of the emotes has a limit of {duration} seconds.{enter}Reduce the duration of the emote and try again.",
"emote_duration_too_long_title": "Your emote exceeds the maximum duration in seconds",
"invalid_model_file_type": "The file has an invalid representation for this {type} item, please review it and try again."
"invalid_model_file_type": "The file has an invalid representation for this {type} item, please review it and try again.",
"emote_creation_tp_collection": "You can't create emotes in Third Party Collections."
},
"emote_notice": "Emotes are available for all body shapes."
},
3 changes: 2 additions & 1 deletion src/modules/translation/languages/es.json
Original file line number Diff line number Diff line change
@@ -236,7 +236,8 @@
"invalid_model_files_representation": "El archivo parece tener más de una representación. Por favor revíselas y vuelva a intentarlo.",
"emote_duration_too_long": ".{enter}La duración de los emoticones tiene un límite de {duration} segundos.{enter}Reduce la duración del emote e intente nuevamente.",
"emote_duration_too_long_title": "El emote supera la duración máxima en segundos",
"invalid_model_file_type": "El archivo tiene una representación inválida para este {type}. Por favor revíselo y vuelva a intentarlo."
"invalid_model_file_type": "El archivo tiene una representación inválida para este {type}. Por favor revíselo y vuelva a intentarlo.",
"emote_creation_tp_collection": "No se pueden crear emotes en una colección externa."
},
"emote_notice": "Las animaciones estan disponibles para todos los cuerpos."
},
3 changes: 2 additions & 1 deletion src/modules/translation/languages/zh.json
Original file line number Diff line number Diff line change
@@ -230,7 +230,8 @@
"invalid_model_files_representation": "该文件似乎有多个表示,请查看它们并重试。",
"emote_duration_too_long": "{title}.{enter}表情的持续时间限制为 {duration} 秒。{enter}减少表情的持续时间,然后重试。",
"emote_duration_too_long_title": "您的表情超过了最长持续时间(以秒为单位)",
"invalid_model_file_type": "该文件对此 {type} 项目的表示无效,请检查它并重试。"
"invalid_model_file_type": "该文件对此 {type} 项目的表示无效,请检查它并重试。",
"emote_creation_tp_collection": "您不能在第三方收藏中创建表情。"
},
"emote_notice": "表情适用于所有体型。"
},