Skip to content

Commit

Permalink
Merge branch 'master' into feat/collaborator-tab
Browse files Browse the repository at this point in the history
  • Loading branch information
meelrossi committed May 13, 2024
2 parents 2fbe459 + 0d80340 commit 50f3018
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 86 deletions.
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"decentraland-ecs": "6.12.4-7784644013.commit-f770b3e",
"decentraland-experiments": "^1.0.2",
"decentraland-transactions": "^2.6.1",
"decentraland-ui": "^5.21.0",
"decentraland-ui": "^5.23.2",
"ethers": "^5.6.8",
"file-saver": "^2.0.1",
"graphql": "^15.8.0",
Expand Down
9 changes: 9 additions & 0 deletions src/components/ItemDetailPage/ItemDetailPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,18 @@
.ItemDetailPage .item-data .attribute-row {
display: flex;
flex-direction: row;
gap: 30px;
margin-top: 10px;
}

.ItemDetailPage .item-data .attribute-column {
flex: 1 50%;
}

.ItemDetailPage .item-data .attribute-column .data {
word-break: break-word;
}

.ItemDetailPage .item-data .subtitle {
color: var(--secondary-text);
font-size: 13px;
Expand Down
1 change: 1 addition & 0 deletions src/components/ItemEditorPage/RightPanel/RightPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ export default class RightPanel extends React.PureComponent<Props, State> {
placeholder={t('item_editor.right_panel.utility_placeholder')}
disabled={!canEditItemMetadata}
value={utility}
tooltip={{ content: t('item_editor.right_panel.utility_tooltip') }}
rows="2"
cols="12"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ import { isLoadingType } from 'decentraland-dapps/dist/modules/loading/selectors
import { getLoadingProjectIds } from 'modules/sync/selectors'
import { SDKVersion } from 'modules/scene/types'
import { Project } from 'modules/project/types'
import { getIsCreateSceneOnlySDK7Enabled, getIsSDK7TemplatesEnabled } from 'modules/features/selectors'
import { getIsCreateSceneOnlySDK7Enabled } from 'modules/features/selectors'

const mapState = (state: RootState): MapStateProps => {
return {
isLoading: isLoadingType(getProjectLoading(state), LOAD_MANIFEST_REQUEST) || getLoadingProjectIds(state).length > 0,
error: getProjectError(state),
isSDK7TemplatesEnabled: getIsSDK7TemplatesEnabled(state),
isCreateSceneOnlySDK7Enabled: getIsCreateSceneOnlySDK7Enabled(state)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export type Props = ModalProps & {
error: string | null
isLoading: boolean
onCreateProject: (name: string, description: string, template: Template, sdk: SDKVersion) => void
isSDK7TemplatesEnabled: boolean
isCreateSceneOnlySDK7Enabled: boolean
}

Expand All @@ -30,6 +29,6 @@ export type State = {
description: string
}

export type MapStateProps = Pick<Props, 'error' | 'isLoading' | 'isSDK7TemplatesEnabled' | 'isCreateSceneOnlySDK7Enabled'>
export type MapStateProps = Pick<Props, 'error' | 'isLoading' | 'isCreateSceneOnlySDK7Enabled'>
export type MapDispatchProps = Pick<Props, 'onCreateProject'>
export type MapDispatch = Dispatch<CreateProjectFromTemplateAction | CallHistoryMethodAction>
18 changes: 0 additions & 18 deletions src/lib/api/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -664,24 +664,6 @@ export class BuilderAPI extends BaseAPI {
return items.map(fromPoolGroup)
}

// TODO: remove this after removing the SDK7_TEMPLATES feature flag
async fetchTemplates() {
const { items }: { items: RemoteProject[]; total: number } = await this.request('get', '/templates', {
retry: retryParams,
params: { sort_by: 'created_at', sort_order: 'asc' }
})
return items.map(fromRemoteProject).sort((template1, template2) => {
if (template1.templateStatus === TemplateStatus.COMING_SOON) {
return 1
}

if (template2.templateStatus === TemplateStatus.COMING_SOON) {
return -1
}
return 0
})
}

async saveProject(project: Project, scene: Scene) {
const manifest = createManifest(toRemoteProject(project), scene)
await this.request('put', `/projects/${project.id}/manifest`, { params: { manifest } })
Expand Down
2 changes: 0 additions & 2 deletions src/modules/features/selectors.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
getIsCreateSceneOnlySDK7Enabled,
getIsMaintenanceEnabled,
getIsPublishCollectionsWertEnabled,
getIsSDK7TemplatesEnabled,
getIsVrmOptOutEnabled,
getIsWearableUtilityEnabled,
getIsWorldContributorEnabled
Expand Down Expand Up @@ -62,7 +61,6 @@ describe('when getting if maintainance is enabled', () => {
})

const ffSelectors = [
{ selector: getIsSDK7TemplatesEnabled, app: ApplicationName.BUILDER, feature: FeatureName.SDK7_TEMPLATES },
{ selector: getIsCreateSceneOnlySDK7Enabled, app: ApplicationName.BUILDER, feature: FeatureName.CREATE_SCENE_ONLY_SDK7 },
{ selector: getIsPublishCollectionsWertEnabled, app: ApplicationName.BUILDER, feature: FeatureName.PUBLISH_COLLECTIONS_WERT },
{ selector: getIsVrmOptOutEnabled, app: ApplicationName.BUILDER, feature: FeatureName.VRM_OPTOUT },
Expand Down
8 changes: 0 additions & 8 deletions src/modules/features/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ export const getIsCampaignEnabled = (state: RootState) => {
}
}

export const getIsSDK7TemplatesEnabled = (state: RootState) => {
try {
return getIsFeatureEnabled(state, ApplicationName.BUILDER, FeatureName.SDK7_TEMPLATES)
} catch (e) {
return false
}
}

export const getIsCreateSceneOnlySDK7Enabled = (state: RootState) => {
try {
return getIsFeatureEnabled(state, ApplicationName.BUILDER, FeatureName.CREATE_SCENE_ONLY_SDK7)
Expand Down
7 changes: 6 additions & 1 deletion src/modules/inspector/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,12 @@ export function* inspectorSaga(builder: BuilderAPI, store: RootStore) {
const { path } = params

const scene: SceneSDK7 = yield getScene()
const paths = [...Object.keys(scene.mappings), 'assets/scene/main.composite']
const paths = [...Object.keys(scene.mappings)]

// add main.composite if missing
if (!paths.includes('assets/scene/main.composite')) {
paths.push('assets/scene/main.composite')
}

const project: Project = yield select(getCurrentProject)
if (project.thumbnail) {
Expand Down
27 changes: 1 addition & 26 deletions src/modules/project/sagas.spec.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,15 @@
import { expectSaga } from 'redux-saga-test-plan'
import { call } from 'redux-saga/effects'
import { Wallet } from 'decentraland-dapps/dist/modules/wallet/types'
import { AuthIdentity } from '@dcl/crypto'
import { BuilderAPI } from 'lib/api/builder'
import { mockTemplate, mockTemplates } from 'specs/project'
import { loginSuccess } from 'modules/identity/actions'
import { loadProjectsRequest, loadTemplatesFailure, loadTemplatesRequest, loadTemplatesSuccess } from './actions'
import { loadProjectsRequest, loadTemplatesRequest } from './actions'
import { projectSaga } from './sagas'

const builderAPI = {
fetchTemplates: jest.fn()
} as unknown as BuilderAPI

// TODO: remove this after removing the SDK7_TEMPLATES feature flag
describe('when handling the loadTemplatesRequest action', () => {
describe('and the request is successful', () => {
it('should put a loadTemplatesSuccess action with the project templates', () => {
return expectSaga(projectSaga, builderAPI)
.provide([[call([builderAPI, 'fetchTemplates']), Promise.resolve([mockTemplate])]])
.put(loadTemplatesSuccess(mockTemplates))
.dispatch(loadTemplatesRequest())
.run({ silenceTimeout: true })
})
})

describe('and the request fails', () => {
it('should put a loadTemplatesFailure action with the error', () => {
return expectSaga(projectSaga, builderAPI)
.provide([[call([builderAPI, 'fetchTemplates']), Promise.reject(new Error('error'))]])
.put(loadTemplatesFailure('error'))
.dispatch(loadTemplatesRequest())
.run({ silenceTimeout: true })
})
})
})

describe('when handling the loginSuccess action', () => {
let wallet: Wallet
let identity: AuthIdentity
Expand Down
23 changes: 5 additions & 18 deletions src/modules/project/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ import { EMPTY_SCENE_METRICS } from 'modules/scene/constants'
import { createScene, setGround, applyLayout, updateScene } from 'modules/scene/actions'
import { SET_EDITOR_READY, setEditorReady, takeScreenshot, setExportProgress, createEditorScene, setGizmo } from 'modules/editor/actions'
import { store } from 'modules/common/store'
import { isRemoteURL } from 'modules/media/utils'
import { getSceneByProjectId } from 'modules/scene/utils'
import { BUILDER_SERVER_URL, BuilderAPI } from 'lib/api/builder'
import { BuilderAPI } from 'lib/api/builder'
import {
SAVE_PROJECT_SUCCESS,
saveProjectRequest,
Expand All @@ -80,7 +79,6 @@ import { locations } from 'routing/locations'
import { downloadZip } from 'lib/zip'
import { didUpdateLayout, getImageAsDataUrl, getTemplate, getTemplates } from './utils'
import { createFiles, createSDK7Files } from './export'
import { getIsSDK7TemplatesEnabled } from 'modules/features/selectors'

export function* projectSaga(builder: BuilderAPI) {
yield takeLatest(CREATE_PROJECT_FROM_TEMPLATE, handleCreateProjectFromTemplate)
Expand Down Expand Up @@ -174,19 +172,13 @@ export function* projectSaga(builder: BuilderAPI) {

function* handleDuplicateProjectRequest(action: DuplicateProjectRequestAction) {
const { project, type, shouldRedirect } = action.payload
const isSDK7TemplatesEnabled: boolean = yield select(getIsSDK7TemplatesEnabled)
const ethAddress: string = yield select(getAddress)
const scene: Scene = yield getSceneByProjectId(project.id, type)

let thumbnail: string = project.thumbnail

try {
// TODO: remove this when the SDK7_TEMPLATES feature flag is removed
if (!isSDK7TemplatesEnabled && project.isTemplate) {
thumbnail = yield call(getImageAsDataUrl, `${BUILDER_SERVER_URL}/projects/${project.id}/media/thumbnail.png`)
} else if (thumbnail && isRemoteURL(thumbnail)) {
thumbnail = yield call(getImageAsDataUrl, project.thumbnail)
}
thumbnail = yield call(getImageAsDataUrl, project.thumbnail)

const newSceneId = uuidv4()
const newScene: Scene = scene.sdk6
Expand Down Expand Up @@ -362,8 +354,7 @@ export function* projectSaga(builder: BuilderAPI) {
function* handleLoadProjectSceneRequest(action: LoadProjectSceneRequestAction) {
const { project, type } = action.payload
try {
const isSDK7TemplatesEnabled: boolean = yield select(getIsSDK7TemplatesEnabled)
if (isSDK7TemplatesEnabled && type === PreviewType.TEMPLATE) {
if (type === PreviewType.TEMPLATE) {
const template: Manifest = yield call(getTemplate, project.id)
yield put(loadProjectSceneSuccess(template.scene))
} else {
Expand All @@ -383,8 +374,7 @@ export function* projectSaga(builder: BuilderAPI) {
function* handleLoadManifestRequest(action: LoadManifestRequestAction) {
const { id, type } = action.payload
try {
const isSDK7TemplatesEnabled: boolean = yield select(getIsSDK7TemplatesEnabled)
if (isSDK7TemplatesEnabled && type === PreviewType.TEMPLATE) {
if (type === PreviewType.TEMPLATE) {
const manifest: Manifest = yield call(getTemplate, id)
yield put(loadManifestSuccess(manifest))
} else {
Expand All @@ -398,10 +388,7 @@ export function* projectSaga(builder: BuilderAPI) {

function* handleLoadTemplatesRequest() {
try {
const isSDK7TemplatesEnabled: boolean = yield select(getIsSDK7TemplatesEnabled)
const projects: Project[] = isSDK7TemplatesEnabled
? ((yield call(getTemplates)) as Manifest[]).map(template => template.project)
: yield call([builder, 'fetchTemplates'])
const projects: Project[] = ((yield call(getTemplates)) as Manifest[]).map(template => template.project)
const record: ModelById<Project> = {}

for (const project of projects) {
Expand Down
1 change: 1 addition & 0 deletions src/modules/translation/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1975,6 +1975,7 @@
"required_permissions": "Permissions",
"description_placeholder": "What makes your Item special?",
"utility_placeholder": "Describe your Item functionality",
"utility_tooltip": "Describe the in-world utility of the Wearable. E.g: Increase damage by 5%",
"copyright": {
"title": "VRM Export Permission",
"vrm_export": "Allow VRM Export",
Expand Down
1 change: 1 addition & 0 deletions src/modules/translation/languages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1993,6 +1993,7 @@
"required_permissions": "Permisos",
"description_placeholder": "¿Qué hace a tu Item especial?",
"utility_placeholder": "Describe la funcionalida de tu Item",
"utility_tooltip": "Describe la funcionalidad dentro del mundo del Wearable. Ej: Incrementa el daño en 5%",
"copyright": {
"title": "Permiso de exportación de VRM",
"vrm_export": "Permitir la exportación de VRM",
Expand Down
1 change: 1 addition & 0 deletions src/modules/translation/languages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1976,6 +1976,7 @@
"required_permissions": "权限",
"description_placeholder": "是什么让您的物品与众不同?",
"utility_placeholder": "描述您的物品功能",
"utility_tooltip": "描述可穿戴设备在现实世界中的用途。 例如:伤害增加5%",
"copyright": {
"title": "VRM出口许可",
"vrm_export": "允许VRM导出",
Expand Down

0 comments on commit 50f3018

Please sign in to comment.