Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(calendar): give a phone the event and the ghost as sheets
Elian Doran8e8001691870
diff --git a/apps/client/src/widgets/collections/calendar/EventPopover.css b/apps/client/src/widgets/collections/calendar/EventPopover.cssindex 459f1497b4..ee8e5ded76 100644--- a/apps/client/src/widgets/collections/calendar/EventPopover.css+++ b/apps/client/src/widgets/collections/calendar/EventPopover.css@@ -48,3 +48,22 @@scrollbar-gutter: stable;}}++/*+ * The same event as a sheet (see EventSheet): the dialog brings the surface, what heads it and the+ * way out, so the body gives up the padding and the scrolling it kept for itself in the popover —+ * a full-page dialog scrolls its own body — and stands as the plain column the shared class makes+ * of it.+ */+.calendar-event-sheet .calendar-event-popover-body {+ padding: 0;+ overflow: visible;+ scrollbar-gutter: auto;+}++/* The note's title row is the dialog's title, so it takes the header's room as a title would —+ the close button beside it keeping its own. */+.calendar-event-sheet .modal-header > .title-row {+ flex: 1;+ min-width: 0;+}diff --git a/apps/client/src/widgets/collections/calendar/EventPopover.tsx b/apps/client/src/widgets/collections/calendar/EventPopover.tsxindex e1630887dc..06bc9a45f3 100644--- a/apps/client/src/widgets/collections/calendar/EventPopover.tsx+++ b/apps/client/src/widgets/collections/calendar/EventPopover.tsx@@ -1,16 +1,18 @@import "./EventPopover.css";-import { useCallback, useEffect, useRef } from "preact/hooks";+import { useCallback, useEffect, useRef, useState } from "preact/hooks";import appContext from "../../../components/app_context";import FNote from "../../../entities/fnote";import { t } from "../../../services/i18n";+import { isMobile } from "../../../services/utils";import { announceEmbeddedNoteClosing, EmbeddedNoteActions, EmbeddedNoteScope, NoteColorAction, OpenNoteActions, useEmbeddedNoteContext } from "../../EmbeddedNotePane";import TitleRow from "../../layout/TitleRow";import NoteDetail from "../../NoteDetail";import PromotedAttributes from "../../PromotedAttributes";import ActionButton from "../../react/ActionButton";import { useLegacyComponentElement, useNote } from "../../react/hooks";+import Modal from "../../react/Modal";import Popover from "../../react/Popover";import { removeFromCalendar } from "./api";import EventDatesEditor from "./EventDatesEditor";@@ -26,27 +28,30 @@ import { AnchorPoint } from "./selection";const EVENT_LABELS = [ "startDate", "endDate", "startTime", "endTime", "recurrence" ];/**- * The whole of an event, in a popover standing beside its chip: the note's title, its own fields —- * when it happens, how it repeats — its promoted attributes and its content, each edited exactly as- * it is anywhere else (the embedded-note arrangement the geo map's pane makes; see- * EmbeddedNotePane). Anchored to the chip that was clicked rather than docked at an edge, so the- * grid never reflows and the event is read where it was found.+ * The whole of an event: the note's title, its own fields — when it happens, how it repeats — its+ * promoted attributes and its content, each edited exactly as it is anywhere else (the+ * embedded-note arrangement the geo map's pane makes; see EmbeddedNotePane).*- * One popover for the selection rather than one per event: clicking another chip is a note switch- * within a standing popover — the editors hear it and save — with the surface re-anchoring to the- * new chip (see the updateKey handed to Popover).+ * Where that stands depends on the screen it stands on. A desktop gets a popover beside the chip+ * that was clicked, so the grid never reflows and the event is read where it was found; a phone+ * gets the sheet the app raises every dialog as, a card anchored beside a chip being wider than the+ * screen it would be anchored on. The same contents either way, and the same note context behind+ * them — only the shell differs, as the icon picker's does (see IconPickerButton).+ *+ * One surface for the selection rather than one per event: clicking another chip is a note switch+ * within a standing surface — the editors hear it and save.*/export default function EventPopover({ noteId, anchor, container, parentNote, isEditable, onClose }: {noteId: string;/** Where the chip was clicked — which of the event's segments to stand by, and the anchor of* last resort when no chip is on the grid at all (a note just committed from a ghost, whose- * chip has yet to be drawn). */+ * chip has yet to be drawn). Of no interest to the sheet, which is anchored to nothing. */anchor: AnchorPoint | null;/** The calendar the chips are read out of (see {@link eventAnchorRect}). */container: HTMLElement | null;/** The calendar's own note, which is how the tree is told what the calendar holds a note by. */parentNote: FNote;- /** The calendar may not be edited, which leaves the popover the ways of opening a note and no+ /** The calendar may not be edited, which leaves the surface the ways of opening a note and no* more — a calendar root's day notes are not events to be recoloured or taken off it. */isEditable: boolean;onClose(): void;@@ -55,51 +60,128 @@ export default function EventPopover({ noteId, anchor, container, parentNote, isconst { noteContext, component } = useEmbeddedNoteContext(note ?? undefined, POPOVER_NTX_ID);/**- * Lets the popover go, having given whatever is being edited in it the chance to save — the+ * Lets the surface go, having given whatever is being edited in it the chance to save — the* geo pane's bargain (see its closePane): announced first, while the editors are still- * mounted, and not waited on. Every way out leads through here; the popover closes at once,- * there being no slide to hold the editors up through.+ * mounted, and not waited on. Every way out leads through here.*/const close = useCallback(() => {void announceEmbeddedNoteClosing(component, POPOVER_NTX_ID);onClose();}, [ component, onClose ]);+ if (!note) {+ return null;+ }++ // The scope stands outside the shell rather than within it, so that a sheet's title — which is+ // the note's own title row, handed to the dialog rather than drawn inside its body — reads the+ // note out of the context like everything else does.+ return (+ <EmbeddedNoteScope component={component} noteContext={noteContext}>+ {isMobile() ? (+ <EventSheet note={note} parentNote={parentNote} isEditable={isEditable} onClose={close} />+ ) : (+ <EventPopoverShell+ note={note}+ anchorRect={() => eventAnchorRect(container, noteId, anchor)}+ updateKey={noteId}+ parentNote={parentNote}+ isEditable={isEditable}+ onClose={close}+ />+ )}+ </EmbeddedNoteScope>+ );+}++/** The event beside its chip, as a desktop shows it. */+function EventPopoverShell({ note, anchorRect, updateKey, parentNote, isEditable, onClose }: {+ note: FNote;+ anchorRect(): DOMRect;+ updateKey: string;+ parentNote: FNote;+ isEditable: boolean;+ onClose(): void;+}) {useEffect(() => {const onKeyDown = (e: KeyboardEvent) => {- if (e.key === "Escape") close();+ if (e.key === "Escape") onClose();};window.addEventListener("keydown", onKeyDown);return () => window.removeEventListener("keydown", onKeyDown);- }, [ close ]);-- if (!note) {- return null;- }+ }, [ onClose ]);return (<PopoverclassName="calendar-event-popover"placement={glob.isRtl ? "left-start" : "right-start"}- getAnchorRect={() => eventAnchorRect(container, noteId, anchor)}- updateKey={noteId}+ getAnchorRect={anchorRect}+ updateKey={updateKey}// A press on another chip is not a dismissal but a switch: the click behind it re-points// this popover at that event (see onEventClick), which would otherwise have to tear the// popover down on the press and build it again on the click.keepOpenSelector=".fc-event"- onDismiss={close}+ onDismiss={onClose}>- <EmbeddedNoteScope component={component} noteContext={noteContext}>- <EventDetails note={note} parentNote={parentNote} isEditable={isEditable} onClose={close} />- </EmbeddedNoteScope>+ <EventDetails note={note} parentNote={parentNote} isEditable={isEditable} onClose={onClose} /></Popover>);}+/**+ * The event as a phone shows it: the sheet the app raises its dialogs as, rising from the foot of+ * the screen (see `body.mobile .modal-dialog` in style.css). Given the whole page rather than the+ * standing 85% of it, since what it holds is a note's own editor and a sheet would spend half the+ * screen on the calendar behind it.+ *+ * The note's title row heads the dialog rather than standing inside it, which is what the sheet+ * has a header for; Escape and the backdrop are the dialog's own to answer.+ */+function EventSheet({ note, parentNote, isEditable, onClose }: {+ note: FNote;+ parentNote: FNote;+ isEditable: boolean;+ onClose(): void;+}) {+ // Marked on the dialog itself rather than on its body, so that what heads it is inside the+ // marked element too (see {@link useLegacyComponentElement}).+ const modalRef = useRef<HTMLDivElement>(null);+ useLegacyComponentElement(modalRef);++ /*+ * Closing is asked of the dialog rather than done to it: what is inside says it is finished —+ * the event taken off the calendar, above all — and the dialog puts itself away, telling the+ * host once it is down. Ceasing to draw a dialog that is still up leaves Bootstrap's backdrop+ * behind, that being laid over the body rather than within the dialog, and a phone left with a+ * page it cannot press is the worst of the ways this could go wrong.+ */+ const [ shown, setShown ] = useState(true);++ return (+ <Modal+ className="calendar-event-sheet"+ size="lg"+ title={<TitleRow compact />}+ isFullPageOnMobile+ scrollable+ modalRef={modalRef}+ show={shown}+ onHidden={onClose}+ >+ <EventDetailsBody+ note={note}+ parentNote={parentNote}+ isEditable={isEditable}+ onClose={() => setShown(false)}+ />+ </Modal>+ );+}+/** The popover's own ntxId, as the geo pane and the quick editor have one of their own. */const POPOVER_NTX_ID = "_calendar-event-popover";-/** The popover's contents, reading the note out of the context the popover provides. */+/** The popover's contents: what heads it, and the event under that. */function EventDetails({ note, parentNote, isEditable, onClose }: {note: FNote;parentNote: FNote;@@ -108,6 +190,7 @@ function EventDetails({ note, parentNote, isEditable, onClose }: {}) {// The popover stands for its component in the DOM, which is how the text editor finds its// host — without this it resolves the widget enclosing the calendar instead (see the geo pane).+ // A sheet marks its dialog instead, what heads it being the dialog's own.const innerRef = useRef<HTMLDivElement>(null);useLegacyComponentElement(innerRef);@@ -119,7 +202,9 @@ function EventDetails({ note, parentNote, isEditable, onClose }: {taking the popover's place rather than standing over it — opened first andclosed after, as the quick editor's own maximize hands over to a tab. A pathrather than an id, as the more-ways-to-open menu passes one (see- OpenNoteActions), so the two roads into the quick editor agree. */}+ OpenNoteActions), so the two roads into the quick editor agree.++ A sheet is offered none: it already has the whole screen to grow into. */}<ActionButtonicon="bx bx-expand-alt"text={t("calendar.maximize_details")}@@ -137,7 +222,24 @@ function EventDetails({ note, parentNote, isEditable, onClose }: {/></div>- <div className="calendar-event-popover-body tn-embedded-note-pane">+ <EventDetailsBody note={note} parentNote={parentNote} isEditable={isEditable} onClose={onClose} />+ </div>+ );+}++/**+ * The event itself, under whatever heads it: what can be done with it, its own fields, the note's+ * promoted attributes and the note. Shared by the two shells, which differ only in what they put+ * around this and how they are dismissed.+ */+function EventDetailsBody({ note, parentNote, isEditable, onClose }: {+ note: FNote;+ parentNote: FNote;+ isEditable: boolean;+ onClose(): void;+}) {+ return (+ <div className="calendar-event-popover-body tn-embedded-note-pane">{/* What can be done with the event: the ways of opening its note (seeOpenNoteActions), then the ways of changing it — left out rather than disabledwhere the calendar may not be edited, as the geo pane leaves them out. */}@@ -177,7 +279,6 @@ function EventDetails({ note, parentNote, isEditable, onClose }: {<PromotedAttributes omit={EVENT_LABELS} /><NoteDetail />- </div></div>);}diff --git a/apps/client/src/widgets/collections/calendar/GhostPopover.css b/apps/client/src/widgets/collections/calendar/GhostPopover.cssindex 66aad8335e..2de6b84ab3 100644--- a/apps/client/src/widgets/collections/calendar/GhostPopover.css+++ b/apps/client/src/widgets/collections/calendar/GhostPopover.css@@ -1,3 +1,11 @@+/*+ * As a sheet (see the mobile shell in GhostPopover.tsx), the dialog brings the heading and the way+ * out; what is left is the form, which gives up the padding the dialog's own body already keeps.+ */+.calendar-ghost-sheet .calendar-ghost-body {+ padding: 0;+}+.calendar-ghost-popover {width: 300px;diff --git a/apps/client/src/widgets/collections/calendar/GhostPopover.tsx b/apps/client/src/widgets/collections/calendar/GhostPopover.tsxindex 917beca956..ea3354b1b5 100644--- a/apps/client/src/widgets/collections/calendar/GhostPopover.tsx+++ b/apps/client/src/widgets/collections/calendar/GhostPopover.tsx@@ -3,22 +3,24 @@ import "./GhostPopover.css";import { useEffect, useState } from "preact/hooks";import { t } from "../../../services/i18n";+import { isMobile } from "../../../services/utils";import ActionButton from "../../react/ActionButton";import Button from "../../react/Button";import FormTextBox from "../../react/FormTextBox";+import Modal from "../../react/Modal";import Popover from "../../react/Popover";import { AnchorPoint, EventDraft } from "./selection";/**- * The ghost: a popover standing beside the dragged-out range, holding the form an event is decided- * in before its note exists. It asks for the one thing the drag did not say — the name — and writes- * out the one thing it did; everything else an event can hold waits for the note, one commit away.- * Dismissed — Escape, the close button, a press anywhere else — the draft simply evaporates:- * nothing was created.+ * The ghost: the form an event is decided in before its note exists. It asks for the one thing the+ * drag did not say — the name — and writes out the one thing it did; everything else an event can+ * hold waits for the note, one commit away. Dismissed — Escape, the close button, a press anywhere+ * else — the draft simply evaporates: nothing was created.*- * A popover rather than the dock, because a draft is born of a place: the form appears beside the- * range that called for it instead of at the far edge, and the grid does not reflow under the very- * range just dragged. The dock takes over at the commit, opening on the note the draft became.+ * A desktop stands it beside the range that called for it, a draft being born of a place: the form+ * appears where the eye already is, and the grid does not reflow under the very range just dragged.+ * A phone gets the sheet the app raises its dialogs as, there being no room beside anything (see+ * EventPopover, which divides itself the same way). The event surface takes over at the commit.** Committing with the title blank is allowed and meaningful: the note is then named by the* calendar's own `#titleTemplate` where one is set (see getNewNoteTitle in trilium-core), which@@ -52,7 +54,10 @@ export default function GhostPopover({ draft, anchor, container, onCommit, onCanonCommit(title);};+ // The sheet answers Escape itself, being a dialog; the popover is not, so it listens.useEffect(() => {+ if (isMobile()) return;+const onKeyDown = (e: KeyboardEvent) => {if (e.key === "Escape") onCancel();};@@ -60,6 +65,52 @@ export default function GhostPopover({ draft, anchor, container, onCommit, onCanreturn () => window.removeEventListener("keydown", onKeyDown);}, [ onCancel ]);+ const form = (+ <div className="calendar-ghost-body">+ <FormTextBox+ autoFocus+ currentValue={title}+ placeholder={t("calendar_view.draft_title_placeholder")}+ onChange={setTitle}+ onKeyDown={(e) => {+ if (e.key === "Enter") commit();+ }}+ />++ <div className="calendar-ghost-when">+ <span className="bx bx-calendar" />+ {describeDraft(draft)}+ </div>++ <div className="calendar-ghost-actions">+ <Button+ kind="primary"+ text={t("calendar_view.create_event")}+ disabled={committing}+ onClick={commit}+ />+ </div>+ </div>+ );++ // A sheet rather than a card beside the range: a phone has no beside. Left at the height a+ // dialog rises to rather than given the whole page — the form is three lines, and a page of it+ // would hide the calendar for no gain. Backdrop and Escape are the dialog's own way out, which+ // is a giving-up rather than a pressing-away: there is no grid under a backdrop to press on.+ if (isMobile()) {+ return (+ <Modal+ className="calendar-ghost-sheet"+ size="md"+ title={t("calendar_view.new_event")}+ show+ onHidden={onCancel}+ >+ {form}+ </Modal>+ );+ }+return (<PopoverclassName="calendar-ghost-popover"@@ -76,31 +127,7 @@ export default function GhostPopover({ draft, anchor, container, onCommit, onCan/></div>- <div className="calendar-ghost-body">- <FormTextBox- autoFocus- currentValue={title}- placeholder={t("calendar_view.draft_title_placeholder")}- onChange={setTitle}- onKeyDown={(e) => {- if (e.key === "Enter") commit();- }}- />-- <div className="calendar-ghost-when">- <span className="bx bx-calendar" />- {describeDraft(draft)}- </div>-- <div className="calendar-ghost-actions">- <Button- kind="primary"- text={t("calendar_view.create_event")}- disabled={committing}- onClick={commit}- />- </div>- </div>+ {form}</Popover>);}diff --git a/apps/client/src/widgets/collections/calendar/index.tsx b/apps/client/src/widgets/collections/calendar/index.tsxindex 72f734c1cd..88c4567a18 100644--- a/apps/client/src/widgets/collections/calendar/index.tsx+++ b/apps/client/src/widgets/collections/calendar/index.tsx@@ -10,7 +10,6 @@ import { useCallback, useContext, useEffect, useMemo, useRef, useState } from "pimport appContext from "../../../components/app_context";import FNote from "../../../entities/fnote";import date_notes from "../../../services/date_notes";-import dialog from "../../../services/dialog";import froca from "../../../services/froca";import { t } from "../../../services/i18n";import note_tooltip from "../../../services/note_tooltip";@@ -30,7 +29,7 @@ import GhostPopover from "./GhostPopover";import { openCalendarContextMenu } from "./context_menu";import { CalendarSelection, EventDraft } from "./selection";import { buildEvents, buildEventsForCalendar } from "./event_builder";-import { formatDateToLocalISO, isValidDuration, parseStartEndDateFromEvent, parseStartEndTimeFromEvent } from "./utils";+import { formatDateToLocalISO, formatTimeToLocalISO, isValidDuration, parseStartEndDateFromEvent, parseStartEndTimeFromEvent } from "./utils";interface CalendarViewData {@@ -197,12 +196,10 @@ export default function CalendarView({ note, noteIds }: ViewModeProps<CalendarVi}}, [ isCalendarRoot, selection, noteIds ]);- // A click on an event opens it into the popover instead of navigating to the popup the- // event's `url` names. Not on mobile, where a tap is already spoken for (see eventDidMount)- // and the popover would take the whole of the screen.+ // A click on an event opens it into the event surface instead of navigating to the popup the+ // event's `url` names — a popover beside the chip, or a sheet where there is no beside (see+ // EventPopover).const onEventClick = useCallback((e: EventClickArg) => {- if (isMobile()) return;-// The chip is an anchor at the event's `url`, and the app's document-level link handler// (see the delegated listeners in link.ts) would open the popup it names no matter what// FullCalendar makes of the click — so the click must not reach the document at all.@@ -270,10 +267,11 @@ export default function CalendarView({ note, noteIds }: ViewModeProps<CalendarVi{...editingProps}// The shading of a dragged range is FullCalendar's to keep and to clear, which it// does on the press that follows — except a press within the ghost standing for- // that very range, which is what the exemption names. Letting it decide is what- // spares a press on the grid: the next selection has already begun by then, and- // FullCalendar knows not to clear what the same press has just made.- unselectCancel=".calendar-ghost-popover"+ // that very range, whichever shell it wears, which is what the exemption names.+ // Letting it decide is what spares a press on the grid: the next selection has+ // already begun by then, and FullCalendar knows not to clear what the same press+ // has just made.+ unselectCancel=".calendar-ghost-popover, .calendar-ghost-sheet"eventClick={onEventClick}// The event the popover stands for is marked as such, and asks for no hover// preview while it does: the popover beside it already says everything the@@ -447,33 +445,21 @@ function useLocale() {function useEditing(note: FNote, isEditable: boolean, isCalendarRoot: boolean, componentId: string | undefined,onDraft: (draft: EventDraft, anchor: { x: number; y: number } | null) => void) {- const onCalendarSelection = useCallback(async (e: DateSelectArg) => {+ const onCalendarSelection = useCallback((e: DateSelectArg) => {const { startDate, endDate } = parseStartEndDateFromEvent(e);if (!startDate) return;const { startTime, endTime } = parseStartEndTimeFromEvent(e);- // On a phone the ghost does not open (see the event click), so the title is still asked- // for up front, in the dialog this flow always led with. Unselected as the dialog closes,- // rather than leaving the range shaded behind it until the next press lands.- if (isMobile()) {- const title = await dialog.prompt({ message: t("relation_map.enter_title_of_new_note"), defaultValue: t("relation_map.default_new_note_title") });- if (title?.trim()) {- await newEvent(note, { title, startDate, endDate, startTime, endTime, componentId });- }- e.view.calendar.unselect();- return;- }-- // Nothing is created yet: the range is handed over as a draft for the ghost popover, and a- // note is made only when the draft is committed (see commitDraft) — a stray drag dismissed- // costs nothing. The range keeps its shading meanwhile, standing on the grid for the event- // to be; the view lets it go when the draft resolves. Where the drag ended anchors the- // ghost beside it (see ghostAnchorRect).+ // Nothing is created yet: the range is handed over as a draft for the ghost, and a note is+ // made only when the draft is committed (see commitDraft) — a stray drag dismissed costs+ // nothing. The range keeps its shading meanwhile, standing on the grid for the event to be;+ // the view lets it go when the draft resolves. Where the drag ended anchors the ghost+ // beside it (see ghostAnchorRect), which a sheet has no use for.onDraft({ startDate, endDate, startTime, endTime },e.jsEvent ? { x: e.jsEvent.clientX, y: e.jsEvent.clientY } : null);- }, [ note, componentId, onDraft ]);+ }, [ onDraft ]);const onEventChange = useCallback(async (e: EventChangeArg) => {// Only process actual date/time changes, not other property changes (e.g., title via setProp).@@ -491,23 +477,64 @@ function useEditing(note: FNote, isEditable: boolean, isCalendarRoot: boolean, cchangeEvent(note, { startDate, endDate, startTime, endTime, componentId });}, [ componentId ]);- // Called upon when clicking the day number in the calendar, opens or creates the day note but only if in a calendar root.+ /**+ * A tap or click on the grid itself. In a calendar root that opens or creates the day's note,+ * which is what a day means there. Elsewhere it is the phone's way of making an event: a touch+ * drag asks for a long press before it selects anything (`selectLongPressDelay`), so a tap+ * selects no range and nothing would open at all — the tap stands for a draft instead, which+ * costs nothing if it was a mistake.+ */const onDateClick = useCallback(async (e: DateClickArg) => {- const eventNote = await date_notes.getDayNote(e.dateStr, note.noteId);- if (eventNote) {- appContext.triggerCommand("openInPopup", { noteIdOrPath: eventNote.noteId });+ if (isCalendarRoot) {+ const eventNote = await date_notes.getDayNote(e.dateStr, note.noteId);+ if (eventNote) {+ appContext.triggerCommand("openInPopup", { noteIdOrPath: eventNote.noteId });+ }+ return;}- }, [ note ]);++ const draft = draftFromDateClick(e);+ if (draft) onDraft(draft, null);+ }, [ note, isCalendarRoot, onDraft ]);return {select: onCalendarSelection,eventChange: onEventChange,- dateClick: isCalendarRoot ? onDateClick : undefined,+ // A desktop leaves this alone where there are events to make: a click there already+ // selects the range it fell in, and answering the tap as well would raise two ghosts.+ dateClick: isCalendarRoot || (isMobile() && isEditable) ? onDateClick : undefined,editable: isEditable,selectable: isEditable};}+/**+ * The draft a tap stands for, a tap naming a moment where a drag names a range: the whole of a day+ * where the view deals in days, and an hour from the slot where it deals in hours — the length+ * FullCalendar itself gives an event whose end nobody said.+ */+function draftFromDateClick(e: DateClickArg): EventDraft | null {+ const startDate = formatDateToLocalISO(e.date);+ if (!startDate) return null;++ if (e.allDay) {+ return { startDate };+ }++ const end = new Date(e.date.getTime() + TAPPED_EVENT_DURATION);+ const endDate = formatDateToLocalISO(end);+ return {+ startDate,+ // Only where the hour runs into the next day; a single day says itself with the start.+ endDate: endDate !== startDate ? endDate : undefined,+ startTime: formatTimeToLocalISO(e.date),+ endTime: formatTimeToLocalISO(end)+ };+}++/** How long an event tapped into being lasts, FullCalendar's own default for one that says no end. */+const TAPPED_EVENT_DURATION = 60 * 60 * 1000;+function useEventDisplayCustomization(parentNote: FNote, componentId: string | undefined) {const eventDidMount = useCallback((e: EventMountArg) => {const { iconClass, promotedAttributes } = e.event.extendedProps;@@ -577,11 +604,9 @@ function useEventDisplayCustomization(parentNote: FNote, componentId: string | uopenCalendarContextMenu(contextMenuEvent, note, parentNote, componentId);}- if (isMobile()) {- e.el.addEventListener("click", onContextMenu);- } else {- e.el.addEventListener("contextmenu", onContextMenu);- }+ // A long press raises it on a phone, as a right-click does on a desktop; the tap itself now+ // belongs to the event sheet, which offers what the menu offers and more (see onEventClick).+ e.el.addEventListener("contextmenu", onContextMenu);}, []);return { eventDidMount };}