/
githubmirror
/
wp-calypso
Обзор
Документация
Войти
/
githubmirror
/
wp-calypso
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
client/jetpack-cloud/sections/plugin-management/controller.tsx
42 строки
1 KB
Harris Papazoglou
Feature flags: Removes various production-enabled flags. (#98344)
15 янв 2025, 16:25
Не верифицирован
15 янв 2025, 16:25
6d17c7b
Код
Авторство
О чём код?
import page, { type Callback, type Context } from '@automattic/calypso-router'; import JetpackManageSidebar from 'calypso/jetpack-cloud/sections/sidebar-navigation/jetpack-manage'; import { isAgencyUser } from 'calypso/state/partner-portal/partner/selectors'; import Header from '../agency-dashboard/header'; import PluginsOverview from './plugins-overview'; const redirectIfHasNoAccess = ( context: Context ) => { const state = context.store.getState(); const isAgency = isAgencyUser( state ); if ( ! isAgency ) { page.redirect( '/' ); return; } }; const setSidebar = ( context: Context ): void => { context.secondary = <JetpackManageSidebar path={ context.path } />; }; export const pluginManagementContext: Callback = ( context, next ) => { redirectIfHasNoAccess( context ); const { site } = context.params; context.header = <Header />; // Set secondary context only on multi-site view if ( ! site ) { setSidebar( context ); } next(); }; export const pluginDetailsContext: Callback = ( context, next ) => { redirectIfHasNoAccess( context ); const { plugin, site } = context.params; context.header = <Header />; // Set secondary context only on multi-site view if ( ! site ) { setSidebar( context ); } context.primary = <PluginsOverview pluginSlug={ plugin } site={ site } path={ context.path } />; next(); };