React = require 'react/addons' OnboardingActions = require './onboarding-actions' ReactCSSTransitionGroup = React.addons.CSSTransitionGroup PageRouterStore = require './page-router-store' WelcomePage = require './welcome-page' AccountChoosePage = require './account-choose-page' AccountSettingsPage = require './account-settings-page' InitialPreferencesPage = require './initial-preferences-page' InitialPackagesPage = require './initial-packages-page' class PageRouter extends React.Component @displayName: 'PageRouter' @containerRequired: false constructor: (@props) -> @state = @_getStateFromStore() window.OnboardingActions = OnboardingActions _getStateFromStore: => page: PageRouterStore.page() pageData: PageRouterStore.pageData() componentDidMount: => @unsubscribe = PageRouterStore.listen(@_onStateChanged, @) {width, height} = React.findDOMNode(@refs.activePage).getBoundingClientRect() atom.center() atom.setSizeAnimated(width, height, 0) atom.show() componentDidUpdate: => setTimeout(@_resizePage, 10) _resizePage: => {width, height} = React.findDOMNode(@refs.activePage).getBoundingClientRect() atom.setSizeAnimated(width, height) _onStateChanged: => @setState(@_getStateFromStore()) componentWillUnmount: => @unsubscribe?() render: =>