mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-11 19:44:21 +00:00
303e44abb3
* [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
52 lines
1020 B
TypeScript
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;
|
|
}
|
|
}
|