Download wp-calypso/client/state/gravatar-status/selectors.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 904 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/gravatar-status/selectors.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/gravatar-status/selectors.js
-
curl -L -o selectors.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/gravatar-status/selectors.js
904 Bytes
| import { getCurrentUserId } from 'calypso/state/current-user/selectors'; | |
| import 'calypso/state/gravatar-status/init'; | |
| /** | |
| * Returns true if we're currently uploading a Gravatar | |
| * @param {Object} state - The state | |
| * @returns {boolean} - If uploading a Gravatar | |
| */ | |
| export function isCurrentUserUploadingGravatar( state ) { | |
| return state.gravatarStatus.isUploading; | |
| } | |
| /** | |
| * Returns the temp Gravatar if it exists and | |
| * the current user ID is passed in, otherwise false | |
| * @param {Object} state - The state | |
| * @param {number} userId - The ID of the user we're checking | |
| * @returns {string|boolean} - The temp Gravatar string, or false | |
| */ | |
| export function getUserTempGravatar( state, userId ) { | |
| return getCurrentUserId( state ) === userId && ( state.gravatarStatus.tempImage ?? false ); | |
| } | |
| export const hasGravatar = ( state ) => { | |
| return !! state.gravatarStatus?.gravatarDetails?.has_gravatar; | |
| }; | |