wongjiahau/ttap-web

View on GitHub
src/ts/redux/actions/toggleSetTimeConstraintView.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { IMasterState, MasterStateAction } from "./../reducers/masterState";

export class ToggleSetTimeConstraintView extends MasterStateAction {
  public constructor(private open: boolean) {
    super();
  }
  public TypeName(): string {
    return this.open
      ? "open set time constraint view"
      : "close set time constraint view";
  }
  protected GenerateNewState(state: IMasterState): IMasterState {
    return {
      ...state,
      TimetableListState: {
        ...state.TimetableListState,
        ShowingAlternateSlotOf: null,
      },
      SetTimeConstraintState: {
        ...state.SetTimeConstraintState,
        IsOpen: this.open,
      },
    };
  }
}