aboutsummaryrefslogtreecommitdiff
path: root/src/content/reducers/mark.ts
blob: a8f2f1b3805e64f571135f1f382d094a88cfc92f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import * as actions from '../actions';

export interface State {
  setMode: boolean;
  jumpMode: boolean;
}

const defaultState: State = {
  setMode: false,
  jumpMode: false,
};

export default function reducer(
  state: State = defaultState,
  action: actions.MarkAction,
): State {
  switch (action.type) {
  case actions.MARK_START_SET:
    return { ...state, setMode: true };
  case actions.MARK_START_JUMP:
    return { ...state, jumpMode: true };
  case actions.MARK_CANCEL:
    return { ...state, setMode: false, jumpMode: false };
  default:
    return state;
  }
}