Download wp-calypso/client/my-sites/earn/controller.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.14 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/my-sites/earn/controller.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/my-sites/earn/controller.ts
-
curl -L -o controller.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/my-sites/earn/controller.ts
1.14 kB
| import page, { type Callback } from '@automattic/calypso-router'; | |
| import { createElement } from 'react'; | |
| import isJetpackCloud from 'calypso/lib/jetpack/is-jetpack-cloud'; | |
| import JetpackMonetize from './jetpack-monetize'; | |
| import Main from './main'; | |
| const earnPath = ! isJetpackCloud() ? '/earn' : '/monetize'; | |
| export const redirectToAdsEarnings: Callback = ( context ) => { | |
| page.redirect( earnPath + '/ads-earnings/' + context.params.site_id ); | |
| }; | |
| export const redirectToAdsSettings: Callback = ( context ) => { | |
| page.redirect( earnPath + '/ads-settings/' + context.params.site_id ); | |
| }; | |
| export const redirectToSettings: Callback = ( context ) => { | |
| page.redirect( earnPath + '/payments/' + context.params.site_id ); | |
| }; | |
| export const layout: Callback = ( context, next ) => { | |
| // Scroll to the top | |
| if ( typeof window !== 'undefined' ) { | |
| window.scrollTo( 0, 0 ); | |
| } | |
| context.primary = createElement( Main, { | |
| section: context.params.section, | |
| path: context.path, | |
| query: context.query, | |
| } ); | |
| next(); | |
| }; | |
| export const jetpackMonetize: Callback = ( context, next ) => { | |
| context.primary = createElement( JetpackMonetize ); | |
| next(); | |
| }; | |