File tree Expand file tree Collapse file tree 6 files changed +21
-15
lines changed
views/Calendar/components Expand file tree Collapse file tree 6 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,6 @@ export const getCategory = (event: Schema_Event) => {
8888export const assembleGridEvent = (
8989 event : Partial < Schema_GridEvent >
9090) : Schema_GridEvent => {
91- // TODO: Maybe move to a constants file?
9291 const DEFAULT_POSITION = {
9392 isOverlapping : false ,
9493 widthMultiplier : 1 ,
Original file line number Diff line number Diff line change @@ -43,7 +43,12 @@ export const assignEventToRow = (
4343 return { fits, rowNum } ;
4444} ;
4545
46- export const assignEventsToRow = ( allDayEvents : Schema_Event [ ] ) => {
46+ export const assignEventsToRow = (
47+ allDayEvents : Schema_Event [ ]
48+ ) : {
49+ rowsCount : number ;
50+ allDayEvents : Schema_GridEvent [ ] ;
51+ } => {
4752 const rows : number [ ] [ ] = [ ] ;
4853 // makes copy of all event objects to allow for adding a 'row' field
4954 // can likely be optimized using immer's `produce` and `draft`
@@ -442,7 +447,8 @@ export const getAbsoluteLeftPosition = (
442447 }
443448
444449 if (
445- event . position ?. isOverlapping &&
450+ ! event . isAllDay &&
451+ event . position . isOverlapping &&
446452 event . position . horizontalOrder > 1
447453 ) {
448454 positionStart += eventWidth * ( event . position . horizontalOrder - 1 ) ;
Original file line number Diff line number Diff line change @@ -5,16 +5,18 @@ import { assignEventsToRow } from "@web/common/utils/grid.util";
55import { Schema_GridEvent } from "@web/common/types/web.event.types" ;
66import { assembleGridEvent } from "@web/common/utils/event.util" ;
77
8+ type Schema_GridEvent_NoPosition = Omit < Schema_GridEvent , "position" > ;
9+
810export const selectAllDayEvents = createSelector (
911 ( state : RootState ) => state . events . entities . value || { } ,
1012 ( state : RootState ) => state . events . getWeekEvents . value || [ ] ,
1113 ( entities , weekIds ) => {
1214 if ( ! ( "data" in weekIds ) || weekIds . data . length === 0 ) return [ ] ;
1315
14- const weekEvents : Schema_Event [ ] = weekIds . data . map (
16+ const weekEvents : Schema_GridEvent_NoPosition [ ] = weekIds . data . map (
1517 ( _id : string ) => entities [ _id ]
1618 ) ;
17- const _allDayEvents : Schema_Event [ ] = weekEvents . filter (
19+ const _allDayEvents : Schema_GridEvent_NoPosition [ ] = weekEvents . filter (
1820 ( e : Schema_Event ) => e !== undefined && e . isAllDay
1921 ) ;
2022 const { allDayEvents } = assignEventsToRow ( _allDayEvents ) ;
Original file line number Diff line number Diff line change @@ -6,7 +6,9 @@ import React, {
66 useMemo ,
77} from "react" ;
88import dayjs from "dayjs" ;
9+ import { Priorities } from "@core/constants/core.constants" ;
910import { Schema_GridEvent } from "@web/common/types/web.event.types" ;
11+ import { isOptimisticEvent } from "@web/common/utils/event.util" ;
1012import { Measurements_Grid } from "@web/views/Calendar/hooks/grid/useGridLayout" ;
1113import { WeekProps } from "@web/views/Calendar/hooks/useWeek" ;
1214import { Flex } from "@web/components/Flex" ;
@@ -22,8 +24,6 @@ import { ZIndex } from "@web/common/constants/web.constants";
2224import { Text } from "@web/components/Text" ;
2325
2426import { StyledEvent , StyledEventScaler , StyledEventTitle } from "../../styled" ;
25- import { Priorities } from "@core/constants/core.constants" ;
26- import { isOptimisticEvent } from "@web/common/utils/event.util" ;
2727
2828interface Props {
2929 event : Schema_GridEvent ;
Original file line number Diff line number Diff line change 11import dayjs from "dayjs" ;
22import React , { memo , MouseEvent } from "react" ;
3- import { Schema_Event } from "@core/types/event.types " ;
3+ import { Priorities } from "@core/constants/core.constants " ;
44import { Flex } from "@web/components/Flex" ;
5+ import { Schema_GridEvent } from "@web/common/types/web.event.types" ;
6+ import { isOptimisticEvent } from "@web/common/utils/event.util" ;
57import { AlignItems , FlexDirections } from "@web/components/Flex/styled" ;
68import { SpaceCharacter } from "@web/components/SpaceCharacter" ;
79import { getPosition } from "@web/views/Calendar/hooks/event/getPosition" ;
@@ -10,17 +12,14 @@ import { WeekProps } from "@web/views/Calendar/hooks/useWeek";
1012import { Text } from "@web/components/Text" ;
1113
1214import { StyledEvent } from "../../Event/styled" ;
13- import { Schema_GridEvent } from "@web/common/types/web.event.types" ;
14- import { Priorities } from "@core/constants/core.constants" ;
15- import { isOptimisticEvent } from "@web/common/utils/event.util" ;
1615
1716interface Props {
1817 event : Schema_GridEvent ;
1918 isPlaceholder : boolean ;
2019 measurements : Measurements_Grid ;
2120 startOfView : WeekProps [ "component" ] [ "startOfView" ] ;
2221 endOfView : WeekProps [ "component" ] [ "endOfView" ] ;
23- onMouseDown : ( e : MouseEvent , event : Schema_Event ) => void ;
22+ onMouseDown : ( e : MouseEvent , event : Schema_GridEvent ) => void ;
2423}
2524
2625const AllDayEvent = ( {
Original file line number Diff line number Diff line change 11import React , { MouseEvent } from "react" ;
2- import { Schema_Event } from "@core/types/event.types" ;
32import { ID_GRID_EVENTS_ALLDAY } from "@web/common/constants/web.constants" ;
3+ import { Schema_GridEvent } from "@web/common/types/web.event.types" ;
44import { Measurements_Grid } from "@web/views/Calendar/hooks/grid/useGridLayout" ;
55import { WeekProps } from "@web/views/Calendar/hooks/useWeek" ;
66import { useAppDispatch , useAppSelector } from "@web/store/store.hooks" ;
@@ -26,7 +26,7 @@ export const AllDayEvents = ({
2626 const draftId = useAppSelector ( selectDraftId ) ;
2727 const dispatch = useAppDispatch ( ) ;
2828
29- const onMouseDown = ( e : MouseEvent , event : Schema_Event ) => {
29+ const onMouseDown = ( e : MouseEvent , event : Schema_GridEvent ) => {
3030 e . stopPropagation ( ) ;
3131
3232 if ( isSomedayEventFormOpen ( ) ) {
@@ -38,7 +38,7 @@ export const AllDayEvents = ({
3838
3939 return (
4040 < StyledEvents id = { ID_GRID_EVENTS_ALLDAY } >
41- { allDayEvents . map ( ( event : Schema_Event , i ) => {
41+ { allDayEvents . map ( ( event : Schema_GridEvent , i ) => {
4242 return (
4343 < AllDayEventMemo
4444 key = { `${ event . title } -${ i } ` }
You can’t perform that action at this time.
0 commit comments