mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 18:32:20 +08:00
e44a7e28b6
Summary: Add spinner and refactor container view to be router add `NylasStore` as a global importable. specs for APIEnv login page fixes add old fixes to container view finish extracting pages fix onboarding flow Test Plan: edgehill --test Reviewers: bengotow Reviewed By: bengotow Differential Revision: https://phab.nylas.com/D1652
41 lines
1 KiB
CoffeeScript
41 lines
1 KiB
CoffeeScript
Reflux = require 'reflux'
|
|
OnboardingActions = require './onboarding-actions'
|
|
NylasStore = require 'nylas-store'
|
|
ipc = require 'ipc'
|
|
|
|
return unless atom.getWindowType() is "onboarding"
|
|
|
|
class PageRouterStore extends NylasStore
|
|
constructor: ->
|
|
atom.onWindowPropsReceived @_onWindowPropsChagned
|
|
|
|
@_page = atom.getWindowProps().page ? ''
|
|
@_pageData = atom.getWindowProps().pageData ? {}
|
|
|
|
@_pageStack = [{page: @_page, pageData: @_pageData}]
|
|
|
|
@listenTo OnboardingActions.moveToPreviousPage, @_onMoveToPreviousPage
|
|
@listenTo OnboardingActions.moveToPage, @_onMoveToPage
|
|
|
|
_onWindowPropsChagned: ({page, pageData}={}) =>
|
|
@_onMoveToPage(page, pageData)
|
|
|
|
page: -> @_page
|
|
|
|
pageData: -> @_pageData
|
|
|
|
connectType: ->
|
|
@_connectType
|
|
|
|
_onMoveToPreviousPage: ->
|
|
current = @_pageStack.pop()
|
|
prev = @_pageStack.pop()
|
|
@_onMoveToPage(prev.page, prev.pageData)
|
|
|
|
_onMoveToPage: (page, pageData={}) ->
|
|
@_pageStack.push({page, pageData})
|
|
@_page = page
|
|
@_pageData = pageData
|
|
@trigger()
|
|
|
|
module.exports = new PageRouterStore()
|