Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import ViewPort from 'components/ViewPort'
import SideBar from 'components/SideBar'
import LocalStorageToast from 'components/LocalStorageToast'
import Tools from './Tools'
import Metrics from './Metrics'
import ItemDragLayer from './ItemDragLayer'
import { ToolName } from './Tools/Tools.types'
import { Props, State } from './EditorPage.types'
import './EditorPage.css'
export const LOCALSTORAGE_TUTORIAL_KEY = 'builder-tutorial'
export const LOCALSTORAGE_INCENTIVE_BANNER_KEY = 'builder-incentive-banner'
const TOAST_ITEMS_THRESHOLD = 5 // local storage toast will show when a user has at least this amount of items
const localStorage = getLocalStorage()
export default class EditorPage extends React.PureComponent {
state = {
isIncentiveBannerOpen: false
}
componentWillMount() {
const { currentProject, onOpenModal } = this.props
if (currentProject && !localStorage.getItem(LOCALSTORAGE_TUTORIAL_KEY)) {
const showTutorial = experiments.getCurrentValueFor(EXPERIMENT_TUTORIAL_OPEN, true)
if (showTutorial) {
onOpenModal('TutorialModal')
}
}
import * as React from 'react'
import { env } from 'decentraland-commons'
import { Button, Close } from 'decentraland-ui'
import { getAnalytics } from 'decentraland-dapps/dist/modules/analytics/utils'
import Modal from 'decentraland-dapps/dist/containers/Modal'
import { getLocalStorage } from 'decentraland-dapps/dist/lib/localStorage'
import { t } from 'decentraland-dapps/dist/modules/translation/utils'
import { LOCALSTORAGE_TUTORIAL_KEY } from 'components/EditorPage/EditorPage'
import { preventDefault } from 'lib/preventDefault'
import { getSlides } from './slides'
import { Props, State } from './TutorialModal.types'
import './TutorialModal.css'
const PUBLIC_URL = env.get('PUBLIC_URL')
const localStorage = getLocalStorage()
// Segment Events
const TUTORIAL_STEP_EVENT = 'Tutorial Step'
const TUTORIAL_SKIP_EVENT = 'Tutorial Skip'
const TUTORIAL_COMPLETE = 'Tutorial Complete'
export const LOCALSTORAGE_TUTORIAL_EMAIL_KEY = 'builder-tutorial-email'
export default class TutorialModal extends React.PureComponent {
state = {
step: 0
}
slides = getSlides()
preventVideoContextMenu = preventDefault()
import * as React from 'react'
import { Popup, Row, Close } from 'decentraland-ui'
import { getLocalStorage } from 'decentraland-dapps/dist/lib/localStorage'
import { t } from 'decentraland-dapps/dist/modules/translation/utils'
import Icon from 'components/Icon'
import ShortcutTooltip from 'components/ShortcutTooltip'
import { IconName } from 'components/Icon/Icon.types'
import { debounce } from 'lib/debounce'
import { Shortcut } from 'modules/keyboard/types'
import { ToolName, Props, DefaultProps, State } from './Tools.types'
export const LOCALSTORAGE_SHORTCUT_POPUP_KEY = 'builder-shortcut-popup'
const localStorage = getLocalStorage()
export default class Tools extends React.PureComponent {
static defaultProps: DefaultProps = {
onClick: (_: ToolName) => {
/* noop */
}
}
state = {
isShortcutPopupOpen: this.isShortcutPopupDismissed()
}
_isMounted: boolean = false
updatePopupPositionDebounced = debounce(() => this.updatePopupPosition(), 200)
import * as React from 'react'
import { getLocalStorage } from 'decentraland-dapps/dist/lib/localStorage'
import { t } from 'decentraland-dapps/dist/modules/translation/utils'
import { Close } from 'decentraland-ui'
import { Props, State } from './LocalStorageToast.types'
import './LocalStorageToast.css'
export const LOCALSTORAGE_TOAST_KEY = 'builder-localstorage-toast'
const localStorage = getLocalStorage()
export default class LocalStorageToast extends React.PureComponent {
state = {
isVisible: !localStorage.getItem(LOCALSTORAGE_TOAST_KEY)
}
handleClick = () => {
this.setState({ isVisible: false })
localStorage.setItem(LOCALSTORAGE_TOAST_KEY, '1')
}
render() {
if (!this.state.isVisible) {
return null
}
return (
import * as React from 'react'
import isMobile from 'ismobilejs'
import { Button, Hero, Header, Page } from 'decentraland-ui'
import { t } from 'decentraland-dapps/dist/modules/translation/utils'
import { getLocalStorage } from 'decentraland-dapps/dist/lib/localStorage'
import { getAnalytics } from 'decentraland-dapps/dist/modules/analytics/utils'
import MobilePageHero from 'components/MobilePageHero/MobilePageHero'
import Footer from 'components/Footer'
import Navbar from 'components/Navbar'
import { newsletter, EMAIL_INTEREST } from 'lib/api/newsletter'
import { Props, State } from './MobilePage.types'
import './MobilePage.css'
const localStorage = getLocalStorage()
export default class MobilePage extends React.PureComponent {
state = {
email: '',
isLoading: false
}
analytics = getAnalytics()
componentDidMount() {
document.body.classList.add('mobile-body')
}
componentWillUnmount() {
document.body.classList.remove('mobile-body')
}
import * as React from 'react'
import { Close } from 'decentraland-ui'
import { getLocalStorage } from 'decentraland-dapps/dist/lib/localStorage'
import { t, T } from 'decentraland-dapps/dist/modules/translation/utils'
import { getAnalytics } from 'decentraland-dapps/dist/modules/analytics/utils'
import { locations } from 'routing/locations'
import { Props, State } from './LocalStorageToast.types'
import './LocalStorageToast.css'
export const LOCAL_STORAGE_SIGN_IN_EVENT = 'Sign in from editor toast'
export const LOCALSTORAGE_TOAST_KEY = 'builder-localstorage-signin-toast'
const localStorage = getLocalStorage()
export default class LocalStorageToast extends React.PureComponent {
state = {
isVisible: !localStorage.getItem(LOCALSTORAGE_TOAST_KEY) && this.props.isVisible
}
analytics = getAnalytics()
componentWillReceiveProps(nextProps: Props) {
if (nextProps.isVisible && !localStorage.getItem(LOCALSTORAGE_TOAST_KEY)) {
this.setState({ isVisible: true })
}
}
handleClose = () => {
this.setState({ isVisible: false })