mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-15 02:54:07 +00:00
23 lines
593 B
TypeScript
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 });
|