-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add plugins management to A4A dashboard
- Loading branch information
1 parent
b931027
commit 57f79c7
Showing
4 changed files
with
62 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,34 @@ | ||
import page from '@automattic/calypso-router'; | ||
import { type Callback } from '@automattic/calypso-router'; | ||
import { LayoutWithGuidedTour as Layout } from 'calypso/a8c-for-agencies/components/layout/layout-with-guided-tour'; | ||
import LayoutTop from 'calypso/a8c-for-agencies/components/layout/layout-with-payment-notification'; | ||
import MobileSidebarNavigation from 'calypso/a8c-for-agencies/components/sidebar/mobile-sidebar-navigation'; | ||
import LayoutBody from 'calypso/layout/hosting-dashboard/body'; | ||
import LayoutHeader, { | ||
LayoutHeaderSubtitle as Subtitle, | ||
LayoutHeaderTitle as Title, | ||
} from 'calypso/layout/hosting-dashboard/header'; | ||
import PageViewTracker from 'calypso/lib/analytics/page-view-tracker'; | ||
import { A4A_PLUGINS_LINK } from '../../components/sidebar-menu/lib/constants'; | ||
import MainSidebar from '../../components/sidebar-menu/main'; | ||
|
||
export const pluginsContext: Callback = ( context, next ) => { | ||
export const pluginsContext: Callback = ( context ) => { | ||
const { slug } = context.params; | ||
const redirectPath = slug | ||
? `${ A4A_PLUGINS_LINK }/manage/sites/${ slug }` | ||
: `${ A4A_PLUGINS_LINK }/manage/sites`; | ||
|
||
page.redirect( redirectPath ); | ||
}; | ||
|
||
export const pluginManagementContext: Callback = ( context, next ) => { | ||
context.secondary = <MainSidebar path={ context.path } />; | ||
context.primary = ( | ||
<Layout title="Plugins" wide sidebarNavigation={ <MobileSidebarNavigation /> }> | ||
<LayoutTop> | ||
<LayoutHeader> | ||
<Title>Plugins</Title> | ||
<Subtitle>plugins of your agency</Subtitle> | ||
</LayoutHeader> | ||
</LayoutTop> | ||
<LayoutBody> | ||
<div>test</div> | ||
</LayoutBody> | ||
</Layout> | ||
<> | ||
<PageViewTracker title="Plugins" path={ context.path } /> | ||
</> | ||
); | ||
next(); | ||
}; | ||
|
||
export const pluginDetailsContext: Callback = ( context, next ) => { | ||
context.secondary = <MainSidebar path={ context.path } />; | ||
context.primary = ( | ||
<> | ||
<PageViewTracker title="Plugins" path={ context.path } /> | ||
</> | ||
); | ||
next(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,29 @@ | ||
import page from '@automattic/calypso-router'; | ||
import { requireAccessContext } from 'calypso/a8c-for-agencies/controller'; | ||
import { makeLayout, render as clientRender } from 'calypso/controller'; | ||
import { pluginsContext } from './controller'; | ||
import { renderPluginsDashboard } from 'calypso/my-sites/plugins/controller'; | ||
import { pluginsContext, pluginManagementContext, pluginDetailsContext } from './controller'; | ||
|
||
export default function () { | ||
page( '/plugins', requireAccessContext, pluginsContext, makeLayout, clientRender ); | ||
|
||
page( '/plugins/:slug', requireAccessContext, pluginsContext, makeLayout, clientRender ); | ||
|
||
page( | ||
'/plugins/manage/sites', | ||
requireAccessContext, | ||
pluginManagementContext, | ||
renderPluginsDashboard, | ||
makeLayout, | ||
clientRender | ||
); | ||
|
||
page( | ||
'/plugins/manage/sites/:slug', | ||
requireAccessContext, | ||
pluginDetailsContext, | ||
renderPluginsDashboard, | ||
makeLayout, | ||
clientRender | ||
); | ||
} |