@sprucelabs/spruce-calendar-components 20.5.4 → 20.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -153,6 +153,7 @@ export default class RemoteEventStore {
153
153
  return target;
154
154
  }
155
155
  cleanPayload(payload) {
156
+ const dateToUpdate = payload.dateToUpdate;
156
157
  const normalized = normalizeSchemaValues(calendarEventSchema, payload, {
157
158
  shouldValidate: false,
158
159
  });
@@ -171,6 +172,10 @@ export default class RemoteEventStore {
171
172
  //@ts-ignore
172
173
  delete normalized[key];
173
174
  }
175
+ if (dateToUpdate) {
176
+ ;
177
+ normalized.dateToUpdate = dateToUpdate;
178
+ }
174
179
  return normalized;
175
180
  }
176
181
  setCalendarId(id) {
@@ -35,6 +35,52 @@ export default class EventDateTimeToolViewController extends AbstractViewControl
35
35
  }
36
36
  handleSelectDateFromCalendar({ dateTimeMs, }) {
37
37
  return __awaiter(this, void 0, void 0, function* () {
38
+ let shouldBail = false;
39
+ const formattedDestination = dateUtil.format(dateTimeMs, 'MMM do');
40
+ const dlg = this.renderInDialog({
41
+ shouldShowCloseButton: false,
42
+ header: {
43
+ title: 'Which would you like to do?',
44
+ },
45
+ body: {
46
+ sections: [
47
+ {
48
+ buttons: [
49
+ {
50
+ id: 'move',
51
+ label: `Move this event to ${formattedDestination}.`,
52
+ onClick: () => __awaiter(this, void 0, void 0, function* () {
53
+ yield dlg.hide();
54
+ }),
55
+ },
56
+ {
57
+ id: 'navigate',
58
+ label: `Deselect event and navigate to ${formattedDestination}.`,
59
+ onClick: () => __awaiter(this, void 0, void 0, function* () {
60
+ shouldBail = true;
61
+ const { calendarVc } = this.getContext();
62
+ calendarVc.setStartDate(dateTimeMs);
63
+ calendarVc.deselectEvent();
64
+ yield dlg.hide();
65
+ }),
66
+ },
67
+ {
68
+ id: 'cancel',
69
+ label: 'Nevermind',
70
+ onClick: () => __awaiter(this, void 0, void 0, function* () {
71
+ shouldBail = true;
72
+ yield dlg.hide();
73
+ }),
74
+ },
75
+ ],
76
+ },
77
+ ],
78
+ },
79
+ });
80
+ yield dlg.wait();
81
+ if (shouldBail) {
82
+ return;
83
+ }
38
84
  const { hour, minute } = dateUtil.splitDate(this.getContext().event.startDateTimeMs);
39
85
  yield this.formVc.setValue('startDateTime', dateUtil.setTimeOfDay(dateTimeMs, hour, minute, 0, 0));
40
86
  this.calendarVc.setSelectedDates([this.getSelectedDate(dateTimeMs)]);
@@ -139,6 +139,7 @@ class RemoteEventStore {
139
139
  return target;
140
140
  }
141
141
  cleanPayload(payload) {
142
+ const dateToUpdate = payload.dateToUpdate;
142
143
  const normalized = (0, schema_1.normalizeSchemaValues)(calendar_utils_1.calendarEventSchema, payload, {
143
144
  shouldValidate: false,
144
145
  });
@@ -157,6 +158,10 @@ class RemoteEventStore {
157
158
  //@ts-ignore
158
159
  delete normalized[key];
159
160
  }
161
+ if (dateToUpdate) {
162
+ ;
163
+ normalized.dateToUpdate = dateToUpdate;
164
+ }
160
165
  return normalized;
161
166
  }
162
167
  setCalendarId(id) {
@@ -27,6 +27,52 @@ class EventDateTimeToolViewController extends heartwood_view_controllers_1.Abstr
27
27
  this.cardVc = this.CardVc();
28
28
  }
29
29
  async handleSelectDateFromCalendar({ dateTimeMs, }) {
30
+ let shouldBail = false;
31
+ const formattedDestination = calendar_utils_1.dateUtil.format(dateTimeMs, 'MMM do');
32
+ const dlg = this.renderInDialog({
33
+ shouldShowCloseButton: false,
34
+ header: {
35
+ title: 'Which would you like to do?',
36
+ },
37
+ body: {
38
+ sections: [
39
+ {
40
+ buttons: [
41
+ {
42
+ id: 'move',
43
+ label: `Move this event to ${formattedDestination}.`,
44
+ onClick: async () => {
45
+ await dlg.hide();
46
+ },
47
+ },
48
+ {
49
+ id: 'navigate',
50
+ label: `Deselect event and navigate to ${formattedDestination}.`,
51
+ onClick: async () => {
52
+ shouldBail = true;
53
+ const { calendarVc } = this.getContext();
54
+ calendarVc.setStartDate(dateTimeMs);
55
+ calendarVc.deselectEvent();
56
+ await dlg.hide();
57
+ },
58
+ },
59
+ {
60
+ id: 'cancel',
61
+ label: 'Nevermind',
62
+ onClick: async () => {
63
+ shouldBail = true;
64
+ await dlg.hide();
65
+ },
66
+ },
67
+ ],
68
+ },
69
+ ],
70
+ },
71
+ });
72
+ await dlg.wait();
73
+ if (shouldBail) {
74
+ return;
75
+ }
30
76
  const { hour, minute } = calendar_utils_1.dateUtil.splitDate(this.getContext().event.startDateTimeMs);
31
77
  await this.formVc.setValue('startDateTime', calendar_utils_1.dateUtil.setTimeOfDay(dateTimeMs, hour, minute, 0, 0));
32
78
  this.calendarVc.setSelectedDates([this.getSelectedDate(dateTimeMs)]);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-calendar-components",
3
3
  "description": "Calendar components for working with calendars and Sprucebot.",
4
- "version": "20.5.4",
4
+ "version": "20.5.7",
5
5
  "skill": {
6
6
  "namespace": "calendar"
7
7
  },