Пример #1
0
			errorLogger.saveDiagnosticReducer( function() {
				const state = reduxStore.getState();
				return {
					blog_id: getSelectedSiteId( state ),
					calypso_section: getSectionName( state ),
				};
			} );
Пример #2
0
	page( '*', function( context, next ) {
		const previousLayoutIsSingleTree = !! document.getElementsByClassName( 'wp-singletree-layout' )
			.length;

		const singleTreeSections = [
			'account-recovery',
			'login',
			'posts-custom',
			'theme',
			'themes',
			'preview',
			'domain-connect-authorize',
		];
		const sectionName = getSectionName( context.store.getState() );
		const isMultiTreeLayout = ! includes( singleTreeSections, sectionName );

		if ( isMultiTreeLayout && previousLayoutIsSingleTree ) {
			debug( 'Re-rendering multi-tree layout' );
			ReactDom.unmountComponentAtNode( document.getElementById( 'wpcom' ) );
			renderLayout( context.store );
		} else if ( ! isMultiTreeLayout && ! previousLayoutIsSingleTree ) {
			debug( 'Unmounting multi-tree layout' );
			ReactDom.unmountComponentAtNode( document.getElementById( 'primary' ) );
			ReactDom.unmountComponentAtNode( document.getElementById( 'secondary' ) );
		}
		next();
	} );
Пример #3
0
export default connect( ( state ) => ( {
	sectionName: getSectionName( state ),
	isSectionLoading: isSectionLoading( state ),
	tourState: getGuidedTourState( state ),
	isValid: ( when ) => !! when( state ),
	lastAction: getLastAction( state ),
} ), {
Пример #4
0
export function shouldViewBeVisible( state ) {
	const sectionName = getSectionName( state );

	return isEnabled( 'ui/first-view' ) &&
		isViewEnabled( state, sectionName ) &&
		! wasFirstViewHiddenSinceEnteringCurrentSection( state ) &&
		! isSectionLoading( state );
}
Пример #5
0
	state => ( {
		sectionName: getSectionName( state ),
		isSectionLoading: isSectionLoading( state ),
		tourState: getGuidedTourState( state ),
		isValid: when => !! when( state ),
		lastAction: getLastAction( state ),
		requestedTour: getInitialQueryArguments( state ).tour,
	} ),
Пример #6
0
export function wasFirstViewHiddenSinceEnteringCurrentSection( state ) {
	const sectionName = getSectionName( state );
	const actionsSinceEnteringCurrentSection = takeRightWhile( getActionLog( state ), ( action ) => {
		return ( action.type !== ROUTE_SET ) || ( action.type === ROUTE_SET && routeSetIsInCurrentSection( state, action ) );
	} );

	return some( actionsSinceEnteringCurrentSection,
		action => action.type === FIRST_VIEW_HIDE && action.view === sectionName );
}
Пример #7
0
const isSectionBlacklisted = state => includes( BLACKLISTED_SECTIONS, getSectionName( state ) );
Пример #8
0
	state => [ state.ui.happychat.open, getSectionName( state ) ]
Пример #9
0
	state => state.ui.happychat.open && getSectionName( state ) !== 'happychat',
Пример #10
0
	state => [ state.happychat.ui.isOpen, getSectionName( state ) ]
Пример #11
0
export const inSection = sectionName => state => getSectionName( state ) === sectionName;
Пример #12
0
export function isSectionEligibleForNpsSurvey( state ) {
	const sectionName = getSectionName( state );
	return SECTION_NAME_WHITELIST.indexOf( sectionName ) > -1;
}