Skip to content

Commit

Permalink
Show add event button in mobile header for mail app
Browse files Browse the repository at this point in the history
  • Loading branch information
wrdhub committed Aug 30, 2024
1 parent 3bfeb4d commit 41271e4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/calendar-app/calendar/view/CalendarMobileHeader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ import { NavButton } from "../../../common/gui/base/NavButton.js"
import { SEARCH_PREFIX } from "../../../common/misc/RouteChange.js"
import { client } from "../../../common/misc/ClientDetector.js"
import { CalendarViewType } from "../../../common/api/common/utils/CommonCalendarUtils.js"
import { Icons } from "../../../common/gui/base/icons/Icons.js"

export interface CalendarMobileHeaderAttrs extends AppHeaderAttrs {
viewType: CalendarViewType
viewSlider: ViewSlider
navConfiguration: CalendarNavConfiguration
onCreateEvent: () => unknown
onToday: () => unknown
onViewTypeSelected: (viewType: CalendarViewType) => unknown
onTap?: ClickHandler
Expand Down Expand Up @@ -67,7 +69,13 @@ export class CalendarMobileHeader implements Component<CalendarMobileHeaderAttrs
click: attrs.onToday,
}),
this.renderViewSelector(attrs),
this.renderSearchNavigationButton(),
client.isCalendarApp()
? this.renderSearchNavigationButton()
: m(IconButton, {
icon: Icons.Add,
title: "newEvent_action",
click: attrs.onCreateEvent,
}),
],
injections: m(ProgressBar, { progress: attrs.offlineIndicatorModel.getProgress() }),
})
Expand All @@ -89,7 +97,7 @@ export class CalendarMobileHeader implements Component<CalendarMobileHeaderAttrs
}

private renderSearchNavigationButton() {
if (locator.logins.isInternalUserLoggedIn() && client.isCalendarApp()) {
if (locator.logins.isInternalUserLoggedIn()) {
const route = m.route.get().startsWith(SEARCH_PREFIX) ? m.route.get() : "/search/calendar"
return m(NavButton, {
label: "search_label",
Expand Down
1 change: 1 addition & 0 deletions src/calendar-app/calendar/view/CalendarView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ export class CalendarView extends BaseTopLevelView implements TopLevelView<Calen
"short",
(viewType, next) => this.viewPeriod(viewType, next),
),
onCreateEvent: () => this.createNewEventDialog(),
onToday: () => {
// in case it has been set, when onToday is called we definitely do not want the time to be ignored
this.viewModel.ignoreNextValidTimeSelection = false
Expand Down

0 comments on commit 41271e4

Please sign in to comment.