-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: initial support for web editor (#2764)
* feat: added InspectorPage, loaded and connected scene * chore: linted * feat: convert scene into composite * feat: added mappings * feat: integrate inspector * chore: install dependencies * chore: fix tests * feat: self host inspector * chore: added feature flag * fix: remove hardcoded parent origin * feat: support sdk7 in schema * chore: fix tests * fix: remove localhost from config * chore: remove ignore
- Loading branch information
Showing
51 changed files
with
3,880 additions
and
785 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,5 @@ yarn-error.log* | |
|
||
src/ecsScene/scene.js | ||
/public/editor.js | ||
/public/inspector* | ||
/src/ecsScene/ecs.js.raw |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { connect } from 'react-redux' | ||
import { RootState } from 'modules/common/types' | ||
import { isLoggedIn } from 'modules/identity/selectors' | ||
import { getCurrentScene } from 'modules/scene/selectors' | ||
import { connectInspector, openInspector } from 'modules/inspector/actions' | ||
import { MapStateProps, MapDispatch, MapDispatchProps } from './InspectorPage.types' | ||
import EditorPage from './InspectorPage' | ||
|
||
const mapState = (state: RootState): MapStateProps => { | ||
return { | ||
isLoggedIn: isLoggedIn(state), | ||
scene: getCurrentScene(state) | ||
} | ||
} | ||
|
||
const mapDispatch = (dispatch: MapDispatch): MapDispatchProps => ({ | ||
onOpen: () => dispatch(openInspector()), | ||
onConnect: iframeId => dispatch(connectInspector(iframeId)) | ||
}) | ||
|
||
export default connect(mapState, mapDispatch)(EditorPage) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.InspectorPage { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
.InspectorPage iframe { | ||
width: 100%; | ||
height: 100%; | ||
border: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* eslint-disable no-debugger */ | ||
import * as React from 'react' | ||
import { Center, Loader } from 'decentraland-ui' | ||
|
||
import { Props, State } from './InspectorPage.types' | ||
import './InspectorPage.css' | ||
|
||
export default class InspectorPage extends React.PureComponent<Props, State> { | ||
state: State = { | ||
isLoaded: false | ||
} | ||
|
||
componentDidMount() { | ||
const { onOpen } = this.props | ||
onOpen() | ||
} | ||
|
||
refIframe = (iframe: HTMLIFrameElement | null) => { | ||
const { onConnect } = this.props | ||
if (iframe) { | ||
iframe.onload = () => { | ||
this.setState({ isLoaded: true }) | ||
} | ||
onConnect(iframe.id) | ||
} | ||
} | ||
|
||
render() { | ||
const { scene, isLoggedIn } = this.props | ||
|
||
if (!isLoggedIn) { | ||
return ( | ||
<div className="InspectorPager"> | ||
<Center>Sign In</Center> | ||
</div> | ||
) | ||
} | ||
|
||
return ( | ||
<div className="InspectorPage"> | ||
{!this.state.isLoaded && <Loader active />} | ||
{scene && ( | ||
<iframe ref={this.refIframe} title="inspector" id="inspector" src={`/inspector-index.html?parent=${window.location.origin}`} /> | ||
)} | ||
</div> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Dispatch } from 'redux' | ||
import { Scene } from 'modules/scene/types' | ||
import { connectInspector, ConnectInspectorAction, openInspector, OpenInspectorAction } from 'modules/inspector/actions' | ||
|
||
export type Props = { | ||
scene: Scene | null | ||
isLoggedIn: boolean | ||
onOpen: typeof openInspector | ||
onConnect: typeof connectInspector | ||
} | ||
|
||
export type State = { | ||
isLoaded: boolean | ||
} | ||
|
||
export type MapStateProps = Pick<Props, 'isLoggedIn' | 'scene'> | ||
export type MapDispatchProps = Pick<Props, 'onOpen' | 'onConnect'> | ||
export type MapDispatch = Dispatch<OpenInspectorAction | ConnectInspectorAction> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import InspectorPage from './InspectorPage.container' | ||
|
||
export default InspectorPage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/components/SideBar/EntityEditor/EntityField/EntityField.types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.