|
|
import page from '@automattic/calypso-router'; |
|
|
import Debug from 'debug'; |
|
|
import { translate } from 'i18n-calypso'; |
|
|
import { makeLayout, render as clientRender } from 'calypso/controller'; |
|
|
import { sites, siteSelection } from 'calypso/my-sites/controller'; |
|
|
import { landForPrimarySite, landForSelectedSite } from './sections/landing/controller'; |
|
|
|
|
|
const debug = new Debug( 'calypso:jetpack-cloud:controller' ); |
|
|
|
|
|
const selectionPrompt = ( context, next ) => { |
|
|
debug( 'controller: selectionPrompt', context ); |
|
|
context.getSiteSelectionHeaderText = () => |
|
|
|
|
|
|
|
|
|
|
|
translate( 'Select a site to open {{strong}}Jetpack.com{{/strong}}', { |
|
|
components: { strong: <strong style={ { textTransform: 'none' } } /> }, |
|
|
} ); |
|
|
next(); |
|
|
}; |
|
|
|
|
|
const clearPageTitle = ( context, next ) => { |
|
|
context.clearPageTitle = true; |
|
|
next(); |
|
|
}; |
|
|
|
|
|
export default function () { |
|
|
page( '/landing/:site', siteSelection, landForSelectedSite, makeLayout, clientRender ); |
|
|
page( |
|
|
'/landing', |
|
|
siteSelection, |
|
|
selectionPrompt, |
|
|
clearPageTitle, |
|
|
sites, |
|
|
makeLayout, |
|
|
clientRender |
|
|
); |
|
|
page( '/', landForPrimarySite, makeLayout, clientRender ); |
|
|
} |
|
|
|