Download wp-calypso/client/state/ui/preview/selectors.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/ui/preview/selectors.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/ui/preview/selectors.js
-
curl -L -o selectors.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/ui/preview/selectors.js
1.1 kB
| import { getSite } from 'calypso/state/sites/selectors'; | |
| import { getSelectedSiteId } from 'calypso/state/ui/selectors'; | |
| import 'calypso/state/ui/init'; | |
| /** | |
| * Returns the URL if SitePreview currently has one. | |
| * @param {Object} state Global state tree | |
| * @returns {?string} The url or null | |
| * @see client/blocks/site-preview | |
| */ | |
| export function getPreviewUrl( state ) { | |
| return state.ui.preview.currentPreviewUrl; | |
| } | |
| /** | |
| * Returns the site object for the current site set for SitePreview. | |
| * @param {Object} state Global state tree | |
| * @returns {?Object} Selected site | |
| */ | |
| export function getPreviewSite( state ) { | |
| const siteId = getPreviewSiteId( state ); | |
| if ( ! siteId ) { | |
| return null; | |
| } | |
| return getSite( state, siteId ); | |
| } | |
| /** | |
| * Returns the site ID for SitePreview for use in "All My Sites". | |
| * @param {Object} state Global state tree | |
| * @returns {?number} Selected preview site ID | |
| */ | |
| export function getPreviewSiteId( state ) { | |
| const siteId = getSelectedSiteId( state ); | |
| if ( siteId ) { | |
| return siteId; | |
| } | |
| return state.ui.preview.currentPreviewSiteId; | |
| } | |