Skip to content

Commit 1009dc9

Browse files
committed
fix: add position props during create shortcut
This change updates the draft event creation process in the useShortcuts hook by adding default event properties, including: - Setting an unassigned priority - Adding default positioning information - Ensuring consistent event structure when creating draft events via shortcuts
1 parent f0c25c2 commit 1009dc9

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

packages/web/src/views/Calendar/hooks/shortcuts/useShortcuts.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Key } from "ts-keycode-enum";
55
import { Dayjs } from "dayjs";
66
import { Categories_Event } from "@core/types/event.types";
77
import {
8+
Priorities,
89
SOMEDAY_MONTH_LIMIT_MSG,
910
SOMEDAY_WEEK_LIMIT_MSG,
1011
} from "@core/constants/core.constants";
@@ -13,6 +14,7 @@ import { isEventFormOpen } from "@web/common/utils";
1314
import { draftSlice } from "@web/ducks/events/slices/draft.slice";
1415
import { viewSlice } from "@web/ducks/events/slices/view.slice";
1516
import { ROOT_ROUTES } from "@web/common/constants/routes";
17+
import { Schema_GridEvent } from "@web/common/types/web.event.types";
1618
import {
1719
selectIsAtMonthlyLimit,
1820
selectIsAtWeeklyLimit,
@@ -97,14 +99,22 @@ export const useShortcuts = ({
9799
const _createTimedDraft = () => {
98100
const { startDate, endDate } = getDraftTimes(isCurrentWeek, startOfView);
99101

102+
const event: Schema_GridEvent = {
103+
startDate,
104+
endDate,
105+
priority: Priorities.UNASSIGNED,
106+
position: {
107+
isOverlapping: false,
108+
widthMultiplier: 1,
109+
horizontalOrder: 1,
110+
},
111+
};
112+
100113
dispatch(
101114
draftSlice.actions.start({
102115
activity: "createShortcut",
103116
eventType: Categories_Event.TIMED,
104-
event: {
105-
startDate,
106-
endDate,
107-
},
117+
event,
108118
})
109119
);
110120
};

0 commit comments

Comments
 (0)