import { EventRecord , RootRecord } from "./model" ; import { setMenuDisplayMonth } from "./menus" ; import { getMovingEventRectMap } from "./util" ; import { MouseCoordinates , MouseStartCoordinates , MovingEventOrder , MovingEventRectMap , } from "./types" ; export const setFocusedEvent = ( focusedEvent ? , focusedEventTimestamp ? ) => ( { type : "SET_FOCUSED_EVENT" , focusedEvent , focusedEventTimestamp , } ) ; export const setResizingEvent = ( resizingEvent ? ) => ( { type : "SET_RESIZING_EVENT" , movingEvent : null , mouseStartCoordinates : { offsetX : 0 , offsetY : 0 , date : null , } , resizingEvent , } ) ; export const setMovingEvent = ( movingEvent ? , mouseStartCoordinates ? ) => ( { type : "SET_MOVING_EVENT" , mouseStartCoordinates , movingEvent , movingEventRectMap : movingEvent && mouseStartCoordinates ? getMovingEventRectMap ( movingEvent , mouseStartCoordinates ) : { } , resizingEvent : null , } ) ; export const setMovingEventOrder = ( movingEventOrder ? ) => ( { type : "SET_MOVING_EVENT_ORDER" , movingEventOrder , } ) ; export const setMovingEventRectMap = ( movingEventRectMap ? ) => ( { type : "SET_MOVING_EVENT_RECT_MAP" , movingEventRectMap , } ) ; export const setMouseCoordinates = ( mouseCoordinates , draggingEventDateRange ? ) => ( { type : "SET_MOUSE_COORDINATES" , mouseCoordinates , draggingEventDateRange , } ) ; export const setSelectedEvent = ( selectedEvent ? ) => ( { type : "SET_SELECTED_EVENT" , selectedEvent , } ) ; export const setDisplayMonth = ( displayMonth ) => { setMenuDisplayMonth ( displayMonth ) ; return { type : "SET_DISPLAY_MONTH" , displayMonth , } ; } ; export const refreshEvents = ( rootRecord ) => ( { type : "SET_EVENTS" , events : rootRecord . getEvents ( ) , } ) ; export const setIsSmallScreen = ( isSmallScreen ) => ( { type : "SET_SMALL_SCREEN" , isSmallScreen , } ) ; export const setMenuOpenRecord = ( menuOpenRecord ) => ( { type : "SET_MENU_OPEN_RECORD" , menuOpenRecord , } ) ; export const setDebugProp = ( payload ) => ( { type : "SET_DEBUG_PROP" , payload , } ) ;