diff --git a/src/calendar-app/calendar/view/CalendarView.ts b/src/calendar-app/calendar/view/CalendarView.ts index 9ac7ffe2a5c1..c3f23e5bde76 100644 --- a/src/calendar-app/calendar/view/CalendarView.ts +++ b/src/calendar-app/calendar/view/CalendarView.ts @@ -36,7 +36,6 @@ import { getStartOfTheWeekOffset, getStartOfTheWeekOffsetForUser, getTimeZone, - getWeekNumber, hasSourceUrl, isBirthdayEvent, isClientOnlyCalendar, @@ -1141,6 +1140,9 @@ export class CalendarView extends BaseTopLevelView implements TopLevelView) { if (!args.view) { this.setUrl(this.currentViewType, this.viewModel.selectedDate(), true) + if (this.currentViewType === CalendarViewType.WEEK || this.currentViewType === CalendarViewType.THREE_DAY) { + this.viewModel.setSelectedTime(Time.fromDateTime(DateTime.fromObject({ hour: deviceConfig.getScrollTime(), minute: 0 }))) + } } else { this.currentViewType = CalendarViewTypeByValue[args.view as CalendarViewType] ? args.view : CalendarViewType.MONTH const urlDateParam = args.date @@ -1162,7 +1164,9 @@ export class CalendarView extends BaseTopLevelView implements TopLevelView | null = null + private timeOptions: Array<{ name: string; value: number }> = [] oncreate() { locator.themeController.getCustomThemes().then((themes) => { this._customThemes = themes m.redraw() }) + + const userSettingsGroupRoot = locator.logins.getUserController().userSettingsGroupRoot + const timeFormat = userSettingsGroupRoot.timeFormat + + for (let hour = 0; hour < 24; hour++) { + this.timeOptions.push({ + name: DateTime.fromFormat(hour.toString(), "h").toFormat(timeFormat === TimeFormat.TWENTY_FOUR_HOURS ? "HH:mm" : "hh:mm a"), + value: hour, + }) + } } view(): Children { @@ -117,6 +129,7 @@ export class AppearanceSettingsViewer implements UpdatableSettingsViewer { m(".h4.mt-l", lang.get("settingsForDevice_label")), m(DropDownSelector, languageDropDownAttrs), this._renderThemeSelector(), + this.renderScrollTimeSelector(), m(".h4.mt-l", lang.get("userSettings_label")), m(DropDownSelector, hourFormatDropDownAttrs), m(DropDownSelector, weekStartDropDownAttrs), @@ -145,6 +158,18 @@ export class AppearanceSettingsViewer implements UpdatableSettingsViewer { return m(DropDownSelector, themeDropDownAttrs) } + renderScrollTimeSelector(): Children { + const themeDropDownAttrs: DropDownSelectorAttrs = { + label: "weekScrollTime_label", + helpLabel: () => lang.get("weekScrollTime_msg"), + items: this.timeOptions as SelectorItemList, + selectedValue: deviceConfig.getScrollTime(), + selectionChangedHandler: (value) => deviceConfig.setScrollTime(value), + dropdownWidth: 300, + } + return m(DropDownSelector, themeDropDownAttrs) + } + entityEventsReceived(updates: ReadonlyArray): Promise { return promiseMap(updates, (update) => { if (isUpdateForTypeRef(UserSettingsGroupRootTypeRef, update)) { diff --git a/src/mail-app/translations/de.ts b/src/mail-app/translations/de.ts index 49d0227fe551..8cafa35b5db2 100644 --- a/src/mail-app/translations/de.ts +++ b/src/mail-app/translations/de.ts @@ -1912,6 +1912,8 @@ export default { "threeDays_label": "Drei Tage", "prevThreeDays_label": "Vorherige drei Tage", "nextThreeDays_label": "Nächsten drei Tage", + "weekScrollTime_label": "Standardzeit", + "weekScrollTime_msg": "Standardzeit für Drei-Tage- und Wochen-Ansichten zum Blättern zu", // Put in temporarily, will be removed soon "localAdminGroup_label": "Local admin group", "assignAdminRightsToLocallyAdministratedUserError_msg": "You can't assign global admin rights to a locally administrated user.", diff --git a/src/mail-app/translations/de_sie.ts b/src/mail-app/translations/de_sie.ts index f607e881cb13..c02b0a290999 100644 --- a/src/mail-app/translations/de_sie.ts +++ b/src/mail-app/translations/de_sie.ts @@ -1912,6 +1912,8 @@ export default { "threeDays_label": "Drei Tage", "prevThreeDays_label": "Vorherige drei Tage", "nextThreeDays_label": "Nächsten drei Tage", + "weekScrollTime_label": "Standardzeit", + "weekScrollTime_msg": "Standardzeit für Drei-Tage- und Wochen-Ansichten zum Blättern zu", // Put in temporarily, will be removed soon "localAdminGroup_label": "Local admin group", "assignAdminRightsToLocallyAdministratedUserError_msg": "You can't assign global admin rights to a locally administrated user.", diff --git a/src/mail-app/translations/en.ts b/src/mail-app/translations/en.ts index 65af51b19560..2e08e6cb16a7 100644 --- a/src/mail-app/translations/en.ts +++ b/src/mail-app/translations/en.ts @@ -1906,12 +1906,14 @@ export default { "yourMessage_label": "Your message", "you_label": "You", // Put in temporarily, will be removed soon - "localAdminGroup_label": "Local admin group", - "assignAdminRightsToLocallyAdministratedUserError_msg": "You can't assign global admin rights to a locally administrated user.", - "localAdminGroups_label": "Local admin groups", "threeDays_label": "Three Days", "prevThreeDays_label": "Previous three days", - "nextThreeDays_label": "Next three days" + "nextThreeDays_label": "Next three days", + "weekScrollTime_label": "Default time", + "weekScrollTime_msg": "Default time for Three Days and Week views to scroll to", + // Put in temporarily + "localAdminGroup_label": "Local admin group", + "assignAdminRightsToLocallyAdministratedUserError_msg": "You can't assign global admin rights to a locally administrated user.", "localAdminGroups_label": "Local admin groups" } } diff --git a/test/tests/misc/DeviceConfigTest.ts b/test/tests/misc/DeviceConfigTest.ts index 8b2612c84fc4..d9582d572d4c 100644 --- a/test/tests/misc/DeviceConfigTest.ts +++ b/test/tests/misc/DeviceConfigTest.ts @@ -109,6 +109,7 @@ o.spec("DeviceConfig", function () { events: [], lastRatingPromptedDate: null, retryRatingPromptAfter: null, + scrollTime: 8 } when(localStorageMock.getItem(DeviceConfig.LocalStorageKey)).thenReturn(JSON.stringify(storedInLocalStorage))