Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements Guests Page #7955

Open
wants to merge 1 commit into
base: 7205-simplified-event-editor
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/calendar-app/calendar/gui/CalendarGuiUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ import { CalendarEventPreviewViewModel } from "./eventpopup/CalendarEventPreview
import { createAsyncDropdown } from "../../../common/gui/base/Dropdown.js"
import { UserController } from "../../../common/api/main/UserController.js"
import { ClientOnlyCalendarsInfo } from "../../../common/misc/DeviceConfig.js"
import { SelectOption } from "../../../common/gui/base/Select.js"

export function renderCalendarSwitchLeftButton(label: TranslationKey, click: () => unknown): Child {
return m(IconButton, {
Expand Down Expand Up @@ -422,23 +423,33 @@ export const createAlarmIntervalItems = (locale: string): SelectorItemList<Alarm
name: humanDescriptionForAlarmInterval(value, locale),
}
})
export const createAttendingItems = (): SelectorItemList<CalendarAttendeeStatus> => [

export interface AttendingItem extends SelectOption<CalendarAttendeeStatus> {
name: string
selectable?: boolean
}

export const createAttendingItems = (): AttendingItem[] => [
{
name: lang.get("yes_label"),
value: CalendarAttendeeStatus.ACCEPTED,
ariaValue: lang.get("yes_label"),
},
{
name: lang.get("maybe_label"),
value: CalendarAttendeeStatus.TENTATIVE,
ariaValue: lang.get("maybe_label"),
},
{
name: lang.get("no_label"),
value: CalendarAttendeeStatus.DECLINED,
ariaValue: lang.get("no_label"),
},
{
name: lang.get("pending_label"),
value: CalendarAttendeeStatus.NEEDS_ACTION,
selectable: false,
ariaValue: lang.get("pending_label"),
},
]

Expand Down
18 changes: 11 additions & 7 deletions src/calendar-app/calendar/gui/RemindersEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { Select, SelectAttributes, SelectOption } from "../../../common/gui/base
import { Icon, IconSize } from "../../../common/gui/base/Icon.js"
import { BaseButton } from "../../../common/gui/base/buttons/BaseButton.js"
import { ButtonColor, getColors } from "../../../common/gui/base/Button.js"
import stream from "mithril/stream"

export type RemindersEditorAttrs = {
addAlarm: (alarm: AlarmInterval) => unknown
Expand Down Expand Up @@ -150,17 +151,20 @@ export class RemindersEditor implements Component<RemindersEditorAttrs> {
m(Select<RemindersSelectOption, AlarmInterval>, {
ariaLabel: lang.get("calendarReminderIntervalValue_label"),
selected: defaultSelected,
options: alarmOptions,
options: stream(alarmOptions),
renderOption: (option) => this.renderReminderOptions(option, false, false),
renderDisplay: (option) => this.renderReminderOptions(option, alarms.length > 0, true),
onChange: (newValue) => {
onchange: (newValue) => {
if (newValue.value.value === -1) {
return this.showCustomReminderIntervalDialog((value, unit) => {
addNewAlarm({
value,
unit,
// timeout needed to prevent the custom interval dialog to be closed by the key event triggered inside the select component
return setTimeout(() => {
this.showCustomReminderIntervalDialog((value, unit) => {
addNewAlarm({
value,
unit,
})
})
})
}, 0)
}
addAlarm(newValue.value)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ export class CalendarEventWhoModel {
// if there are other attendees and we have an organizer that's us, we must use that organizer
// because changing the organizer address after the attendees were invited is suboptimal.
return [this._organizer.address]
} else if (this.eventType === EventType.OWN) {
return this.ownMailAddresses
} else {
// something is wrong.
throw new ProgrammingError("could not figure out which addresses are a valid organizer for this event.")
Expand Down
Loading