Download wp-calypso/client/state/activity-log/restore/reducer.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.36 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/activity-log/restore/reducer.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/activity-log/restore/reducer.js
-
curl -L -o reducer.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/activity-log/restore/reducer.js
1.36 kB
| import { | |
| REWIND_RESTORE, | |
| REWIND_RESTORE_DISMISS, | |
| REWIND_RESTORE_DISMISS_PROGRESS, | |
| REWIND_RESTORE_REQUEST, | |
| REWIND_RESTORE_UPDATE_PROGRESS, | |
| } from 'calypso/state/action-types'; | |
| import { keyedReducer } from 'calypso/state/utils'; | |
| const startProgress = ( state, { timestamp } ) => ( { | |
| errorCode: '', | |
| failureReason: '', | |
| message: '', | |
| percent: 0, | |
| status: 'queued', | |
| timestamp, | |
| rewindId: '', | |
| } ); | |
| const updateProgress = ( | |
| state, | |
| { | |
| errorCode, | |
| failureReason, | |
| message, | |
| percent, | |
| restoreId, | |
| status, | |
| timestamp, | |
| rewindId, | |
| context, | |
| currentEntry, | |
| } | |
| ) => ( { | |
| errorCode, | |
| failureReason, | |
| message, | |
| percent, | |
| restoreId, | |
| status, | |
| timestamp, | |
| rewindId, | |
| context, | |
| currentEntry, | |
| } ); | |
| export const restoreProgress = keyedReducer( 'siteId', ( state = {}, action ) => { | |
| switch ( action.type ) { | |
| case REWIND_RESTORE: | |
| return startProgress( state, action ); | |
| case REWIND_RESTORE_DISMISS_PROGRESS: | |
| return null; | |
| case REWIND_RESTORE_UPDATE_PROGRESS: | |
| return updateProgress( state, action ); | |
| case REWIND_RESTORE_DISMISS: | |
| return null; | |
| } | |
| return state; | |
| } ); | |
| export const restoreRequest = keyedReducer( 'siteId', ( state = null, action ) => { | |
| switch ( action.type ) { | |
| case REWIND_RESTORE: | |
| return null; | |
| case REWIND_RESTORE_DISMISS: | |
| return null; | |
| case REWIND_RESTORE_REQUEST: | |
| return action.activityId; | |
| } | |
| return state; | |
| } ); | |