Files
pybricks-code/src/reducers/editor.ts
T
2020-04-19 15:53:28 -05:00

23 lines
593 B
TypeScript

import { Ace } from 'ace-builds';
import { Reducer, combineReducers } from 'redux';
import { CurrentEditorAction, EditorActionType } from '../actions/editor';
type CurrentEditSession = Ace.EditSession | null;
const current: Reducer<CurrentEditSession, CurrentEditorAction> = (
state = null,
action,
) => {
switch (action.type) {
case EditorActionType.Current:
return action.editSession || null;
default:
return state;
}
};
export interface EditorState {
current: CurrentEditSession;
}
export default combineReducers({ current });