Skip to content

Commit a2df2c0

Browse files
committed
♻️ Refactor: Update GridEventPreview and SomedayEvents imports and types
1 parent b867c33 commit a2df2c0

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

packages/web/src/views/Calendar/components/Event/Grid/GridEventPreview/GridEventPreview.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { FC, memo } from "react";
2+
import { Priorities } from "@core/constants/core.constants";
23
import { DAY_COMPACT, DAY_HOUR_MIN_M } from "@core/constants/date.constants";
3-
import { Schema_GridEvent } from "@web/common/types/web.event.types";
4+
import { Schema_Event } from "@core/types/event.types";
45
import { getWidthBuffer } from "@web/common/utils/grid.util";
56
import { Flex } from "@web/components/Flex";
67
import { AlignItems, FlexWrap } from "@web/components/Flex/styled";
@@ -15,23 +16,22 @@ import { WeekProps } from "@web/views/Calendar/hooks/useWeek";
1516
import { DateCalcs } from "@web/views/Calendar/hooks/grid/useDateCalcs";
1617
import { SpaceCharacter } from "@web/components/SpaceCharacter";
1718
import { snapToGrid } from "@web/views/Calendar/components/Event/Grid/GridEventPreview/snap.grid";
18-
import { MouseCoords } from "@web/views/Calendar/hooks/draft/sidebar/useMousePosition";
1919

2020
import { getItemStyles, layerStyles, StyledGridEventPreview } from "./styled";
2121

22-
export interface Props {
22+
interface Props {
2323
dateCalcs: DateCalcs;
2424
dayIndex: number;
25-
event: Schema_GridEvent;
25+
event: Schema_Event;
2626
isOverAllDayRow: boolean;
2727
isOverMainGrid: boolean;
2828
measurements: Measurements_Grid;
29-
mouseCoords: MouseCoords;
29+
mouseCoords: { x: number; y: number };
3030
startOfView: WeekProps["component"]["startOfView"];
3131
gridScrollRef: Refs_Grid["gridScrollRef"];
3232
}
3333

34-
export const GridEventPreview: FC<Props> = memo(function GridEventPreview({
34+
const _GridEventPreview: FC<Props> = ({
3535
dateCalcs,
3636
dayIndex,
3737
event,
@@ -41,7 +41,7 @@ export const GridEventPreview: FC<Props> = memo(function GridEventPreview({
4141
mouseCoords,
4242
startOfView,
4343
gridScrollRef,
44-
}) {
44+
}) => {
4545
const { colWidths } = measurements;
4646
const { x, y } = mouseCoords;
4747

@@ -93,7 +93,7 @@ export const GridEventPreview: FC<Props> = memo(function GridEventPreview({
9393
className={"active"}
9494
duration={1}
9595
height={height}
96-
priority={event.priority}
96+
priority={event.priority || Priorities.UNASSIGNED}
9797
role="button"
9898
tabIndex={0}
9999
width={width}
@@ -114,4 +114,6 @@ export const GridEventPreview: FC<Props> = memo(function GridEventPreview({
114114
</div>
115115
</div>
116116
);
117-
});
117+
};
118+
119+
export const GridEventPreview = memo(_GridEventPreview);

packages/web/src/views/Calendar/components/Sidebar/SomedayTab/SomedayEvents/Wrappers/DraggableSomedayEvent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React, { FC } from "react";
22
import { Draggable } from "@hello-pangea/dnd";
33
import { Categories_Event, Schema_Event } from "@core/types/event.types";
4-
import { SidebarProps } from "@web/views/Calendar/hooks/draft/sidebar/useSidebar";
54
import { ID_SOMEDAY_DRAFT } from "@web/common/constants/web.constants";
5+
import { SidebarProps } from "@web/views/Calendar/components/Draft/hooks/sidebar/useSidebar";
66

77
import { SomedayEvent } from "../SomedayEvent";
88

packages/web/src/views/Calendar/components/Sidebar/SomedayTab/SomedayEvents/Wrappers/DraggableSomedayEvents.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { FC, memo } from "react";
22
import { Categories_Event, Schema_Event } from "@core/types/event.types";
33
import { ID_SOMEDAY_DRAFT } from "@web/common/constants/web.constants";
44
import { Schema_GridEvent } from "@web/common/types/web.event.types";
5-
import { SidebarProps } from "@web/views/Calendar/hooks/draft/sidebar/useSidebar";
5+
import { SidebarProps } from "@web/views/Calendar/components/Draft/hooks/sidebar/useSidebar";
66

77
import { DraggableSomedayEvent } from "./DraggableSomedayEvent";
88

@@ -35,3 +35,5 @@ export const DraggableSomedayEvents: FC<{
3535
</>
3636
);
3737
});
38+
39+
DraggableSomedayEvents.displayName = "DraggableSomedayEvents";

0 commit comments

Comments
 (0)