Add delayed presentationMode thunks.

pull/10616/head
Hunter Trujillo 2017-02-16 15:25:15 -07:00
parent 87937e8bc3
commit a18e6e4f98
3 changed files with 19 additions and 3 deletions

View File

@ -9,7 +9,7 @@ import DashboardHeader from 'src/dashboards/components/DashboardHeader';
import timeRanges from 'hson!../../shared/data/timeRanges.hson';
import {getMappings, getAppsForHosts, getMeasurementsForHost, getAllHosts} from 'src/hosts/apis';
import {fetchLayouts} from 'shared/apis';
import {enablePresentationMode} from 'shared/actions/ui';
import {delayEnablePresentationMode} from 'shared/actions/ui';
const {
shape,
@ -187,7 +187,7 @@ const mapStateToProps = (state) => ({
const mapDispatchToProps = (dispatch) => ({
handleClickPresentationButton: () => {
dispatch(enablePresentationMode())
dispatch(delayEnablePresentationMode())
},
})

View File

@ -1,3 +1,5 @@
import {PRESENTATION_MODE_DELAY} from '../constants'
export function enablePresentationMode() {
return {
type: 'ENABLE_PRESENTATION_MODE',
@ -9,3 +11,15 @@ export function disablePresentationMode() {
type: 'DISABLE_PRESENTATION_MODE',
}
}
export function delayEnablePresentationMode() {
return (dispatch) => {
setTimeout(() => dispatch(enablePresentationMode()), PRESENTATION_MODE_DELAY)
}
}
export function delayDisablePresentationMode() {
return (dispatch) => {
setTimeout(() => dispatch(disablePresentationMode()), PRESENTATION_MODE_DELAY)
}
}

View File

@ -466,4 +466,6 @@ export const DEFAULT_LINE_COLORS = [
export const STROKE_WIDTH = {
heavy: 3.5,
light: 1.5,
};
};
export const PRESENTATION_MODE_DELAY = 250 // In milliseconds.