MyCrypto/common/reducers/onboardStatus.ts
Olajide Ogundipe Jr 303e44abb3 Onboarding Modal (#611)
* [WIP] Start port of V3 Modal

* allow lambda functions in React Components

* lint code

* add null case for modalRef

* fix action test

* reduce onboard slide boilerplate

* delete images and componentize OnboardSlide

* comment out info onboarding message

* fix merge conflict

* fix prettier error

* revert tslint file

* fix type in modal

* add translations to onboard modal

* add in images, fix stlyes
2018-01-11 12:13:14 -06:00

52 lines
1020 B
TypeScript

import { OnboardStatusAction } from 'actions/onboardStatus';
import { TypeKeys } from 'actions/onboardStatus/constants';
export interface State {
sessionStarted: boolean;
slideNumber: number;
}
export const INITIAL_STATE: State = {
sessionStarted: false,
slideNumber: 1
};
export function onboardStatus(state: State = INITIAL_STATE, action: OnboardStatusAction): State {
switch (action.type) {
case TypeKeys.START_ONBOARD_SESSION: {
return {
...state,
sessionStarted: true
};
}
case TypeKeys.RESUME_SLIDE: {
return {
...state,
slideNumber: action.slideNumber
};
}
case TypeKeys.DECREMENT_SLIDE: {
const prevSlide = state.slideNumber - 1;
return {
...state,
slideNumber: prevSlide
};
}
case TypeKeys.INCREMENT_SLIDE: {
const nextSlide = state.slideNumber + 1;
return {
...state,
slideNumber: nextSlide
};
}
default:
return state;
}
}