#211 · An event is a moment or a duration: one + Event dialog with Moment and Duration tabs (#209)
- timeline-app
- pull request
Closes #209. An **event** is a moment (one time) or a duration (a span between two times). This PR gives adding one a single button and dialog, and makes the wording say "event" wherever it means either kind. ## One + Event - **+ Event** replaces **+ Moment** and **+ Duration** in the timeline toolbar. The timeline's right-click menu item **+Moment** is now **+ Event**. - The event dialog opens on a **Moment | Duration** tab bar. - For a new event, **Duration** turns it into a duration starting at the moment's time and lasting a quarter of the view. **Moment** turns a new duration into a moment at its start. Title, notes, tags and sensitive-content labels carry over both ways. - For an existing event, the tab shows its kind and the other is disabled ("An existing moment stays a moment."). Changing kind would be a conversion, which this PR doesn't do. - A new event's dialog is titled **New event**. **New duration starting here** in a moment's details also opens one, on the Duration tab. - **How it's built:** the moment and duration forms are still two ` `s, because a great deal of the editor's behaviour hangs off each. Switching tabs closes one and opens the other in the same place, with the enter and exit animations turned off for the swap (`data-dialog-switched`), so it reads as one dialog with two pages. If you'd rather they truly be one element, that's a larger follow-up. ## Wording "Event" now appears wherever text means a moment or a duration: - **Editor:** "Search events", "No events match.", "View events", "Every event" in Shift or scale, "Event label" in the Time display preview, the tour's "Add an event" step (which replaces the separate moment and duration steps), and help tips. - **Website:** account content preferences, retention settings, and the label hint. - **API descriptions** in the OpenAPI document. - **Docs and README:** the guide now opens with "Events: moments and durations" and "Adding an event". `durations.md` describes the tabs. Old uses of "event" that meant a moment are now "moment". `architecture.md` notes that the format's `events` field holds the moments, under that name for compatibility. These keep their kind-specific words: counts by kind ("Moved 2,500 moments and 0 durations"), fields only one kind has, duration endpoints, the moment selector, benchmark scenario names, and API, JSON and SQL identifiers. `test/wording.test.mjs` used to fail on any "event" in visible text, which enforced the old vocabulary. It now checks the reverse: "moments and durations" or "moment or duration" in what people read fails, unless glossed ("events (moments and durations)") or part of a count. ## Tests - **Dialog:** `moment-dialog-browser.mjs` switches a new event to Duration and back, checking that the title and tags carry over, that the other dialog is closed and that nothing is added. It also checks that an existing duration's Moment tab is disabled. - **Old buttons:** the search, selection, summaries, help (tour), issues and desktop-cache tests, and the desktop UI benchmark's `new-duration` and `endpoint-picker` scenarios, now use + Event and the tab. - **Local runs:** `npm test` passes (299), along with typecheck and Prettier. `test/browser.mjs` and `test/offline-browser.mjs` pass in Chromium, Firefox and WebKit, in the Playwright Docker image.